📄 omxipcs_bgr888toycbcr444ls_mcu_u8_s16_c3p3.c
字号:
/** * * * File Name: omxIPCS_BGR888ToYCbCr444LS_MCU_U8_S16_C3P3.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 - Converts BGR888 to YUV444 in floating point. * Source is in three channel, pixel domain and the destination would be in * three-channel planar format. Output is a JPEG MCU. * */#include "omxtypes.h"#include "armCOMM.h"#include "armOMX.h"#include "omxIP.h"#include "armIP.h"/** * Function: omxIPCS_BGR888ToYCbCr444LS_MCU_U8_S16_C3P3 (4.4.3.7.3) * * Description: * These functions convert an input BGR888 MCU to one of the following * sub-sampled color spaces with level-shift: YCbCr4:4:4, YCbCr4:2:2, and * YCbCr4:2:0. The parameter pDstMCU[0] must point to the start of a buffer * with sufficient free space to contain the particular number of contiguously * stored 8x8 Y blocks that constitute a complete MCU given the output chroma * sub-sampling scheme, i.e., 1, 2, or 4 of 8x8 Y blocks for YCbCr 4:4:4, 4:2:2, * or 4:2:0 output, respectively. * * Input Arguments: * * pSrc - pointer to the source image data buffer. The source image data * are stored in interleaved order as BGRBGRBGR The image data * buffer pSrc can support bottom-up storage formats. For * bottom-up images, srcStep can be less than 0. * srcStep - distance in bytes between the starts of consecutive lines in * the source image; can be less than 0 to support bottom-up * storage format. * * Output Arguments: * * pDstMCU[3] - output MCU pointers. The parameter pDstMCU[0] must point * to the start of a buffer with sufficient free space to contain * the particular number of contiguously stored 8x8 Y blocks that * constitute a complete MCU given the output chroma sub-sampling * scheme, i.e., 1, 2, or 4 8x8 Y blocks for YCbCr 4:4:4, 4:2:2, or * 4:2:0 output, respectively. The parameter pDstMCU[1] points to * the Cb block, and the parameter pDstMCU[2] points to the Cr * block. Output components are expressed using a Q8 * representation and are bounded on the interval [-128, 127]. The * buffers referenced by pDstMCU[] support top-down storage format * only, and all pointers pDstMCU[0..2] must be 8-byte aligned. * * Return Value: * * OMX_Sts_NoErr - no error * OMX_Sts_BadArgErr - one or more of the following bad argument * conditions was detected: * - a pointer was NULL * - the absolute value of srcStep was smaller than 24 for YCbCr 444, * or 48 for YCbCr422/ YCbCr420 * - the start address of each pointer in pDstMCU[] was not 8-byte aligned * */ OMXResult omxIPCS_BGR888ToYCbCr444LS_MCU_U8_S16_C3P3( const OMX_U8 *pSrc, OMX_INT srcStep, OMX_S16 *pDstMCU[3] ){ OMX_S16 *pDstY, *pDstCb, *pDstCr; OMX_U8 Rdata, Gdata, Bdata; OMX_INT i, j; armRetArgErrIf(!pSrc, OMX_Sts_BadArgErr); armRetArgErrIf(!pDstMCU, OMX_Sts_BadArgErr); armRetArgErrIf(!pDstMCU[0], OMX_Sts_BadArgErr); armRetArgErrIf(!pDstMCU[1], OMX_Sts_BadArgErr); armRetArgErrIf(!pDstMCU[2], OMX_Sts_BadArgErr); armRetArgErrIf(!armIs8ByteAligned(pDstMCU[0]), OMX_Sts_BadArgErr); armRetArgErrIf(!armIs8ByteAligned(pDstMCU[1]), OMX_Sts_BadArgErr); armRetArgErrIf(!armIs8ByteAligned(pDstMCU[2]), OMX_Sts_BadArgErr); armRetArgErrIf(((srcStep > (-3 * JPEG_MCU_PIX_WIDTH_444)) && (srcStep < (3 * JPEG_MCU_PIX_WIDTH_444))), OMX_Sts_BadArgErr); pDstY = pDstMCU[0]; pDstCb = pDstMCU[1]; pDstCr = pDstMCU[2]; for(i = 0; i < 8; i++) { for(j = 0; j < 8*3; j+=3) { Bdata = pSrc[j]; Gdata = pSrc[j+1]; Rdata = pSrc[j+2]; armIPCS_ComputeYUVFromRGB_JPEG_F32_S16(Rdata, Gdata, Bdata, pDstY++, pDstCb++, pDstCr++); } pSrc += srcStep; } return OMX_Sts_NoErr;}/* End of file */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -