static void rgb24_to_yuvj420p(AVPicture *dst, AVPicture *src,

                              int width, int height)

{

    int wrap, wrap3, width2;

    int r, g, b, r1, g1, b1, w;

    uint8_t *lum, *cb, *cr;

    const uint8_t *p;



    lum = dst->data[0];

    cb = dst->data[1];

    cr = dst->data[2];



    width2 = (width + 1) >> 1;

    wrap = dst->linesize[0];

    wrap3 = src->linesize[0];

    p = src->data[0];

    for(;height>=2;height -= 2) {

        for(w = width; w >= 2; w -= 2) {

            RGB_IN(r, g, b, p);

            r1 = r;

            g1 = g;

            b1 = b;

            lum[0] = RGB_TO_Y(r, g, b);



            RGB_IN(r, g, b, p + BPP);

            r1 += r;

            g1 += g;

            b1 += b;

            lum[1] = RGB_TO_Y(r, g, b);

            p += wrap3;

            lum += wrap;



            RGB_IN(r, g, b, p);

            r1 += r;

            g1 += g;

            b1 += b;

            lum[0] = RGB_TO_Y(r, g, b);



            RGB_IN(r, g, b, p + BPP);

            r1 += r;

            g1 += g;

            b1 += b;

            lum[1] = RGB_TO_Y(r, g, b);



            cb[0] = RGB_TO_U(r1, g1, b1, 2);

            cr[0] = RGB_TO_V(r1, g1, b1, 2);



            cb++;

            cr++;

            p += -wrap3 + 2 * BPP;

            lum += -wrap + 2;

        }

        if (w) {

            RGB_IN(r, g, b, p);

            r1 = r;

            g1 = g;

            b1 = b;

            lum[0] = RGB_TO_Y(r, g, b);

            p += wrap3;

            lum += wrap;

            RGB_IN(r, g, b, p);

            r1 += r;

            g1 += g;

            b1 += b;

            lum[0] = RGB_TO_Y(r, g, b);

            cb[0] = RGB_TO_U(r1, g1, b1, 1);

            cr[0] = RGB_TO_V(r1, g1, b1, 1);

            cb++;

            cr++;

            p += -wrap3 + BPP;

            lum += -wrap + 1;

        }

        p += wrap3 + (wrap3 - width * BPP);

        lum += wrap + (wrap - width);

        cb += dst->linesize[1] - width2;

        cr += dst->linesize[2] - width2;

    }

    /* handle odd height */

    if (height) {

        for(w = width; w >= 2; w -= 2) {

            RGB_IN(r, g, b, p);

            r1 = r;

            g1 = g;

            b1 = b;

            lum[0] = RGB_TO_Y(r, g, b);



            RGB_IN(r, g, b, p + BPP);

            r1 += r;

            g1 += g;

            b1 += b;

            lum[1] = RGB_TO_Y(r, g, b);

            cb[0] = RGB_TO_U(r1, g1, b1, 1);

            cr[0] = RGB_TO_V(r1, g1, b1, 1);

            cb++;

            cr++;

            p += 2 * BPP;

           lum += 2;

        }

        if (w) {

            RGB_IN(r, g, b, p);

            lum[0] = RGB_TO_Y(r, g, b);

            cb[0] = RGB_TO_U(r, g, b, 0);

            cr[0] = RGB_TO_V(r, g, b, 0);

        }

    }

}

static void rgb24_to_yuvj420p(AVPicture *dst, AVPicture *src,

                              int width, int height)

