Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 48bfa1fe authored by Chong Zhang's avatar Chong Zhang
Browse files

Fix color conversion from OMX_COLOR_FormatYUV420SemiPlanar

Use NV12ToABGR for OMX_COLOR_Format32BitRGBA8888, and
NV12ToARGB for OMX_COLOR_Format32bitBGRA8888. The naming
convention is reverse in libyuv and omx.

bug: 129908793

test: locally modify StagefrightMetadataRetriever to prefer hw
decoder and output in OMX_COLOR_FormatYUV420SemiPlanar format.
The following tests would fail without this patch and pass with
this patch:

CtsMediaTestCases --android.media.cts.HeifWriterTest#testInputSurface_Grid_Handler fail
CtsMediaTestCases --android.media.cts.HeifWriterTest#testInputSurface_Grid_NoHandler fail
CtsMediaTestCases --android.media.cts.HeifWriterTest#testInputSurface_NoGrid_Handler fail
CtsMediaTestCases --android.media.cts.HeifWriterTest#testInputSurface_NoGrid_NoHandler fail
CtsMediaTestCases --android.media.cts.MediaMetadataRetrieverTest#testGetImageAtIndex fail

(These tests fail because they use bitmap format of RGB, while others
use RGB565.)

Change-Id: I94feea2c29479e72d6111ee6a7ce44805b921e73
parent e6f3293b
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -395,11 +395,16 @@ status_t ColorConverter::convertYUV420SemiPlanarUseLibYUV(
                dst.mStride, src.cropWidth(), src.cropHeight());
        break;

    case OMX_COLOR_Format32BitRGBA8888:
    case OMX_COLOR_Format32bitBGRA8888:
        libyuv::NV12ToARGB(src_y, src.mStride, src_u, src.mStride, (uint8 *)dst_ptr,
                dst.mStride, src.cropWidth(), src.cropHeight());
        break;

    case OMX_COLOR_Format32BitRGBA8888:
        libyuv::NV12ToABGR(src_y, src.mStride, src_u, src.mStride, (uint8 *)dst_ptr,
                dst.mStride, src.cropWidth(), src.cropHeight());
        break;

    default:
        return ERROR_UNSUPPORTED;
   }