History

avutil/film_grain_params: add metadata to common struct

This is needed for AV1 film grain as well, when using AFGS1 streams. Also add extra width/height and subsampling information, which AFGS1 cares about, as part of the same API bump. (And in principle, H274 should also expose this information, since it is needed downstream to correctly adjust the chroma grain frequency to the subsampling ratio) Deprecate the equivalent H274-exclusive fields. To avoid breaking ABI, add the new fields after the union; but with enough of a paper trail to hopefully re-order them on the next bump.

Niklas Haas committed 2 years ago

Commit 35d29601 parent bfbf0f43 files · +62 −4Browse files

Unified · Split

3 files
  1. doc/APIchanges +6 −0
  2. libavutil/film_grain_params.h +54 −3
  3. libavutil/version.h +2 −1
doc/APIchanges+6−0
@@ -2,6 +2,12 @@ The last version increases of all libraries were on 2024-03-07 · 1 unmodified line
22
33 API changes, most recent first:
44
5+2024-03-xx - xxxxxxxxxx - lavu 59.5.100 - film_grain_params.h
6+ Add AVFilmGrainParams.color_range, color_primaries, color_trc, color_space,
7+ width, height, subsampling_x, subsampling_y, bit_depth_luma and
8+ bit_depth_chroma. Deprecate the corresponding fields from
9+ AVFilmGrainH274Params.
10+
511 2024-03-xx - xxxxxxxxxx - lavc 61.3.100 - jni.h
612 Add av_jni_set_android_app_ctx() and av_jni_get_android_app_ctx().
713
libavutil/film_grain_params.h+54−3
@@ -136,20 +136,42 @@ typedef struct AVFilmGrainH274Params { · 135 unmodified lines
136136 */
137137 int model_id;
138138
139− /**
140− * Specifies the bit depth used for the luma component.
141− */
139+#if FF_API_H274_FILM_GRAIN_VCS
140+ /**
141+ * TODO: On this ABI bump, please also re-order the fields in
142+ * AVFilmGrainParams (see below)
143+ */
144+
145+ /**
146+ * Specifies the bit depth used for the luma component.
147+ *
148+ * @deprecated use AVFilmGrainParams.bit_depth_luma.
149+ */
150+ attribute_deprecated
142151 int bit_depth_luma;
143152
144153 /**
145154 * Specifies the bit depth used for the chroma components.
155+ *
156+ * @deprecated use AVFilmGrainParams.bit_depth_chroma.
146157 */
158+ attribute_deprecated
147159 int bit_depth_chroma;
148160
161+ /**
162+ * Specifies the video signal characteristics.
163+ *
164+ * @deprecated use AVFilmGrainParams.color_{range,primaries,trc,space}.
165+ */
166+ attribute_deprecated
149167 enum AVColorRange color_range;
168+ attribute_deprecated
150169 enum AVColorPrimaries color_primaries;
170+ attribute_deprecated
151171 enum AVColorTransferCharacteristic color_trc;
172+ attribute_deprecated
152173 enum AVColorSpace color_space;
174+#endif
153175
154176 /**
155177 * Specifies the blending mode used to blend the simulated film grain
@@ -231,11 +253,40 @@ typedef struct AVFilmGrainParams { · 75 unmodified lines
231253 * Additional fields may be added both here and in any structure included.
232254 * If a codec's film grain structure differs slightly over another
233255 * codec's, fields within may change meaning depending on the type.
256+ *
257+ * TODO: Move this to the end of the structure, at the next ABI bump.
234258 */
235259 union {
236260 AVFilmGrainAOMParams aom;
237261 AVFilmGrainH274Params h274;
238262 } codec;
263+
264+ /**
265+ * Intended display resolution. May be 0 if the codec does not specify
266+ * any restrictions.
267+ */
268+
269+ int width, height;
270+
271+ /**
272+ * Intended subsampling ratio, or 0 for luma-only streams.
273+ */
274+ int subsampling_x, subsampling_y;
275+
276+ /**
277+ * Intended video signal characteristics.
278+ */
279+ enum AVColorRange color_range;
280+ enum AVColorPrimaries color_primaries;
281+ enum AVColorTransferCharacteristic color_trc;
282+ enum AVColorSpace color_space;
283+
284+ /**
285+ * Intended bit depth, or 0 for unknown/unspecified.
286+ */
287+ int bit_depth_luma;
288+ int bit_depth_chroma;
289+
239290 } AVFilmGrainParams;
240291
241292 /**
libavutil/version.h+2−1
@@ -79,7 +79,7 @@ · 78 unmodified lines
7979 */
8080
8181 #define LIBAVUTIL_VERSION_MAJOR 59
82−#define LIBAVUTIL_VERSION_MINOR 4
82+#define LIBAVUTIL_VERSION_MINOR 5
8383 #define LIBAVUTIL_VERSION_MICRO 100
8484
8585 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -111,6 +111,7 @@ · 25 unmodified lines
111111 #define FF_API_FRAME_KEY (LIBAVUTIL_VERSION_MAJOR < 60)
112112 #define FF_API_PALETTE_HAS_CHANGED (LIBAVUTIL_VERSION_MAJOR < 60)
113113 #define FF_API_VULKAN_CONTIGUOUS_MEMORY (LIBAVUTIL_VERSION_MAJOR < 60)
114+#define FF_API_H274_FILM_GRAIN_VCS (LIBAVUTIL_VERSION_MAJOR < 60)
114115
115116 /**
116117 * @}

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