Merge commit '381a722562bcc0b623acf6a00a583fe989bcb72a'

* commit '381a722562bcc0b623acf6a00a583fe989bcb72a':
  mpegvideo: split the encoding-only parts of ff_MPV_frame_end() into a separate function

Conflicts:
	libavcodec/mpegvideo.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-12-06 02:37:51 +01:00
commit 26c2e3bf1a
2 changed files with 38 additions and 10 deletions

View File

@ -1703,8 +1703,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
return 0;
}
/* generic function for encode/decode called after a
* frame has been coded/decoded. */
/* called after a frame has been decoded. */
void ff_MPV_frame_end(MpegEncContext *s)
{
#if FF_API_XVMC
@ -1716,7 +1715,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
} else
FF_ENABLE_DEPRECATION_WARNINGS
#endif /* FF_API_XVMC */
if ((s->er.error_count || s->encoding || !(s->avctx->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) &&
if ((s->er.error_count || !(s->avctx->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) &&
!s->avctx->hwaccel &&
!(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&
s->unrestricted_mv &&
@ -1744,11 +1743,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
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++) {
@ -1766,7 +1760,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
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->current_picture.reference)
ff_thread_report_progress(&s->current_picture_ptr->tf, INT_MAX, 0);

View File

@ -1487,6 +1487,41 @@ no_output_pic:
return 0;
}
static void frame_end(MpegEncContext *s)
{
int i;
if (s->unrestricted_mv &&
s->current_picture.reference &&
!s->intra_only) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
int hshift = desc->log2_chroma_w;
int vshift = desc->log2_chroma_h;
s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize,
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->uvlinesize,
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->uvlinesize,
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;
s->avctx->coded_frame = &s->current_picture_ptr->f;
}
int ff_MPV_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
AVFrame *pic_arg, int *got_packet)
{
@ -1542,7 +1577,7 @@ vbv_retry:
avctx->p_count = s->mb_num - s->i_count - s->skip_count;
avctx->skip_count = s->skip_count;
ff_MPV_frame_end(s);
frame_end(s);
if (CONFIG_MJPEG_ENCODER && s->out_format == FMT_MJPEG)
ff_mjpeg_encode_picture_trailer(s);