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

📄 omxipcs_ycbcr420rszrot_u8_p3r.c

📁 The OpenMAX DL (Development Layer) APIs contain a comprehensive set of audio, video, signal processi
💻 C
📖 第 1 页 / 共 2 页
字号:
    OMX_F32 gridRatioH      = ((OMX_F32)rcpRatiox) / (1 << 16);    OMX_F32 gridRatioV      = ((OMX_F32)rcpRatioy) / (1 << 16);    armRetArgErrIf(!pSrc, OMX_Sts_BadArgErr);    armRetArgErrIf(!pDst, OMX_Sts_BadArgErr);    armRetArgErrIf(!pSrc[0], OMX_Sts_BadArgErr);    armRetArgErrIf(!pSrc[1], OMX_Sts_BadArgErr);    armRetArgErrIf(!pSrc[2], OMX_Sts_BadArgErr);    armRetArgErrIf(!pDst[0], OMX_Sts_BadArgErr);    armRetArgErrIf(!pDst[1], OMX_Sts_BadArgErr);    armRetArgErrIf(!pDst[2], OMX_Sts_BadArgErr);    armRetArgErrIf(!armIs4ByteAligned(pSrc[0]), OMX_Sts_BadArgErr);    armRetArgErrIf(!armIs4ByteAligned(pDst[0]), OMX_Sts_BadArgErr);    armRetArgErrIf(!srcStep, OMX_Sts_BadArgErr);    armRetArgErrIf(!dstStep, OMX_Sts_BadArgErr);    armRetArgErrIf(srcStep[0] < 1, OMX_Sts_BadArgErr);    armRetArgErrIf(srcStep[1] < 1, OMX_Sts_BadArgErr);    armRetArgErrIf(srcStep[2] < 1, OMX_Sts_BadArgErr);    armRetArgErrIf(dstStep[0] < 1, OMX_Sts_BadArgErr);    armRetArgErrIf(dstStep[1] < 1, OMX_Sts_BadArgErr);    armRetArgErrIf(dstStep[2] < 1, OMX_Sts_BadArgErr);    armRetArgErrIf(!armIs4ByteAligned(srcStep[0]), OMX_Sts_BadArgErr);    armRetArgErrIf(!armIs4ByteAligned(dstStep[0]), OMX_Sts_BadArgErr);    armRetArgErrIf(srcSize.width < 1, OMX_Sts_BadArgErr);    armRetArgErrIf(srcSize.height < 1, OMX_Sts_BadArgErr);    armRetArgErrIf(dstSize.width < 1, OMX_Sts_BadArgErr);    armRetArgErrIf(dstSize.height < 1, OMX_Sts_BadArgErr);    armRetArgErrIf(srcSize.width > srcStep[0], OMX_Sts_BadArgErr);    armRetArgErrIf(srcSize.width>>1 > srcStep[1], OMX_Sts_BadArgErr);    armRetArgErrIf(srcSize.width>>1 > srcStep[2], OMX_Sts_BadArgErr);    armRetArgErrIf(dstSize.width & 1, OMX_Sts_BadArgErr);    armRetArgErrIf(dstSize.height & 1, OMX_Sts_BadArgErr);    armRetArgErrIf(rcpRatiox <= 0, OMX_Sts_BadArgErr);    armRetArgErrIf(rcpRatioy <= 0, OMX_Sts_BadArgErr);    armRetArgErrIf(rcpRatiox > (OMX_INT)(((OMX_F32)((srcSize.width&~1)-1) / (OMX_F32)((dstSize.width&~1)-1)) * (1<<16) + 0.5), OMX_Sts_BadArgErr);    armRetArgErrIf(rcpRatioy > (OMX_INT)(((OMX_F32)((srcSize.height&~1)-1) / (OMX_F32)((dstSize.height&~1)-1)) * (1<<16) + 0.5), OMX_Sts_BadArgErr);    armRetArgErrIf((interpolation != OMX_IP_NEAREST) && (interpolation != OMX_IP_BILINEAR), OMX_Sts_BadArgErr);    armRetArgErrIf((rotation != OMX_IP_ROTATE90L) && (rotation != OMX_IP_ROTATE90R) &&                   (rotation != OMX_IP_ROTATE180) && (rotation != OMX_IP_DISABLE) &&                   (rotation != OMX_IP_FLIP_HORIZONTAL) && (rotation != OMX_IP_FLIP_VERTICAL), OMX_Sts_BadArgErr);    if((rotation == OMX_IP_ROTATE90L) || (rotation == OMX_IP_ROTATE90R))    {        armRetArgErrIf(dstSize.height > dstStep[0]  , OMX_Sts_BadArgErr);        armRetArgErrIf(dstSize.height>>1 > dstStep[1], OMX_Sts_BadArgErr);        armRetArgErrIf(dstSize.height>>1 > dstStep[2], OMX_Sts_BadArgErr);    }    else    {        armRetArgErrIf(dstSize.width > dstStep[0]  , OMX_Sts_BadArgErr);        armRetArgErrIf(dstSize.width > 2*dstStep[1], OMX_Sts_BadArgErr);        armRetArgErrIf(dstSize.width > 2*dstStep[2], OMX_Sts_BadArgErr);    }        /*    ----------------------------------------------------------------------------------    Resize:    Resizing is easier, if we have a have a unified grid containing both input and    rescaled images. The pixel (0,0) of the input image co-incides with the pixel     (0,0) of the output image.  We can compute the relative position of rescaled     pixels on the original image grid using the formula -    PIXnew(x,y) = PIXold(x*gridRatioH, y*gridRatioV)    where gridRatioH = SrcWidth/DstWidth and gridRatioV = SrcHeight/DstHeight    Then we apply either the Nearest Neighbour or Bilinear interpolation accordingly.        It is important to note that if DstWidth and DstHeight are not big enough to hold     the interpolated data, the interpolated image gets clipped such that we get the     top-left portion of the interpolated image in the output buffer.    ----------------------------------------------------------------------------------    */    for(component = 0; component < 3; component++)    {        pSrcRef     = pSrc[component];        pDstRef     = pDst[component];        srcStepRef  = srcStep[component];        dstStepRef  = dstStep[component];        outLoopCnt  = (component == 0) ? outHeightY : outHeightUV;        inLoopCnt   = (component == 0) ? outWidthY : outWidthUV;                if(interpolation == OMX_IP_NEAREST)        {            for(i = 0; i < outLoopCnt; i++, pDstRef += dstStepRef)            {                yPos  = armRoundFloatToS32(i * gridRatioV);                for(j = 0; j < inLoopCnt; j++)                {                    xPos = armRoundFloatToS32(j * gridRatioH);                    pDstRef[j] = pSrcRef[xPos + (yPos * srcStepRef)];                }            }        }                else if(interpolation == OMX_IP_BILINEAR)        {            for(i = 0; i < outLoopCnt; i++, pDstRef += dstStepRef)            {                yPos    = (OMX_INT)(i * gridRatioV);                yOff    = (i * gridRatioV) - yPos;                for(j = 0; j < inLoopCnt; j++)                {                    xPos = (OMX_INT)(j * gridRatioH);                    xOff = (j * gridRatioH) - xPos;                    armIPCS_InterpPixel_Bilinear(pSrcRef, srcStepRef, xPos, yPos, xOff, yOff, &pDstRef[j]);                }            }        }    }        /*    ----------------------------------------------------------------------------------    Rotation:    The Rotation operation follows the Resize and is to be done in-place.    The formulae for different flavours of rotation -    H flip: OutPix(x,y) = InPix(width-x,y),    V flip: OutPix(x,y) = InPix(x,height-y),    180 is: OutPix(x,y) = InPix(width-x,height-y),    90L is: OutPix(y,x) = InPix(x,height-y),    90R is: OutPix(y,x) = InPix(width-x,y),        The formulae for rotation by 90R and 90L listed above can't be implemented     in-place, in single looping through the image, and hence it is done in two     iterations (both in-place):      [1] The input is transformed according to the formulae OutPix(y,x) = InPix(x,y).    [2] Then we flip it along HORIZ axis (for 90L) and VERT axis (for 90R).    ---------------------------------------------------------------------------------    */    for(component = 0; component < 3; component++)    {        bufHeight = (component == 0) ? outHeightY : outHeightUV;        bufWidth  = (component == 0) ? outWidthY : outWidthUV;        if(rotation == OMX_IP_FLIP_HORIZONTAL)        {            armIPCS_FlipLeftRight_I(pDst[component], 1, dstStep[component], bufWidth, bufHeight);        }                else if(rotation == OMX_IP_FLIP_VERTICAL)        {            armIPCS_FlipTopBottom_I(pDst[component], 1, dstStep[component], bufWidth, bufHeight);        }                else if(rotation == OMX_IP_ROTATE180)        {            armIPCS_Rotate180_I(pDst[component], 1, dstStep[component], bufWidth, bufHeight);        }                else if(rotation == OMX_IP_ROTATE90L)        {            armIPCS_FlipMajorDiagonal_I(pDst[component], 1, dstStep[component], bufWidth, bufHeight);            armIPCS_FlipTopBottom_I(pDst[component], 1, dstStep[component], bufHeight, bufWidth);        }                else if(rotation == OMX_IP_ROTATE90R)        {            armIPCS_FlipMajorDiagonal_I(pDst[component], 1, dstStep[component], bufWidth, bufHeight);            armIPCS_FlipLeftRight_I(pDst[component], 1, dstStep[component], bufHeight, bufWidth);        }    }    return OMX_Sts_NoErr;}/* End of file */

⌨️ 快捷键说明

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