static av_always_inline void rgb16_32ToUV_half_c_template(int16_t *dstU,

                                                          int16_t *dstV,

                                                          const uint8_t *src,

                                                          int width,

                                                          enum AVPixelFormat origin,

                                                          int shr, int shg,

                                                          int shb, int shp,

                                                          int maskr, int maskg,

                                                          int maskb, int rsh,

                                                          int gsh, int bsh, int S,

                                                          int32_t *rgb2yuv)

{

    const int ru       = rgb2yuv[RU_IDX] << rsh, gu = rgb2yuv[GU_IDX] << gsh, bu = rgb2yuv[BU_IDX] << bsh,

              rv       = rgb2yuv[RV_IDX] << rsh, gv = rgb2yuv[GV_IDX] << gsh, bv = rgb2yuv[BV_IDX] << bsh,

              maskgx   = ~(maskr | maskb);

    const unsigned rnd = (256U<<(S)) + (1<<(S-6));

    int i;



    maskr |= maskr << 1;

    maskb |= maskb << 1;

    maskg |= maskg << 1;

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

        int px0 = input_pixel(2 * i + 0) >> shp;

        int px1 = input_pixel(2 * i + 1) >> shp;

        int b, r, g = (px0 & maskgx) + (px1 & maskgx);

        int rb = px0 + px1 - g;



        b = (rb & maskb) >> shb;

        if (shp ||

            origin == AV_PIX_FMT_BGR565LE || origin == AV_PIX_FMT_BGR565BE ||

            origin == AV_PIX_FMT_RGB565LE || origin == AV_PIX_FMT_RGB565BE) {

            g >>= shg;

        } else {

            g = (g & maskg) >> shg;

        }

        r = (rb & maskr) >> shr;



        dstU[i] = (ru * r + gu * g + bu * b + (unsigned)rnd) >> ((S)-6+1);

        dstV[i] = (rv * r + gv * g + bv * b + (unsigned)rnd) >> ((S)-6+1);

    }

}

static av_always_inline void rgb16_32ToUV_half_c_template(int16_t *dstU,

                                                          int16_t *dstV,

                                                          const uint8_t *src,

                                                          int width,

                                                          enum AVPixelFormat origin,

                                                          int shr, int shg,

                                                          int shb, int shp,

                                                          int maskr, int maskg,

                                                          int maskb, int rsh,

                                                          int gsh, int bsh, int S,

                                                          int32_t *rgb2yuv)

{

    const int ru       = rgb2yuv[RU_IDX] << rsh, gu = rgb2yuv[GU_IDX] << gsh, bu = rgb2yuv[BU_IDX] << bsh,

              rv       = rgb2yuv[RV_IDX] << rsh, gv = rgb2yuv[GV_IDX] << gsh, bv = rgb2yuv[BV_IDX] << bsh,

              maskgx   = ~(maskr | maskb);

    const unsigned rnd = (256U<<(S)) + (1<<(S-6));

    int i;



    maskr |= maskr << 1;

    maskb |= maskb << 1;

    maskg |= maskg << 1;

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

        int px0 = input_pixel(2 * i + 0) >> shp;

        int px1 = input_pixel(2 * i + 1) >> shp;

        int b, r, g = (px0 & maskgx) + (px1 & maskgx);

        int rb = px0 + px1 - g;



        b = (rb & maskb) >> shb;

        if (shp ||

            origin == AV_PIX_FMT_BGR565LE || origin == AV_PIX_FMT_BGR565BE ||

            origin == AV_PIX_FMT_RGB565LE || origin == AV_PIX_FMT_RGB565BE) {

            g >>= shg;

        } else {

            g = (g & maskg) >> shg;

        }

        r = (rb & maskr) >> shr;



        dstU[i] = (ru * r + gu * g + bu * b + (unsigned)rnd) >> ((S)-6+1);

        dstV[i] = (rv * r + gv * g + bv * b + (unsigned)rnd) >> ((S)-6+1);

    }

}

        int px0 = input_pixel(2 * i + 0) >> shp;         int px1 = input_pixel(2 * i + 1) >> shp;
static av_always_inline void FUNC_0(int16_t *dstU,

                                                          int16_t *dstV,

                                                          const uint8_t *src,

                                                          int width,

                                                          enum AVPixelFormat origin,

                                                          int shr, int shg,

                                                          int shb, int shp,

                                                          int maskr, int maskg,

                                                          int maskb, int rsh,

                                                          int gsh, int bsh, int S,

                                                          int32_t *rgb2yuv)

