static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[],

                           int srcSliceY, int srcSliceH, uint8_t *dst[],

                           int dstStride[])

{

    const enum PixelFormat srcFormat = c->srcFormat;

    const enum PixelFormat dstFormat = c->dstFormat;

    const int srcBpp = (c->srcFormatBpp + 7) >> 3;

    const int dstBpp = (c->dstFormatBpp + 7) >> 3;

    const int srcId = c->srcFormatBpp;

    const int dstId = c->dstFormatBpp;

    void (*conv)(const uint8_t *src, uint8_t *dst, int src_size) = NULL;



#define CONV_IS(src, dst) (srcFormat == PIX_FMT_##src && dstFormat == PIX_FMT_##dst)



    if (isRGBA32(srcFormat) && isRGBA32(dstFormat)) {

        if (     CONV_IS(ABGR, RGBA)

              || CONV_IS(ARGB, BGRA)

              || CONV_IS(BGRA, ARGB)

              || CONV_IS(RGBA, ABGR)) conv = shuffle_bytes_3210;

        else if (CONV_IS(ABGR, ARGB)

              || CONV_IS(ARGB, ABGR)) conv = shuffle_bytes_0321;

        else if (CONV_IS(ABGR, BGRA)

              || CONV_IS(ARGB, RGBA)) conv = shuffle_bytes_1230;

        else if (CONV_IS(BGRA, RGBA)

              || CONV_IS(RGBA, BGRA)) conv = shuffle_bytes_2103;

        else if (CONV_IS(BGRA, ABGR)

              || CONV_IS(RGBA, ARGB)) conv = shuffle_bytes_3012;

    } else

    /* BGR -> BGR */

    if ((isBGRinInt(srcFormat) && isBGRinInt(dstFormat)) ||

        (isRGBinInt(srcFormat) && isRGBinInt(dstFormat))) {

        switch (srcId | (dstId << 16)) {

        case 0x000F0010: conv = rgb16to15; break;

        case 0x000F0018: conv = rgb24to15; break;

        case 0x000F0020: conv = rgb32to15; break;

        case 0x0010000F: conv = rgb15to16; break;

        case 0x00100018: conv = rgb24to16; break;

        case 0x00100020: conv = rgb32to16; break;

        case 0x0018000F: conv = rgb15to24; break;

        case 0x00180010: conv = rgb16to24; break;

        case 0x00180020: conv = rgb32to24; break;

        case 0x0020000F: conv = rgb15to32; break;

        case 0x00200010: conv = rgb16to32; break;

        case 0x00200018: conv = rgb24to32; break;

        }

    } else if ((isBGRinInt(srcFormat) && isRGBinInt(dstFormat)) ||

               (isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) {

        switch (srcId | (dstId << 16)) {

        case 0x000C000C: conv = rgb12tobgr12; break;

        case 0x000F000F: conv = rgb15tobgr15; break;

        case 0x000F0010: conv = rgb16tobgr15; break;

        case 0x000F0018: conv = rgb24tobgr15; break;

        case 0x000F0020: conv = rgb32tobgr15; break;

        case 0x0010000F: conv = rgb15tobgr16; break;

        case 0x00100010: conv = rgb16tobgr16; break;

        case 0x00100018: conv = rgb24tobgr16; break;

        case 0x00100020: conv = rgb32tobgr16; break;

        case 0x0018000F: conv = rgb15tobgr24; break;

        case 0x00180010: conv = rgb16tobgr24; break;

        case 0x00180018: conv = rgb24tobgr24; break;

        case 0x00180020: conv = rgb32tobgr24; break;

        case 0x0020000F: conv = rgb15tobgr32; break;

        case 0x00200010: conv = rgb16tobgr32; break;

        case 0x00200018: conv = rgb24tobgr32; break;

        }

    }



    if (!conv) {

        av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n",

               sws_format_name(srcFormat), sws_format_name(dstFormat));

    } else {

        const uint8_t *srcPtr = src[0];

              uint8_t *dstPtr = dst[0];

        if ((srcFormat == PIX_FMT_RGB32_1 || srcFormat == PIX_FMT_BGR32_1) &&

            !isRGBA32(dstFormat))

            srcPtr += ALT32_CORR;



        if ((dstFormat == PIX_FMT_RGB32_1 || dstFormat == PIX_FMT_BGR32_1) &&

            !isRGBA32(srcFormat))

            dstPtr += ALT32_CORR;



        if (dstStride[0] * srcBpp == srcStride[0] * dstBpp && srcStride[0] > 0 &&

            !(srcStride[0] % srcBpp))

            conv(srcPtr, dstPtr + dstStride[0] * srcSliceY,

                 srcSliceH * srcStride[0]);

        else {

            int i;

            dstPtr += dstStride[0] * srcSliceY;



            for (i = 0; i < srcSliceH; i++) {

                conv(srcPtr, dstPtr, c->srcW * srcBpp);

                srcPtr += srcStride[0];

                dstPtr += dstStride[0];

            }

        }

    }

    return srcSliceH;

}

