summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunita Nadampalli <sunitan@ti.com>2016-07-01 14:15:19 -0500
committerSunita Nadampalli <sunitan@ti.com>2016-07-01 14:15:19 -0500
commitc3a858cf45b2612a662447aa7c9ae72fce5aea78 (patch)
tree113bca2fa446dcdff6325c600443426e90ac446b
parentf386031653d2219286fd82a55c2b6caa93f5ecb0 (diff)
downloaddra7xx-c3a858cf45b2612a662447aa7c9ae72fce5aea78.tar.gz
OMX: H264VideoEncoder: Fix ImagePitch setting for Surface Encoding
Because of 32 pixel alignment requirement on SGX, all Gralloc buffers are 32 pixel aligned. During Surface Encoding, the input buffers are allocated from Gralloc, hence the imagePitch setting for encoder should be aligned to 32. Change-Id: I697d9ea78ce5740d761a17a6cd4266e11a3ff3cf Signed-off-by: Sunita Nadampalli <sunitan@ti.com>
-rw-r--r--omx/videoencode/omx_h264_enc/src/omx_H264videoencoder.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/omx/videoencode/omx_h264_enc/src/omx_H264videoencoder.c b/omx/videoencode/omx_h264_enc/src/omx_H264videoencoder.c
index 012604b..60e799a 100644
--- a/omx/videoencode/omx_h264_enc/src/omx_H264videoencoder.c
+++ b/omx/videoencode/omx_h264_enc/src/omx_H264videoencoder.c
@@ -1832,6 +1832,10 @@ static OMX_ERRORTYPE OMXH264VE_DataNotify(OMX_HANDLETYPE hComponent)
(XDAS_Int8 *)&(pH264VEComp->pCodecInBufferBackupArray[InBufferHdrIndex].sMemHdr[0]);
pH264VEComp->pVedEncInBufs->planeDesc[i].memType = XDM_MEMTYPE_TILEDPAGE;
+ pH264VEComp->pVedEncInBufs->imagePitch[0] = pH264VEComp->sBase.pPorts[OMX_H264VE_INPUT_PORT]->sPortDef.format.video.nFrameWidth;
+ if (pH264VEComp->pVedEncInBufs->imagePitch[0] % 32) {
+ pH264VEComp->pVedEncInBufs->imagePitch[0] += (pH264VEComp->pVedEncInBufs->imagePitch[0] % 32);
+ }
}
}
} else {
@@ -1840,11 +1844,11 @@ static OMX_ERRORTYPE OMXH264VE_DataNotify(OMX_HANDLETYPE hComponent)
pH264VEComp->pVedEncInBufs->planeDesc[i].buf = (XDAS_Int8 *)&(((OMXBase_BufHdrPvtData *)(pH264VEComp->pCodecInBufferArray[InBufferHdrIndex]->pPlatformPrivate))->sMemHdr[0]);
pH264VEComp->pVedEncInBufs->planeDesc[i].memType = XDM_MEMTYPE_RAW;
+ pH264VEComp->pVedEncInBufs->imagePitch[0] = pH264VEComp->sBase.pPorts[OMX_H264VE_INPUT_PORT]->sPortDef.format.video.nFrameWidth;
}
pH264VEComp->pVedEncInBufs->planeDesc[i].bufSize.bytes = (pH264VEComp->sBase.pPorts[OMX_H264VE_INPUT_PORT]->sPortDef.format.video.nFrameWidth) * (pH264VEComp->sBase.pPorts[OMX_H264VE_INPUT_PORT]->sPortDef.format.video.nFrameHeight);
- pH264VEComp->pVedEncInBufs->imagePitch[0] = pH264VEComp->sBase.pPorts[OMX_H264VE_INPUT_PORT]->sPortDef.format.video.nFrameWidth;
} else if( i == 1 ) {
if (pH264VEComp->bInputMetaDataBufferMode) {
//Nothing to be done; color conversion and fd xlation is done during the plane0 processing
@@ -1856,6 +1860,10 @@ static OMX_ERRORTYPE OMXH264VE_DataNotify(OMX_HANDLETYPE hComponent)
(XDAS_Int8 *)&(pH264VEComp->pCodecInBufferBackupArray[InBufferHdrIndex].sMemHdr[1]);
pH264VEComp->pVedEncInBufs->planeDesc[i].memType = XDM_MEMTYPE_TILEDPAGE;
+ pH264VEComp->pVedEncInBufs->imagePitch[1] = pH264VEComp->sBase.pPorts[OMX_H264VE_INPUT_PORT]->sPortDef.format.video.nFrameWidth;
+ if (pH264VEComp->pVedEncInBufs->imagePitch[1] % 32) {
+ pH264VEComp->pVedEncInBufs->imagePitch[1] += (pH264VEComp->pVedEncInBufs->imagePitch[1] % 32);
+ }
} else {
memcpy(&((OMXBase_BufHdrPvtData *)(pH264VEComp->pCodecInBufferArray[InBufferHdrIndex]->pPlatformPrivate))->sMemHdr[1], &((OMXBase_BufHdrPvtData *)(pH264VEComp->pCodecInBufferArray[InBufferHdrIndex]->pPlatformPrivate))->sMemHdr[0], sizeof(MemHeader));
@@ -1864,11 +1872,10 @@ static OMX_ERRORTYPE OMXH264VE_DataNotify(OMX_HANDLETYPE hComponent)
pH264VEComp->pVedEncInBufs->planeDesc[i].buf = (XDAS_Int8 *)&(((OMXBase_BufHdrPvtData *)(pH264VEComp->pCodecInBufferArray[InBufferHdrIndex]->pPlatformPrivate))->sMemHdr[1]);
pH264VEComp->pVedEncInBufs->planeDesc[i].memType = XDM_MEMTYPE_RAW;
+ pH264VEComp->pVedEncInBufs->imagePitch[1] = pH264VEComp->sBase.pPorts[OMX_H264VE_INPUT_PORT]->sPortDef.format.video.nFrameWidth;
}
pH264VEComp->pVedEncInBufs->planeDesc[i].bufSize.bytes = (pH264VEComp->sBase.pPorts[OMX_H264VE_INPUT_PORT]->sPortDef.format.video.nFrameWidth) * (pH264VEComp->sBase.pPorts[OMX_H264VE_INPUT_PORT]->sPortDef.format.video.nFrameHeight) / 2;
- pH264VEComp->pVedEncInBufs->imagePitch[1] = pH264VEComp->sBase.pPorts[OMX_H264VE_INPUT_PORT]->sPortDef.format.video.nFrameWidth;
-
} else {
eError = OMX_ErrorUnsupportedSetting;
OSAL_ErrorTrace("only NV12 is supproted currently; wrong param from Codec");