{

    const int VAR_0       = rgb2yuv[RU_IDX] << rsh, VAR_1 = rgb2yuv[GU_IDX] << gsh, VAR_2 = rgb2yuv[BU_IDX] << bsh,

              VAR_3       = rgb2yuv[RV_IDX] << rsh, VAR_4 = rgb2yuv[GV_IDX] << gsh, VAR_5 = rgb2yuv[BV_IDX] << bsh,

              VAR_6   = ~(maskr | maskb);

    const unsigned VAR_7 = (256U<<(S)) + (1<<(S-6));

    int VAR_8;



    maskr |= maskr << 1;

    maskb |= maskb << 1;

    maskg |= maskg << 1;

    for (VAR_8 = 0; VAR_8 < width; VAR_8++) {

        int VAR_9 = input_pixel(2 * VAR_8 + 0) >> shp;

        int VAR_10 = input_pixel(2 * VAR_8 + 1) >> shp;

        int VAR_11, VAR_12, VAR_13 = (VAR_9 & VAR_6) + (VAR_10 & VAR_6);

        int VAR_14 = VAR_9 + VAR_10 - VAR_13;



        VAR_11 = (VAR_14 & maskb) >> shb;

        if (shp ||

            origin == AV_PIX_FMT_BGR565LE || origin == AV_PIX_FMT_BGR565BE ||

            origin == AV_PIX_FMT_RGB565LE || origin == AV_PIX_FMT_RGB565BE) {

            VAR_13 >>= shg;

        } else {

            VAR_13 = (VAR_13 & maskg) >> shg;

        }

        VAR_12 = (VAR_14 & maskr) >> shr;



        dstU[VAR_8] = (VAR_0 * VAR_12 + VAR_1 * VAR_13 + VAR_2 * VAR_11 + (unsigned)VAR_7) >> ((S)-6+1);

        dstV[VAR_8] = (VAR_3 * VAR_12 + VAR_4 * VAR_13 + VAR_5 * VAR_11 + (unsigned)VAR_7) >> ((S)-6+1);

    }

}

static av_always_inline void FUNC_0(int16_t *dstU,
int16_t *dstV,
const uint8_t *src,
int width,
enum AVPixelFormat origin,
int shr, int shg,
int shb, int shp,
int maskr, int maskg,
int maskb, int rsh,
int gsh, int bsh, int S,
int32_t *rgb2yuv)
{ const int VAR_0       = rgb2yuv[RU_IDX] << rsh, VAR_1 = rgb2yuv[GU_IDX] << gsh, VAR_2 = rgb2yuv[BU_IDX] << bsh,
VAR_3       = rgb2yuv[RV_IDX] << rsh, VAR_4 = rgb2yuv[GV_IDX] << gsh, VAR_5 = rgb2yuv[BV_IDX] << bsh,
VAR_6   = ~(maskr | maskb); const unsigned VAR_7 = (256U<<(S)) + (1<<(S-6)); int VAR_8; maskr |= maskr << 1; maskb |= maskb << 1; maskg |= maskg << 1; for (VAR_8 = 0; VAR_8 < width; VAR_8++) { int VAR_9 = input_pixel(2 * VAR_8 + 0) >> shp; int VAR_10 = input_pixel(2 * VAR_8 + 1) >> shp; int VAR_11, VAR_12, VAR_13 = (VAR_9 & VAR_6) + (VAR_10 & VAR_6); int VAR_14 = VAR_9 + VAR_10 - VAR_13; VAR_11 = (VAR_14 & maskb) >> shb; if (shp ||
origin == AV_PIX_FMT_BGR565LE || origin == AV_PIX_FMT_BGR565BE ||
origin == AV_PIX_FMT_RGB565LE || origin == AV_PIX_FMT_RGB565BE) { VAR_13 >>= shg; } else { VAR_13 = (VAR_13 & maskg) >> shg; } VAR_12 = (VAR_14 & maskr) >> shr; dstU[VAR_8] = (VAR_0 * VAR_12 + VAR_1 * VAR_13 + VAR_2 * VAR_11 + (unsigned)VAR_7) >> ((S)-6+1); dstV[VAR_8] = (VAR_3 * VAR_12 + VAR_4 * VAR_13 + VAR_5 * VAR_11 + (unsigned)VAR_7) >> ((S)-6+1); } }