static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[],

                           int srcSliceY, int srcSliceH, uint8_t *dst[],

                           int dstStride[])

{

    const enum PixelFormat srcFormat = c->srcFormat;

    const enum PixelFormat dstFormat = c->dstFormat;

    const int srcBpp = (c->srcFormatBpp + 7) >> 3;

    const int dstBpp = (c->dstFormatBpp + 7) >> 3;

    const int srcId = c->srcFormatBpp;

    const int dstId = c->dstFormatBpp;

    void (*conv)(const uint8_t *src, uint8_t *dst, int src_size) = NULL;



#define CONV_IS(src, dst) (srcFormat == PIX_FMT_##src && dstFormat == PIX_FMT_##dst)



    if (isRGBA32(srcFormat) && isRGBA32(dstFormat)) {

        if (     CONV_IS(ABGR, RGBA)

              || CONV_IS(ARGB, BGRA)

              || CONV_IS(BGRA, ARGB)

              || CONV_IS(RGBA, ABGR)) conv = shuffle_bytes_3210;

        else if (CONV_IS(ABGR, ARGB)

              || CONV_IS(ARGB, ABGR)) conv = shuffle_bytes_0321;

        else if (CONV_IS(ABGR, BGRA)

              || CONV_IS(ARGB, RGBA)) conv = shuffle_bytes_1230;

        else if (CONV_IS(BGRA, RGBA)

              || CONV_IS(RGBA, BGRA)) conv = shuffle_bytes_2103;

        else if (CONV_IS(BGRA, ABGR)

              || CONV_IS(RGBA, ARGB)) conv = shuffle_bytes_3012;

    } else

    

    if ((isBGRinInt(srcFormat) && isBGRinInt(dstFormat)) ||

        (isRGBinInt(srcFormat) && isRGBinInt(dstFormat))) {

        switch (srcId | (dstId << 16)) {

        case 0x000F0010: conv = rgb16to15; break;

        case 0x000F0018: conv = rgb24to15; break;

        case 0x000F0020: conv = rgb32to15; break;

        case 0x0010000F: conv = rgb15to16; break;

        case 0x00100018: conv = rgb24to16; break;

        case 0x00100020: conv = rgb32to16; break;

        case 0x0018000F: conv = rgb15to24; break;

        case 0x00180010: conv = rgb16to24; break;

        case 0x00180020: conv = rgb32to24; break;

        case 0x0020000F: conv = rgb15to32; break;

        case 0x00200010: conv = rgb16to32; break;

        case 0x00200018: conv = rgb24to32; break;

        }

    } else if ((isBGRinInt(srcFormat) && isRGBinInt(dstFormat)) ||

               (isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) {

        switch (srcId | (dstId << 16)) {

        case 0x000C000C: conv = rgb12tobgr12; break;

        case 0x000F000F: conv = rgb15tobgr15; break;

        case 0x000F0010: conv = rgb16tobgr15; break;

        case 0x000F0018: conv = rgb24tobgr15; break;

        case 0x000F0020: conv = rgb32tobgr15; break;

        case 0x0010000F: conv = rgb15tobgr16; break;

        case 0x00100010: conv = rgb16tobgr16; break;

        case 0x00100018: conv = rgb24tobgr16; break;

        case 0x00100020: conv = rgb32tobgr16; break;

        case 0x0018000F: conv = rgb15tobgr24; break;

        case 0x00180010: conv = rgb16tobgr24; break;

        case 0x00180018: conv = rgb24tobgr24; break;

        case 0x00180020: conv = rgb32tobgr24; break;

        case 0x0020000F: conv = rgb15tobgr32; break;

        case 0x00200010: conv = rgb16tobgr32; break;

        case 0x00200018: conv = rgb24tobgr32; break;

        }

    }



    if (!conv) {

        av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n",

               sws_format_name(srcFormat), sws_format_name(dstFormat));

    } else {

        const uint8_t *srcPtr = src[0];

              uint8_t *dstPtr = dst[0];

        if ((srcFormat == PIX_FMT_RGB32_1 || srcFormat == PIX_FMT_BGR32_1) &&

            !isRGBA32(dstFormat))

            srcPtr += ALT32_CORR;



        if ((dstFormat == PIX_FMT_RGB32_1 || dstFormat == PIX_FMT_BGR32_1) &&

            !isRGBA32(srcFormat))

            dstPtr += ALT32_CORR;



        if (dstStride[0] * srcBpp == srcStride[0] * dstBpp && srcStride[0] > 0 &&

            !(srcStride[0] % srcBpp))

            conv(srcPtr, dstPtr + dstStride[0] * srcSliceY,

                 srcSliceH * srcStride[0]);

        else {

            int i;

            dstPtr += dstStride[0] * srcSliceY;



            for (i = 0; i < srcSliceH; i++) {

                conv(srcPtr, dstPtr, c->srcW * srcBpp);

                srcPtr += srcStride[0];

                dstPtr += dstStride[0];

            }

        }

    }

    return srcSliceH;

}

