diff options
author | bohu <bohu@google.com> | 2021-06-13 00:10:11 -0700 |
---|---|---|
committer | Bo Hu <bohu@google.com> | 2021-06-13 22:55:51 +0000 |
commit | 0627db854e5d4bc2f85ff85e79a104ff906ae2ad (patch) | |
tree | 458dfd7cf73c616d709a6bd23a1a03dd14b5831a | |
parent | 35e6d0c0992212a5313949fc5023f1d5b8f03586 (diff) | |
download | goldfish-opengl-0627db854e5d4bc2f85ff85e79a104ff906ae2ad.tar.gz |
c2-codecs: align 2x2 on h264
this will enable wider range of video to be
decoded by hw decoders
Bug: 186018470
Change-Id: Ied2e58080162dfcb53d4ed228ed62ff75c58faa4
-rw-r--r-- | system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp | 8 | ||||
-rw-r--r-- | system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.h | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp b/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp index a9916030..6c57922e 100644 --- a/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp +++ b/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp @@ -477,7 +477,7 @@ status_t C2GoldfishAvcDec::setParams(size_t stride) { status_t C2GoldfishAvcDec::initDecoder() { // if (OK != createDecoder()) return UNKNOWN_ERROR; - mStride = ALIGN16(mWidth); + mStride = ALIGN2(mWidth); mSignalledError = false; resetPlugin(); @@ -635,7 +635,7 @@ void C2GoldfishAvcDec::finishWork(uint64_t index, 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 @@ C2GoldfishAvcDec::ensureDecoderState(const std::shared_ptr<C2BlockPool> &pool) { // 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 @@ C2GoldfishAvcDec::ensureDecoderState(const std::shared_ptr<C2BlockPool> &pool) { 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 3c5be7f9..914a10e7 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 |