{

    int wrap, wrap3, width2;

    int r, g, b, r1, g1, b1, w;

    uint8_t *lum, *cb, *cr;

    const uint8_t *p;



    lum = dst->data[0];

    cb = dst->data[1];

    cr = dst->data[2];



    width2 = (width + 1) >> 1;

    wrap = dst->linesize[0];

    wrap3 = src->linesize[0];

    p = src->data[0];

    for(;height>=2;height -= 2) {

        for(w = width; w >= 2; w -= 2) {

            RGB_IN(r, g, b, p);

            r1 = r;

            g1 = g;

            b1 = b;

            lum[0] = RGB_TO_Y(r, g, b);



            RGB_IN(r, g, b, p + BPP);

            r1 += r;

            g1 += g;

            b1 += b;

            lum[1] = RGB_TO_Y(r, g, b);

            p += wrap3;

            lum += wrap;



            RGB_IN(r, g, b, p);

            r1 += r;

            g1 += g;

            b1 += b;

            lum[0] = RGB_TO_Y(r, g, b);



            RGB_IN(r, g, b, p + BPP);

            r1 += r;

            g1 += g;

            b1 += b;

            lum[1] = RGB_TO_Y(r, g, b);



            cb[0] = RGB_TO_U(r1, g1, b1, 2);

            cr[0] = RGB_TO_V(r1, g1, b1, 2);



            cb++;

            cr++;

            p += -wrap3 + 2 * BPP;

            lum += -wrap + 2;

        }

        if (w) {

            RGB_IN(r, g, b, p);

            r1 = r;

            g1 = g;

            b1 = b;

            lum[0] = RGB_TO_Y(r, g, b);

            p += wrap3;

            lum += wrap;

            RGB_IN(r, g, b, p);

            r1 += r;

            g1 += g;

            b1 += b;

            lum[0] = RGB_TO_Y(r, g, b);

            cb[0] = RGB_TO_U(r1, g1, b1, 1);

            cr[0] = RGB_TO_V(r1, g1, b1, 1);

            cb++;

            cr++;

            p += -wrap3 + BPP;

            lum += -wrap + 1;

        }

        p += wrap3 + (wrap3 - width * BPP);

        lum += wrap + (wrap - width);

        cb += dst->linesize[1] - width2;

        cr += dst->linesize[2] - width2;

    }

    

    if (height) {

        for(w = width; w >= 2; w -= 2) {

            RGB_IN(r, g, b, p);

            r1 = r;

            g1 = g;

            b1 = b;

            lum[0] = RGB_TO_Y(r, g, b);



            RGB_IN(r, g, b, p + BPP);

            r1 += r;

            g1 += g;

            b1 += b;

            lum[1] = RGB_TO_Y(r, g, b);

            cb[0] = RGB_TO_U(r1, g1, b1, 1);

            cr[0] = RGB_TO_V(r1, g1, b1, 1);

            cb++;

            cr++;

            p += 2 * BPP;

           lum += 2;

        }

        if (w) {

            RGB_IN(r, g, b, p);

            lum[0] = RGB_TO_Y(r, g, b);

            cb[0] = RGB_TO_U(r, g, b, 0);

            cr[0] = RGB_TO_V(r, g, b, 0);

        }

    }

}

static void FUNC_0(AVPicture *VAR_0, AVPicture *VAR_1,

                              int VAR_2, int VAR_3)

