void ff_MPV_frame_end(MpegEncContext *s)

{

    int i;

    /* redraw edges for the frame if decoding didn't complete */

    // just to make sure that all data is rendered.

    if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) {

        ff_xvmc_field_end(s);

   } else if((s->error_count || s->encoding || !(s->avctx->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) &&

              !s->avctx->hwaccel &&

              !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&

              s->unrestricted_mv &&

              s->current_picture.f.reference &&

              !s->intra_only &&

              !(s->flags & CODEC_FLAG_EMU_EDGE)) {

        int hshift = av_pix_fmt_descriptors[s->avctx->pix_fmt].log2_chroma_w;

        int vshift = av_pix_fmt_descriptors[s->avctx->pix_fmt].log2_chroma_h;

        s->dsp.draw_edges(s->current_picture.f.data[0], s->current_picture.f.linesize[0],

                          s->h_edge_pos, s->v_edge_pos,

                          EDGE_WIDTH, EDGE_WIDTH,

                          EDGE_TOP | EDGE_BOTTOM);

        s->dsp.draw_edges(s->current_picture.f.data[1], s->current_picture.f.linesize[1],

                          s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,

                          EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,

                          EDGE_TOP | EDGE_BOTTOM);

        s->dsp.draw_edges(s->current_picture.f.data[2], s->current_picture.f.linesize[2],

                          s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,

                          EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,

                          EDGE_TOP | EDGE_BOTTOM);

    }



    emms_c();



    s->last_pict_type                 = s->pict_type;

    s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f.quality;

    if (s->pict_type!= AV_PICTURE_TYPE_B) {

        s->last_non_b_pict_type = s->pict_type;

    }

#if 0

    /* copy back current_picture variables */

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

        if (s->picture[i].f.data[0] == s->current_picture.f.data[0]) {

            s->picture[i] = s->current_picture;

            break;

        }

    }

    assert(i < MAX_PICTURE_COUNT);

#endif



    if (s->encoding) {

        /* release non-reference frames */

        for (i = 0; i < s->picture_count; i++) {

            if (s->picture[i].f.data[0] && !s->picture[i].f.reference

                /* && s->picture[i].type != FF_BUFFER_TYPE_SHARED */) {

                free_frame_buffer(s, &s->picture[i]);

            }

        }

    }

    // clear copies, to avoid confusion

#if 0

    memset(&s->last_picture,    0, sizeof(Picture));

    memset(&s->next_picture,    0, sizeof(Picture));

    memset(&s->current_picture, 0, sizeof(Picture));

#endif

    s->avctx->coded_frame = &s->current_picture_ptr->f;



    if (s->codec_id != AV_CODEC_ID_H264 && s->current_picture.f.reference) {

        ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0);

    }

}

void ff_MPV_frame_end(MpegEncContext *s)

{

    int i;

    

    

    if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) {

        ff_xvmc_field_end(s);

   } else if((s->error_count || s->encoding || !(s->avctx->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) &&

              !s->avctx->hwaccel &&

              !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&

              s->unrestricted_mv &&

              s->current_picture.f.reference &&

              !s->intra_only &&

              !(s->flags & CODEC_FLAG_EMU_EDGE)) {

        int hshift = av_pix_fmt_descriptors[s->avctx->pix_fmt].log2_chroma_w;

        int vshift = av_pix_fmt_descriptors[s->avctx->pix_fmt].log2_chroma_h;

        s->dsp.draw_edges(s->current_picture.f.data[0], s->current_picture.f.linesize[0],

                          s->h_edge_pos, s->v_edge_pos,

                          EDGE_WIDTH, EDGE_WIDTH,

                          EDGE_TOP | EDGE_BOTTOM);

        s->dsp.draw_edges(s->current_picture.f.data[1], s->current_picture.f.linesize[1],

                          s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,

                          EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,

                          EDGE_TOP | EDGE_BOTTOM);

        s->dsp.draw_edges(s->current_picture.f.data[2], s->current_picture.f.linesize[2],

                          s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,

                          EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,

                          EDGE_TOP | EDGE_BOTTOM);

    }



    emms_c();



    s->last_pict_type                 = s->pict_type;

    s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f.quality;

    if (s->pict_type!= AV_PICTURE_TYPE_B) {

        s->last_non_b_pict_type = s->pict_type;

    }

#if 0

    

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

        if (s->picture[i].f.data[0] == s->current_picture.f.data[0]) {

            s->picture[i] = s->current_picture;

            break;

        }

    }

    assert(i < MAX_PICTURE_COUNT);

