Merge commit '381a722562bcc0b623acf6a00a583fe989bcb72a'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 6 Dec 2013 01:37:51 +0000 (02:37 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 6 Dec 2013 01:48:09 +0000 (02:48 +0100)
* 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>
1  2 
libavcodec/mpegvideo.c
libavcodec/mpegvideo_enc.c

@@@ -1716,9 -1669,8 +1715,9 @@@ FF_DISABLE_DEPRECATION_WARNING
      } 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  &&
++    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 &&
          s->current_picture.reference &&
          !s->intra_only &&
@@@ -1487,8 -1359,51 +1487,43 @@@ no_output_pic
      return 0;
  }
  
 -    if (s->encoding) {
 -        /* release non-reference frames */
 -        for (i = 0; i < MAX_PICTURE_COUNT; i++) {
 -            if (!s->picture[i].reference)
 -                ff_mpeg_unref_picture(s, &s->picture[i]);
 -        }
 -    }
 -
+ 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,
 -                          const AVFrame *pic_arg, int *got_packet)
 +                          AVFrame *pic_arg, int *got_packet)
  {
      MpegEncContext *s = avctx->priv_data;
      int i, stuffing_count, ret;