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

📄 omxipcs_cbycry422rszcscrotbgr_u8_u16_c2r.c

📁 The OpenMAX DL (Development Layer) APIs contain a comprehensive set of audio, video, signal processi
💻 C
📖 第 1 页 / 共 2 页
字号:
    |Y21 U21 Y22 V21|Y23 U22 Y24 V22|Y25 U23 Y26 V23|Y27 U24 Y28 V24|...    ----------------------------------------------------------------    |Y31 U31 Y32 V31|Y33 U32 Y34 V32|Y35 U33 Y36 V33|Y37 U34 Y38 V34|...    ----------------------------------------------------------------    |Y41 U41 Y42 V41|Y43 U42 Y44 V42|Y45 U43 Y46 V43|Y47 U44 Y48 V44|...    ----------------------------------------------------------------                                ||                                ||                                \/                      -------------------------                      |Yout1 Uout1|Yout2 Vout1|                      -------------------------        Yout1 = Interpolate(Y11, Y12, Y21, Y22)    Uout1 = Interpolate(U11, U21)    Yout2 = Interpolate(Y15, Y16, Y25, Y26)    Vout1 = Interpolate(V11, V21)            Colour Space Conversion:    CSC is clubbed with scale reduction and hence doesn't have to be done in-place.    A function armIPCS_ColourConvertAndPack() is called, after reading the scaled     input pixels. This function calls the relevant macros to perform YUV422->RGB    conversion and then pixel packing (BGR565 or BGR555).    ------------------------------------------------------------------------------    */        pRefSrcU        = pSrc;    pRefSrcY        = pSrc+ 1;    pRefSrcV        = pSrc + 2;    srcRowSkipY     = scaleFactor * srcStep;    srcRowSkipUV    = scaleFactor * srcStep;    srcPixSkipY     = scaleFactor * 2;    srcPixSkipUV    = scaleFactor * 4;    outBufWidth     = (OMX_INT)((OMX_F32)roiSize.width/scaleFactor);    /* measured in pixels */    outBufHeight    = (OMX_INT)((OMX_F32)roiSize.height/scaleFactor);        if((rotation == OMX_IP_ROTATE90L) || (rotation == OMX_IP_ROTATE90R))    {        dstPixSkip  = dstStep >> 1;        dstRowSkip  = 1;    }    else    {        dstPixSkip  = 1;        dstRowSkip  = dstStep >> 1;    }        if(interpolation == OMX_IP_NEAREST)    {        for(i = 0; i < outBufHeight; i++)        {            pSrcY   = pRefSrcY + (srcRowSkipY * i);            pSrcU   = pRefSrcU + (srcRowSkipUV * i);            pSrcV   = pRefSrcV + (srcRowSkipUV * i);            pDstRGB = (OMX_U16 *)pDst + (dstRowSkip * i);                        for(j = 0; j < outBufWidth; j += 2)            {                Y0data  = *pSrcY;   pSrcY += srcPixSkipY;                Udata   = *pSrcU;   pSrcU += srcPixSkipUV;                Y1data  = *pSrcY;   pSrcY += srcPixSkipY;                Vdata   = *pSrcV;   pSrcV += srcPixSkipUV;                                armIPCS_ColourConvertAndPack(Y0data, Udata, Vdata, colorConversion, pDstRGB);                pDstRGB += dstPixSkip;                armIPCS_ColourConvertAndPack(Y1data, Udata, Vdata, colorConversion, pDstRGB);                pDstRGB += dstPixSkip;            }        }    }        else if(interpolation == OMX_IP_BILINEAR)    {        for(i = 0; i < outBufHeight; i++)        {            pSrcY   = pRefSrcY + (srcRowSkipY * i);            pSrcU   = pRefSrcU + (srcRowSkipUV * i);            pSrcV   = pRefSrcV + (srcRowSkipUV * i);            pDstRGB = (OMX_U16 *)pDst  + (dstRowSkip * i);                        for(j = 0; j < outBufWidth; j += 2)            {                tempPix16   = armRoundFloatToS16((pSrcY[0] + pSrcY[2] + pSrcY[srcStep] + pSrcY[srcStep+2])/(OMX_F32)4);                Y0data      = (OMX_U8)armClip(OMX_MIN_U8, OMX_MAX_U8, tempPix16);                pSrcY       += srcPixSkipY;                                tempPix16   = armRoundFloatToS16((pSrcU[0] + pSrcU[srcStep])/(OMX_F32)2);                Udata       = (OMX_U8)armClip(OMX_MIN_U8, OMX_MAX_U8, tempPix16);                pSrcU       += srcPixSkipUV;                                tempPix16   = armRoundFloatToS16((pSrcY[0] + pSrcY[2] + pSrcY[srcStep] + pSrcY[srcStep+2])/(OMX_F32)4);                Y1data      = (OMX_U8)armClip(OMX_MIN_U8, OMX_MAX_U8, tempPix16);                pSrcY       += srcPixSkipY;                                tempPix16   = armRoundFloatToS16((pSrcV[0] + pSrcV[srcStep])/(OMX_F32)2);                Vdata       = (OMX_U8)armClip(OMX_MIN_U8, OMX_MAX_U8, tempPix16);                pSrcV       += srcPixSkipUV;                                armIPCS_ColourConvertAndPack(Y0data, Udata, Vdata, colorConversion, pDstRGB);                pDstRGB += dstPixSkip;                armIPCS_ColourConvertAndPack(Y1data, Udata, Vdata, colorConversion, pDstRGB);                pDstRGB += dstPixSkip;            }        }    }    /*    ---------------------------------------------------------------------------------    Rotation:    The Rotation operation follows the Resize-CSC 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 elegantly, in single looping through the image, and hence it is done    in two iterations (both of which can be done in-place, easily):    [1] The input is transformed according to the formulae OutPix(y,x) = InPix(x,y).        This is equivalent to flipping the image along the major diagonal and is         already performed during the Resize-Csc phase.    [2] Then we flip it along HORIZ axis (for 90L) and VERT axis (for 90R).    ---------------------------------------------------------------------------------    */        switch(rotation)    {        case OMX_IP_FLIP_HORIZONTAL : armIPCS_FlipLeftRight_I(pDst, 2, dstStep, outBufWidth, outBufHeight);                                      break;        case OMX_IP_FLIP_VERTICAL   : armIPCS_FlipTopBottom_I(pDst, 2, dstStep, outBufWidth, outBufHeight);                                      break;        case OMX_IP_ROTATE180       : armIPCS_Rotate180_I(pDst, 2, dstStep, outBufWidth, outBufHeight);                                      break;        case OMX_IP_ROTATE90L       : armIPCS_FlipTopBottom_I(pDst, 2, dstStep, outBufHeight, outBufWidth);                                      break;        case OMX_IP_ROTATE90R       : armIPCS_FlipLeftRight_I(pDst, 2, dstStep, outBufHeight, outBufWidth);                                      break;        default                     : break;    }    return OMX_Sts_NoErr;}/** * Function: armIPCS_ColourConvertAndPack * * Description: * This is a utility function used only by omxIPCS_CbYCrY422RszCscRotBGR_U8_U16_C2R(). * It converts a pixel from YCbCr representation to an RGB variant (BGR565 or BGR555), * based on the <colorConversion> parameter and stores the result in <pDstRGB>. * * Return Value: * OMXVoid */static OMXVoid armIPCS_ColourConvertAndPack(OMX_U8 Ydata, OMX_U8 Udata, OMX_U8 Vdata, OMXIPColorSpace colorConversion, OMX_U16 *pDstRGB){    OMX_F32  Rdata, Gdata, Bdata;        armIPCS_ComputeRGBFromYUV_F32(Ydata, Udata, Vdata, &Rdata, &Gdata, &Bdata);        if(colorConversion == OMX_IP_BGR565)    {        *pDstRGB  = armIPCS_PackToBGR565_F32(Bdata, Gdata, Rdata);    }    else    {        *pDstRGB  = armIPCS_PackToRGB555_F32(Bdata, Gdata, Rdata);    }}            /* End of file */

⌨️ 快捷键说明

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