Snap for 7488450 from 1aac42ecbda6497d567a667b6520a274aebfe6d1 to s-keystone-qcom-release

Change-Id: I635556ff0b8ff6a0e4884775cba318cc1a3d06f2
diff --git a/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp b/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp
index a991603..6c57922 100644
--- a/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp
+++ b/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp
@@ -477,7 +477,7 @@
 
 status_t C2GoldfishAvcDec::initDecoder() {
     //    if (OK != createDecoder()) return UNKNOWN_ERROR;
-    mStride = ALIGN16(mWidth);
+    mStride = ALIGN2(mWidth);
     mSignalledError = false;
     resetPlugin();
 
@@ -635,7 +635,7 @@
 
 c2_status_t
 C2GoldfishAvcDec::ensureDecoderState(const std::shared_ptr<C2BlockPool> &pool) {
-    if (mOutBlock && (mOutBlock->width() != ALIGN16(mWidth) ||
+    if (mOutBlock && (mOutBlock->width() != ALIGN2(mWidth) ||
                       mOutBlock->height() != mHeight)) {
         mOutBlock.reset();
     }
@@ -647,7 +647,7 @@
         // C2MemoryUsage usage = {(unsigned
         // int)(BufferUsage::GPU_DATA_BUFFER)};// { C2MemoryUsage::CPU_READ,
         // C2MemoryUsage::CPU_WRITE };
-        c2_status_t err = pool->fetchGraphicBlock(ALIGN16(mWidth), mHeight,
+        c2_status_t err = pool->fetchGraphicBlock(ALIGN2(mWidth), mHeight,
                                                   format, usage, &mOutBlock);
         if (err != C2_OK) {
             ALOGE("fetchGraphicBlock for Output failed with status %d", err);
@@ -661,7 +661,7 @@
             DDD("found handle %d", mHostColorBufferId);
         }
         DDD("provided (%dx%d) required (%dx%d)", mOutBlock->width(),
-            mOutBlock->height(), ALIGN16(mWidth), mHeight);
+            mOutBlock->height(), ALIGN2(mWidth), mHeight);
     }
 
     return C2_OK;
diff --git a/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.h b/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.h
index 3c5be7f..914a10e 100644
--- a/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.h
+++ b/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.h
@@ -28,6 +28,8 @@
 
 namespace android {
 
+#define ALIGN2(x) ((((x) + 1) >> 1) << 1)
+#define ALIGN8(x) ((((x) + 7) >> 3) << 3)
 #define ALIGN16(x) ((((x) + 15) >> 4) << 4)
 #define ALIGN32(x) ((((x) + 31) >> 5) << 5)
 #define MAX_NUM_CORES 4