[FFmpeg-cvslog] avutil/frame: Remove AVFrame QP table API

Andreas Rheinhardt git at videolan.org
Wed Apr 28 00:16:18 EEST 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Sat Mar  6 19:33:32 2021 +0100| [b8accd1175d20ab308de69dbd06bda06a02183e3] | committer: James Almer

avutil/frame: Remove AVFrame QP table API

Originally deprecated in 1296b1f6c0631ab79464e22d48a6a1548450b943;
scheduled again for removal in a9915268327b097bba84a07f68968d8c07f4b549.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b8accd1175d20ab308de69dbd06bda06a02183e3
---

 libavfilter/f_sidedata.c | 34 -----------------
 libavutil/frame.c        | 97 ------------------------------------------------
 libavutil/frame.h        | 41 --------------------
 libavutil/version.h      |  3 --
 4 files changed, 175 deletions(-)

diff --git a/libavfilter/f_sidedata.c b/libavfilter/f_sidedata.c
index 6f25d2b311..0542373ed8 100644
--- a/libavfilter/f_sidedata.c
+++ b/libavfilter/f_sidedata.c
@@ -43,7 +43,6 @@ typedef struct SideDataContext {
 } SideDataContext;
 
 #define OFFSET(x) offsetof(SideDataContext, x)
-#if FF_API_FRAME_QP
 #define DEFINE_OPTIONS(filt_name, FLAGS) \
 static const AVOption filt_name##_options[] = { \
     { "mode", "set a mode of operation", OFFSET(mode),   AV_OPT_TYPE_INT,    {.i64 = 0 }, 0, SIDEDATA_NB-1, FLAGS, "mode" }, \
@@ -66,8 +65,6 @@ static const AVOption filt_name##_options[] = { \
     {   "SPHERICAL",                  "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_SPHERICAL                  }, 0, 0, FLAGS, "type" }, \
     {   "CONTENT_LIGHT_LEVEL",        "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_CONTENT_LIGHT_LEVEL        }, 0, 0, FLAGS, "type" }, \
     {   "ICC_PROFILE",                "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_ICC_PROFILE                }, 0, 0, FLAGS, "type" }, \
-    {   "QP_TABLE_PROPERTIES",        "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_QP_TABLE_PROPERTIES        }, 0, 0, FLAGS, "type" }, \
-    {   "QP_TABLE_DATA",              "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_QP_TABLE_DATA              }, 0, 0, FLAGS, "type" }, \
     {   "S12M_TIMECOD",               "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_S12M_TIMECODE              }, 0, 0, FLAGS, "type" }, \
     {   "DYNAMIC_HDR_PLUS",           "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_DYNAMIC_HDR_PLUS           }, 0, 0, FLAGS, "type" }, \
     {   "REGIONS_OF_INTEREST",        "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_REGIONS_OF_INTEREST        }, 0, 0, FLAGS, "type" }, \
@@ -75,37 +72,6 @@ static const AVOption filt_name##_options[] = { \
     {   "SEI_UNREGISTERED",           "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_SEI_UNREGISTERED           }, 0, 0, FLAGS, "type" }, \
     { NULL } \
 }
-#else
-#define DEFINE_OPTIONS(filt_name, FLAGS) \
-static const AVOption filt_name##_options[] = { \
-    { "mode", "set a mode of operation", OFFSET(mode),   AV_OPT_TYPE_INT,    {.i64 = 0 }, 0, SIDEDATA_NB-1, FLAGS, "mode" }, \
-    {   "select", "select frame",        0,              AV_OPT_TYPE_CONST,  {.i64 = SIDEDATA_SELECT }, 0, 0, FLAGS, "mode" }, \
-    {   "delete", "delete side data",    0,              AV_OPT_TYPE_CONST,  {.i64 = SIDEDATA_DELETE }, 0, 0, FLAGS, "mode" }, \
-    { "type",   "set side data type",    OFFSET(type),   AV_OPT_TYPE_INT,    {.i64 = -1 }, -1, INT_MAX, FLAGS, "type" }, \
-    {   "PANSCAN",                    "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_PANSCAN                    }, 0, 0, FLAGS, "type" }, \
-    {   "A53_CC",                     "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_A53_CC                     }, 0, 0, FLAGS, "type" }, \
-    {   "STEREO3D",                   "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_STEREO3D                   }, 0, 0, FLAGS, "type" }, \
-    {   "MATRIXENCODING",             "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_MATRIXENCODING             }, 0, 0, FLAGS, "type" }, \
-    {   "DOWNMIX_INFO",               "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_DOWNMIX_INFO               }, 0, 0, FLAGS, "type" }, \
-    {   "REPLAYGAIN",                 "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_REPLAYGAIN                 }, 0, 0, FLAGS, "type" }, \
-    {   "DISPLAYMATRIX",              "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_DISPLAYMATRIX              }, 0, 0, FLAGS, "type" }, \
-    {   "AFD",                        "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_AFD                        }, 0, 0, FLAGS, "type" }, \
-    {   "MOTION_VECTORS",             "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_MOTION_VECTORS             }, 0, 0, FLAGS, "type" }, \
-    {   "SKIP_SAMPLES",               "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_SKIP_SAMPLES               }, 0, 0, FLAGS, "type" }, \
-    {   "AUDIO_SERVICE_TYPE",         "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_AUDIO_SERVICE_TYPE         }, 0, 0, FLAGS, "type" }, \
-    {   "MASTERING_DISPLAY_METADATA", "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_MASTERING_DISPLAY_METADATA }, 0, 0, FLAGS, "type" }, \
-    {   "GOP_TIMECODE",               "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_GOP_TIMECODE               }, 0, 0, FLAGS, "type" }, \
-    {   "SPHERICAL",                  "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_SPHERICAL                  }, 0, 0, FLAGS, "type" }, \
-    {   "CONTENT_LIGHT_LEVEL",        "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_CONTENT_LIGHT_LEVEL        }, 0, 0, FLAGS, "type" }, \
-    {   "ICC_PROFILE",                "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_ICC_PROFILE                }, 0, 0, FLAGS, "type" }, \
-    {   "S12M_TIMECOD",               "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_S12M_TIMECODE              }, 0, 0, FLAGS, "type" }, \
-    {   "DYNAMIC_HDR_PLUS",           "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_DYNAMIC_HDR_PLUS           }, 0, 0, FLAGS, "type" }, \
-    {   "REGIONS_OF_INTEREST",        "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_REGIONS_OF_INTEREST        }, 0, 0, FLAGS, "type" }, \
-    {   "DETECTION_BOUNDING_BOXES",   "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_DETECTION_BBOXES           }, 0, 0, FLAGS, "type" }, \
-    {   "SEI_UNREGISTERED",           "", 0,             AV_OPT_TYPE_CONST,  {.i64 = AV_FRAME_DATA_SEI_UNREGISTERED           }, 0, 0, FLAGS, "type" }, \
-    { NULL } \
-}
-#endif
 
 static av_cold int init(AVFilterContext *ctx)
 {
diff --git a/libavutil/frame.c b/libavutil/frame.c
index bb77e2d534..df826fbfb7 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -46,80 +46,6 @@ MAKE_ACCESSORS(AVFrame, frame, enum AVColorRange, color_range)
                (frame)->channels == \
                av_get_channel_layout_nb_channels((frame)->channel_layout))
 
-#if FF_API_FRAME_QP
-struct qp_properties {
-    int stride;
-    int type;
-};
-
-int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int qp_type)
-{
-    struct qp_properties *p;
-    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);
-
-    ref = av_buffer_ref(buf);
-    if (!av_frame_new_side_data_from_buf(f, AV_FRAME_DATA_QP_TABLE_DATA, ref)) {
-        av_buffer_unref(&ref);
-        return AVERROR(ENOMEM);
-    }
-
-    sd = av_frame_new_side_data(f, AV_FRAME_DATA_QP_TABLE_PROPERTIES,
-                                sizeof(struct qp_properties));
-    if (!sd)
-        return AVERROR(ENOMEM);
-
-    p = (struct qp_properties *)sd->data;
-    p->stride = stride;
-    p->type = qp_type;
-
-    return 0;
-}
-
-int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type)
-{
-    AVBufferRef *buf = NULL;
-
-    *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;
-    }
-
-    return buf ? buf->data : NULL;
-}
-#endif
-
 #if FF_API_COLORSPACE_NAME
 const char *av_get_colorspace_name(enum AVColorSpace val)
 {
@@ -422,20 +348,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_replace(&dst->qp_table_buf, 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
-
     ret = av_buffer_replace(&dst->opaque_ref, src->opaque_ref);
     ret |= av_buffer_replace(&dst->private_ref, src->private_ref);
     return ret;
@@ -566,11 +478,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);
 
@@ -844,10 +751,6 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type)
     case AV_FRAME_DATA_S12M_TIMECODE:               return "SMPTE 12-1 timecode";
     case AV_FRAME_DATA_SPHERICAL:                   return "Spherical Mapping";
     case AV_FRAME_DATA_ICC_PROFILE:                 return "ICC profile";
-#if FF_API_FRAME_QP
-    case AV_FRAME_DATA_QP_TABLE_PROPERTIES:         return "QP table properties";
-    case AV_FRAME_DATA_QP_TABLE_DATA:               return "QP table data";
-#endif
     case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata SMPTE2094-40 (HDR10+)";
     case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of Interest";
     case AV_FRAME_DATA_VIDEO_ENC_PARAMS:            return "Video encoding parameters";
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 0d7ed29dfc..fbecebbd70 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -142,23 +142,6 @@ enum AVFrameSideDataType {
      */
     AV_FRAME_DATA_ICC_PROFILE,
 
-#if FF_API_FRAME_QP
-    /**
-     * Implementation-specific description of the format of AV_FRAME_QP_TABLE_DATA.
-     * The contents of this side data are undocumented and internal; use
-     * av_frame_set_qp_table() and av_frame_get_qp_table() to access this in a
-     * meaningful way instead.
-     */
-    AV_FRAME_DATA_QP_TABLE_PROPERTIES,
-
-    /**
-     * Raw QP table data. Its format is described by
-     * AV_FRAME_DATA_QP_TABLE_PROPERTIES. Use av_frame_set_qp_table() and
-     * av_frame_get_qp_table() to access this instead.
-     */
-    AV_FRAME_DATA_QP_TABLE_DATA,
-#endif
-
     /**
      * Timecode which conforms to SMPTE ST 12-1. The data is an array of 4 uint32_t
      * where the first uint32_t describes how many (1-3) of the other timecodes are used.
@@ -638,24 +621,6 @@ typedef struct AVFrame {
      */
     int pkt_size;
 
-#if FF_API_FRAME_QP
-    /**
-     * QP table
-     */
-    attribute_deprecated
-    int8_t *qscale_table;
-    /**
-     * QP store stride
-     */
-    attribute_deprecated
-    int qstride;
-
-    attribute_deprecated
-    int qscale_type;
-
-    attribute_deprecated
-    AVBufferRef *qp_table_buf;
-#endif
     /**
      * For hwaccel-format frames, this should be a reference to the
      * AVHWFramesContext describing the frame.
@@ -744,12 +709,6 @@ attribute_deprecated
 int     av_frame_get_pkt_size(const AVFrame *frame);
 attribute_deprecated
 void    av_frame_set_pkt_size(AVFrame *frame, int val);
-#if FF_API_FRAME_QP
-attribute_deprecated
-int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
-attribute_deprecated
-int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type);
-#endif
 attribute_deprecated
 enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
 attribute_deprecated
diff --git a/libavutil/version.h b/libavutil/version.h
index f14406f7b0..a4648d12c2 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -105,9 +105,6 @@
  * @{
  */
 
-#ifndef FF_API_FRAME_QP
-#define FF_API_FRAME_QP                 (LIBAVUTIL_VERSION_MAJOR < 57)
-#endif
 #ifndef FF_API_PLUS1_MINUS1
 #define FF_API_PLUS1_MINUS1             (LIBAVUTIL_VERSION_MAJOR < 57)
 #endif



More information about the ffmpeg-cvslog mailing list