{

    int VAR_4, VAR_5, VAR_6;

    int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13;

    uint8_t *lum, *cb, *cr;

    const uint8_t *VAR_14;



    lum = VAR_0->data[0];

    cb = VAR_0->data[1];

    cr = VAR_0->data[2];



    VAR_6 = (VAR_2 + 1) >> 1;

    VAR_4 = VAR_0->linesize[0];

    VAR_5 = VAR_1->linesize[0];

    VAR_14 = VAR_1->data[0];

    for(;VAR_3>=2;VAR_3 -= 2) {

        for(VAR_13 = VAR_2; VAR_13 >= 2; VAR_13 -= 2) {

            RGB_IN(VAR_7, VAR_8, VAR_9, VAR_14);

            VAR_10 = VAR_7;

            VAR_11 = VAR_8;

            VAR_12 = VAR_9;

            lum[0] = RGB_TO_Y(VAR_7, VAR_8, VAR_9);



            RGB_IN(VAR_7, VAR_8, VAR_9, VAR_14 + BPP);

            VAR_10 += VAR_7;

            VAR_11 += VAR_8;

            VAR_12 += VAR_9;

            lum[1] = RGB_TO_Y(VAR_7, VAR_8, VAR_9);

            VAR_14 += VAR_5;

            lum += VAR_4;



            RGB_IN(VAR_7, VAR_8, VAR_9, VAR_14);

            VAR_10 += VAR_7;

            VAR_11 += VAR_8;

            VAR_12 += VAR_9;

            lum[0] = RGB_TO_Y(VAR_7, VAR_8, VAR_9);



            RGB_IN(VAR_7, VAR_8, VAR_9, VAR_14 + BPP);

            VAR_10 += VAR_7;

            VAR_11 += VAR_8;

            VAR_12 += VAR_9;

            lum[1] = RGB_TO_Y(VAR_7, VAR_8, VAR_9);



            cb[0] = RGB_TO_U(VAR_10, VAR_11, VAR_12, 2);

            cr[0] = RGB_TO_V(VAR_10, VAR_11, VAR_12, 2);



            cb++;

            cr++;

            VAR_14 += -VAR_5 + 2 * BPP;

            lum += -VAR_4 + 2;

        }

        if (VAR_13) {

            RGB_IN(VAR_7, VAR_8, VAR_9, VAR_14);

            VAR_10 = VAR_7;

            VAR_11 = VAR_8;

            VAR_12 = VAR_9;

            lum[0] = RGB_TO_Y(VAR_7, VAR_8, VAR_9);

            VAR_14 += VAR_5;

            lum += VAR_4;

            RGB_IN(VAR_7, VAR_8, VAR_9, VAR_14);

            VAR_10 += VAR_7;

            VAR_11 += VAR_8;

            VAR_12 += VAR_9;

            lum[0] = RGB_TO_Y(VAR_7, VAR_8, VAR_9);

            cb[0] = RGB_TO_U(VAR_10, VAR_11, VAR_12, 1);

            cr[0] = RGB_TO_V(VAR_10, VAR_11, VAR_12, 1);

            cb++;

            cr++;

            VAR_14 += -VAR_5 + BPP;

            lum += -VAR_4 + 1;

        }

        VAR_14 += VAR_5 + (VAR_5 - VAR_2 * BPP);

        lum += VAR_4 + (VAR_4 - VAR_2);

        cb += VAR_0->linesize[1] - VAR_6;

        cr += VAR_0->linesize[2] - VAR_6;

    }

    

    if (VAR_3) {

        for(VAR_13 = VAR_2; VAR_13 >= 2; VAR_13 -= 2) {

            RGB_IN(VAR_7, VAR_8, VAR_9, VAR_14);

            VAR_10 = VAR_7;

            VAR_11 = VAR_8;

            VAR_12 = VAR_9;

            lum[0] = RGB_TO_Y(VAR_7, VAR_8, VAR_9);



            RGB_IN(VAR_7, VAR_8, VAR_9, VAR_14 + BPP);

            VAR_10 += VAR_7;

            VAR_11 += VAR_8;

            VAR_12 += VAR_9;

            lum[1] = RGB_TO_Y(VAR_7, VAR_8, VAR_9);

            cb[0] = RGB_TO_U(VAR_10, VAR_11, VAR_12, 1);

            cr[0] = RGB_TO_V(VAR_10, VAR_11, VAR_12, 1);

            cb++;

            cr++;

            VAR_14 += 2 * BPP;

           lum += 2;

        }

        if (VAR_13) {

            RGB_IN(VAR_7, VAR_8, VAR_9, VAR_14);

            lum[0] = RGB_TO_Y(VAR_7, VAR_8, VAR_9);

            cb[0] = RGB_TO_U(VAR_7, VAR_8, VAR_9, 0);

            cr[0] = RGB_TO_V(VAR_7, VAR_8, VAR_9, 0);

        }

    }

}