static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[],                            int srcSliceY, int srcSliceH, uint8_t *dst[],                            int dstStride[])     const int srcBpp = (c->srcFormatBpp + 7) >> 3;     const int dstBpp = (c->dstFormatBpp + 7) >> 3;     void (*conv)(const uint8_t *src, uint8_t *dst, int src_size) = NULL;
static int FUNC_0(SwsContext *VAR_0, const uint8_t *VAR_14[], int VAR_2[],

                           int VAR_3, int VAR_4, uint8_t *VAR_14[],

                           int VAR_6[])

{

    const enum PixelFormat VAR_7 = VAR_0->VAR_7;

    const enum PixelFormat VAR_8 = VAR_0->VAR_8;

    const int VAR_9 = (VAR_0->srcFormatBpp + 7) >> 3;

    const int VAR_10 = (VAR_0->dstFormatBpp + 7) >> 3;

    const int VAR_11 = VAR_0->srcFormatBpp;

    const int VAR_12 = VAR_0->dstFormatBpp;

    void (*VAR_13)(const uint8_t *VAR_14, uint8_t *VAR_14, int VAR_14) = NULL;



#define CONV_IS(VAR_14, VAR_14) (VAR_7 == PIX_FMT_##VAR_14 && VAR_8 == PIX_FMT_##VAR_14)



    if (isRGBA32(VAR_7) && isRGBA32(VAR_8)) {

        if (     CONV_IS(ABGR, RGBA)

              || CONV_IS(ARGB, BGRA)

              || CONV_IS(BGRA, ARGB)

              || CONV_IS(RGBA, ABGR)) VAR_13 = shuffle_bytes_3210;

        else if (CONV_IS(ABGR, ARGB)

              || CONV_IS(ARGB, ABGR)) VAR_13 = shuffle_bytes_0321;

        else if (CONV_IS(ABGR, BGRA)

              || CONV_IS(ARGB, RGBA)) VAR_13 = shuffle_bytes_1230;

        else if (CONV_IS(BGRA, RGBA)

              || CONV_IS(RGBA, BGRA)) VAR_13 = shuffle_bytes_2103;

        else if (CONV_IS(BGRA, ABGR)

              || CONV_IS(RGBA, ARGB)) VAR_13 = shuffle_bytes_3012;

    } else

    

    if ((isBGRinInt(VAR_7) && isBGRinInt(VAR_8)) ||

        (isRGBinInt(VAR_7) && isRGBinInt(VAR_8))) {

        switch (VAR_11 | (VAR_12 << 16)) {

        case 0x000F0010: VAR_13 = rgb16to15; break;

        case 0x000F0018: VAR_13 = rgb24to15; break;

        case 0x000F0020: VAR_13 = rgb32to15; break;

        case 0x0010000F: VAR_13 = rgb15to16; break;

        case 0x00100018: VAR_13 = rgb24to16; break;

        case 0x00100020: VAR_13 = rgb32to16; break;

        case 0x0018000F: VAR_13 = rgb15to24; break;

        case 0x00180010: VAR_13 = rgb16to24; break;

        case 0x00180020: VAR_13 = rgb32to24; break;

        case 0x0020000F: VAR_13 = rgb15to32; break;

        case 0x00200010: VAR_13 = rgb16to32; break;

        case 0x00200018: VAR_13 = rgb24to32; break;

        }

    } else if ((isBGRinInt(VAR_7) && isRGBinInt(VAR_8)) ||

               (isRGBinInt(VAR_7) && isBGRinInt(VAR_8))) {

        switch (VAR_11 | (VAR_12 << 16)) {

        case 0x000C000C: VAR_13 = rgb12tobgr12; break;

        case 0x000F000F: VAR_13 = rgb15tobgr15; break;

        case 0x000F0010: VAR_13 = rgb16tobgr15; break;

        case 0x000F0018: VAR_13 = rgb24tobgr15; break;

        case 0x000F0020: VAR_13 = rgb32tobgr15; break;

        case 0x0010000F: VAR_13 = rgb15tobgr16; break;

        case 0x00100010: VAR_13 = rgb16tobgr16; break;

        case 0x00100018: VAR_13 = rgb24tobgr16; break;

        case 0x00100020: VAR_13 = rgb32tobgr16; break;

        case 0x0018000F: VAR_13 = rgb15tobgr24; break;

        case 0x00180010: VAR_13 = rgb16tobgr24; break;

        case 0x00180018: VAR_13 = rgb24tobgr24; break;

        case 0x00180020: VAR_13 = rgb32tobgr24; break;

        case 0x0020000F: VAR_13 = rgb15tobgr32; break;

        case 0x00200010: VAR_13 = rgb16tobgr32; break;

        case 0x00200018: VAR_13 = rgb24tobgr32; break;

        }

    }



    if (!VAR_13) {

        av_log(VAR_0, AV_LOG_ERROR, "internal error %s -> %s converter\n",

               sws_format_name(VAR_7), sws_format_name(VAR_8));

    } else {

        const uint8_t *VAR_15 = VAR_14[0];

              uint8_t *dstPtr = VAR_14[0];

        if ((VAR_7 == PIX_FMT_RGB32_1 || VAR_7 == PIX_FMT_BGR32_1) &&

            !isRGBA32(VAR_8))

            VAR_15 += ALT32_CORR;



        if ((VAR_8 == PIX_FMT_RGB32_1 || VAR_8 == PIX_FMT_BGR32_1) &&

            !isRGBA32(VAR_7))

            dstPtr += ALT32_CORR;



        if (VAR_6[0] * VAR_9 == VAR_2[0] * VAR_10 && VAR_2[0] > 0 &&

            !(VAR_2[0] % VAR_9))

            VAR_13(VAR_15, dstPtr + VAR_6[0] * VAR_3,

                 VAR_4 * VAR_2[0]);

        else {

            int VAR_16;

            dstPtr += VAR_6[0] * VAR_3;



            for (VAR_16 = 0; VAR_16 < VAR_4; VAR_16++) {

                VAR_13(VAR_15, dstPtr, VAR_0->srcW * VAR_9);

                VAR_15 += VAR_2[0];

                dstPtr += VAR_6[0];

            }

        }

    }

    return VAR_4;

}

