aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbohu <bohu@google.com>2021-05-18 16:17:25 -0700
committerbohu <bohu@google.com>2021-05-18 22:34:14 -0700
commit2ab2acee5db1799d554e08111abe6ce4510a3324 (patch)
treee77b42b44d0106aaa22a90d0dcb755f84c6b876a
parentf3d866462754bd4064bb02501dd808ef2ab55ca6 (diff)
downloadgoldfish-opengl-2ab2acee5db1799d554e08111abe6ce4510a3324.tar.gz
c2-codecs: use align 16 instead of align 32 for h264
align 32 is not needed in hw decoder(needed only by sw decoder) and it could lead to stretched output frame (e.g., 176x144 will be stretched to 192x144) Test: atest android.media.cts.DecodeEditEncodeTest#testVideoEditQCIF (still fails one frame, but it is another issue) Bug: 186637916 Change-Id: I01a196adf63d49d5a8e8ac0cd100b416193be0d6 Merged-In: I01a196adf63d49d5a8e8ac0cd100b416193be0d6
-rw-r--r--system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp8
-rw-r--r--system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.h1
2 files changed, 5 insertions, 4 deletions
diff --git a/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp b/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp
index 6c57005a..efb86c2b 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 = ALIGN32(mWidth);
+ mStride = ALIGN16(mWidth);
mSignalledError = false;
resetPlugin();
@@ -632,7 +632,7 @@ void C2GoldfishAvcDec::finishWork(uint64_t index,
c2_status_t
C2GoldfishAvcDec::ensureDecoderState(const std::shared_ptr<C2BlockPool> &pool) {
- if (mOutBlock && (mOutBlock->width() != ALIGN32(mWidth) ||
+ if (mOutBlock && (mOutBlock->width() != ALIGN16(mWidth) ||
mOutBlock->height() != mHeight)) {
mOutBlock.reset();
}
@@ -644,7 +644,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(ALIGN32(mWidth), mHeight,
+ c2_status_t err = pool->fetchGraphicBlock(ALIGN16(mWidth), mHeight,
format, usage, &mOutBlock);
if (err != C2_OK) {
ALOGE("fetchGraphicBlock for Output failed with status %d", err);
@@ -666,7 +666,7 @@ C2GoldfishAvcDec::ensureDecoderState(const std::shared_ptr<C2BlockPool> &pool) {
const_cast<uint8_t *>(wView.data()[C2PlanarLayout::PLANE_Y]);
}
DDD("provided (%dx%d) required (%dx%d)", mOutBlock->width(),
- mOutBlock->height(), ALIGN32(mWidth), mHeight);
+ mOutBlock->height(), ALIGN16(mWidth), mHeight);
}
return C2_OK;
diff --git a/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.h b/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.h
index 906d26ba..c726418a 100644
--- a/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.h
+++ b/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.h
@@ -28,6 +28,7 @@
namespace android {
+#define ALIGN16(x) ((((x) + 15) >> 4) << 4)
#define ALIGN32(x) ((((x) + 31) >> 5) << 5)
#define MAX_NUM_CORES 4
#define MIN(a, b) (((a) < (b)) ? (a) : (b))