From 72a6741bef5699f38df4d95864d7fcdc2ca53d6e Mon Sep 17 00:00:00 2001 From: Praveen Chavan Date: Fri, 30 Jun 2017 01:15:05 -0700 Subject: [PATCH] mm-video-v4l2: venc: Set 601-Limited colorspace for color-converted buffers Colorspace is derived from gralloc-handles for graphic-buffers and set to codec. RGBA8888 Buffers are converted to YUV via C2D and have 601-Limited color. When passed to the device-layer, such buffers do not have gralloc-handle and hence colorspace does not get set. Set colorspace as 601-L explicitly in such case to the codec. b/63147656 Test: verified that it fixes the failures in EncodeVirtualDisplayTest# testEncodeVirtualDisplay and DecodeEditEncodeTest#testVideoEdit720p CRs-Fixed: 2070838 Change-Id: Iae2705b8f4256d8e76309d2d1adb7cb6d3eb1692 --- .../vidc/venc/src/video_encoder_device_v4l2.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/msm8998/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp b/msm8998/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp index 92d98b52..64b709d1 100644 --- a/msm8998/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp +++ b/msm8998/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp @@ -4105,6 +4105,13 @@ bool venc_dev::venc_empty_buf(void *buffer, void *pmem_data_buf, unsigned index, ": filled %d of %d format 0x%lx", fd, plane[0].bytesused, plane[0].length, m_sVenc_cfg.inputformat); } } else { + // color_format == 1 ==> RGBA to YUV Color-converted buffer + // Buffers color-converted via C2D have 601-Limited color + if (!streaming[OUTPUT_PORT]) { + DEBUG_PRINT_HIGH("Setting colorspace 601-L for Color-converted buffer"); + venc_set_colorspace(MSM_VIDC_BT601_6_625, 0 /*range-limited*/, + MSM_VIDC_TRANSFER_601_6_525, MSM_VIDC_MATRIX_601_6_525); + } plane[0].m.userptr = (unsigned long) bufhdr->pBuffer; plane[0].data_offset = bufhdr->nOffset; plane[0].length = bufhdr->nAllocLen;