History

avutil/frame: Remove AVFrame QP table API

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

Andreas Rheinhardt committed 5 years ago

Commit b8accd11 parent ad524cb4 files · +0 −175Browse files

Unified · Split

4 files
  1. libavfilter/f_sidedata.c +0 −34
  2. libavutil/frame.c +0 −97
  3. libavutil/frame.h +0 −41
  4. libavutil/version.h +0 −3
libavfilter/f_sidedata.c+0−34
@@ -43,7 +43,6 @@ typedef struct SideDataContext { · 42 unmodified lines
43} SideDataContext;43} SideDataContext;
44 44
45#define OFFSET(x) offsetof(SideDataContext, x)45#define OFFSET(x) offsetof(SideDataContext, x)
46#if FF_API_FRAME_QP
47#define DEFINE_OPTIONS(filt_name, FLAGS) \46#define DEFINE_OPTIONS(filt_name, FLAGS) \
48static const AVOption filt_name##_options[] = { \47static const AVOption filt_name##_options[] = { \
49 { "mode", "set a mode of operation", OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, SIDEDATA_NB-1, FLAGS, "mode" }, \48 { "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[] = { \ · 16 unmodified lines
66 { "SPHERICAL", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_SPHERICAL }, 0, 0, FLAGS, "type" }, \65 { "SPHERICAL", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_SPHERICAL }, 0, 0, FLAGS, "type" }, \
67 { "CONTENT_LIGHT_LEVEL", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_CONTENT_LIGHT_LEVEL }, 0, 0, FLAGS, "type" }, \66 { "CONTENT_LIGHT_LEVEL", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_CONTENT_LIGHT_LEVEL }, 0, 0, FLAGS, "type" }, \
68 { "ICC_PROFILE", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_ICC_PROFILE }, 0, 0, FLAGS, "type" }, \67 { "ICC_PROFILE", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_ICC_PROFILE }, 0, 0, FLAGS, "type" }, \
69 { "QP_TABLE_PROPERTIES", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_QP_TABLE_PROPERTIES }, 0, 0, FLAGS, "type" }, \
70 { "QP_TABLE_DATA", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_QP_TABLE_DATA }, 0, 0, FLAGS, "type" }, \
71 { "S12M_TIMECOD", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_S12M_TIMECODE }, 0, 0, FLAGS, "type" }, \68 { "S12M_TIMECOD", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_S12M_TIMECODE }, 0, 0, FLAGS, "type" }, \
72 { "DYNAMIC_HDR_PLUS", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_DYNAMIC_HDR_PLUS }, 0, 0, FLAGS, "type" }, \69 { "DYNAMIC_HDR_PLUS", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_DYNAMIC_HDR_PLUS }, 0, 0, FLAGS, "type" }, \
73 { "REGIONS_OF_INTEREST", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_REGIONS_OF_INTEREST }, 0, 0, FLAGS, "type" }, \70 { "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[] = { \ · 1 unmodified line
75 { "SEI_UNREGISTERED", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_SEI_UNREGISTERED }, 0, 0, FLAGS, "type" }, \72 { "SEI_UNREGISTERED", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_SEI_UNREGISTERED }, 0, 0, FLAGS, "type" }, \
76 { NULL } \73 { NULL } \
77}74}
78#else
79#define DEFINE_OPTIONS(filt_name, FLAGS) \
80static const AVOption filt_name##_options[] = { \
81 { "mode", "set a mode of operation", OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, SIDEDATA_NB-1, FLAGS, "mode" }, \
82 { "select", "select frame", 0, AV_OPT_TYPE_CONST, {.i64 = SIDEDATA_SELECT }, 0, 0, FLAGS, "mode" }, \
83 { "delete", "delete side data", 0, AV_OPT_TYPE_CONST, {.i64 = SIDEDATA_DELETE }, 0, 0, FLAGS, "mode" }, \
84 { "type", "set side data type", OFFSET(type), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, INT_MAX, FLAGS, "type" }, \
85 { "PANSCAN", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_PANSCAN }, 0, 0, FLAGS, "type" }, \
86 { "A53_CC", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_A53_CC }, 0, 0, FLAGS, "type" }, \
87 { "STEREO3D", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_STEREO3D }, 0, 0, FLAGS, "type" }, \
88 { "MATRIXENCODING", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_MATRIXENCODING }, 0, 0, FLAGS, "type" }, \
89 { "DOWNMIX_INFO", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_DOWNMIX_INFO }, 0, 0, FLAGS, "type" }, \
90 { "REPLAYGAIN", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_REPLAYGAIN }, 0, 0, FLAGS, "type" }, \
91 { "DISPLAYMATRIX", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_DISPLAYMATRIX }, 0, 0, FLAGS, "type" }, \
92 { "AFD", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_AFD }, 0, 0, FLAGS, "type" }, \
93 { "MOTION_VECTORS", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_MOTION_VECTORS }, 0, 0, FLAGS, "type" }, \
94 { "SKIP_SAMPLES", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_SKIP_SAMPLES }, 0, 0, FLAGS, "type" }, \
95 { "AUDIO_SERVICE_TYPE", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_AUDIO_SERVICE_TYPE }, 0, 0, FLAGS, "type" }, \
96 { "MASTERING_DISPLAY_METADATA", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_MASTERING_DISPLAY_METADATA }, 0, 0, FLAGS, "type" }, \
97 { "GOP_TIMECODE", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_GOP_TIMECODE }, 0, 0, FLAGS, "type" }, \
98 { "SPHERICAL", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_SPHERICAL }, 0, 0, FLAGS, "type" }, \
99 { "CONTENT_LIGHT_LEVEL", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_CONTENT_LIGHT_LEVEL }, 0, 0, FLAGS, "type" }, \
100 { "ICC_PROFILE", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_ICC_PROFILE }, 0, 0, FLAGS, "type" }, \
101 { "S12M_TIMECOD", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_S12M_TIMECODE }, 0, 0, FLAGS, "type" }, \
102 { "DYNAMIC_HDR_PLUS", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_DYNAMIC_HDR_PLUS }, 0, 0, FLAGS, "type" }, \
103 { "REGIONS_OF_INTEREST", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_REGIONS_OF_INTEREST }, 0, 0, FLAGS, "type" }, \
104 { "DETECTION_BOUNDING_BOXES", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_DETECTION_BBOXES }, 0, 0, FLAGS, "type" }, \
105 { "SEI_UNREGISTERED", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_SEI_UNREGISTERED }, 0, 0, FLAGS, "type" }, \
106 { NULL } \
107}
108#endif
109 75
110static av_cold int init(AVFilterContext *ctx)76static av_cold int init(AVFilterContext *ctx)
111{77{
libavutil/frame.c+0−97
@@ -46,80 +46,6 @@ MAKE_ACCESSORS(AVFrame, frame, enum AVColorRange, color_range) · 45 unmodified lines
46 (frame)->channels == \46 (frame)->channels == \
47 av_get_channel_layout_nb_channels((frame)->channel_layout))47 av_get_channel_layout_nb_channels((frame)->channel_layout))
48 48
49#if FF_API_FRAME_QP
50struct qp_properties {
51 int stride;
52 int type;
53};
54
55int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int qp_type)
56{
57 struct qp_properties *p;
58 AVFrameSideData *sd;
59 AVBufferRef *ref;
60
61FF_DISABLE_DEPRECATION_WARNINGS
62 av_buffer_unref(&f->qp_table_buf);
63
64 f->qp_table_buf = buf;
65 f->qscale_table = buf->data;
66 f->qstride = stride;
67 f->qscale_type = qp_type;
68FF_ENABLE_DEPRECATION_WARNINGS
69
70 av_frame_remove_side_data(f, AV_FRAME_DATA_QP_TABLE_PROPERTIES);
71 av_frame_remove_side_data(f, AV_FRAME_DATA_QP_TABLE_DATA);
72
73 ref = av_buffer_ref(buf);
74 if (!av_frame_new_side_data_from_buf(f, AV_FRAME_DATA_QP_TABLE_DATA, ref)) {
75 av_buffer_unref(&ref);
76 return AVERROR(ENOMEM);
77 }
78
79 sd = av_frame_new_side_data(f, AV_FRAME_DATA_QP_TABLE_PROPERTIES,
80 sizeof(struct qp_properties));
81 if (!sd)
82 return AVERROR(ENOMEM);
83
84 p = (struct qp_properties *)sd->data;
85 p->stride = stride;
86 p->type = qp_type;
87
88 return 0;
89}
90
91int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type)
92{
93 AVBufferRef *buf = NULL;
94
95 *stride = 0;
96 *type = 0;
97
98FF_DISABLE_DEPRECATION_WARNINGS
99 if (f->qp_table_buf) {
100 *stride = f->qstride;
101 *type = f->qscale_type;
102 buf = f->qp_table_buf;
103FF_ENABLE_DEPRECATION_WARNINGS
104 } else {
105 AVFrameSideData *sd;
106 struct qp_properties *p;
107 sd = av_frame_get_side_data(f, AV_FRAME_DATA_QP_TABLE_PROPERTIES);
108 if (!sd)
109 return NULL;
110 p = (struct qp_properties *)sd->data;
111 sd = av_frame_get_side_data(f, AV_FRAME_DATA_QP_TABLE_DATA);
112 if (!sd)
113 return NULL;
114 *stride = p->stride;
115 *type = p->type;
116 buf = sd->buf;
117 }
118
119 return buf ? buf->data : NULL;
120}
121#endif
122
123#if FF_API_COLORSPACE_NAME49#if FF_API_COLORSPACE_NAME
124const char *av_get_colorspace_name(enum AVColorSpace val)50const char *av_get_colorspace_name(enum AVColorSpace val)
125{51{
@@ -422,20 +348,6 @@ FF_ENABLE_DEPRECATION_WARNINGS · 296 unmodified lines
422 av_dict_copy(&sd_dst->metadata, sd_src->metadata, 0);348 av_dict_copy(&sd_dst->metadata, sd_src->metadata, 0);
423 }349 }
424 350
425#if FF_API_FRAME_QP
426FF_DISABLE_DEPRECATION_WARNINGS
427 dst->qscale_table = NULL;
428 dst->qstride = 0;
429 dst->qscale_type = 0;
430 av_buffer_replace(&dst->qp_table_buf, src->qp_table_buf);
431 if (dst->qp_table_buf) {
432 dst->qscale_table = dst->qp_table_buf->data;
433 dst->qstride = src->qstride;
434 dst->qscale_type = src->qscale_type;
435 }
436FF_ENABLE_DEPRECATION_WARNINGS
437#endif
438
439 ret = av_buffer_replace(&dst->opaque_ref, src->opaque_ref);351 ret = av_buffer_replace(&dst->opaque_ref, src->opaque_ref);
440 ret |= av_buffer_replace(&dst->private_ref, src->private_ref);352 ret |= av_buffer_replace(&dst->private_ref, src->private_ref);
441 return ret;353 return ret;
@@ -566,11 +478,6 @@ void av_frame_unref(AVFrame *frame) · 124 unmodified lines
566 av_buffer_unref(&frame->extended_buf[i]);478 av_buffer_unref(&frame->extended_buf[i]);
567 av_freep(&frame->extended_buf);479 av_freep(&frame->extended_buf);
568 av_dict_free(&frame->metadata);480 av_dict_free(&frame->metadata);
569#if FF_API_FRAME_QP
570FF_DISABLE_DEPRECATION_WARNINGS
571 av_buffer_unref(&frame->qp_table_buf);
572FF_ENABLE_DEPRECATION_WARNINGS
573#endif
574 481
575 av_buffer_unref(&frame->hw_frames_ctx);482 av_buffer_unref(&frame->hw_frames_ctx);
576 483
@@ -844,10 +751,6 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type) · 267 unmodified lines
844 case AV_FRAME_DATA_S12M_TIMECODE: return "SMPTE 12-1 timecode";751 case AV_FRAME_DATA_S12M_TIMECODE: return "SMPTE 12-1 timecode";
845 case AV_FRAME_DATA_SPHERICAL: return "Spherical Mapping";752 case AV_FRAME_DATA_SPHERICAL: return "Spherical Mapping";
846 case AV_FRAME_DATA_ICC_PROFILE: return "ICC profile";753 case AV_FRAME_DATA_ICC_PROFILE: return "ICC profile";
847#if FF_API_FRAME_QP
848 case AV_FRAME_DATA_QP_TABLE_PROPERTIES: return "QP table properties";
849 case AV_FRAME_DATA_QP_TABLE_DATA: return "QP table data";
850#endif
851 case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata SMPTE2094-40 (HDR10+)";754 case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata SMPTE2094-40 (HDR10+)";
852 case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of Interest";755 case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of Interest";
853 case AV_FRAME_DATA_VIDEO_ENC_PARAMS: return "Video encoding parameters";756 case AV_FRAME_DATA_VIDEO_ENC_PARAMS: return "Video encoding parameters";
libavutil/frame.h+0−41
@@ -142,23 +142,6 @@ enum AVFrameSideDataType { · 141 unmodified lines
142 */142 */
143 AV_FRAME_DATA_ICC_PROFILE,143 AV_FRAME_DATA_ICC_PROFILE,
144 144
145#if FF_API_FRAME_QP
146 /**
147 * Implementation-specific description of the format of AV_FRAME_QP_TABLE_DATA.
148 * The contents of this side data are undocumented and internal; use
149 * av_frame_set_qp_table() and av_frame_get_qp_table() to access this in a
150 * meaningful way instead.
151 */
152 AV_FRAME_DATA_QP_TABLE_PROPERTIES,
153
154 /**
155 * Raw QP table data. Its format is described by
156 * AV_FRAME_DATA_QP_TABLE_PROPERTIES. Use av_frame_set_qp_table() and
157 * av_frame_get_qp_table() to access this instead.
158 */
159 AV_FRAME_DATA_QP_TABLE_DATA,
160#endif
161
162 /**145 /**
163 * Timecode which conforms to SMPTE ST 12-1. The data is an array of 4 uint32_t146 * Timecode which conforms to SMPTE ST 12-1. The data is an array of 4 uint32_t
164 * where the first uint32_t describes how many (1-3) of the other timecodes are used.147 * where the first uint32_t describes how many (1-3) of the other timecodes are used.
@@ -638,24 +621,6 @@ typedef struct AVFrame { · 473 unmodified lines
638 */621 */
639 int pkt_size;622 int pkt_size;
640 623
641#if FF_API_FRAME_QP
642 /**
643 * QP table
644 */
645 attribute_deprecated
646 int8_t *qscale_table;
647 /**
648 * QP store stride
649 */
650 attribute_deprecated
651 int qstride;
652
653 attribute_deprecated
654 int qscale_type;
655
656 attribute_deprecated
657 AVBufferRef *qp_table_buf;
658#endif
659 /**624 /**
660 * For hwaccel-format frames, this should be a reference to the625 * For hwaccel-format frames, this should be a reference to the
661 * AVHWFramesContext describing the frame.626 * AVHWFramesContext describing the frame.
@@ -744,12 +709,6 @@ attribute_deprecated · 82 unmodified lines
744int av_frame_get_pkt_size(const AVFrame *frame);709int av_frame_get_pkt_size(const AVFrame *frame);
745attribute_deprecated710attribute_deprecated
746void av_frame_set_pkt_size(AVFrame *frame, int val);711void av_frame_set_pkt_size(AVFrame *frame, int val);
747#if FF_API_FRAME_QP
748attribute_deprecated
749int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
750attribute_deprecated
751int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type);
752#endif
753attribute_deprecated712attribute_deprecated
754enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);713enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
755attribute_deprecated714attribute_deprecated
libavutil/version.h+0−3
@@ -105,9 +105,6 @@ · 104 unmodified lines
105 * @{105 * @{
106 */106 */
107 107
108#ifndef FF_API_FRAME_QP
109#define FF_API_FRAME_QP (LIBAVUTIL_VERSION_MAJOR < 57)
110#endif
111#ifndef FF_API_PLUS1_MINUS1108#ifndef FF_API_PLUS1_MINUS1
112#define FF_API_PLUS1_MINUS1 (LIBAVUTIL_VERSION_MAJOR < 57)109#define FF_API_PLUS1_MINUS1 (LIBAVUTIL_VERSION_MAJOR < 57)
113#endif110#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t