summaryrefslogtreecommitdiffstats
path: root/mm-video-v4l2
diff options
context:
space:
mode:
authorPraveen Chavan <pchavan@codeaurora.org>2015-03-25 01:03:34 -0700
committerZhijun He <zhijunhe@google.com>2015-05-07 10:40:07 -0700
commit56eba06a2d3cdd93732e65d3bb52f0f1e7441532 (patch)
treea82e4bbae7fe390e48689fa59266e23860eafe99 /mm-video-v4l2
parentf3ca23b5bd0c3d78d321ccf5c5af5eb0d461ff1a (diff)
downloadandroid_hardware_qcom_media-56eba06a2d3cdd93732e65d3bb52f0f1e7441532.tar.gz
android_hardware_qcom_media-56eba06a2d3cdd93732e65d3bb52f0f1e7441532.tar.bz2
android_hardware_qcom_media-56eba06a2d3cdd93732e65d3bb52f0f1e7441532.zip
mm-video-v4l2: venc: Clamp 601 -> 709 if requested by camera
Read colorspace hint from gralloc handle and request conversion to 709 bug 17785855 Change-Id: I8be052f810e98746399d9d381f2c4025b05ae19b
Diffstat (limited to 'mm-video-v4l2')
-rw-r--r--mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
index ea729a59..de92e202 100644
--- a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
+++ b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
@@ -1,5 +1,5 @@
/*--------------------------------------------------------------------------
-Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
+Copyright (c) 2010-2015, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -44,6 +44,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef _ANDROID_
#include <media/hardware/HardwareAPI.h>
#include <gralloc_priv.h>
+#include <qdMetaData.h>
#endif
#define ALIGN(x, to_align) ((((unsigned long) x) + (to_align - 1)) & ~(to_align - 1))
@@ -2648,6 +2649,19 @@ bool venc_dev::venc_empty_buf(void *buffer, void *pmem_data_buf, unsigned index,
DEBUG_PRINT_LOW("Set control id = 0x%x, value = 0x%x, flags = 0x%x",
control.id, control.value, handle->flags);
}
+
+ if (handle->base_metadata) {
+ MetaData_t *pMeta =
+ reinterpret_cast<MetaData_t*>(handle->base_metadata);
+ ColorSpace_t csc = pMeta->operation & UPDATE_COLOR_SPACE ?
+ pMeta->colorSpace : (ColorSpace_t)-1;
+ if (csc == ITU_R_709) {
+ buf.flags |= V4L2_MSM_BUF_FLAG_YUV_601_709_CLAMP;
+ DEBUG_PRINT_LOW("venc_empty_buf: force 601 -> 709 clamping");
+ }
+ } else {
+ DEBUG_PRINT_LOW("venc_empty_buf: gralloc metadata is NULL");
+ }
DEBUG_PRINT_LOW("venc_empty_buf: Opaque camera buf: fd = %d "
": filled %d of %d", fd, plane.bytesused, plane.length);
}