diff options
Diffstat (limited to 'media/libstagefright/colorconversion')
-rw-r--r-- | media/libstagefright/colorconversion/SoftwareRenderer.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/media/libstagefright/colorconversion/SoftwareRenderer.cpp b/media/libstagefright/colorconversion/SoftwareRenderer.cpp index e92c192..59af12a 100644 --- a/media/libstagefright/colorconversion/SoftwareRenderer.cpp +++ b/media/libstagefright/colorconversion/SoftwareRenderer.cpp @@ -150,11 +150,20 @@ void SoftwareRenderer::resetFormatIfChanged(const sp<AMessage> &format) { CHECK(mCropHeight > 0); CHECK(mConverter == NULL || mConverter->isValid()); +#ifdef EXYNOS4_ENHANCEMENTS + CHECK_EQ(0, + native_window_set_usage( + mNativeWindow.get(), + GRALLOC_USAGE_SW_READ_NEVER | GRALLOC_USAGE_SW_WRITE_OFTEN + | GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP + | GRALLOC_USAGE_HW_FIMC1)); +#else CHECK_EQ(0, native_window_set_usage( mNativeWindow.get(), GRALLOC_USAGE_SW_READ_NEVER | GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP)); +#endif CHECK_EQ(0, native_window_set_scaling_mode( @@ -252,8 +261,14 @@ std::list<FrameRenderTracker::Info> SoftwareRenderer::render( uint8_t *dst_y = (uint8_t *)dst; size_t dst_y_size = buf->stride * buf->height; + +#ifdef EXYNOS4_ENHANCEMENTS + size_t dst_c_stride = buf->stride / 2; + size_t dst_c_size = ALIGN(dst_c_stride, 16) * buf->height / 2; +#else size_t dst_c_stride = ALIGN(buf->stride / 2, 16); size_t dst_c_size = dst_c_stride * buf->height / 2; +#endif uint8_t *dst_v = dst_y + dst_y_size; uint8_t *dst_u = dst_v + dst_c_size; @@ -282,13 +297,25 @@ std::list<FrameRenderTracker::Info> SoftwareRenderer::render( const uint8_t *src_uv = (const uint8_t *)data + mWidth * (mHeight - mCropTop / 2); - uint8_t *dst_y = (uint8_t *)dst; +#ifdef EXYNOS4_ENHANCEMENTS + void *pYUVBuf[3]; + CHECK_EQ(0, mapper.unlock(buf->handle)); + CHECK_EQ(0, mapper.lock( + buf->handle, GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_YUV_ADDR, bounds, pYUVBuf)); + + size_t dst_c_stride = buf->stride / 2; + uint8_t *dst_y = (uint8_t *)pYUVBuf[0]; + uint8_t *dst_v = (uint8_t *)pYUVBuf[1]; + uint8_t *dst_u = (uint8_t *)pYUVBuf[2]; +#else + uint8_t *dst_y = (uint8_t *)dst; size_t dst_y_size = buf->stride * buf->height; size_t dst_c_stride = ALIGN(buf->stride / 2, 16); size_t dst_c_size = dst_c_stride * buf->height / 2; uint8_t *dst_v = dst_y + dst_y_size; uint8_t *dst_u = dst_v + dst_c_size; +#endif for (int y = 0; y < mCropHeight; ++y) { memcpy(dst_y, src_y, mCropWidth); |