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

📄 omxipcs_ycbcr422tobgr565ls_mcu_s16_u16_p3c3.c

📁 The OpenMAX DL (Development Layer) APIs contain a comprehensive set of audio, video, signal processi
💻 C
字号:
/** * *  * File Name:  omxIPCS_YCbCr422ToBGR565LS_MCU_S16_U16_P3C3.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 YUV422 to BGR565 in floating point. *                Source data is stored as a JPEG MCU in three channel, planar domain and  *                the destination would be in three-channel pixel format. * */#include "omxtypes.h"#include "armOMX.h"#include "omxIP.h"#include "armCOMM.h"#include "armIP.h"/** * Function:  omxIPCS_YCbCr422ToBGR565LS_MCU_S16_U16_P3C3   (4.4.3.8.6) * * Description: * These functions convert sub-sampled YCbCr data to BGR565 data with  * level-shift.  The parameter pSrcMCU[0] must point to the start of a  * sufficient number of contiguously stored 8x8 Y blocks to constitute a  * complete MCU given the source chroma sub-sampling scheme, i.e., 1, 2, or 4  * blocks for YCbCr 4:4:4, 4:2:2, or YCbCr 4:2:0, respectively.  * * Input Arguments: *    *   pSrcMCU - buffer containing input MCU pointers: pSrcMCU[0] points to the  *            first Y block, pSrcMCU[1] points to Cb the block, and pSrcMCU[2]  *            points to the Cr block; all three must be aligned on 8-byte  *            boundaries.  The parameter pSrcMCU[0] must point to the start of  *            a sufficient number of contiguously stored 8x8 Y blocks to  *            constitute a complete MCU given the source chroma sub-sampling  *            scheme, i.e., 1, 2, or 4 blocks for YCbCr 4:4:4, 4:2:2, or YCbCr  *            4:2:0, respectively. Only top-down storage format is supported.   *            Input components are represented using Q8 and are bounded on the  *            interval [-128, 127].  *   dstStep - distance in bytes between the starts of consecutive lines in  *            the destination image; can take negative values to support  *            bottom-up storage format.  * * Output Arguments: *    *   pDst - output image buffer pointer; data are interleaved as follows:   *            [B G R B G R  ], where G is represented using 6 bits, and B and R  *            are represented using 5 bits.  Output components are saturated.  *            The parameter dstStep can take negative values to support  *            bottom-up storage.  * * Return Value: *     *    OMX_Sts_NoErr - no error  *    OMX_Sts_BadArgErr - bad arguments - returned if one or more of the  *              following is true:  *    -   a pointer was NULL  *    -   the absolute value of dstStep was smaller than 16 (for YCbCr444)  *        or 32 (for YCbCr422/YCbCr420)  *    -   a pointer in pSrcMCU[] was not 8-byte aligned  * */ OMXResult omxIPCS_YCbCr422ToBGR565LS_MCU_S16_U16_P3C3(        const OMX_S16 *pSrcMCU[3],        OMX_U16 *pDstRGB,        OMX_INT dstStep       ){       const OMX_S16 *pSrcY, *pSrcCb, *pSrcCr;    OMX_S16 Ydata, Ydata2, Udata, Vdata;    OMX_F32 Rdata, Gdata, Bdata, Rdata2, Gdata2, Bdata2;    OMX_INT i, j;    OMX_U16 *pRGB;    OMX_INT blk;    ARM_BLOCK8x8 *y8x8;    OMX_INT blkOffset[2] = {0, 8};    OMX_INT blkOffset_UV[2] = {0, 4};    armRetArgErrIf(!pSrcMCU, OMX_Sts_BadArgErr);    armRetArgErrIf(!pDstRGB, OMX_Sts_BadArgErr);    armRetArgErrIf(!pSrcMCU[0], OMX_Sts_BadArgErr);    armRetArgErrIf(!pSrcMCU[1], OMX_Sts_BadArgErr);    armRetArgErrIf(!pSrcMCU[2], OMX_Sts_BadArgErr);    armRetArgErrIf(!armIs8ByteAligned(pSrcMCU[0]), OMX_Sts_BadArgErr);    armRetArgErrIf(!armIs8ByteAligned(pSrcMCU[1]), OMX_Sts_BadArgErr);    armRetArgErrIf(!armIs8ByteAligned(pSrcMCU[2]), OMX_Sts_BadArgErr);    armRetArgErrIf(((dstStep > (-2 * JPEG_MCU_PIX_WIDTH_422)) && ((dstStep < 2 * JPEG_MCU_PIX_WIDTH_422))), OMX_Sts_BadArgErr);    /*    ---------------------------------------------------------------------------------    With input data (Y, Cb, Cr) belonging to [-128, 127] and output data (R, G, B)     belonging to [0, 255], colour conversion equations in the JPEG domain would be -     R = (Y + 128) + 1.40200 * Cr    G = (Y + 128) - 0.34414 * Cb - 0.71414 * Cr    B = (Y + 128) + 1.77200 * Cb        The armComputeXFromYUV_JPEG() 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.  This is followed armIPCS_PackToRGB565() that packs    the R, G, B data in 565 format.    ---------------------------------------------------------------------------------    */    y8x8 = (ARM_BLOCK8x8 *)pSrcMCU[0];       pSrcY   = pSrcMCU[0];    pSrcCb  = pSrcMCU[1];    pSrcCr  = pSrcMCU[2];    for(blk = 0; blk < 2; blk++)    {        pSrcY   = (OMX_S16 *)y8x8++;        pSrcCb  = pSrcMCU[1] + blkOffset_UV[blk];        pSrcCr  = pSrcMCU[2] + blkOffset_UV[blk];        pRGB    = pDstRGB + blkOffset[blk];        for(i = 0; i < 8; i++)        {            for(j = 0; j < 4*2; j+=2)            {                Ydata       = *pSrcY++;                Ydata2      = *pSrcY++;                Udata       = *pSrcCb++;                Vdata       = *pSrcCr++;                armIPCS_ComputeRGBFromYUV_JPEG_F32(Ydata, Udata, Vdata, &Rdata, &Gdata, &Bdata);                armIPCS_ComputeRGBFromYUV_JPEG_F32(Ydata2, Udata, Vdata, &Rdata2, &Gdata2, &Bdata2);                pRGB[j]   = armIPCS_PackToBGR565_F32(Bdata,  Gdata,  Rdata);                pRGB[j+1] = armIPCS_PackToBGR565_F32(Bdata2, Gdata2, Rdata2);            }            pSrcCb  += 4;            pSrcCr  += 4;            pRGB    += dstStep>>1;        }    }    return OMX_Sts_NoErr;}/* End of file */

⌨️ 快捷键说明

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