static int FUNC_0(SwsContext *VAR_0, const uint8_t *VAR_14[], int VAR_2[],
int VAR_3, int VAR_4, uint8_t *VAR_14[],
int VAR_6[])
{ const enum PixelFormat VAR_7 = VAR_0->VAR_7; const enum PixelFormat VAR_8 = VAR_0->VAR_8; const int VAR_9 = (VAR_0->srcFormatBpp + 7) >> 3; const int VAR_10 = (VAR_0->dstFormatBpp + 7) >> 3; const int VAR_11 = VAR_0->srcFormatBpp; const int VAR_12 = VAR_0->dstFormatBpp; void (*VAR_13)(const uint8_t *VAR_14, uint8_t *VAR_14, int VAR_14) = NULL; #define CONV_IS(VAR_14, VAR_14) (VAR_7 == PIX_FMT_##VAR_14 && VAR_8 == PIX_FMT_##VAR_14)
if (isRGBA32(VAR_7) && isRGBA32(VAR_8)) { if (     CONV_IS(ABGR, RGBA)
|| CONV_IS(ARGB, BGRA)
|| CONV_IS(BGRA, ARGB)
|| CONV_IS(RGBA, ABGR)) VAR_13 = shuffle_bytes_3210; else if (CONV_IS(ABGR, ARGB)
|| CONV_IS(ARGB, ABGR)) VAR_13 = shuffle_bytes_0321; else if (CONV_IS(ABGR, BGRA)
|| CONV_IS(ARGB, RGBA)) VAR_13 = shuffle_bytes_1230; else if (CONV_IS(BGRA, RGBA)
|| CONV_IS(RGBA, BGRA)) VAR_13 = shuffle_bytes_2103; else if (CONV_IS(BGRA, ABGR)
|| CONV_IS(RGBA, ARGB)) VAR_13 = shuffle_bytes_3012; } else if ((isBGRinInt(VAR_7) && isBGRinInt(VAR_8)) ||
(isRGBinInt(VAR_7) && isRGBinInt(VAR_8))) { switch (VAR_11 | (VAR_12 << 16)) { case 0x000F0010: VAR_13 = rgb16to15; break; case 0x000F0018: VAR_13 = rgb24to15; break; case 0x000F0020: VAR_13 = rgb32to15; break; case 0x0010000F: VAR_13 = rgb15to16; break; case 0x00100018: VAR_13 = rgb24to16; break; case 0x00100020: VAR_13 = rgb32to16; break; case 0x0018000F: VAR_13 = rgb15to24; break; case 0x00180010: VAR_13 = rgb16to24; break; case 0x00180020: VAR_13 = rgb32to24; break; case 0x0020000F: VAR_13 = rgb15to32; break; case 0x00200010: VAR_13 = rgb16to32; break; case 0x00200018: VAR_13 = rgb24to32; break; } } else if ((isBGRinInt(VAR_7) && isRGBinInt(VAR_8)) || (isRGBinInt(VAR_7) && isBGRinInt(VAR_8))) { switch (VAR_11 | (VAR_12 << 16)) { case 0x000C000C: VAR_13 = rgb12tobgr12; break; case 0x000F000F: VAR_13 = rgb15tobgr15; break; case 0x000F0010: VAR_13 = rgb16tobgr15; break; case 0x000F0018: VAR_13 = rgb24tobgr15; break; case 0x000F0020: VAR_13 = rgb32tobgr15; break; case 0x0010000F: VAR_13 = rgb15tobgr16; break; case 0x00100010: VAR_13 = rgb16tobgr16; break; case 0x00100018: VAR_13 = rgb24tobgr16; break; case 0x00100020: VAR_13 = rgb32tobgr16; break; case 0x0018000F: VAR_13 = rgb15tobgr24; break; case 0x00180010: VAR_13 = rgb16tobgr24; break; case 0x00180018: VAR_13 = rgb24tobgr24; break; case 0x00180020: VAR_13 = rgb32tobgr24; break; case 0x0020000F: VAR_13 = rgb15tobgr32; break; case 0x00200010: VAR_13 = rgb16tobgr32; break; case 0x00200018: VAR_13 = rgb24tobgr32; break; } } if (!VAR_13) { av_log(VAR_0, AV_LOG_ERROR, "internal error %s -> %s converter\n",
sws_format_name(VAR_7), sws_format_name(VAR_8)); } else { const uint8_t *VAR_15 = VAR_14[0]; uint8_t *dstPtr = VAR_14[0]; if ((VAR_7 == PIX_FMT_RGB32_1 || VAR_7 == PIX_FMT_BGR32_1) &&
!isRGBA32(VAR_8))
VAR_15 += ALT32_CORR; if ((VAR_8 == PIX_FMT_RGB32_1 || VAR_8 == PIX_FMT_BGR32_1) &&
!isRGBA32(VAR_7))
dstPtr += ALT32_CORR; if (VAR_6[0] * VAR_9 == VAR_2[0] * VAR_10 && VAR_2[0] > 0 &&
!(VAR_2[0] % VAR_9))
VAR_13(VAR_15, dstPtr + VAR_6[0] * VAR_3,
VAR_4 * VAR_2[0]); else { int VAR_16; dstPtr += VAR_6[0] * VAR_3; for (VAR_16 = 0; VAR_16 < VAR_4; VAR_16++) { VAR_13(VAR_15, dstPtr, VAR_0->srcW * VAR_9); VAR_15 += VAR_2[0]; dstPtr += VAR_6[0]; } } } return VAR_4; }