#endif



    if (s->encoding) {

        

        for (i = 0; i < s->picture_count; i++) {

            if (s->picture[i].f.data[0] && !s->picture[i].f.reference

                ) {

                free_frame_buffer(s, &s->picture[i]);

            }

        }

    }

    

#if 0

    memset(&s->last_picture,    0, sizeof(Picture));

    memset(&s->next_picture,    0, sizeof(Picture));

    memset(&s->current_picture, 0, sizeof(Picture));

#endif

    s->avctx->coded_frame = &s->current_picture_ptr->f;



    if (s->codec_id != AV_CODEC_ID_H264 && s->current_picture.f.reference) {

        ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0);

    }

}

              !(s->flags & CODEC_FLAG_EMU_EDGE)) {
void FUNC_0(MpegEncContext *VAR_0)

{

    int VAR_1;

    

    

    if (CONFIG_MPEG_XVMC_DECODER && VAR_0->avctx->xvmc_acceleration) {

        ff_xvmc_field_end(VAR_0);

   } else if((VAR_0->error_count || VAR_0->encoding || !(VAR_0->avctx->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) &&

              !VAR_0->avctx->hwaccel &&

              !(VAR_0->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&

              VAR_0->unrestricted_mv &&

              VAR_0->current_picture.f.reference &&

              !VAR_0->intra_only &&

              !(VAR_0->flags & CODEC_FLAG_EMU_EDGE)) {

        int VAR_2 = av_pix_fmt_descriptors[VAR_0->avctx->pix_fmt].log2_chroma_w;

        int VAR_3 = av_pix_fmt_descriptors[VAR_0->avctx->pix_fmt].log2_chroma_h;

        VAR_0->dsp.draw_edges(VAR_0->current_picture.f.data[0], VAR_0->current_picture.f.linesize[0],

                          VAR_0->h_edge_pos, VAR_0->v_edge_pos,

                          EDGE_WIDTH, EDGE_WIDTH,

                          EDGE_TOP | EDGE_BOTTOM);

        VAR_0->dsp.draw_edges(VAR_0->current_picture.f.data[1], VAR_0->current_picture.f.linesize[1],

                          VAR_0->h_edge_pos >> VAR_2, VAR_0->v_edge_pos >> VAR_3,

                          EDGE_WIDTH >> VAR_2, EDGE_WIDTH >> VAR_3,

                          EDGE_TOP | EDGE_BOTTOM);

        VAR_0->dsp.draw_edges(VAR_0->current_picture.f.data[2], VAR_0->current_picture.f.linesize[2],

                          VAR_0->h_edge_pos >> VAR_2, VAR_0->v_edge_pos >> VAR_3,

                          EDGE_WIDTH >> VAR_2, EDGE_WIDTH >> VAR_3,

                          EDGE_TOP | EDGE_BOTTOM);

    }



    emms_c();



    VAR_0->last_pict_type                 = VAR_0->pict_type;

    VAR_0->last_lambda_for [VAR_0->pict_type] = VAR_0->current_picture_ptr->f.quality;

    if (VAR_0->pict_type!= AV_PICTURE_TYPE_B) {

        VAR_0->last_non_b_pict_type = VAR_0->pict_type;

    }

#if 0

    

    for (VAR_1 = 0; VAR_1 < MAX_PICTURE_COUNT; VAR_1++) {

        if (VAR_0->picture[VAR_1].f.data[0] == VAR_0->current_picture.f.data[0]) {

            VAR_0->picture[VAR_1] = VAR_0->current_picture;

            break;

        }

    }

    assert(VAR_1 < MAX_PICTURE_COUNT);

#endif



    if (VAR_0->encoding) {

        

        for (VAR_1 = 0; VAR_1 < VAR_0->picture_count; VAR_1++) {

            if (VAR_0->picture[VAR_1].f.data[0] && !VAR_0->picture[VAR_1].f.reference

                ) {

                free_frame_buffer(VAR_0, &VAR_0->picture[VAR_1]);

            }

        }

    }

    

#if 0

    memset(&VAR_0->last_picture,    0, sizeof(Picture));

    memset(&VAR_0->next_picture,    0, sizeof(Picture));

    memset(&VAR_0->current_picture, 0, sizeof(Picture));

#endif

    VAR_0->avctx->coded_frame = &VAR_0->current_picture_ptr->f;



    if (VAR_0->codec_id != AV_CODEC_ID_H264 && VAR_0->current_picture.f.reference) {

        ff_thread_report_progress(&VAR_0->current_picture_ptr->f, INT_MAX, 0);

    }

}

void FUNC_0(MpegEncContext *VAR_0)
{ int VAR_1; if (CONFIG_MPEG_XVMC_DECODER && VAR_0->avctx->xvmc_acceleration) { ff_xvmc_field_end(VAR_0); } else if((VAR_0->error_count || VAR_0->encoding || !(VAR_0->avctx->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) && !VAR_0->avctx->hwaccel &&
!(VAR_0->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&
VAR_0->unrestricted_mv &&
VAR_0->current_picture.f.reference &&
!VAR_0->intra_only &&
!(VAR_0->flags & CODEC_FLAG_EMU_EDGE)) { int VAR_2 = av_pix_fmt_descriptors[VAR_0->avctx->pix_fmt].log2_chroma_w; int VAR_3 = av_pix_fmt_descriptors[VAR_0->avctx->pix_fmt].log2_chroma_h; VAR_0->dsp.draw_edges(VAR_0->current_picture.f.data[0], VAR_0->current_picture.f.linesize[0],
VAR_0->h_edge_pos, VAR_0->v_edge_pos,
EDGE_WIDTH, EDGE_WIDTH,
EDGE_TOP | EDGE_BOTTOM); VAR_0->dsp.draw_edges(VAR_0->current_picture.f.data[1], VAR_0->current_picture.f.linesize[1],
VAR_0->h_edge_pos >> VAR_2, VAR_0->v_edge_pos >> VAR_3,
EDGE_WIDTH >> VAR_2, EDGE_WIDTH >> VAR_3,
EDGE_TOP | EDGE_BOTTOM); VAR_0->dsp.draw_edges(VAR_0->current_picture.f.data[2], VAR_0->current_picture.f.linesize[2],
VAR_0->h_edge_pos >> VAR_2, VAR_0->v_edge_pos >> VAR_3,
EDGE_WIDTH >> VAR_2, EDGE_WIDTH >> VAR_3,
EDGE_TOP | EDGE_BOTTOM); } emms_c(); VAR_0->last_pict_type                 = VAR_0->pict_type; VAR_0->last_lambda_for [VAR_0->pict_type] = VAR_0->current_picture_ptr->f.quality; if (VAR_0->pict_type!= AV_PICTURE_TYPE_B) { VAR_0->last_non_b_pict_type = VAR_0->pict_type; } #if 0
for (VAR_1 = 0; VAR_1 < MAX_PICTURE_COUNT; VAR_1++) { if (VAR_0->picture[VAR_1].f.data[0] == VAR_0->current_picture.f.data[0]) { VAR_0->picture[VAR_1] = VAR_0->current_picture; break; } } assert(VAR_1 < MAX_PICTURE_COUNT); #endif
if (VAR_0->encoding) { for (VAR_1 = 0; VAR_1 < VAR_0->picture_count; VAR_1++) { if (VAR_0->picture[VAR_1].f.data[0] && !VAR_0->picture[VAR_1].f.reference
) { free_frame_buffer(VAR_0, &VAR_0->picture[VAR_1]); } } } #if 0
memset(&VAR_0->last_picture,    0, sizeof(Picture)); memset(&VAR_0->next_picture,    0, sizeof(Picture)); memset(&VAR_0->current_picture, 0, sizeof(Picture)); #endif
VAR_0->avctx->coded_frame = &VAR_0->current_picture_ptr->f; if (VAR_0->codec_id != AV_CODEC_ID_H264 && VAR_0->current_picture.f.reference) { ff_thread_report_progress(&VAR_0->current_picture_ptr->f, INT_MAX, 0); } }