]> git.sesse.net Git - ffmpeg/commitdiff
lavu: Deprecate AVFrame.error[]
authorVittorio Giovara <vittorio.giovara@gmail.com>
Mon, 28 Sep 2015 09:40:09 +0000 (11:40 +0200)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Wed, 30 Sep 2015 14:44:33 +0000 (16:44 +0200)
These field are difficult to interpret, and are provided by a single
encoder (mpegvideoenc). In general they do not belong to a structure
containing raw data only, so remove them from AVFrame.

Mpegvideoenc now uses a private field in Picture for its internal
computations.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
libavcodec/mpegpicture.c
libavcodec/mpegpicture.h
libavcodec/mpegvideo_enc.c
libavutil/frame.c
libavutil/frame.h
libavutil/version.h

index 9df14151e6e4e15f1d197dbadc3cda3768aa7d07..f3a9dd05af9d33fc07eca741c1d2d94a053a60f4 100644 (file)
@@ -358,6 +358,9 @@ int ff_mpeg_ref_picture(AVCodecContext *avctx, Picture *dst, Picture *src)
     dst->reference               = src->reference;
     dst->shared                  = src->shared;
 
+    memcpy(dst->encoding_error, src->encoding_error,
+           sizeof(dst->encoding_error));
+
     return 0;
 fail:
     ff_mpeg_unref_picture(avctx, dst);
index 0588f02ee5cc5bc2b9a850e8c097c78b36d5165b..115c2883d3041a24a947a3785a76e46846280a17 100644 (file)
@@ -83,6 +83,8 @@ typedef struct Picture {
 
     int reference;
     int shared;
+
+    uint64_t encoding_error[4];
 } Picture;
 
 /**
index 862d07f978137ee291ce61ee87d734b13cdbd3a4..e5ff3ed70e194fac5b0a13d2a6239693341bc55a 100644 (file)
@@ -1482,6 +1482,12 @@ FF_DISABLE_DEPRECATION_WARNINGS
     av_frame_copy_props(s->avctx->coded_frame, s->current_picture.f);
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
+#if FF_API_ERROR_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+    memcpy(s->current_picture.f->error, s->current_picture.encoding_error,
+           sizeof(s->current_picture.encoding_error));
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 }
 
 static void update_noise_reduction(MpegEncContext *s)
@@ -1688,8 +1694,8 @@ vbv_retry:
             ff_write_pass1_stats(s);
 
         for (i = 0; i < 4; i++) {
-            s->current_picture_ptr->f->error[i] = s->current_picture.f->error[i];
-            avctx->error[i] += s->current_picture_ptr->f->error[i];
+            s->current_picture_ptr->encoding_error[i] = s->current_picture.encoding_error[i];
+            avctx->error[i] += s->current_picture_ptr->encoding_error[i];
         }
 
         if (s->avctx->flags & AV_CODEC_FLAG_PASS1)
@@ -2590,7 +2596,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
         /* note: quant matrix value (8) is implied here */
         s->last_dc[i] = 128 << s->intra_dc_precision;
 
-        s->current_picture.f->error[i] = 0;
+        s->current_picture.encoding_error[i] = 0;
     }
     s->mb_skip_run = 0;
     memset(s->last_mv, 0, sizeof(s->last_mv));
@@ -3148,13 +3154,13 @@ static int encode_thread(AVCodecContext *c, void *arg){
                 if(s->mb_x*16 + 16 > s->width ) w= s->width - s->mb_x*16;
                 if(s->mb_y*16 + 16 > s->height) h= s->height- s->mb_y*16;
 
-                s->current_picture.f->error[0] += sse(
+                s->current_picture.encoding_error[0] += sse(
                     s, s->new_picture.f->data[0] + s->mb_x*16 + s->mb_y*s->linesize*16,
                     s->dest[0], w, h, s->linesize);
-                s->current_picture.f->error[1] += sse(
+                s->current_picture.encoding_error[1] += sse(
                     s, s->new_picture.f->data[1] + s->mb_x*8  + s->mb_y*s->uvlinesize*chr_h,
                     s->dest[1], w>>1, h>>s->chroma_y_shift, s->uvlinesize);
-                s->current_picture.f->error[2] += sse(
+                s->current_picture.encoding_error[2] += sse(
                     s, s->new_picture.f->data[2] + s->mb_x*8  + s->mb_y*s->uvlinesize*chr_h,
                     s->dest[2], w>>1, h>>s->chroma_y_shift, s->uvlinesize);
             }
@@ -3207,9 +3213,9 @@ static void merge_context_after_encode(MpegEncContext *dst, MpegEncContext *src)
     MERGE(misc_bits);
     MERGE(er.error_count);
     MERGE(padding_bug_score);
-    MERGE(current_picture.f->error[0]);
-    MERGE(current_picture.f->error[1]);
-    MERGE(current_picture.f->error[2]);
+    MERGE(current_picture.encoding_error[0]);
+    MERGE(current_picture.encoding_error[1]);
+    MERGE(current_picture.encoding_error[2]);
 
     if(dst->avctx->noise_reduction){
         for(i=0; i<64; i++){
index 32ec47066b90f08523220fa3695232ff7f0d3dc5..e4f6ab3daa3ee776769770080a3296a6c791a4b4 100644 (file)
@@ -400,7 +400,11 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
     dst->color_range            = src->color_range;
     dst->chroma_location        = src->chroma_location;
 
+#if FF_API_ERROR_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
     memcpy(dst->error, src->error, sizeof(dst->error));
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 
     for (i = 0; i < src->nb_side_data; i++) {
         const AVFrameSideData *sd_src = src->side_data[i];
index d231ff3966f38aa977846d2ff1f1c2415868333d..c723cb02c327da24ff5f412268bd52b1c5e763dc 100644 (file)
@@ -240,10 +240,13 @@ typedef struct AVFrame {
      */
     void *opaque;
 
+#if FF_API_ERROR_FRAME
     /**
-     * error
+     * @deprecated unused
      */
+    attribute_deprecated
     uint64_t error[AV_NUM_DATA_POINTERS];
+#endif
 
     /**
      * When decoding, this signals how much the picture must be delayed.
index 3c12d7192a65ae82fa79c763e51a56b0f20eef21..20059c4678acfafb5117aae46a25e21ecca1a3af 100644 (file)
@@ -96,6 +96,9 @@
 #ifndef FF_API_PLUS1_MINUS1
 #define FF_API_PLUS1_MINUS1             (LIBAVUTIL_VERSION_MAJOR < 56)
 #endif
+#ifndef FF_API_ERROR_FRAME
+#define FF_API_ERROR_FRAME              (LIBAVUTIL_VERSION_MAJOR < 56)
+#endif
 
 
 /**