summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngela Stegmaier <angelabaker@ti.com>2016-01-19 14:46:56 -0600
committerVishal Mahaveer <vishalm@ti.com>2016-03-15 15:24:31 -0600
commit304a172748bd5560e935cb19d8e23472df125fff (patch)
treebca6c6bffcf005308f4398fb474a7d237a480b93
parent0fc6ae38e16e6bda0a424162d4fb642d2114fa3c (diff)
downloaddra7xx-304a172748bd5560e935cb19d8e23472df125fff.tar.gz
OMX: Set displayWidth and Width Requirements for Mpeg2
The graphics/display requires 32 byte alignment, however the mpeg2 codec doesn't require alignment to 32 by default and doesn't automatically assume a stride for non-TILED output buffers. So, the displayWidth parameter must be set in the case that the width is not 32 byte aligned, as required by the display. And when setting the displayWidth parameter, the mpeg2 codec requires 128 alignment. This patch updates the output buffer and output width to the proper padded size and also sets the displayWidth. The maxWidth must also be set to the padded width and not the actual video width, or else the codec will throw an error when setting displayWidth to the padded width. Without these changes, the output for videos with a width that is not aligned is corrupted. Change-Id: I9d6d7e8b68874d237d1a89d8db792026350ba0cc Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
-rw-r--r--omx/videodecode/omx_mpeg2_dec/src/omx_mpeg2dec.c17
-rw-r--r--omx/videodecode/omx_videodec_common/src/omx_video_decoder_internal.c17
2 files changed, 30 insertions, 4 deletions
diff --git a/omx/videodecode/omx_mpeg2_dec/src/omx_mpeg2dec.c b/omx/videodecode/omx_mpeg2_dec/src/omx_mpeg2dec.c
index de97e36..6c1b470 100644
--- a/omx/videodecode/omx_mpeg2_dec/src/omx_mpeg2dec.c
+++ b/omx/videodecode/omx_mpeg2_dec/src/omx_mpeg2dec.c
@@ -110,11 +110,13 @@ void OMXMPEG2VD_SetStaticParams(OMX_HANDLETYPE hComponent, void *staticparams)
OMX_COMPONENTTYPE *pHandle = NULL;
OMXVidDecComp *pVidDecComp = NULL;
OMXMPEG2VidDecComp *pMPEG2VidDecComp = NULL;
+ OMX_CONFIG_RECTTYPE *p2DOutBufAllocParam = NULL;
IMPEG2VDEC_Params *params;
pHandle = (OMX_COMPONENTTYPE *)hComponent;
pVidDecComp
= (OMXVidDecComp *)pHandle->pComponentPrivate;
+ p2DOutBufAllocParam = &(pVidDecComp->t2DBufferAllocParams[OMX_VIDDEC_OUTPUT_PORT]);
pMPEG2VidDecComp =
(OMXMPEG2VidDecComp *) pVidDecComp->pCodecSpecific;
@@ -123,6 +125,8 @@ void OMXMPEG2VD_SetStaticParams(OMX_HANDLETYPE hComponent, void *staticparams)
params->viddecParams.size = sizeof(IMPEG2VDEC_Params);
+ params->viddecParams.maxWidth = p2DOutBufAllocParam->nWidth;
+
params->viddecParams.maxFrameRate = 30000;
params->viddecParams.maxBitRate = 10000000;
@@ -150,14 +154,21 @@ void OMXMPEG2VD_SetStaticParams(OMX_HANDLETYPE hComponent, void *staticparams)
void OMXMPEG2VD_SetDynamicParams(OMX_HANDLETYPE hComponent, void *dynParams)
{
+ OMX_COMPONENTTYPE *pHandle = NULL;
+ OMXVidDecComp *pVidDecComp = NULL;
+ OMX_CONFIG_RECTTYPE *p2DOutBufAllocParam = NULL;
IMPEG2VDEC_DynamicParams *dynamicParams;
+ pHandle = (OMX_COMPONENTTYPE *)hComponent;
+ pVidDecComp
+ = (OMXVidDecComp *)pHandle->pComponentPrivate;
+ p2DOutBufAllocParam = &(pVidDecComp->t2DBufferAllocParams[OMX_VIDDEC_OUTPUT_PORT]);
dynamicParams = (IMPEG2VDEC_DynamicParams *)dynParams;
/*! Update the Individual fields in the Dyanmic Params of MPEG2 decoder */
dynamicParams->viddecDynamicParams.size = sizeof(IMPEG2VDEC_DynamicParams);
dynamicParams->viddecDynamicParams.decodeHeader = XDM_DECODE_AU;
- dynamicParams->viddecDynamicParams.displayWidth = 0;
+ dynamicParams->viddecDynamicParams.displayWidth = p2DOutBufAllocParam->nWidth;
dynamicParams->viddecDynamicParams.frameSkipMode = IVIDEO_NO_SKIP;
dynamicParams->viddecDynamicParams.newFrameFlag = XDAS_TRUE;
dynamicParams->viddecDynamicParams.putDataFxn = NULL;
@@ -191,7 +202,7 @@ PaddedBuffParams CalculateMPEG2VD_outbuff_details(OMX_HANDLETYPE hComponent,
= ((((width + PADX + 127) & ~127) * (height + PADY))); */
/* The 2 additional rows and columns are required as per codec request to boost performance. */
OutBuffDetails.nBufferSize
- = ((width + 2) * (height + 2));
+ = ((((width + 127) & ~127) + 2) * (height + 2));
/* Multiply buffer size by 1.5 to account for both luma and chroma */
OutBuffDetails.nBufferSize = (OutBuffDetails.nBufferSize * 3) >> 1;
@@ -200,7 +211,7 @@ PaddedBuffParams CalculateMPEG2VD_outbuff_details(OMX_HANDLETYPE hComponent,
OutBuffDetails.n1DBufferAlignment = 16;
//OutBuffDetails.nPaddedWidth = (width + PADX + 127) & ~127;
//OutBuffDetails.nPaddedHeight = height + PADY;
- OutBuffDetails.nPaddedWidth = width;
+ OutBuffDetails.nPaddedWidth = (width + 127) & ~127;
OutBuffDetails.nPaddedHeight = height;
OutBuffDetails.n2DBufferYAlignment = 1;
OutBuffDetails.n2DBufferXAlignment = 16;
diff --git a/omx/videodecode/omx_videodec_common/src/omx_video_decoder_internal.c b/omx/videodecode/omx_videodec_common/src/omx_video_decoder_internal.c
index cc7f2ed..df0c216 100644
--- a/omx/videodecode/omx_videodec_common/src/omx_video_decoder_internal.c
+++ b/omx/videodecode/omx_videodec_common/src/omx_video_decoder_internal.c
@@ -449,9 +449,9 @@ OMX_ERRORTYPE OMXVidDec_SetInPortDef(OMX_HANDLETYPE hComponent,
pOutputPortDef->nBufferCountActual = tOutBufParams.nBufferCountActual;
/*! Set the Static Params (Decoder Specific) */
- pVidDecComp->fpSet_StaticParams(hComponent, pVidDecComp->pDecStaticParams);
pVidDecComp->pDecStaticParams->maxHeight = nFrameHeight;
pVidDecComp->pDecStaticParams->maxWidth = nFrameWidth;
+ pVidDecComp->fpSet_StaticParams(hComponent, pVidDecComp->pDecStaticParams);
if( pOutputPortDef->nBufferCountActual < pOutputPortDef->nBufferCountMin ) {
pOutputPortDef->nBufferCountActual = pOutputPortDef->nBufferCountMin;
}
@@ -562,6 +562,13 @@ OMX_ERRORTYPE OMXVidDec_HandleFirstFrame(OMX_HANDLETYPE hComponent,
nFrameHeight = pVidDecComp->pDecStaticParams->maxHeight;
}
+ /*! Check whether the displayWidth already accounts for any
+ * difference between the current and new frame width */
+ if ( nFrameWidth != nFrameWidthNew &&
+ nFrameWidth == pVidDecComp->pDecDynParams->displayWidth ) {
+ nFrameWidthNew = nFrameWidth;
+ }
+
tOutBufParams = pVidDecComp->fpCalc_OubuffDetails(hComponent,
(OMX_U32)pDecStatus->outputWidth, (OMX_U32)pDecStatus->outputHeight);
@@ -748,6 +755,14 @@ OMX_ERRORTYPE OMXVidDec_HandleCodecProcError(OMX_HANDLETYPE hComponent,
nFrameWidth = pVidDecComp->pDecStaticParams->maxWidth;
nFrameHeight = pVidDecComp->pDecStaticParams->maxHeight;
}
+
+ /*! Check whether the displayWidth already accounts for any
+ * difference between the current and new frame width */
+ if ( nFrameWidth != nFrameWidthNew &&
+ nFrameWidth == pVidDecComp->pDecDynParams->displayWidth ) {
+ nFrameWidthNew = nFrameWidth;
+ }
+
/*! Check whether the height and width reported by codec matches
* that of output port */
if( nFrameHeightNew != nFrameHeight || nFrameWidthNew != nFrameWidth