diff options
author | Wonsik Kim <wonsik@google.com> | 2020-12-03 11:07:58 -0800 |
---|---|---|
committer | Bruno Martins <bgcngm@gmail.com> | 2021-03-07 15:30:33 +0000 |
commit | 2bc5b225a6221fa44034d5fe4e6881f05eb02c67 (patch) | |
tree | dd234e3ca309d78d1e2d8536d1e51a4e977f94ab /media/codec2/sfplugin/Codec2Buffer.cpp | |
parent | 1710b8573fee66aafee89558fc4e4986a04cc6e3 (diff) |
CCodec: fix ByteBuffer mode image
- Set offset to (0,0) of Y plane.
- Fix wrapping criteria.
Bug: 169379476
Test: atest CtsMediaTestCases -- --module-arg CtsMediaTestCases:size:small
Test: atest ccodec_unit_test
Change-Id: Ic7e074ddaef277833707363b0b9fecfe210bd57f
(cherry picked from commit 2eb063152f67e886472ed42c07f3634a5eb63f19)
Diffstat (limited to 'media/codec2/sfplugin/Codec2Buffer.cpp')
-rw-r--r-- | media/codec2/sfplugin/Codec2Buffer.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/media/codec2/sfplugin/Codec2Buffer.cpp b/media/codec2/sfplugin/Codec2Buffer.cpp index 25e7da9206..19414a0a0c 100644 --- a/media/codec2/sfplugin/Codec2Buffer.cpp +++ b/media/codec2/sfplugin/Codec2Buffer.cpp @@ -276,20 +276,22 @@ public: int32_t planeSize = 0; for (uint32_t i = 0; i < layout.numPlanes; ++i) { const C2PlaneInfo &plane = layout.planes[i]; - ssize_t minOffset = plane.minOffset(mWidth, mHeight); - ssize_t maxOffset = plane.maxOffset(mWidth, mHeight); + int64_t planeStride = std::abs(plane.rowInc / plane.colInc); + ssize_t minOffset = plane.minOffset( + mWidth / plane.colSampling, mHeight / plane.rowSampling); + ssize_t maxOffset = plane.maxOffset( + mWidth / plane.colSampling, mHeight / plane.rowSampling); if (minPtr > mView.data()[i] + minOffset) { minPtr = mView.data()[i] + minOffset; } if (maxPtr < mView.data()[i] + maxOffset) { maxPtr = mView.data()[i] + maxOffset; } - planeSize += std::abs(plane.rowInc) * align(mHeight, 64) - / plane.rowSampling / plane.colSampling - * divUp(mAllocatedDepth, 8u); + planeSize += planeStride * divUp(mAllocatedDepth, 8u) + * align(mHeight, 64) / plane.rowSampling; } - if ((maxPtr - minPtr + 1) <= planeSize) { + if (minPtr == mView.data()[0] && (maxPtr - minPtr + 1) <= planeSize) { // FIXME: this is risky as reading/writing data out of bound results // in an undefined behavior, but gralloc does assume a // contiguous mapping |