diff options
author | SeungBeom Kim <sbcrux.kim@samsung.com> | 2010-10-17 15:18:22 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-10-18 11:24:39 -0700 |
commit | 6dbcf81abac113ddef7543cf0083035d03a615f8 (patch) | |
tree | 7b48b3d11d44bc1ecb72b09daa139f26a30d6947 /sec_mm | |
parent | 662f3b4f712f4094c806826ece38f17decc91c68 (diff) | |
download | device_samsung_crespo-6dbcf81abac113ddef7543cf0083035d03a615f8.zip device_samsung_crespo-6dbcf81abac113ddef7543cf0083035d03a615f8.tar.gz device_samsung_crespo-6dbcf81abac113ddef7543cf0083035d03a615f8.tar.bz2 |
Bug Fix Video decode color converter for H/W Thumbnail
related-to-bug: 3106534
Real OMX_COLOR_FormatYUV420Planar Data return.
if Use Thumbnail Mode then set as follows before Decoding
/************************************************/
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_BOOL param = OMX_TRUE;
ret = OMX_GetExtensionIndex(
mHandle,
"OMX.SEC.index.ThumbnailMode",
&eIndexParamFilename);
if (ret == OMX_ErrorNone)
OMX_SetConfig(
mHandle, eIndexParamFilename, ¶m);
/***********************************************/
Change-Id: Ia2cf2c4145687c45fb8f2987e66db59434266f34
Signed-off-by: SeungBeom Kim <sbcrux.kim@samsung.com>
Diffstat (limited to 'sec_mm')
4 files changed, 106 insertions, 26 deletions
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/src/SsbSipMfcDecAPI.c b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/src/SsbSipMfcDecAPI.c index 4293747..508f290 100644 --- a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/src/SsbSipMfcDecAPI.c +++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/src/SsbSipMfcDecAPI.c @@ -545,7 +545,7 @@ int tile_4x2_read(int x_size, int y_size, int x_pos, int y_pos) return trans_addr; } -void tile_to_linear_4x2(unsigned char *p_linear_addr, unsigned char *p_tiled_addr, unsigned int x_size, unsigned int y_size) +void Y_tile_to_linear_4x2(unsigned char *p_linear_addr, unsigned char *p_tiled_addr, unsigned int x_size, unsigned int y_size) { int trans_addr; unsigned int i, j, k, index; @@ -568,38 +568,107 @@ void tile_to_linear_4x2(unsigned char *p_linear_addr, unsigned char *p_tiled_add data8[2] = p_tiled_addr[trans_addr + 64 * k + 2]; data8[3] = p_tiled_addr[trans_addr + 64 * k + 3]; - p_linear_addr[i * x_size + x_size * k + j] = data8[0]; - p_linear_addr[i * x_size + x_size * k + j + 1] = data8[1]; - p_linear_addr[i * x_size + x_size * k + j + 2] = data8[2]; - p_linear_addr[i * x_size + x_size * k + j + 3] = data8[3]; + p_linear_addr[index] = data8[0]; + p_linear_addr[index + 1] = data8[1]; + p_linear_addr[index + 2] = data8[2]; + p_linear_addr[index + 3] = data8[3]; data8[0] = p_tiled_addr[trans_addr + 64 * k + 4]; data8[1] = p_tiled_addr[trans_addr + 64 * k + 5]; data8[2] = p_tiled_addr[trans_addr + 64 * k + 6]; data8[3] = p_tiled_addr[trans_addr + 64 * k + 7]; - p_linear_addr[i * x_size + x_size * k + j + 4] = data8[0]; - p_linear_addr[i * x_size + x_size * k + j + 5] = data8[1]; - p_linear_addr[i * x_size + x_size * k + j + 6] = data8[2]; - p_linear_addr[i * x_size + x_size * k + j + 7] = data8[3]; + p_linear_addr[index + 4] = data8[0]; + p_linear_addr[index + 5] = data8[1]; + p_linear_addr[index + 6] = data8[2]; + p_linear_addr[index + 7] = data8[3]; data8[0] = p_tiled_addr[trans_addr + 64 * k + 8]; data8[1] = p_tiled_addr[trans_addr + 64 * k + 9]; data8[2] = p_tiled_addr[trans_addr + 64 * k + 10]; data8[3] = p_tiled_addr[trans_addr + 64 * k + 11]; - p_linear_addr[i*x_size + x_size * k + j + 8] = data8[0]; - p_linear_addr[i*x_size + x_size * k + j + 9] = data8[1]; - p_linear_addr[i*x_size + x_size * k + j + 10] = data8[2]; - p_linear_addr[i*x_size + x_size * k + j + 11] = data8[3]; + + p_linear_addr[index + 8] = data8[0]; + p_linear_addr[index + 9] = data8[1]; + p_linear_addr[index + 10] = data8[2]; + p_linear_addr[index + 11] = data8[3]; data8[0] = p_tiled_addr[trans_addr + 64 * k + 12]; data8[1] = p_tiled_addr[trans_addr + 64 * k + 13]; data8[2] = p_tiled_addr[trans_addr + 64 * k + 14]; data8[3] = p_tiled_addr[trans_addr + 64 * k + 15]; - p_linear_addr[i*x_size + x_size * k + j + 12] = data8[0]; - p_linear_addr[i*x_size + x_size * k + j + 13] = data8[1]; - p_linear_addr[i*x_size + x_size * k + j + 14] = data8[2]; - p_linear_addr[i*x_size + x_size * k + j + 15] = data8[3]; + + p_linear_addr[index + 12] = data8[0]; + p_linear_addr[index + 13] = data8[1]; + p_linear_addr[index + 14] = data8[2]; + p_linear_addr[index + 15] = data8[3]; + } + } + } +} + +void CbCr_tile_to_linear_4x2(unsigned char *p_linear_addr, unsigned char *p_tiled_addr, unsigned int x_size, unsigned int y_size) +{ + int trans_addr; + unsigned int i, j, k, index; + unsigned char data8[4]; + unsigned int half_y_size = y_size / 2; + unsigned int max_index = x_size * half_y_size; + unsigned char *pUVAddr[2]; + + pUVAddr[0] = p_linear_addr; + pUVAddr[1] = p_linear_addr + ((x_size * half_y_size) / 2); + + for (i = 0; i < half_y_size; i = i + 16) { + for (j = 0; j < x_size; j = j + 16) { + trans_addr = tile_4x2_read(x_size, half_y_size, j, i); + for (k = 0; k < 16; k++) { + /* limit check - prohibit segmentation fault */ + index = (i * x_size) + (x_size * k) + j; + /* remove equal condition to solve thumbnail bug */ + if (index + 16 > max_index) { + continue; + } + + data8[0] = p_tiled_addr[trans_addr + 64 * k + 0]; + data8[1] = p_tiled_addr[trans_addr + 64 * k + 1]; + data8[2] = p_tiled_addr[trans_addr + 64 * k + 2]; + data8[3] = p_tiled_addr[trans_addr + 64 * k + 3]; + + pUVAddr[index%2][index/2] = data8[0]; + pUVAddr[(index+1)%2][(index+1)/2] = data8[1]; + pUVAddr[(index+2)%2][(index+2)/2] = data8[2]; + pUVAddr[(index+3)%2][(index+3)/2] = data8[3]; + + data8[0] = p_tiled_addr[trans_addr + 64 * k + 4]; + data8[1] = p_tiled_addr[trans_addr + 64 * k + 5]; + data8[2] = p_tiled_addr[trans_addr + 64 * k + 6]; + data8[3] = p_tiled_addr[trans_addr + 64 * k + 7]; + + pUVAddr[(index+4)%2][(index+4)/2] = data8[0]; + pUVAddr[(index+5)%2][(index+5)/2] = data8[1]; + pUVAddr[(index+6)%2][(index+6)/2] = data8[2]; + pUVAddr[(index+7)%2][(index+7)/2] = data8[3]; + + data8[0] = p_tiled_addr[trans_addr + 64 * k + 8]; + data8[1] = p_tiled_addr[trans_addr + 64 * k + 9]; + data8[2] = p_tiled_addr[trans_addr + 64 * k + 10]; + data8[3] = p_tiled_addr[trans_addr + 64 * k + 11]; + + pUVAddr[(index+8)%2][(index+8)/2] = data8[0]; + pUVAddr[(index+9)%2][(index+9)/2] = data8[1]; + pUVAddr[(index+10)%2][(index+10)/2] = data8[2]; + pUVAddr[(index+11)%2][(index+11)/2] = data8[3]; + + data8[0] = p_tiled_addr[trans_addr + 64 * k + 12]; + data8[1] = p_tiled_addr[trans_addr + 64 * k + 13]; + data8[2] = p_tiled_addr[trans_addr + 64 * k + 14]; + data8[3] = p_tiled_addr[trans_addr + 64 * k + 15]; + + pUVAddr[(index+12)%2][(index+12)/2] = data8[0]; + pUVAddr[(index+13)%2][(index+13)/2] = data8[1]; + pUVAddr[(index+14)%2][(index+14)/2] = data8[2]; + pUVAddr[(index+15)%2][(index+15)/2] = data8[3]; } } } diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h index 1d2c0e8..e083998 100644 --- a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h +++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h @@ -287,9 +287,8 @@ extern "C" { /*--------------------------------------------------------------------------------*/ /* Format Conversion API */ /*--------------------------------------------------------------------------------*/ - -void tile_to_linear_4x2(unsigned char *p_linear_addr, unsigned char *p_tiled_addr, unsigned int x_size, unsigned int y_size); -void tile_to_linear_NEON_NEW(unsigned char *p_linear_addr, unsigned char *p_tiled_addr, unsigned int x_size, unsigned int y_size); +void Y_tile_to_linear_4x2(unsigned char *p_linear_addr, unsigned char *p_tiled_addr, unsigned int x_size, unsigned int y_size); +void CbCr_tile_to_linear_4x2(unsigned char *p_linear_addr, unsigned char *p_tiled_addr, unsigned int x_size, unsigned int y_size); /*--------------------------------------------------------------------------------*/ /* Decoding APIs */ diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.c b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.c index 34a005d..4d2944d 100644 --- a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.c +++ b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.c @@ -937,7 +937,7 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA #ifdef USE_SAMSUNG_COLORFORMAT SEC_OMX_BASEPORT *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX]; - if ((pH264Dec->hMFCH264Handle.bThumbnailMode == OMX_FALSE) || + if ((pH264Dec->hMFCH264Handle.bThumbnailMode == OMX_FALSE) && (pSECOutputPort->portDefinition.format.video.eColorFormat == SEC_OMX_COLOR_FormatNV12PhysicalAddress)) #else @@ -952,8 +952,14 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA SEC_OSAL_Memcpy(pOutBuf + sizeof(frameSize) + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr)); } else { SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420 out for ThumbnailMode"); - tile_to_linear_4x2(pOutBuf, (unsigned char *)outputInfo.YVirAddr, bufWidth, bufHeight); - tile_to_linear_4x2(pOutBuf + frameSize, (unsigned char *)outputInfo.CVirAddr, bufWidth, bufHeight / 2); + Y_tile_to_linear_4x2( + (unsigned char *)pOutBuf, + (unsigned char *)outputInfo.YVirAddr, + bufWidth, bufHeight); + CbCr_tile_to_linear_4x2( + ((unsigned char *)pOutBuf) + frameSize, + (unsigned char *)outputInfo.CVirAddr, + bufWidth, bufHeight); } } diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c index 13ca1a8..7fac824 100644 --- a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c +++ b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c @@ -1117,7 +1117,7 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT #ifdef USE_SAMSUNG_COLORFORMAT SEC_OMX_BASEPORT *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX]; - if ((pMpeg4Dec->hMFCMpeg4Handle.bThumbnailMode == OMX_FALSE) || + if ((pMpeg4Dec->hMFCMpeg4Handle.bThumbnailMode == OMX_FALSE) && (pSECOutputPort->portDefinition.format.video.eColorFormat == SEC_OMX_COLOR_FormatNV12PhysicalAddress)) #else @@ -1132,8 +1132,14 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT SEC_OSAL_Memcpy(pOutputBuf + sizeof(frameSize) + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr)); } else { SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420 out for ThumbnailMode"); - tile_to_linear_4x2(pOutputBuf, (unsigned char *)outputInfo.YVirAddr, bufWidth, bufHeight); - tile_to_linear_4x2(pOutputBuf + frameSize, (unsigned char *)outputInfo.CVirAddr, bufWidth, bufHeight / 2); + Y_tile_to_linear_4x2( + (unsigned char *)pOutputBuf, + (unsigned char *)outputInfo.YVirAddr, + bufWidth, bufHeight); + CbCr_tile_to_linear_4x2( + ((unsigned char *)pOutputBuf) + frameSize, + (unsigned char *)outputInfo.CVirAddr, + bufWidth, bufHeight); } } |