Loading media/codec2/components/gav1/C2SoftGav1Dec.cpp +18 −15 Original line number Diff line number Diff line Loading @@ -470,13 +470,12 @@ void C2SoftGav1Dec::process(const std::unique_ptr<C2Work> &work, } } static void copyOutputBufferToYV12Frame(uint8_t *dst, const uint8_t *srcY, static void copyOutputBufferToYuvPlanarFrame(uint8_t *dst, const uint8_t *srcY, const uint8_t *srcU, const uint8_t *srcV, size_t srcYStride, size_t srcUStride, size_t srcVStride, size_t dstYStride, size_t dstUVStride, uint32_t width, uint32_t height) { const size_t dstYStride = align(width, 16); const size_t dstUVStride = align(dstYStride / 2, 16); uint8_t *const dstStart = dst; for (size_t i = 0; i < height; ++i) { Loading Loading @@ -570,10 +569,10 @@ static void convertYUV420Planar16ToY410(uint32_t *dst, const uint16_t *srcY, static void convertYUV420Planar16ToYUV420Planar( uint8_t *dst, const uint16_t *srcY, const uint16_t *srcU, const uint16_t *srcV, size_t srcYStride, size_t srcUStride, size_t srcVStride, size_t dstStride, size_t width, size_t height) { size_t srcVStride, size_t dstYStride, size_t dstUVStride, size_t width, size_t height) { uint8_t *dstY = (uint8_t *)dst; size_t dstYSize = dstStride * height; size_t dstUVStride = align(dstStride / 2, 16); size_t dstYSize = dstYStride * height; size_t dstUVSize = dstUVStride * height / 2; uint8_t *dstV = dstY + dstYSize; uint8_t *dstU = dstV + dstUVSize; Loading @@ -584,7 +583,7 @@ static void convertYUV420Planar16ToYUV420Planar( } srcY += srcYStride; dstY += dstStride; dstY += dstYStride; } for (size_t y = 0; y < (height + 1) / 2; ++y) { Loading Loading @@ -683,6 +682,9 @@ bool C2SoftGav1Dec::outputBuffer(const std::shared_ptr<C2BlockPool> &pool, size_t srcYStride = buffer->stride[0]; size_t srcUStride = buffer->stride[1]; size_t srcVStride = buffer->stride[2]; C2PlanarLayout layout = wView.layout(); size_t dstYStride = layout.planes[C2PlanarLayout::PLANE_Y].rowInc; size_t dstUVStride = layout.planes[C2PlanarLayout::PLANE_U].rowInc; if (buffer->bitdepth == 10) { const uint16_t *srcY = (const uint16_t *)buffer->plane[0]; Loading @@ -692,18 +694,19 @@ bool C2SoftGav1Dec::outputBuffer(const std::shared_ptr<C2BlockPool> &pool, if (format == HAL_PIXEL_FORMAT_RGBA_1010102) { convertYUV420Planar16ToY410( (uint32_t *)dst, srcY, srcU, srcV, srcYStride / 2, srcUStride / 2, srcVStride / 2, align(mWidth, 16), mWidth, mHeight); srcVStride / 2, dstYStride / sizeof(uint32_t), mWidth, mHeight); } else { convertYUV420Planar16ToYUV420Planar(dst, srcY, srcU, srcV, srcYStride / 2, srcUStride / 2, srcVStride / 2, align(mWidth, 16), mWidth, mHeight); dstYStride, dstUVStride, mWidth, mHeight); } } else { const uint8_t *srcY = (const uint8_t *)buffer->plane[0]; const uint8_t *srcU = (const uint8_t *)buffer->plane[1]; const uint8_t *srcV = (const uint8_t *)buffer->plane[2]; copyOutputBufferToYV12Frame(dst, srcY, srcU, srcV, srcYStride, srcUStride, srcVStride, mWidth, mHeight); copyOutputBufferToYuvPlanarFrame(dst, srcY, srcU, srcV, srcYStride, srcUStride, srcVStride, dstYStride, dstUVStride, mWidth, mHeight); } finishWork(buffer->user_private_data, work, std::move(block)); block = nullptr; Loading Loading
media/codec2/components/gav1/C2SoftGav1Dec.cpp +18 −15 Original line number Diff line number Diff line Loading @@ -470,13 +470,12 @@ void C2SoftGav1Dec::process(const std::unique_ptr<C2Work> &work, } } static void copyOutputBufferToYV12Frame(uint8_t *dst, const uint8_t *srcY, static void copyOutputBufferToYuvPlanarFrame(uint8_t *dst, const uint8_t *srcY, const uint8_t *srcU, const uint8_t *srcV, size_t srcYStride, size_t srcUStride, size_t srcVStride, size_t dstYStride, size_t dstUVStride, uint32_t width, uint32_t height) { const size_t dstYStride = align(width, 16); const size_t dstUVStride = align(dstYStride / 2, 16); uint8_t *const dstStart = dst; for (size_t i = 0; i < height; ++i) { Loading Loading @@ -570,10 +569,10 @@ static void convertYUV420Planar16ToY410(uint32_t *dst, const uint16_t *srcY, static void convertYUV420Planar16ToYUV420Planar( uint8_t *dst, const uint16_t *srcY, const uint16_t *srcU, const uint16_t *srcV, size_t srcYStride, size_t srcUStride, size_t srcVStride, size_t dstStride, size_t width, size_t height) { size_t srcVStride, size_t dstYStride, size_t dstUVStride, size_t width, size_t height) { uint8_t *dstY = (uint8_t *)dst; size_t dstYSize = dstStride * height; size_t dstUVStride = align(dstStride / 2, 16); size_t dstYSize = dstYStride * height; size_t dstUVSize = dstUVStride * height / 2; uint8_t *dstV = dstY + dstYSize; uint8_t *dstU = dstV + dstUVSize; Loading @@ -584,7 +583,7 @@ static void convertYUV420Planar16ToYUV420Planar( } srcY += srcYStride; dstY += dstStride; dstY += dstYStride; } for (size_t y = 0; y < (height + 1) / 2; ++y) { Loading Loading @@ -683,6 +682,9 @@ bool C2SoftGav1Dec::outputBuffer(const std::shared_ptr<C2BlockPool> &pool, size_t srcYStride = buffer->stride[0]; size_t srcUStride = buffer->stride[1]; size_t srcVStride = buffer->stride[2]; C2PlanarLayout layout = wView.layout(); size_t dstYStride = layout.planes[C2PlanarLayout::PLANE_Y].rowInc; size_t dstUVStride = layout.planes[C2PlanarLayout::PLANE_U].rowInc; if (buffer->bitdepth == 10) { const uint16_t *srcY = (const uint16_t *)buffer->plane[0]; Loading @@ -692,18 +694,19 @@ bool C2SoftGav1Dec::outputBuffer(const std::shared_ptr<C2BlockPool> &pool, if (format == HAL_PIXEL_FORMAT_RGBA_1010102) { convertYUV420Planar16ToY410( (uint32_t *)dst, srcY, srcU, srcV, srcYStride / 2, srcUStride / 2, srcVStride / 2, align(mWidth, 16), mWidth, mHeight); srcVStride / 2, dstYStride / sizeof(uint32_t), mWidth, mHeight); } else { convertYUV420Planar16ToYUV420Planar(dst, srcY, srcU, srcV, srcYStride / 2, srcUStride / 2, srcVStride / 2, align(mWidth, 16), mWidth, mHeight); dstYStride, dstUVStride, mWidth, mHeight); } } else { const uint8_t *srcY = (const uint8_t *)buffer->plane[0]; const uint8_t *srcU = (const uint8_t *)buffer->plane[1]; const uint8_t *srcV = (const uint8_t *)buffer->plane[2]; copyOutputBufferToYV12Frame(dst, srcY, srcU, srcV, srcYStride, srcUStride, srcVStride, mWidth, mHeight); copyOutputBufferToYuvPlanarFrame(dst, srcY, srcU, srcV, srcYStride, srcUStride, srcVStride, dstYStride, dstUVStride, mWidth, mHeight); } finishWork(buffer->user_private_data, work, std::move(block)); block = nullptr; Loading