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
This commit is contained in:
Praveen Chavan 2017-06-30 01:15:05 -07:00 committed by Chong Zhang
parent 956c1217c1
commit 72a6741bef

View file

@ -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;