Merge commit '0b0a7a751de02464a33717e70352f696372ba1c4'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 6 Dec 2013 02:04:32 +0000 (03:04 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 6 Dec 2013 02:12:10 +0000 (03:12 +0100)
* commit '0b0a7a751de02464a33717e70352f696372ba1c4':
  mpegvideo: move encode-only parts of common_end() to encode_end()

Conflicts:
libavcodec/mpegvideo.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/mpegvideo.c
libavcodec/mpegvideo.h
libavcodec/mpegvideo_enc.c

@@@ -379,16 -368,11 +379,16 @@@ int ff_alloc_picture(MpegEncContext *s
  {
      int i, ret;
  
-             free_picture_tables(pic);
 +    if (pic->qscale_table_buf)
 +        if (   pic->alloc_mb_width  != s->mb_width
 +            || pic->alloc_mb_height != s->mb_height)
++            ff_free_picture_tables(pic);
 +
      if (shared) {
 -        assert(pic->f.data[0]);
 +        av_assert0(pic->f.data[0]);
          pic->shared = 1;
      } else {
 -        assert(!pic->f.buf[0]);
 +        av_assert0(!pic->f.buf[0]);
  
          if (alloc_frame_buffer(s, pic) < 0)
              return -1;
@@@ -957,6 -927,6 +957,7 @@@ void ff_wmv2_encode_mb(MpegEncContext 
  
  int ff_mpeg_ref_picture(MpegEncContext *s, Picture *dst, Picture *src);
  void ff_mpeg_unref_picture(MpegEncContext *s, Picture *picture);
+ void ff_free_picture_tables(Picture *pic);
  
 +
  #endif /* AVCODEC_MPEGVIDEO_H */
@@@ -963,6 -847,20 +963,24 @@@ av_cold int ff_MPV_encode_end(AVCodecCo
      for (i = 0; i < FF_ARRAY_ELEMS(s->tmp_frames); i++)
          av_frame_free(&s->tmp_frames[i]);
  
+     ff_free_picture_tables(&s->new_picture);
+     ff_mpeg_unref_picture(s, &s->new_picture);
+     av_freep(&s->avctx->stats_out);
+     av_freep(&s->ac_stats);
++    if(s->q_chroma_intra_matrix   != s->q_intra_matrix  ) av_freep(&s->q_chroma_intra_matrix);
++    if(s->q_chroma_intra_matrix16 != s->q_intra_matrix16) av_freep(&s->q_chroma_intra_matrix16);
++    s->q_chroma_intra_matrix=   NULL;
++    s->q_chroma_intra_matrix16= NULL;
+     av_freep(&s->q_intra_matrix);
+     av_freep(&s->q_inter_matrix);
+     av_freep(&s->q_intra_matrix16);
+     av_freep(&s->q_inter_matrix16);
+     av_freep(&s->input_picture);
+     av_freep(&s->reordered_input_picture);
+     av_freep(&s->dct_offset);
      return 0;
  }