yuv2yuvX16_c_template(const int16_t *lumFilter, const int16_t **lumSrc,

                      int lumFilterSize, const int16_t *chrFilter,

                      const int16_t **chrUSrc, const int16_t **chrVSrc,

                      int chrFilterSize, const int16_t **alpSrc,

                      uint16_t *dest, uint16_t *uDest, uint16_t *vDest,

                      uint16_t *aDest, int dstW, int chrDstW,

                      int big_endian, int output_bits)

{

    //FIXME Optimize (just quickly written not optimized..)

    int i;

    int shift = 11 + 16 - output_bits;



#define output_pixel(pos, val) \

    if (big_endian) { \

        if (output_bits == 16) { \

            AV_WB16(pos, av_clip_uint16(val >> shift)); \

        } else { \

            AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits)); \

        } \

    } else { \

        if (output_bits == 16) { \

            AV_WL16(pos, av_clip_uint16(val >> shift)); \

        } else { \

            AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits)); \

        } \

    }

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

        int val = 1 << (26-output_bits);

        int j;



        for (j = 0; j < lumFilterSize; j++)

            val += lumSrc[j][i] * lumFilter[j];



        output_pixel(&dest[i], val);

    }



    if (uDest) {

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

            int u = 1 << (26-output_bits);

            int v = 1 << (26-output_bits);

            int j;



            for (j = 0; j < chrFilterSize; j++) {

                u += chrUSrc[j][i] * chrFilter[j];

                v += chrVSrc[j][i] * chrFilter[j];

            }



            output_pixel(&uDest[i], u);

            output_pixel(&vDest[i], v);

        }

    }



    if (CONFIG_SWSCALE_ALPHA && aDest) {

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

            int val = 1 << (26-output_bits);

            int j;



            for (j = 0; j < lumFilterSize; j++)

                val += alpSrc[j][i] * lumFilter[j];



            output_pixel(&aDest[i], val);

        }

    }

#undef output_pixel

}

yuv2yuvX16_c_template(const int16_t *lumFilter, const int16_t **lumSrc,

                      int lumFilterSize, const int16_t *chrFilter,

                      const int16_t **chrUSrc, const int16_t **chrVSrc,

                      int chrFilterSize, const int16_t **alpSrc,

                      uint16_t *dest, uint16_t *uDest, uint16_t *vDest,

                      uint16_t *aDest, int dstW, int chrDstW,

                      int big_endian, int output_bits)

{

    

    int i;

    int shift = 11 + 16 - output_bits;



#define output_pixel(pos, val) \

    if (big_endian) { \

        if (output_bits == 16) { \

            AV_WB16(pos, av_clip_uint16(val >> shift)); \

        } else { \

            AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits)); \

        } \

    } else { \

        if (output_bits == 16) { \

            AV_WL16(pos, av_clip_uint16(val >> shift)); \

        } else { \

            AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits)); \

        } \

    }

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

        int val = 1 << (26-output_bits);

        int j;



        for (j = 0; j < lumFilterSize; j++)

            val += lumSrc[j][i] * lumFilter[j];



        output_pixel(&dest[i], val);

    }



    if (uDest) {

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

            int u = 1 << (26-output_bits);

            int v = 1 << (26-output_bits);

            int j;



            for (j = 0; j < chrFilterSize; j++) {

                u += chrUSrc[j][i] * chrFilter[j];

                v += chrVSrc[j][i] * chrFilter[j];

            }



            output_pixel(&uDest[i], u);

            output_pixel(&vDest[i], v);

        }

    }



    if (CONFIG_SWSCALE_ALPHA && aDest) {

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

            int val = 1 << (26-output_bits);

            int j;



            for (j = 0; j < lumFilterSize; j++)

                val += alpSrc[j][i] * lumFilter[j];



            output_pixel(&aDest[i], val);

        }

    }

#undef output_pixel

}

FUNC_0(const int16_t *VAR_0, const int16_t **VAR_1,

                      int VAR_2, const int16_t *VAR_3,

                      const int16_t **VAR_4, const int16_t **VAR_5,

                      int VAR_6, const int16_t **VAR_7,

                      uint16_t *VAR_8, uint16_t *VAR_9, uint16_t *VAR_10,

                      uint16_t *VAR_11, int VAR_12, int VAR_13,

                      int VAR_14, int VAR_15)

