⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 omxipcs_bgr565toycbcr444ls_mcu_u16_s16_c3p3.c

📁 The OpenMAX DL (Development Layer) APIs contain a comprehensive set of audio, video, signal processi
💻 C
字号:
/** * *  * File Name:  omxIPCS_BGR565ToYCbCr444LS_MCU_U16_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 RGB565 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_BGR565ToYCbCr444LS_MCU_U16_S16_C3P3   (4.4.3.7.6) * * Description: * This function converts packed BGR565 image data to the following  * sub-sampled color spaces:  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 - references the source image data buffer.  Pixel intensities are  *            interleaved as shown in Table 4 1, and G, B, and R are  *            represented using, respectively, 6, 5, and 5 bits.  The image  *            data buffer pSrcsupports bottom-up storage format, for which  *            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 of 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 - bad arguments. Returned for any of the following  *              conditions:  *    -   a pointer was NULL  *    -   srcStep was an odd number or its absolute value was less  *        than 16 for YCbCr444 or 32 for YCbCr422/YCbCr420.  *    -   a pointer in pDstMCU[] was not 8-byte aligned  * */ OMXResult omxIPCS_BGR565ToYCbCr444LS_MCU_U16_S16_C3P3(        const OMX_U16 *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 > (-2 * JPEG_MCU_PIX_WIDTH_444)) && (srcStep < (2 * JPEG_MCU_PIX_WIDTH_444))), OMX_Sts_BadArgErr);    armRetArgErrIf((srcStep % 2), OMX_Sts_BadArgErr);    /*    --------------------------------------------------------------------------    With input data (R, G, B) belonging to [0, 255] and output data (Y,Cb,Cr)     expected in [-128, 127], CC equations in JPEG domain would be -     Y  =  0.29900*R  + 0.58700*G  + 0.11400*B - 128    Cb = -0.16874*R  - 0.33126*G  + 0.50000*B    Cr =  0.50000*R  - 0.41869*G  - 0.08131*B        The armComputeXFromRGB_JPEG() functions apart from doing the colour conversion,     takes care of type-conversion from intermediate float values and clipping to     S16, taking care of rounding errors.    --------------------------------------------------------------------------    */        pDstY   = pDstMCU[0];    pDstCb  = pDstMCU[1];    pDstCr  = pDstMCU[2];        for(i = 0; i < 8; i++)    {        for(j = 0; j < 8; j++)        {            armIPCS_UnpackBGR565(pSrc[j], &Bdata, &Gdata, &Rdata);            armIPCS_ComputeYUVFromRGB_JPEG_F32_S16(Rdata, Gdata, Bdata, pDstY++, pDstCb++, pDstCr++);        }        pSrc += srcStep>>1;    }    return OMX_Sts_NoErr;} /* End of file */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -