📄 omxipcs_ycbycr422tobgr565_u8_u16_c2c3r.c
字号:
/** * * * File Name: omxIPCS_YCbYCr422ToBGR565_U8_U16_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 BGR565 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_YCbYCr422ToBGR565_U8_U16_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_YCbYCr422ToBGR565_U8_U16_C2C3R( const OMX_U8 *pSrc, OMX_INT srcStep, OMX_U16 *pDst, OMX_INT dstStep, OMXSize roiSize ){ OMX_INT convWidth; /* convWidth is the bytes to read */ OMX_INT convHeight = roiSize.height; OMX_U8 Y0data, Y1data, Udata, Vdata; OMX_F32 Rdata, Gdata, Bdata; OMX_U16 *BGRptr; OMX_INT i, j; 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/2 < roiSize.width, OMX_Sts_BadArgErr); dstStep >>= 1; /* dstStep is converted to half-word size length */ for(i=0; i<convHeight; i++, pSrc+=srcStep, pDst+=dstStep) { BGRptr = pDst; convWidth = roiSize.width; j = 0; while(convWidth >= 2) { Y0data = pSrc[j]; Udata = pSrc[j+1]; Y1data = pSrc[j+2]; Vdata = pSrc[j+3]; armIPCS_ComputeRGBFromYUV_F32(Y0data, Udata, Vdata, &Rdata, &Gdata, &Bdata); *BGRptr++ = armIPCS_PackToBGR565_F32(Bdata, Gdata, Rdata); armIPCS_ComputeRGBFromYUV_F32(Y1data, Udata, Vdata, &Rdata, &Gdata, &Bdata); *BGRptr++ = armIPCS_PackToBGR565_F32(Bdata, Gdata, Rdata); j+=4; convWidth -= 2; } if(convWidth == 1) { Y0data = pSrc[j]; Udata = pSrc[j+1]; Vdata = pSrc[j+3]; armIPCS_ComputeRGBFromYUV_F32(Y0data, Udata, Vdata, &Rdata, &Gdata, &Bdata); *BGRptr++ = armIPCS_PackToBGR565_F32(Bdata, Gdata, Rdata); } } return OMX_Sts_NoErr;}/* End of file */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -