static int dxtory_decode_v1_420(AVCodecContext *avctx, AVFrame *pic,

                                const uint8_t *src, int src_size)

{

    int h, w;

    uint8_t *Y1, *Y2, *U, *V;

    int ret;



    if (src_size < avctx->width * avctx->height * 3LL / 2) {

        av_log(avctx, AV_LOG_ERROR, "packet too small\n");

        return AVERROR_INVALIDDATA;

    }



    avctx->pix_fmt = AV_PIX_FMT_YUV420P;

    if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)

        return ret;



    Y1 = pic->data[0];

    Y2 = pic->data[0] + pic->linesize[0];

    U  = pic->data[1];

    V  = pic->data[2];

    for (h = 0; h < avctx->height; h += 2) {

        for (w = 0; w < avctx->width; w += 2) {

            AV_COPY16(Y1 + w, src);

            AV_COPY16(Y2 + w, src + 2);

            U[w >> 1] = src[4] + 0x80;

            V[w >> 1] = src[5] + 0x80;

            src += 6;

        }

        Y1 += pic->linesize[0] << 1;

        Y2 += pic->linesize[0] << 1;

        U  += pic->linesize[1];

        V  += pic->linesize[2];

    }



    return 0;

}

static int dxtory_decode_v1_420(AVCodecContext *avctx, AVFrame *pic,

                                const uint8_t *src, int src_size)

{

    int h, w;

    uint8_t *Y1, *Y2, *U, *V;

    int ret;



    if (src_size < avctx->width * avctx->height * 3LL / 2) {

        av_log(avctx, AV_LOG_ERROR, "packet too small\n");

        return AVERROR_INVALIDDATA;

    }



    avctx->pix_fmt = AV_PIX_FMT_YUV420P;

    if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)

        return ret;



    Y1 = pic->data[0];

    Y2 = pic->data[0] + pic->linesize[0];

    U  = pic->data[1];

    V  = pic->data[2];

    for (h = 0; h < avctx->height; h += 2) {

        for (w = 0; w < avctx->width; w += 2) {

            AV_COPY16(Y1 + w, src);

            AV_COPY16(Y2 + w, src + 2);

            U[w >> 1] = src[4] + 0x80;

            V[w >> 1] = src[5] + 0x80;

            src += 6;

        }

        Y1 += pic->linesize[0] << 1;

        Y2 += pic->linesize[0] << 1;

        U  += pic->linesize[1];

        V  += pic->linesize[2];

    }



    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1,

                                const uint8_t *VAR_2, int VAR_3)

{

    int VAR_4, VAR_5;

    uint8_t *Y1, *Y2, *U, *V;

    int VAR_6;



    if (VAR_3 < VAR_0->width * VAR_0->height * 3LL / 2) {

        av_log(VAR_0, AV_LOG_ERROR, "packet too small\n");

        return AVERROR_INVALIDDATA;

    }



    VAR_0->pix_fmt = AV_PIX_FMT_YUV420P;

    if ((VAR_6 = ff_get_buffer(VAR_0, VAR_1, 0)) < 0)

        return VAR_6;



    Y1 = VAR_1->data[0];

    Y2 = VAR_1->data[0] + VAR_1->linesize[0];

    U  = VAR_1->data[1];

    V  = VAR_1->data[2];

    for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4 += 2) {

        for (VAR_5 = 0; VAR_5 < VAR_0->width; VAR_5 += 2) {

            AV_COPY16(Y1 + VAR_5, VAR_2);

            AV_COPY16(Y2 + VAR_5, VAR_2 + 2);

            U[VAR_5 >> 1] = VAR_2[4] + 0x80;

            V[VAR_5 >> 1] = VAR_2[5] + 0x80;

            VAR_2 += 6;

        }

        Y1 += VAR_1->linesize[0] << 1;

        Y2 += VAR_1->linesize[0] << 1;

        U  += VAR_1->linesize[1];

        V  += VAR_1->linesize[2];

    }



    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1,
const uint8_t *VAR_2, int VAR_3)
{ int VAR_4, VAR_5; uint8_t *Y1, *Y2, *U, *V; int VAR_6; if (VAR_3 < VAR_0->width * VAR_0->height * 3LL / 2) { av_log(VAR_0, AV_LOG_ERROR, "packet too small\n"); return AVERROR_INVALIDDATA; } VAR_0->pix_fmt = AV_PIX_FMT_YUV420P; if ((VAR_6 = ff_get_buffer(VAR_0, VAR_1, 0)) < 0)
return VAR_6; Y1 = VAR_1->data[0]; Y2 = VAR_1->data[0] + VAR_1->linesize[0]; U  = VAR_1->data[1]; V  = VAR_1->data[2]; for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4 += 2) { for (VAR_5 = 0; VAR_5 < VAR_0->width; VAR_5 += 2) { AV_COPY16(Y1 + VAR_5, VAR_2); AV_COPY16(Y2 + VAR_5, VAR_2 + 2); U[VAR_5 >> 1] = VAR_2[4] + 0x80; V[VAR_5 >> 1] = VAR_2[5] + 0x80; VAR_2 += 6; } Y1 += VAR_1->linesize[0] << 1; Y2 += VAR_1->linesize[0] << 1; U  += VAR_1->linesize[1]; V  += VAR_1->linesize[2]; } return 0; }