summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorc_sisanj <sisanj@codeaurora.org>2015-10-13 18:01:04 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2015-10-13 21:40:35 -0700
commita09af0f3a541538ba25c0242808c3a4e5412b2a9 (patch)
tree24463bb56067e7f415a7ef5260d3621875d74236
parent834d6a83c1c69d7adfc27d5acdcd9080f59eff1d (diff)
downloadandroid_hardware_qcom_media-a09af0f3a541538ba25c0242808c3a4e5412b2a9.tar.gz
android_hardware_qcom_media-a09af0f3a541538ba25c0242808c3a4e5412b2a9.tar.bz2
android_hardware_qcom_media-a09af0f3a541538ba25c0242808c3a4e5412b2a9.zip
mm-video-v4l12: update stride info for YUV420P and YUV420SP
Update stride and slice-height equal to width and height respectively for color format YUV420P and YUV420SP. This is done to avoid distortion of image. Change-Id: I9b1ab1bb30088ef784296e3dfa7402cf84b4a7c0
-rw-r--r--mm-video-v4l2/vidc/vdec/src/omx_vdec_hevc.cpp7
-rw-r--r--mm-video-v4l2/vidc/vdec/src/omx_vdec_hevc_swvdec.cpp8
2 files changed, 15 insertions, 0 deletions
diff --git a/mm-video-v4l2/vidc/vdec/src/omx_vdec_hevc.cpp b/mm-video-v4l2/vidc/vdec/src/omx_vdec_hevc.cpp
index de47d35c..0f60505d 100644
--- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_hevc.cpp
+++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_hevc.cpp
@@ -127,6 +127,7 @@ extern "C" {
#define Log2(number, power) { OMX_U32 temp = number; power = 0; while( (0 == (temp & 0x1)) && power < 16) { temp >>=0x1; power++; } }
#define Q16ToFraction(q,num,den) { OMX_U32 power; Log2(q,power); num = q >> power; den = 0x1 << (16 - power); }
#define EXTRADATA_IDX(__num_planes) (__num_planes - 1)
+#define ALIGN(x, to_align) ((((unsigned) x) + (to_align - 1)) & ~(to_align - 1))
#define DEFAULT_EXTRADATA (OMX_INTERLACE_EXTRADATA)
@@ -7381,6 +7382,12 @@ OMX_ERRORTYPE omx_vdec::update_portdef(OMX_PARAM_PORTDEFINITIONTYPE *portDefn)
portDefn->format.video.nFrameWidth = drv_ctx.video_resolution.frame_width;
portDefn->format.video.nStride = drv_ctx.video_resolution.stride;
portDefn->format.video.nSliceHeight = drv_ctx.video_resolution.scan_lines;
+
+ if ((portDefn->format.video.eColorFormat == OMX_COLOR_FormatYUV420Planar) ||
+ (portDefn->format.video.eColorFormat == OMX_COLOR_FormatYUV420SemiPlanar)) {
+ portDefn->format.video.nStride = ALIGN(drv_ctx.video_resolution.frame_width, 16);
+ portDefn->format.video.nSliceHeight = drv_ctx.video_resolution.frame_height;
+ }
DEBUG_PRINT_HIGH("update_portdef Width = %lu Height = %lu Stride = %ld"
" SliceHeight = %lu", portDefn->format.video.nFrameWidth,
portDefn->format.video.nFrameHeight,
diff --git a/mm-video-v4l2/vidc/vdec/src/omx_vdec_hevc_swvdec.cpp b/mm-video-v4l2/vidc/vdec/src/omx_vdec_hevc_swvdec.cpp
index ccc603e4..39e2dfee 100644
--- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_hevc_swvdec.cpp
+++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_hevc_swvdec.cpp
@@ -120,6 +120,7 @@ extern "C"{
#define Log2(number, power) { OMX_U32 temp = number; power = 0; while( (0 == (temp & 0x1)) && power < 16) { temp >>=0x1; power++; } }
#define Q16ToFraction(q,num,den) { OMX_U32 power; Log2(q,power); num = q >> power; den = 0x1 << (16 - power); }
#define EXTRADATA_IDX(__num_planes) (__num_planes - 1)
+#define ALIGN(x, to_align) ((((unsigned) x) + (to_align - 1)) & ~(to_align - 1))
#define DEFAULT_EXTRADATA (OMX_INTERLACE_EXTRADATA)
@@ -8369,6 +8370,13 @@ OMX_ERRORTYPE omx_vdec::update_portdef(OMX_PARAM_PORTDEFINITIONTYPE *portDefn)
portDefn->format.video.nFrameWidth = drv_ctx.video_resolution.frame_width;
portDefn->format.video.nStride = drv_ctx.video_resolution.stride;
portDefn->format.video.nSliceHeight = drv_ctx.video_resolution.scan_lines;
+
+ if ((portDefn->format.video.eColorFormat == OMX_COLOR_FormatYUV420Planar) ||
+ (portDefn->format.video.eColorFormat == OMX_COLOR_FormatYUV420SemiPlanar)) {
+ portDefn->format.video.nStride = ALIGN(drv_ctx.video_resolution.frame_width, 16);
+ portDefn->format.video.nSliceHeight = drv_ctx.video_resolution.frame_height;
+ }
+
DEBUG_PRINT_HIGH("update_portdef Width = %lu Height = %lu Stride = %ld"
" SliceHeight = %lu", portDefn->format.video.nFrameWidth,
portDefn->format.video.nFrameHeight,