Loading media/libstagefright/colorconversion/ColorConverter.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ bool ColorConverter::isValid() const { || mDstFormat == OMX_COLOR_Format32bitBGRA8888; case OMX_COLOR_FormatYUV420Planar16: return mDstFormat == OMX_COLOR_Format32BitRGBA1010102; return mDstFormat == OMX_COLOR_FormatYUV444Y410; case OMX_COLOR_FormatCbYCrY: case OMX_QCOM_COLOR_FormatYVU420SemiPlanar: Loading @@ -77,6 +77,12 @@ bool ColorConverter::isValid() const { } } bool ColorConverter::isDstRGB() const { return mDstFormat == OMX_COLOR_Format16bitRGB565 || mDstFormat == OMX_COLOR_Format32BitRGBA8888 || mDstFormat == OMX_COLOR_Format32bitBGRA8888; } ColorConverter::BitmapParams::BitmapParams( void *bits, size_t width, size_t height, Loading @@ -99,7 +105,7 @@ ColorConverter::BitmapParams::BitmapParams( case OMX_COLOR_Format32bitBGRA8888: case OMX_COLOR_Format32BitRGBA8888: case OMX_COLOR_Format32BitRGBA1010102: case OMX_COLOR_FormatYUV444Y410: mBpp = 4; mStride = 4 * mWidth; break; Loading media/libstagefright/colorconversion/SoftwareRenderer.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -134,6 +134,10 @@ void SoftwareRenderer::resetFormatIfChanged(const sp<AMessage> &format) { } case OMX_COLOR_FormatYUV420Planar16: { // Here we would convert OMX_COLOR_FormatYUV420Planar16 into // OMX_COLOR_FormatYUV444Y410, and put it inside a buffer with // format HAL_PIXEL_FORMAT_RGBA_1010102. Surfaceflinger will // use render engine to convert it to RGB if needed. halFormat = HAL_PIXEL_FORMAT_RGBA_1010102; bufWidth = (mCropWidth + 1) & ~1; bufHeight = (mCropHeight + 1) & ~1; Loading @@ -152,7 +156,7 @@ void SoftwareRenderer::resetFormatIfChanged(const sp<AMessage> &format) { CHECK(mConverter->isValid()); } else if (mColorFormat == OMX_COLOR_FormatYUV420Planar16) { mConverter = new ColorConverter( mColorFormat, OMX_COLOR_Format32BitRGBA1010102); mColorFormat, OMX_COLOR_FormatYUV444Y410); CHECK(mConverter->isValid()); } Loading Loading @@ -380,7 +384,7 @@ skip_copying: if (format->findInt32("android._dataspace", (int32_t *)&dataSpace) && dataSpace != mDataSpace) { mDataSpace = dataSpace; if (mConverter != NULL) { if (mConverter != NULL && mConverter->isDstRGB()) { // graphics only supports full range RGB. ColorConverter should have // converted any YUV to full range. dataSpace = (android_dataspace) Loading media/libstagefright/include/media/stagefright/ColorConverter.h +2 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ struct ColorConverter { bool isValid() const; bool isDstRGB() const; status_t convert( const void *srcBits, size_t srcWidth, size_t srcHeight, Loading Loading
media/libstagefright/colorconversion/ColorConverter.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ bool ColorConverter::isValid() const { || mDstFormat == OMX_COLOR_Format32bitBGRA8888; case OMX_COLOR_FormatYUV420Planar16: return mDstFormat == OMX_COLOR_Format32BitRGBA1010102; return mDstFormat == OMX_COLOR_FormatYUV444Y410; case OMX_COLOR_FormatCbYCrY: case OMX_QCOM_COLOR_FormatYVU420SemiPlanar: Loading @@ -77,6 +77,12 @@ bool ColorConverter::isValid() const { } } bool ColorConverter::isDstRGB() const { return mDstFormat == OMX_COLOR_Format16bitRGB565 || mDstFormat == OMX_COLOR_Format32BitRGBA8888 || mDstFormat == OMX_COLOR_Format32bitBGRA8888; } ColorConverter::BitmapParams::BitmapParams( void *bits, size_t width, size_t height, Loading @@ -99,7 +105,7 @@ ColorConverter::BitmapParams::BitmapParams( case OMX_COLOR_Format32bitBGRA8888: case OMX_COLOR_Format32BitRGBA8888: case OMX_COLOR_Format32BitRGBA1010102: case OMX_COLOR_FormatYUV444Y410: mBpp = 4; mStride = 4 * mWidth; break; Loading
media/libstagefright/colorconversion/SoftwareRenderer.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -134,6 +134,10 @@ void SoftwareRenderer::resetFormatIfChanged(const sp<AMessage> &format) { } case OMX_COLOR_FormatYUV420Planar16: { // Here we would convert OMX_COLOR_FormatYUV420Planar16 into // OMX_COLOR_FormatYUV444Y410, and put it inside a buffer with // format HAL_PIXEL_FORMAT_RGBA_1010102. Surfaceflinger will // use render engine to convert it to RGB if needed. halFormat = HAL_PIXEL_FORMAT_RGBA_1010102; bufWidth = (mCropWidth + 1) & ~1; bufHeight = (mCropHeight + 1) & ~1; Loading @@ -152,7 +156,7 @@ void SoftwareRenderer::resetFormatIfChanged(const sp<AMessage> &format) { CHECK(mConverter->isValid()); } else if (mColorFormat == OMX_COLOR_FormatYUV420Planar16) { mConverter = new ColorConverter( mColorFormat, OMX_COLOR_Format32BitRGBA1010102); mColorFormat, OMX_COLOR_FormatYUV444Y410); CHECK(mConverter->isValid()); } Loading Loading @@ -380,7 +384,7 @@ skip_copying: if (format->findInt32("android._dataspace", (int32_t *)&dataSpace) && dataSpace != mDataSpace) { mDataSpace = dataSpace; if (mConverter != NULL) { if (mConverter != NULL && mConverter->isDstRGB()) { // graphics only supports full range RGB. ColorConverter should have // converted any YUV to full range. dataSpace = (android_dataspace) Loading
media/libstagefright/include/media/stagefright/ColorConverter.h +2 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ struct ColorConverter { bool isValid() const; bool isDstRGB() const; status_t convert( const void *srcBits, size_t srcWidth, size_t srcHeight, Loading