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

📄 omxicjp_copyexpand_u8_c3.c

📁 The OpenMAX DL (Development Layer) APIs contain a comprehensive set of audio, video, signal processi
💻 C
字号:
/** *  * File Name:  omxICJP_CopyExpand_U8_C3.c * OpenMAX DL: v1.0.2 * Revision:   10586 * Date:       Wednesday, March 5, 2008 *  * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. *  *  * * Description: * This file contains module for Copy/Expand for an MCU on the boundary * */#include "omxtypes.h"#include "armOMX.h"#include "omxIC.h"#include "armCOMM.h"/** * Function:  omxICJP_CopyExpand_U8_C3   (5.1.3.1.1) * * Description: * This function copies an image block from the source image buffer to the  * destination image buffer.  If the size of the destination block is larger  * than the size of the source block, then the function affects pixel  * expansion by filling extra space in the destination block with copies of  * pixel values from the edges of the source block. This function is intended  * for use in the JPEG encoder for completion of partial MCUs (e.g., BGR8:8:8,  * RGB8:8:8) along the vertical and horizontal image boundaries prior to  * conversion to the target encoded color space.  As such, the destination  * block must be of size larger than or equal to the source block, and must  * have standard JPEG MCU [ISO10918-1] dimensions of either 8x8, 8x16, 16x8,  * or 16x16 horizontal by vertical pixels. Both top-down and bottom-up storage  * are supported, and are indicated, respectively, via positive and negative  * values for the parameters srcStep/dstStep. For example, given positive  * source and destination step values (top-down source and destination  * images), the function copies the source block to the destination block, and  * pads the the extra space in the destination block to the right of the  * source block boundary with copies of the right-most pixel from the source  * block on each scanline. Similarly, any extra space in the larger  * destination block below the source block boundary is padded with copies of  * the bottom-most pixel from the source block. This function supports only  * interleaved (C3) image blocks.  * * Input Arguments: *    *   pSrc - pointer to the source block  *   srcStep - distance in bytes between the starts of consecutive lines in  *            the source image; a positive value may be used to indicate  *            top-down storage, or a negative value may be used to indicate  *            bottom-up storage  *   srcSize - size of the source block  *   dstStep - distance in bytes between the starts of consecutive lines in  *            the destination image; a positive value may be used to indicate  *            top-down storage, or a negative value may be used to indicate  *            bottom-up storage  *   dstSize - size of destination block; if dstSize > srcSize then pixel  *            expansion is applied.  * * Output Arguments: *    *   pDst - pointer to the destination buffer  * * Return Value: *     *    OMX_Sts_NoErr - no error  *    OMX_Sts_BadArgErr - bad arguments; returned under one or more of the  *              following conditions: a pointer was NULL  *    -   one of the source or destination region rectangle dimensions was  *              equal to 0 dstSize is not equal to one of the following:  *              {8,8}, {8,16}, {16,8}, or {16,16}. srcSize.width >  *              dstSize.width. srcSize.height > dstSize.height.  *    -   either |srcStep| < 3 or |dstStep| < 3  * */OMXResult omxICJP_CopyExpand_U8_C3(     const OMX_U8 *pSrc,     OMX_INT srcStep,     OMXSize srcSize,     OMX_U8 *pDst,     OMX_INT dstStep,     OMXSize dstSize ){    OMX_INT srcX,srcY,dstX,dstY;    OMX_U8  coefOne,coefTwo,coefThr;        /* Argument Checks */    armRetArgErrIf( pSrc == NULL, OMX_Sts_BadArgErr)    armRetArgErrIf( pDst == NULL, OMX_Sts_BadArgErr)        armRetArgErrIf( (srcStep < 3) && (srcStep > -3), OMX_Sts_BadArgErr)    armRetArgErrIf( (dstStep < 3) && (dstStep > -3), OMX_Sts_BadArgErr)        armRetArgErrIf( srcSize.height <=0, OMX_Sts_BadArgErr)    armRetArgErrIf( srcSize.width  <=0, OMX_Sts_BadArgErr)        armRetArgErrIf( dstSize.height <=0, OMX_Sts_BadArgErr)    armRetArgErrIf( dstSize.width  <=0, OMX_Sts_BadArgErr)        armRetArgErrIf( dstSize.height < srcSize.height, OMX_Sts_BadArgErr)    armRetArgErrIf( dstSize.width  < srcSize.width , OMX_Sts_BadArgErr)    /* Processing */    for(srcY = 0 ; srcY < srcSize.height ; srcY++)    {        /* Copy the contents of source image */        for(srcX = 0 ; srcX < (3 * srcSize.width) ; srcX += 3 )        {            pDst[srcX]     = pSrc[srcX];            pDst[srcX + 1] = pSrc[srcX + 1];            pDst[srcX + 2] = pSrc[srcX + 2];        }                /* Border Element */         coefOne = pSrc[srcX - 3];        coefTwo = pSrc[srcX - 2];        coefThr = pSrc[srcX - 1];                /* Replicate the border elements on right side */        for(dstX = (3 * srcSize.width) ; dstX < (3 * dstSize.width) ; dstX += 3)        {            pDst[dstX]     = coefOne;            pDst[dstX + 1] = coefTwo;            pDst[dstX + 2] = coefThr;                    }        pDst += dstStep;        pSrc += srcStep;    }    /* Replicate the border elements on bottom side */    for(dstX = 0 ;dstX < dstSize.width ; dstX++)    {        coefOne = pDst[-dstStep];        coefTwo = pDst[-dstStep + 1];        coefThr = pDst[-dstStep + 2];                for(dstY =  0 ; dstY < (dstSize.height - srcSize.height) ; dstY++)        {            pDst[ dstY * dstStep ]    = coefOne;            pDst[ dstY * dstStep + 1] = coefTwo;            pDst[ dstY * dstStep + 2] = coefThr;                    }                pDst += 3;    }    return OMX_Sts_NoErr;}/* End of File */

⌨️ 快捷键说明

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