static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *got_frame)

{

    DiracFrame *out = s->delay_frames[0];

    int i, out_idx  = 0;

    int ret;



    /* find frame with lowest picture number */

    for (i = 1; s->delay_frames[i]; i++)

        if (s->delay_frames[i]->avframe->display_picture_number < out->avframe->display_picture_number) {

            out     = s->delay_frames[i];

            out_idx = i;

        }



    for (i = out_idx; s->delay_frames[i]; i++)

        s->delay_frames[i] = s->delay_frames[i+1];



    if (out) {

        out->reference ^= DELAYED_PIC_REF;

        *got_frame = 1;

        if((ret = av_frame_ref(picture, out->avframe)) < 0)

            return ret;

    }



    return 0;

}

static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *got_frame)

{

    DiracFrame *out = s->delay_frames[0];

    int i, out_idx  = 0;

    int ret;



    

    for (i = 1; s->delay_frames[i]; i++)

        if (s->delay_frames[i]->avframe->display_picture_number < out->avframe->display_picture_number) {

            out     = s->delay_frames[i];

            out_idx = i;

        }



    for (i = out_idx; s->delay_frames[i]; i++)

        s->delay_frames[i] = s->delay_frames[i+1];



    if (out) {

        out->reference ^= DELAYED_PIC_REF;

        *got_frame = 1;

        if((ret = av_frame_ref(picture, out->avframe)) < 0)

            return ret;

    }



    return 0;

}

        *got_frame = 1;
static int FUNC_0(DiracContext *VAR_0, AVFrame *VAR_1, int *VAR_2)

{

    DiracFrame *out = VAR_0->delay_frames[0];

    int VAR_3, VAR_4  = 0;

    int VAR_5;



    

    for (VAR_3 = 1; VAR_0->delay_frames[VAR_3]; VAR_3++)

        if (VAR_0->delay_frames[VAR_3]->avframe->display_picture_number < out->avframe->display_picture_number) {

            out     = VAR_0->delay_frames[VAR_3];

            VAR_4 = VAR_3;

        }



    for (VAR_3 = VAR_4; VAR_0->delay_frames[VAR_3]; VAR_3++)

        VAR_0->delay_frames[VAR_3] = VAR_0->delay_frames[VAR_3+1];



    if (out) {

        out->reference ^= DELAYED_PIC_REF;

        *VAR_2 = 1;

        if((VAR_5 = av_frame_ref(VAR_1, out->avframe)) < 0)

            return VAR_5;

    }



    return 0;

}

static int FUNC_0(DiracContext *VAR_0, AVFrame *VAR_1, int *VAR_2)
{ DiracFrame *out = VAR_0->delay_frames[0]; int VAR_3, VAR_4  = 0; int VAR_5; for (VAR_3 = 1; VAR_0->delay_frames[VAR_3]; VAR_3++) if (VAR_0->delay_frames[VAR_3]->avframe->display_picture_number < out->avframe->display_picture_number) { out     = VAR_0->delay_frames[VAR_3]; VAR_4 = VAR_3; } for (VAR_3 = VAR_4; VAR_0->delay_frames[VAR_3]; VAR_3++) VAR_0->delay_frames[VAR_3] = VAR_0->delay_frames[VAR_3+1]; if (out) { out->reference ^= DELAYED_PIC_REF; *VAR_2 = 1; if((VAR_5 = av_frame_ref(VAR_1, out->avframe)) < 0)
return VAR_5; } return 0; }