static int dnxhd_decode_frame(AVCodecContext *avctx, void *data,

                              int *got_frame, AVPacket *avpkt)

{

    const uint8_t *buf = avpkt->data;

    int buf_size = avpkt->size;

    DNXHDContext *ctx = avctx->priv_data;

    ThreadFrame frame = { .f = data };

    AVFrame *picture = data;

    int first_field = 1;

    int ret;



    ff_dlog(avctx, "frame size %d\n", buf_size);



decode_coding_unit:

    if ((ret = dnxhd_decode_header(ctx, picture, buf, buf_size, first_field)) < 0)

        return ret;



    if ((avctx->width || avctx->height) &&

        (ctx->width != avctx->width || ctx->height != avctx->height)) {

        av_log(avctx, AV_LOG_WARNING, "frame size changed: %dx%d -> %dx%d\n",

               avctx->width, avctx->height, ctx->width, ctx->height);

        first_field = 1;

    }

    if (avctx->pix_fmt != AV_PIX_FMT_NONE && avctx->pix_fmt != ctx->pix_fmt) {

        av_log(avctx, AV_LOG_WARNING, "pix_fmt changed: %s -> %s\n",

               av_get_pix_fmt_name(avctx->pix_fmt), av_get_pix_fmt_name(ctx->pix_fmt));

        first_field = 1;

    }



    avctx->pix_fmt = ctx->pix_fmt;

    ret = ff_set_dimensions(avctx, ctx->width, ctx->height);

    if (ret < 0)

        return ret;



    if (first_field) {

        if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)

            return ret;

        picture->pict_type = AV_PICTURE_TYPE_I;

        picture->key_frame = 1;

    }



    ctx->buf_size = buf_size - 0x280;

    ctx->buf = buf + 0x280;

    avctx->execute2(avctx, dnxhd_decode_row, picture, NULL, ctx->mb_height);



    if (first_field && picture->interlaced_frame) {

        buf      += ctx->cid_table->coding_unit_size;

        buf_size -= ctx->cid_table->coding_unit_size;

        first_field = 0;

        goto decode_coding_unit;

    }



    *got_frame = 1;

    return avpkt->size;

}

static int dnxhd_decode_frame(AVCodecContext *avctx, void *data,

                              int *got_frame, AVPacket *avpkt)

{

    const uint8_t *buf = avpkt->data;

    int buf_size = avpkt->size;

    DNXHDContext *ctx = avctx->priv_data;

    ThreadFrame frame = { .f = data };

    AVFrame *picture = data;

    int first_field = 1;

    int ret;



    ff_dlog(avctx, "frame size %d\n", buf_size);



decode_coding_unit:

    if ((ret = dnxhd_decode_header(ctx, picture, buf, buf_size, first_field)) < 0)

        return ret;



    if ((avctx->width || avctx->height) &&

        (ctx->width != avctx->width || ctx->height != avctx->height)) {

        av_log(avctx, AV_LOG_WARNING, "frame size changed: %dx%d -> %dx%d\n",

               avctx->width, avctx->height, ctx->width, ctx->height);

        first_field = 1;

    }

    if (avctx->pix_fmt != AV_PIX_FMT_NONE && avctx->pix_fmt != ctx->pix_fmt) {

        av_log(avctx, AV_LOG_WARNING, "pix_fmt changed: %s -> %s\n",

               av_get_pix_fmt_name(avctx->pix_fmt), av_get_pix_fmt_name(ctx->pix_fmt));

        first_field = 1;

    }



    avctx->pix_fmt = ctx->pix_fmt;

    ret = ff_set_dimensions(avctx, ctx->width, ctx->height);

    if (ret < 0)

        return ret;



    if (first_field) {

        if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)

            return ret;

        picture->pict_type = AV_PICTURE_TYPE_I;

        picture->key_frame = 1;

    }



    ctx->buf_size = buf_size - 0x280;

    ctx->buf = buf + 0x280;

    avctx->execute2(avctx, dnxhd_decode_row, picture, NULL, ctx->mb_height);



    if (first_field && picture->interlaced_frame) {

        buf      += ctx->cid_table->coding_unit_size;

        buf_size -= ctx->cid_table->coding_unit_size;

        first_field = 0;

        goto decode_coding_unit;

    }



    *got_frame = 1;

    return avpkt->size;

}

    int ret;
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,

                              int *VAR_2, AVPacket *VAR_3)

