static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output,

                             AVPacket *avpkt)

{

    int ret;

    HEVCContext *s = avctx->priv_data;



    if (!avpkt->size) {

        ret = ff_hevc_output_frame(s, data, 1);

        if (ret < 0)

            return ret;



        *got_output = ret;

        return 0;

    }



    s->ref = NULL;

    ret    = decode_nal_units(s, avpkt->data, avpkt->size);

    if (ret < 0)

        return ret;



    /* verify the SEI checksum */

    if (avctx->err_recognition & AV_EF_CRCCHECK && s->is_decoded &&

        avctx->err_recognition & AV_EF_EXPLODE &&

        s->is_md5) {

        ret = verify_md5(s, s->ref->frame);

        if (ret < 0) {

            ff_hevc_unref_frame(s, s->ref, ~0);

            return ret;

        }

    }

    s->is_md5 = 0;



    if (s->is_decoded) {

        av_log(avctx, AV_LOG_DEBUG, "Decoded frame with POC %d.\n", s->poc);

        s->is_decoded = 0;

    }



    if (s->output_frame->buf[0]) {

        av_frame_move_ref(data, s->output_frame);

        *got_output = 1;

    }



    return avpkt->size;

}

static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output,

                             AVPacket *avpkt)

{

    int ret;

    HEVCContext *s = avctx->priv_data;



    if (!avpkt->size) {

        ret = ff_hevc_output_frame(s, data, 1);

        if (ret < 0)

            return ret;



        *got_output = ret;

        return 0;

    }



    s->ref = NULL;

    ret    = decode_nal_units(s, avpkt->data, avpkt->size);

    if (ret < 0)

        return ret;



    

    if (avctx->err_recognition & AV_EF_CRCCHECK && s->is_decoded &&

        avctx->err_recognition & AV_EF_EXPLODE &&

        s->is_md5) {

        ret = verify_md5(s, s->ref->frame);

        if (ret < 0) {

            ff_hevc_unref_frame(s, s->ref, ~0);

            return ret;

        }

    }

    s->is_md5 = 0;



    if (s->is_decoded) {

        av_log(avctx, AV_LOG_DEBUG, "Decoded frame with POC %d.\n", s->poc);

        s->is_decoded = 0;

    }



    if (s->output_frame->buf[0]) {

        av_frame_move_ref(data, s->output_frame);

        *got_output = 1;

    }



    return avpkt->size;

}

static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2,

                             AVPacket *VAR_3)

{

    int VAR_4;

    HEVCContext *s = VAR_0->priv_data;



    if (!VAR_3->size) {

        VAR_4 = ff_hevc_output_frame(s, VAR_1, 1);

        if (VAR_4 < 0)

            return VAR_4;



        *VAR_2 = VAR_4;

        return 0;

    }



    s->ref = NULL;

    VAR_4    = decode_nal_units(s, VAR_3->VAR_1, VAR_3->size);

    if (VAR_4 < 0)

        return VAR_4;



    

    if (VAR_0->err_recognition & AV_EF_CRCCHECK && s->is_decoded &&

        VAR_0->err_recognition & AV_EF_EXPLODE &&

        s->is_md5) {

        VAR_4 = verify_md5(s, s->ref->frame);

        if (VAR_4 < 0) {

            ff_hevc_unref_frame(s, s->ref, ~0);

            return VAR_4;

        }

    }

    s->is_md5 = 0;



    if (s->is_decoded) {

        av_log(VAR_0, AV_LOG_DEBUG, "Decoded frame with POC %d.\n", s->poc);

        s->is_decoded = 0;

    }



    if (s->output_frame->buf[0]) {

        av_frame_move_ref(VAR_1, s->output_frame);

        *VAR_2 = 1;

    }



    return VAR_3->size;

}

static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2,
AVPacket *VAR_3)
{ int VAR_4; HEVCContext *s = VAR_0->priv_data; if (!VAR_3->size) { VAR_4 = ff_hevc_output_frame(s, VAR_1, 1); if (VAR_4 < 0)
return VAR_4; *VAR_2 = VAR_4; return 0; } s->ref = NULL; VAR_4    = decode_nal_units(s, VAR_3->VAR_1, VAR_3->size); if (VAR_4 < 0)
return VAR_4; if (VAR_0->err_recognition & AV_EF_CRCCHECK && s->is_decoded &&
VAR_0->err_recognition & AV_EF_EXPLODE &&
s->is_md5) { VAR_4 = verify_md5(s, s->ref->frame); if (VAR_4 < 0) { ff_hevc_unref_frame(s, s->ref, ~0); return VAR_4; } } s->is_md5 = 0; if (s->is_decoded) { av_log(VAR_0, AV_LOG_DEBUG, "Decoded frame with POC %d.\n", s->poc); s->is_decoded = 0; } if (s->output_frame->buf[0]) { av_frame_move_ref(VAR_1, s->output_frame); *VAR_2 = 1; } return VAR_3->size; }