📄 omxipcs_ycbcr444tobgr565_u8_u16_p3c3r.c
字号:
/** * * * File Name: omxIPCS_YCbCr444ToBGR565_U8_U16_P3C3R.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 - YUV444 to BGR565 in floating point. * The source is in three-channel format and planar 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_YCbCr444ToBGR565_U8_U16_P3C3R (4.4.3.1.3) * * Description: * Converts a planar YCbCr444 input image to a pixel-oriented 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 pointed to by pDst. The * YCbCr444 input image is organized in memory as specified in Table 4-2. The * pixel-oriented BGR565 output image is organized in memory as specified in * Table 4-1. * * Input Arguments: * * pSrc - vector containing pointers to Y, Cb, and Cr planes * 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 buffer * * 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 < roiSize.width * - dstStep/2 < roiSize.width * - roiSize has a field with zero or negative value * */ OMXResult omxIPCS_YCbCr444ToBGR565_U8_U16_P3C3R( const OMX_U8 *pSrc[3], OMX_INT srcStep, OMX_U16 *pDst, OMX_INT dstStep, OMXSize roiSize ){ OMX_INT convWidth = roiSize.width; /* convWidth is the bytes to read */ OMX_INT convHeight = roiSize.height; OMX_U8 Ydata, Udata, Vdata; OMX_F32 Rdata, Gdata, Bdata; OMX_U16 *RGBptr; const OMX_U8 *Yptr, *Uptr, *Vptr; OMX_INT i, j; armRetArgErrIf(!pSrc, OMX_Sts_BadArgErr); armRetArgErrIf(!pDst, OMX_Sts_BadArgErr); armRetArgErrIf(!pSrc[0], OMX_Sts_BadArgErr); armRetArgErrIf(!pSrc[1], OMX_Sts_BadArgErr); armRetArgErrIf(!pSrc[2], 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 < roiSize.width, OMX_Sts_BadArgErr); armRetArgErrIf(dstStep/2 < roiSize.width, OMX_Sts_BadArgErr); dstStep >>= 1; /* dstStep is converted to half-word size length */ Yptr = pSrc[0]; Uptr = pSrc[1]; Vptr = pSrc[2]; for(i = 0; i < convHeight; i++, Yptr += srcStep, Uptr += srcStep, Vptr += srcStep, pDst += dstStep) { RGBptr = pDst; for(j = 0; j < convWidth; j++) { Ydata = Yptr[j]; Udata = Uptr[j]; Vdata = Vptr[j]; armIPCS_ComputeRGBFromYUV_F32(Ydata, Udata, Vdata, &Rdata, &Gdata, &Bdata); *RGBptr++ = armIPCS_PackToBGR565_F32(Bdata, Gdata, Rdata); } } return OMX_Sts_NoErr;}/* End of file */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -