[FFmpeg-devel] [PATCH 1/4] Remove all uses of AVFrame QP tables and related fields in AVFrame

Michael Niedermayer michael at niedermayer.cc
Sat Feb 29 14:21:53 EET 2020


Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavutil/frame.c | 62 +++++++++--------------------------------------
 1 file changed, 12 insertions(+), 50 deletions(-)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index e4038096c2..89089c6cc0 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -57,15 +57,6 @@ int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int qp_type)
     AVFrameSideData *sd;
     AVBufferRef *ref;
 
-FF_DISABLE_DEPRECATION_WARNINGS
-    av_buffer_unref(&f->qp_table_buf);
-
-    f->qp_table_buf = buf;
-    f->qscale_table = buf->data;
-    f->qstride      = stride;
-    f->qscale_type  = qp_type;
-FF_ENABLE_DEPRECATION_WARNINGS
-
     av_frame_remove_side_data(f, AV_FRAME_DATA_QP_TABLE_PROPERTIES);
     av_frame_remove_side_data(f, AV_FRAME_DATA_QP_TABLE_DATA);
 
@@ -90,30 +81,22 @@ FF_ENABLE_DEPRECATION_WARNINGS
 int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type)
 {
     AVBufferRef *buf = NULL;
+    AVFrameSideData *sd;
+    struct qp_properties *p;
 
     *stride = 0;
     *type   = 0;
 
-FF_DISABLE_DEPRECATION_WARNINGS
-    if (f->qp_table_buf) {
-        *stride = f->qstride;
-        *type   = f->qscale_type;
-        buf     = f->qp_table_buf;
-FF_ENABLE_DEPRECATION_WARNINGS
-    } else {
-        AVFrameSideData *sd;
-        struct qp_properties *p;
-        sd = av_frame_get_side_data(f, AV_FRAME_DATA_QP_TABLE_PROPERTIES);
-        if (!sd)
-            return NULL;
-        p = (struct qp_properties *)sd->data;
-        sd = av_frame_get_side_data(f, AV_FRAME_DATA_QP_TABLE_DATA);
-        if (!sd)
-            return NULL;
-        *stride = p->stride;
-        *type   = p->type;
-        buf     = sd->buf;
-    }
+    sd = av_frame_get_side_data(f, AV_FRAME_DATA_QP_TABLE_PROPERTIES);
+    if (!sd)
+        return NULL;
+    p = (struct qp_properties *)sd->data;
+    sd = av_frame_get_side_data(f, AV_FRAME_DATA_QP_TABLE_DATA);
+    if (!sd)
+        return NULL;
+    *stride = p->stride;
+    *type   = p->type;
+    buf     = sd->buf;
 
     return buf ? buf->data : NULL;
 }
@@ -408,22 +391,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
         av_dict_copy(&sd_dst->metadata, sd_src->metadata, 0);
     }
 
-#if FF_API_FRAME_QP
-FF_DISABLE_DEPRECATION_WARNINGS
-    dst->qscale_table = NULL;
-    dst->qstride      = 0;
-    dst->qscale_type  = 0;
-    av_buffer_unref(&dst->qp_table_buf);
-    if (src->qp_table_buf) {
-        dst->qp_table_buf = av_buffer_ref(src->qp_table_buf);
-        if (dst->qp_table_buf) {
-            dst->qscale_table = dst->qp_table_buf->data;
-            dst->qstride      = src->qstride;
-            dst->qscale_type  = src->qscale_type;
-        }
-    }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
 
     av_buffer_unref(&dst->opaque_ref);
     av_buffer_unref(&dst->private_ref);
@@ -565,11 +532,6 @@ void av_frame_unref(AVFrame *frame)
         av_buffer_unref(&frame->extended_buf[i]);
     av_freep(&frame->extended_buf);
     av_dict_free(&frame->metadata);
-#if FF_API_FRAME_QP
-FF_DISABLE_DEPRECATION_WARNINGS
-    av_buffer_unref(&frame->qp_table_buf);
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
 
     av_buffer_unref(&frame->hw_frames_ctx);
 
-- 
2.17.1



More information about the ffmpeg-devel mailing list