📄 omxipcs_ycbycr422tobgr888_u8_c2c3r.c
字号:
/** * * * File Name: omxIPCS_YCbYCr422ToBGR888_U8_C2C3R.c * OpenMAX DL: v1.0.2 * Revision: 10586 * Date: Wednesday, March 5, 2008 * * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. * * * * Description : Colour Conversion Routine - YUV422 to BGR888 in floating point. * The source is in two-channel format and pixel domain, and * the destination in three-channel format and pixel domain. * */#include "omxtypes.h"#include "armOMX.h"#include "omxIP.h"#include "armCOMM.h"#include "armIP.h"/** * Function: omxIPCS_YCbYCr422ToBGR888_U8_C2C3R (4.4.3.1.6) * * Description: * Convert a pixel-oriented YCbYCr422 input image to a pixel-oriented BGR888 * or BGR565 output image. The ROI of the source image is pointed to by pSrc, * and the result is placed into the ROI of the destination image referenced * by pDst. Memory organization for pixel-oriented YCbYCr422, BGR888, and * BGR565 images is specified in Table 4-1. * * Input Arguments: * * pSrc - pointer to the source ROI * srcStep - distance in bytes between the starts of consecutive lines in * the source image * dstStep - distance in bytes between the starts of consecutive lines in * the destination image * roiSize - size of the source and destination ROI in pixels * * Output Arguments: * * pDst - pointer to the destination ROI * * Return Value: * * OMX_Sts_NoErr - no error * OMX_Sts_BadArgErr - bad arguments detected; at least one of the * following is true: * - pSrc or pDst is NULL * - srcStep or dstStep is less than or equal to zero * - srcStep/2 < roiSize.width * - omxIPCS_YCbYCr422ToBGR888_U8_C2C3R() only: dstStep/3 < roiSize.width * - omxIPCS_YCbYCr422ToBGR565_U8_U16_C2C3R() only: dstStep/2 < roiSize.width * - roiSize has a field with zero or negative value * */ OMXResult omxIPCS_YCbYCr422ToBGR888_U8_C2C3R( const OMX_U8 *pSrc, OMX_INT srcStep, OMX_U8 *pDst, OMX_INT dstStep, OMXSize roiSize ){ OMX_INT convWidth = roiSize.width; /* convWidth is the bytes to read */ OMX_INT convHeight = roiSize.height; OMX_U8 Y0data, Y1data, Udata, Vdata; OMX_INT i, j, k; armRetArgErrIf(!pSrc, OMX_Sts_BadArgErr); armRetArgErrIf(!pDst, OMX_Sts_BadArgErr); armRetArgErrIf(srcStep <= 0, OMX_Sts_BadArgErr); armRetArgErrIf(dstStep <= 0, OMX_Sts_BadArgErr); armRetArgErrIf(roiSize.width <= 0, OMX_Sts_BadArgErr); armRetArgErrIf(roiSize.height <= 0, OMX_Sts_BadArgErr); armRetArgErrIf(srcStep/2 < roiSize.width, OMX_Sts_BadArgErr); armRetArgErrIf(dstStep/3 < roiSize.width, OMX_Sts_BadArgErr); /* ------------------------------------------------------------------------ Colour conversion equations R = 1.164(Y-16) + 1.596(Cr-128) G = 1.164(Y-16) - 0.813(Cr-128) - 0.392(Cb-128) B = 1.164(Y-16) + 2.017(Cb-128) INTERLEAVED YUV422 DATA (Current input format) |YU|YV|YU|YV|... The armIPCS_ComputeXFromYUV_Raw() functions apart from doing the colour conversion, takes care of type-conversion from intermediate float values and clipping to U8, taking care of rounding errors. ------------------------------------------------------------------------ */ for(i=0; i<convHeight; i++, pSrc+=srcStep, pDst+=dstStep) { j=0; k=0; convWidth = roiSize.width; while(convWidth >= 2) { Y0data = pSrc[j]; Udata = pSrc[j+1]; Y1data = pSrc[j+2]; Vdata = pSrc[j+3]; armIPCS_ComputeRGBFromYUV_F32_U8(Y0data, Udata, Vdata, &pDst[k+2], &pDst[k+1], &pDst[k]); armIPCS_ComputeRGBFromYUV_F32_U8(Y1data, Udata, Vdata, &pDst[k+5], &pDst[k+4], &pDst[k+3]); j+=4; k+=6; convWidth -= 2; } if(convWidth == 1) { Y0data = pSrc[j]; Udata = pSrc[j+1]; Vdata = pSrc[j+3]; armIPCS_ComputeRGBFromYUV_F32_U8(Y0data, Udata, Vdata, &pDst[k+2], &pDst[k+1], &pDst[k]); } } return OMX_Sts_NoErr;}/* End of file */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -