static void decode_plane(FFV1Context *s, uint8_t *src,

                         int w, int h, int stride, int plane_index,

                         int pixel_stride)

{

    int x, y;

    int16_t *sample[2];

    sample[0] = s->sample_buffer + 3;

    sample[1] = s->sample_buffer + w + 6 + 3;



    s->run_index = 0;



    memset(s->sample_buffer, 0, 2 * (w + 6) * sizeof(*s->sample_buffer));



    for (y = 0; y < h; y++) {

        int16_t *temp = sample[0]; // FIXME: try a normal buffer



        sample[0] = sample[1];

        sample[1] = temp;



        sample[1][-1] = sample[0][0];

        sample[0][w]  = sample[0][w - 1];



// { START_TIMER

        if (s->avctx->bits_per_raw_sample <= 8) {

            decode_line(s, w, sample, plane_index, 8);

            for (x = 0; x < w; x++)

                src[x*pixel_stride + stride * y] = sample[1][x];

        } else {

            decode_line(s, w, sample, plane_index, s->avctx->bits_per_raw_sample);

            if (s->packed_at_lsb) {

                for (x = 0; x < w; x++) {

                    ((uint16_t*)(src + stride*y))[x*pixel_stride] = sample[1][x];

                }

            } else {

                for (x = 0; x < w; x++) {

                    ((uint16_t*)(src + stride*y))[x*pixel_stride] = sample[1][x] << (16 - s->avctx->bits_per_raw_sample) | ((uint16_t **)sample)[1][x] >> (2 * s->avctx->bits_per_raw_sample - 16);

                }

            }

        }

// STOP_TIMER("decode-line") }

    }

}

static void decode_plane(FFV1Context *s, uint8_t *src,

                         int w, int h, int stride, int plane_index,

                         int pixel_stride)

{

    int x, y;

    int16_t *sample[2];

    sample[0] = s->sample_buffer + 3;

    sample[1] = s->sample_buffer + w + 6 + 3;



    s->run_index = 0;



    memset(s->sample_buffer, 0, 2 * (w + 6) * sizeof(*s->sample_buffer));



    for (y = 0; y < h; y++) {

        int16_t *temp = sample[0]; 



        sample[0] = sample[1];

        sample[1] = temp;



        sample[1][-1] = sample[0][0];

        sample[0][w]  = sample[0][w - 1];





        if (s->avctx->bits_per_raw_sample <= 8) {

            decode_line(s, w, sample, plane_index, 8);

            for (x = 0; x < w; x++)

                src[x*pixel_stride + stride * y] = sample[1][x];

        } else {

            decode_line(s, w, sample, plane_index, s->avctx->bits_per_raw_sample);

            if (s->packed_at_lsb) {

                for (x = 0; x < w; x++) {

                    ((uint16_t*)(src + stride*y))[x*pixel_stride] = sample[1][x];

                }

            } else {

                for (x = 0; x < w; x++) {

                    ((uint16_t*)(src + stride*y))[x*pixel_stride] = sample[1][x] << (16 - s->avctx->bits_per_raw_sample) | ((uint16_t **)sample)[1][x] >> (2 * s->avctx->bits_per_raw_sample - 16);

                }

            }

        }



    }

}

static void decode_plane(FFV1Context *s, uint8_t *src,             decode_line(s, w, sample, plane_index, 8);             decode_line(s, w, sample, plane_index, s->avctx->bits_per_raw_sample);
static void FUNC_0(FFV1Context *VAR_0, uint8_t *VAR_1,

                         int VAR_2, int VAR_3, int VAR_4, int VAR_5,

                         int VAR_6)

{

    int VAR_7, VAR_8;

    int16_t *sample[2];

    sample[0] = VAR_0->sample_buffer + 3;

    sample[1] = VAR_0->sample_buffer + VAR_2 + 6 + 3;



    VAR_0->run_index = 0;



    memset(VAR_0->sample_buffer, 0, 2 * (VAR_2 + 6) * sizeof(*VAR_0->sample_buffer));



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

        int16_t *temp = sample[0]; 



        sample[0] = sample[1];

        sample[1] = temp;



        sample[1][-1] = sample[0][0];

        sample[0][VAR_2]  = sample[0][VAR_2 - 1];





        if (VAR_0->avctx->bits_per_raw_sample <= 8) {

            decode_line(VAR_0, VAR_2, sample, VAR_5, 8);

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

                VAR_1[VAR_7*VAR_6 + VAR_4 * VAR_8] = sample[1][VAR_7];

        } else {

            decode_line(VAR_0, VAR_2, sample, VAR_5, VAR_0->avctx->bits_per_raw_sample);

            if (VAR_0->packed_at_lsb) {

                for (VAR_7 = 0; VAR_7 < VAR_2; VAR_7++) {

                    ((uint16_t*)(VAR_1 + VAR_4*VAR_8))[VAR_7*VAR_6] = sample[1][VAR_7];

                }

            } else {

                for (VAR_7 = 0; VAR_7 < VAR_2; VAR_7++) {

                    ((uint16_t*)(VAR_1 + VAR_4*VAR_8))[VAR_7*VAR_6] = sample[1][VAR_7] << (16 - VAR_0->avctx->bits_per_raw_sample) | ((uint16_t **)sample)[1][VAR_7] >> (2 * VAR_0->avctx->bits_per_raw_sample - 16);

                }

            }

        }



    }

}

static void FUNC_0(FFV1Context *VAR_0, uint8_t *VAR_1,
int VAR_2, int VAR_3, int VAR_4, int VAR_5,
int VAR_6)
{ int VAR_7, VAR_8; int16_t *sample[2]; sample[0] = VAR_0->sample_buffer + 3; sample[1] = VAR_0->sample_buffer + VAR_2 + 6 + 3; VAR_0->run_index = 0; memset(VAR_0->sample_buffer, 0, 2 * (VAR_2 + 6) * sizeof(*VAR_0->sample_buffer)); for (VAR_8 = 0; VAR_8 < VAR_3; VAR_8++) { int16_t *temp = sample[0]; sample[0] = sample[1]; sample[1] = temp; sample[1][-1] = sample[0][0]; sample[0][VAR_2]  = sample[0][VAR_2 - 1]; if (VAR_0->avctx->bits_per_raw_sample <= 8) { decode_line(VAR_0, VAR_2, sample, VAR_5, 8); for (VAR_7 = 0; VAR_7 < VAR_2; VAR_7++) VAR_1[VAR_7*VAR_6 + VAR_4 * VAR_8] = sample[1][VAR_7]; } else { decode_line(VAR_0, VAR_2, sample, VAR_5, VAR_0->avctx->bits_per_raw_sample); if (VAR_0->packed_at_lsb) { for (VAR_7 = 0; VAR_7 < VAR_2; VAR_7++) { ((uint16_t*)(VAR_1 + VAR_4*VAR_8))[VAR_7*VAR_6] = sample[1][VAR_7]; } } else { for (VAR_7 = 0; VAR_7 < VAR_2; VAR_7++) { ((uint16_t*)(VAR_1 + VAR_4*VAR_8))[VAR_7*VAR_6] = sample[1][VAR_7] << (16 - VAR_0->avctx->bits_per_raw_sample) | ((uint16_t **)sample)[1][VAR_7] >> (2 * VAR_0->avctx->bits_per_raw_sample - 16); } } } } }