static void FUNC_0(AVPicture *VAR_0, AVPicture *VAR_1,
int VAR_2, int VAR_3)
{ int VAR_4, VAR_5, VAR_6; int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13; uint8_t *lum, *cb, *cr; const uint8_t *VAR_14; lum = VAR_0->data[0]; cb = VAR_0->data[1]; cr = VAR_0->data[2]; VAR_6 = (VAR_2 + 1) >> 1; VAR_4 = VAR_0->linesize[0]; VAR_5 = VAR_1->linesize[0]; VAR_14 = VAR_1->data[0]; for(;VAR_3>=2;VAR_3 -= 2) { for(VAR_13 = VAR_2; VAR_13 >= 2; VAR_13 -= 2) { RGB_IN(VAR_7, VAR_8, VAR_9, VAR_14); VAR_10 = VAR_7; VAR_11 = VAR_8; VAR_12 = VAR_9; lum[0] = RGB_TO_Y(VAR_7, VAR_8, VAR_9); RGB_IN(VAR_7, VAR_8, VAR_9, VAR_14 + BPP); VAR_10 += VAR_7; VAR_11 += VAR_8; VAR_12 += VAR_9; lum[1] = RGB_TO_Y(VAR_7, VAR_8, VAR_9); VAR_14 += VAR_5; lum += VAR_4; RGB_IN(VAR_7, VAR_8, VAR_9, VAR_14); VAR_10 += VAR_7; VAR_11 += VAR_8; VAR_12 += VAR_9; lum[0] = RGB_TO_Y(VAR_7, VAR_8, VAR_9); RGB_IN(VAR_7, VAR_8, VAR_9, VAR_14 + BPP); VAR_10 += VAR_7; VAR_11 += VAR_8; VAR_12 += VAR_9; lum[1] = RGB_TO_Y(VAR_7, VAR_8, VAR_9); cb[0] = RGB_TO_U(VAR_10, VAR_11, VAR_12, 2); cr[0] = RGB_TO_V(VAR_10, VAR_11, VAR_12, 2); cb++; cr++; VAR_14 += -VAR_5 + 2 * BPP; lum += -VAR_4 + 2; } if (VAR_13) { RGB_IN(VAR_7, VAR_8, VAR_9, VAR_14); VAR_10 = VAR_7; VAR_11 = VAR_8; VAR_12 = VAR_9; lum[0] = RGB_TO_Y(VAR_7, VAR_8, VAR_9); VAR_14 += VAR_5; lum += VAR_4; RGB_IN(VAR_7, VAR_8, VAR_9, VAR_14); VAR_10 += VAR_7; VAR_11 += VAR_8; VAR_12 += VAR_9; lum[0] = RGB_TO_Y(VAR_7, VAR_8, VAR_9); cb[0] = RGB_TO_U(VAR_10, VAR_11, VAR_12, 1); cr[0] = RGB_TO_V(VAR_10, VAR_11, VAR_12, 1); cb++; cr++; VAR_14 += -VAR_5 + BPP; lum += -VAR_4 + 1; } VAR_14 += VAR_5 + (VAR_5 - VAR_2 * BPP); lum += VAR_4 + (VAR_4 - VAR_2); cb += VAR_0->linesize[1] - VAR_6; cr += VAR_0->linesize[2] - VAR_6; } if (VAR_3) { for(VAR_13 = VAR_2; VAR_13 >= 2; VAR_13 -= 2) { RGB_IN(VAR_7, VAR_8, VAR_9, VAR_14); VAR_10 = VAR_7; VAR_11 = VAR_8; VAR_12 = VAR_9; lum[0] = RGB_TO_Y(VAR_7, VAR_8, VAR_9); RGB_IN(VAR_7, VAR_8, VAR_9, VAR_14 + BPP); VAR_10 += VAR_7; VAR_11 += VAR_8; VAR_12 += VAR_9; lum[1] = RGB_TO_Y(VAR_7, VAR_8, VAR_9); cb[0] = RGB_TO_U(VAR_10, VAR_11, VAR_12, 1); cr[0] = RGB_TO_V(VAR_10, VAR_11, VAR_12, 1); cb++; cr++; VAR_14 += 2 * BPP; lum += 2; } if (VAR_13) { RGB_IN(VAR_7, VAR_8, VAR_9, VAR_14); lum[0] = RGB_TO_Y(VAR_7, VAR_8, VAR_9); cb[0] = RGB_TO_U(VAR_7, VAR_8, VAR_9, 0); cr[0] = RGB_TO_V(VAR_7, VAR_8, VAR_9, 0); } } }