{

    

    int VAR_16;

    int VAR_17 = 11 + 16 - VAR_15;



#define output_pixel(pos, VAR_22) \

    if (VAR_14) { \

        if (VAR_15 == 16) { \

            AV_WB16(pos, av_clip_uint16(VAR_22 >> VAR_17)); \

        } else { \

            AV_WB16(pos, av_clip_uintp2(VAR_22 >> VAR_17, VAR_15)); \

        } \

    } else { \

        if (VAR_15 == 16) { \

            AV_WL16(pos, av_clip_uint16(VAR_22 >> VAR_17)); \

        } else { \

            AV_WL16(pos, av_clip_uintp2(VAR_22 >> VAR_17, VAR_15)); \

        } \

    }

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

        int VAR_22 = 1 << (26-VAR_15);

        int VAR_22;



        for (VAR_22 = 0; VAR_22 < VAR_2; VAR_22++)

            VAR_22 += VAR_1[VAR_22][VAR_16] * VAR_0[VAR_22];



        output_pixel(&VAR_8[VAR_16], VAR_22);

    }



    if (VAR_9) {

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

            int VAR_20 = 1 << (26-VAR_15);

            int VAR_21 = 1 << (26-VAR_15);

            int VAR_22;



            for (VAR_22 = 0; VAR_22 < VAR_6; VAR_22++) {

                VAR_20 += VAR_4[VAR_22][VAR_16] * VAR_3[VAR_22];

                VAR_21 += VAR_5[VAR_22][VAR_16] * VAR_3[VAR_22];

            }



            output_pixel(&VAR_9[VAR_16], VAR_20);

            output_pixel(&VAR_10[VAR_16], VAR_21);

        }

    }



    if (CONFIG_SWSCALE_ALPHA && VAR_11) {

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

            int VAR_22 = 1 << (26-VAR_15);

            int VAR_22;



            for (VAR_22 = 0; VAR_22 < VAR_2; VAR_22++)

                VAR_22 += VAR_7[VAR_22][VAR_16] * VAR_0[VAR_22];



            output_pixel(&VAR_11[VAR_16], VAR_22);

        }

    }

#undef output_pixel

}

FUNC_0(const int16_t *VAR_0, const int16_t **VAR_1,
int VAR_2, const int16_t *VAR_3,
const int16_t **VAR_4, const int16_t **VAR_5,
int VAR_6, const int16_t **VAR_7,
uint16_t *VAR_8, uint16_t *VAR_9, uint16_t *VAR_10,
uint16_t *VAR_11, int VAR_12, int VAR_13,
int VAR_14, int VAR_15)
{ int VAR_16; int VAR_17 = 11 + 16 - VAR_15; #define output_pixel(pos, VAR_22) \
if (VAR_14) { \ if (VAR_15 == 16) { \ AV_WB16(pos, av_clip_uint16(VAR_22 >> VAR_17)); \ } else { \ AV_WB16(pos, av_clip_uintp2(VAR_22 >> VAR_17, VAR_15)); \ } \ } else { \ if (VAR_15 == 16) { \ AV_WL16(pos, av_clip_uint16(VAR_22 >> VAR_17)); \ } else { \ AV_WL16(pos, av_clip_uintp2(VAR_22 >> VAR_17, VAR_15)); \ } \ } for (VAR_16 = 0; VAR_16 < VAR_12; VAR_16++) { int VAR_22 = 1 << (26-VAR_15); int VAR_22; for (VAR_22 = 0; VAR_22 < VAR_2; VAR_22++) VAR_22 += VAR_1[VAR_22][VAR_16] * VAR_0[VAR_22]; output_pixel(&VAR_8[VAR_16], VAR_22); } if (VAR_9) { for (VAR_16 = 0; VAR_16 < VAR_13; VAR_16++) { int VAR_20 = 1 << (26-VAR_15); int VAR_21 = 1 << (26-VAR_15); int VAR_22; for (VAR_22 = 0; VAR_22 < VAR_6; VAR_22++) { VAR_20 += VAR_4[VAR_22][VAR_16] * VAR_3[VAR_22]; VAR_21 += VAR_5[VAR_22][VAR_16] * VAR_3[VAR_22]; } output_pixel(&VAR_9[VAR_16], VAR_20); output_pixel(&VAR_10[VAR_16], VAR_21); } } if (CONFIG_SWSCALE_ALPHA && VAR_11) { for (VAR_16 = 0; VAR_16 < VAR_12; VAR_16++) { int VAR_22 = 1 << (26-VAR_15); int VAR_22; for (VAR_22 = 0; VAR_22 < VAR_2; VAR_22++) VAR_22 += VAR_7[VAR_22][VAR_16] * VAR_0[VAR_22]; output_pixel(&VAR_11[VAR_16], VAR_22); } } #undef output_pixel
}