{

    const uint8_t *VAR_4 = VAR_3->VAR_1;

    int VAR_5 = VAR_3->size;

    DNXHDContext *ctx = VAR_0->priv_data;

    ThreadFrame frame = { .f = VAR_1 };

    AVFrame *picture = VAR_1;

    int VAR_6 = 1;

    int VAR_7;



    ff_dlog(VAR_0, "frame size %d\n", VAR_5);



decode_coding_unit:

    if ((VAR_7 = dnxhd_decode_header(ctx, picture, VAR_4, VAR_5, VAR_6)) < 0)

        return VAR_7;



    if ((VAR_0->width || VAR_0->height) &&

        (ctx->width != VAR_0->width || ctx->height != VAR_0->height)) {

        av_log(VAR_0, AV_LOG_WARNING, "frame size changed: %dx%d -> %dx%d\n",

               VAR_0->width, VAR_0->height, ctx->width, ctx->height);

        VAR_6 = 1;

    }

    if (VAR_0->pix_fmt != AV_PIX_FMT_NONE && VAR_0->pix_fmt != ctx->pix_fmt) {

        av_log(VAR_0, AV_LOG_WARNING, "pix_fmt changed: %s -> %s\n",

               av_get_pix_fmt_name(VAR_0->pix_fmt), av_get_pix_fmt_name(ctx->pix_fmt));

        VAR_6 = 1;

    }



    VAR_0->pix_fmt = ctx->pix_fmt;

    VAR_7 = ff_set_dimensions(VAR_0, ctx->width, ctx->height);

    if (VAR_7 < 0)

        return VAR_7;



    if (VAR_6) {

        if ((VAR_7 = ff_thread_get_buffer(VAR_0, &frame, 0)) < 0)

            return VAR_7;

        picture->pict_type = AV_PICTURE_TYPE_I;

        picture->key_frame = 1;

    }



    ctx->VAR_5 = VAR_5 - 0x280;

    ctx->VAR_4 = VAR_4 + 0x280;

    VAR_0->execute2(VAR_0, dnxhd_decode_row, picture, NULL, ctx->mb_height);



    if (VAR_6 && picture->interlaced_frame) {

        VAR_4      += ctx->cid_table->coding_unit_size;

        VAR_5 -= ctx->cid_table->coding_unit_size;

        VAR_6 = 0;

        goto decode_coding_unit;

    }



    *VAR_2 = 1;

    return VAR_3->size;

}

static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,
int *VAR_2, AVPacket *VAR_3)
{ const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; DNXHDContext *ctx = VAR_0->priv_data; ThreadFrame frame = { .f = VAR_1 }; AVFrame *picture = VAR_1; int VAR_6 = 1; int VAR_7; ff_dlog(VAR_0, "frame size %d\n", VAR_5); decode_coding_unit:
if ((VAR_7 = dnxhd_decode_header(ctx, picture, VAR_4, VAR_5, VAR_6)) < 0)
return VAR_7; if ((VAR_0->width || VAR_0->height) &&
(ctx->width != VAR_0->width || ctx->height != VAR_0->height)) { av_log(VAR_0, AV_LOG_WARNING, "frame size changed: %dx%d -> %dx%d\n",
VAR_0->width, VAR_0->height, ctx->width, ctx->height); VAR_6 = 1; } if (VAR_0->pix_fmt != AV_PIX_FMT_NONE && VAR_0->pix_fmt != ctx->pix_fmt) { av_log(VAR_0, AV_LOG_WARNING, "pix_fmt changed: %s -> %s\n",
av_get_pix_fmt_name(VAR_0->pix_fmt), av_get_pix_fmt_name(ctx->pix_fmt)); VAR_6 = 1; } VAR_0->pix_fmt = ctx->pix_fmt; VAR_7 = ff_set_dimensions(VAR_0, ctx->width, ctx->height); if (VAR_7 < 0)
return VAR_7; if (VAR_6) { if ((VAR_7 = ff_thread_get_buffer(VAR_0, &frame, 0)) < 0)
return VAR_7; picture->pict_type = AV_PICTURE_TYPE_I; picture->key_frame = 1; } ctx->VAR_5 = VAR_5 - 0x280; ctx->VAR_4 = VAR_4 + 0x280; VAR_0->execute2(VAR_0, dnxhd_decode_row, picture, NULL, ctx->mb_height); if (VAR_6 && picture->interlaced_frame) { VAR_4      += ctx->cid_table->coding_unit_size; VAR_5 -= ctx->cid_table->coding_unit_size; VAR_6 = 0; goto decode_coding_unit; } *VAR_2 = 1; return VAR_3->size; }