static void pack_yuv(TiffEncoderContext * s, uint8_t * dst, int lnum)

{

    AVFrame *p = &s->picture;

    int i, j, k;

    int w = (s->width - 1) / s->subsampling[0] + 1;

    uint8_t *pu = &p->data[1][lnum / s->subsampling[1] * p->linesize[1]];

    uint8_t *pv = &p->data[2][lnum / s->subsampling[1] * p->linesize[2]];

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

        for (j = 0; j < s->subsampling[1]; j++)

            for (k = 0; k < s->subsampling[0]; k++)

                *dst++ = p->data[0][(lnum + j) * p->linesize[0] +

                                    i * s->subsampling[0] + k];

        *dst++ = *pu++;

        *dst++ = *pv++;

    }

}

static void pack_yuv(TiffEncoderContext * s, uint8_t * dst, int lnum)

{

    AVFrame *p = &s->picture;

    int i, j, k;

    int w = (s->width - 1) / s->subsampling[0] + 1;

    uint8_t *pu = &p->data[1][lnum / s->subsampling[1] * p->linesize[1]];

    uint8_t *pv = &p->data[2][lnum / s->subsampling[1] * p->linesize[2]];

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

        for (j = 0; j < s->subsampling[1]; j++)

            for (k = 0; k < s->subsampling[0]; k++)

                *dst++ = p->data[0][(lnum + j) * p->linesize[0] +

                                    i * s->subsampling[0] + k];

        *dst++ = *pu++;

        *dst++ = *pv++;

    }

}

static void FUNC_0(TiffEncoderContext * VAR_0, uint8_t * VAR_1, int VAR_2)

{

    AVFrame *p = &VAR_0->picture;

    int VAR_3, VAR_4, VAR_5;

    int VAR_6 = (VAR_0->width - 1) / VAR_0->subsampling[0] + 1;

    uint8_t *pu = &p->data[1][VAR_2 / VAR_0->subsampling[1] * p->linesize[1]];

    uint8_t *pv = &p->data[2][VAR_2 / VAR_0->subsampling[1] * p->linesize[2]];

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

        for (VAR_4 = 0; VAR_4 < VAR_0->subsampling[1]; VAR_4++)

            for (VAR_5 = 0; VAR_5 < VAR_0->subsampling[0]; VAR_5++)

                *VAR_1++ = p->data[0][(VAR_2 + VAR_4) * p->linesize[0] +

                                    VAR_3 * VAR_0->subsampling[0] + VAR_5];

        *VAR_1++ = *pu++;

        *VAR_1++ = *pv++;

    }

}

static void FUNC_0(TiffEncoderContext * VAR_0, uint8_t * VAR_1, int VAR_2)
{ AVFrame *p = &VAR_0->picture; int VAR_3, VAR_4, VAR_5; int VAR_6 = (VAR_0->width - 1) / VAR_0->subsampling[0] + 1; uint8_t *pu = &p->data[1][VAR_2 / VAR_0->subsampling[1] * p->linesize[1]]; uint8_t *pv = &p->data[2][VAR_2 / VAR_0->subsampling[1] * p->linesize[2]]; for (VAR_3 = 0; VAR_3 < VAR_6; VAR_3++){ for (VAR_4 = 0; VAR_4 < VAR_0->subsampling[1]; VAR_4++) for (VAR_5 = 0; VAR_5 < VAR_0->subsampling[0]; VAR_5++) *VAR_1++ = p->data[0][(VAR_2 + VAR_4) * p->linesize[0] +
VAR_3 * VAR_0->subsampling[0] + VAR_5]; *VAR_1++ = *pu++; *VAR_1++ = *pv++; } }