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

📄 omxipcs_ycbcr420tobgr888ls_mcu_s16_u8_p3c3.c

📁 The OpenMAX DL (Development Layer) APIs contain a comprehensive set of audio, video, signal processi
💻 C
字号:
/** * *  * File Name:  omxIPCS_YCbCr420ToBGR888LS_MCU_S16_U8_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 YUV420 to BGR888 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 "armCOMM.h"#include "armOMX.h"#include "omxIP.h"#include "armIP.h"/** * Function:  omxIPCS_YCbCr420ToBGR888LS_MCU_S16_U8_P3C3   (4.4.3.8.3) * * Description: * These functions convert sub-sampled YCbCr data to BGR888 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:  The parameter  *            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  *            pointers 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  *            expressed using a Q8 representation and are bounded on the  *            interval [-128, 127].  *   dstStep - distance in bytes between the starts of consecutive lines in  *            the destination image; values less than 0 are allowed to support  *            bottom-up storage format.  * * Output Arguments: *    *   pDst - points to the output image buffer in which the output data (C3  *            representation) are interleaved as follows:  BGRBGRBGR...   *            Bottom-up storage format is supported. Outputs are saturated to  *            the OMX_U8 range [0, 255].  The parameter dstStep can take  *            negative values to support bottom-up storage format.  * * Return Value: *     *    OMX_Sts_NoErr - no error  *    OMX_Sts_BadArgErr - bad arguments.  Returned if one or more of the  *              following was true:  *    -   a pointer was NULL  *    -   the absolute value of dstStep was smaller than 24 (for YCbCr444)  *        or 48 (for YCbCr422/YCbCr420)  *    -   a pointer in pSrcMCU[] was not 8-byte aligned  * */OMXResult omxIPCS_YCbCr420ToBGR888LS_MCU_S16_U8_P3C3(    const OMX_S16 *pSrcMCU[3],    OMX_U8 *pDst,    OMX_INT dstStep){       const OMX_S16 *pSrcY, *pSrcY2, *pSrcCb, *pSrcCr;    OMX_S16 Ydata, Ydata2, Ydata3, Ydata4, Udata, Vdata;    OMX_INT i, j, blk_x, blk_y;    ARM_BLOCK8x8 *y8x8;    OMX_INT blkOffset_Dst, blkOffset_UV;    OMX_U8  *pRGB, *pRGB2;    ARM_JpegPixelYUV2RGBConversionFunctionType pixCCfn = armIPCS_ComputeRGBFromYUV_JPEG_F32_U8;        armRetArgErrIf(!pSrcMCU, OMX_Sts_BadArgErr);    armRetArgErrIf(!pDst, 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 > (-3 * JPEG_MCU_PIX_WIDTH_420)) && (dstStep < (3 * JPEG_MCU_PIX_WIDTH_420))), OMX_Sts_BadArgErr);    y8x8 = (ARM_BLOCK8x8 *)pSrcMCU[0];        for(blk_y = 0; blk_y < 2; blk_y++)    {        for(blk_x = 0; blk_x < 2; blk_x++)        {            blkOffset_Dst = blk_y * 8 * dstStep + blk_x * 24;            blkOffset_UV  = blk_y * 8 * 4 + blk_x * 4;                        pSrcY   = (OMX_S16 *)y8x8++;            pSrcY2  = pSrcY + 8;            pSrcCb  = pSrcMCU[1] + blkOffset_UV;            pSrcCr  = pSrcMCU[2] + blkOffset_UV;            pRGB    = pDst + blkOffset_Dst;            pRGB2   = pRGB + dstStep;            for(i = 0; i < 4; i++)            {                for(j = 0; j < 4*6; j+=6)                {                    Ydata       = *pSrcY++;                    Ydata2      = *pSrcY++;                    Ydata3      = *pSrcY2++;                    Ydata4      = *pSrcY2++;                    Udata       = *pSrcCb++;                    Vdata       = *pSrcCr++;                                        pixCCfn(Ydata, Udata, Vdata, &pRGB[j+2], &pRGB[j+1], &pRGB[j]);                    pixCCfn(Ydata2, Udata, Vdata, &pRGB[j+5], &pRGB[j+4], &pRGB[j+3]);                    pixCCfn(Ydata3, Udata, Vdata, &pRGB2[j+2], &pRGB2[j+1], &pRGB2[j]);                    pixCCfn(Ydata4, Udata, Vdata, &pRGB2[j+5], &pRGB2[j+4], &pRGB2[j+3]);                }                pSrcY   += 8;                pSrcY2  += 8;                pSrcCb  += 4;                pSrcCr  += 4;                pRGB    += 2 * dstStep;                pRGB2   += 2 * dstStep;            }        }    }    return OMX_Sts_NoErr;}/* End of file */

⌨️ 快捷键说明

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