History

avutil/film_grain_params: add support for H.274 Film Grain Characteristics

Used by codecs like H.264, HEVC, and VVC.

James Almer committed 5 years ago

Commit e3b5ff11 parent 41d1dba3 files · +93 −1Browse files

Unified · Split

3 files
  1. doc/APIchanges +3 −0
  2. libavutil/film_grain_params.h +89 −0
  3. libavutil/version.h +1 −1
doc/APIchanges+3−0
@@ -13,6 +13,9 @@ libavutil: 2021-04-27 · 12 unmodified lines
1313
1414
1515 API changes, most recent first:
16+2021-07-22 - xxxxxxxxxx - lavu 57.2.100 - film_grain_params.h
17+ Add AV_FILM_GRAIN_PARAMS_H274, AVFilmGrainH274Params
18+
1619 2021-07-19 - xxxxxxxxxx - lavu 57.1.100 - cpu.h
1720 Add av_cpu_force_count()
1821
libavutil/film_grain_params.h+89−0
@@ -28,6 +28,11 @@ enum AVFilmGrainParamsType { · 27 unmodified lines
2828 * The union is valid when interpreted as AVFilmGrainAOMParams (codec.aom)
2929 */
3030 AV_FILM_GRAIN_PARAMS_AV1,
31+
32+ /**
33+ * The union is valid when interpreted as AVFilmGrainH274Params (codec.h274)
34+ */
35+ AV_FILM_GRAIN_PARAMS_H274,
3136 };
3237
3338 /**
@@ -117,6 +122,89 @@ typedef struct AVFilmGrainAOMParams { · 83 unmodified lines
117122 int limit_output_range;
118123 } AVFilmGrainAOMParams;
119124
125+/**
126+ * This structure describes how to handle film grain synthesis for codecs using
127+ * the ITU-T H.274 Versatile suplemental enhancement information message.
128+ *
129+ * @note The struct must be allocated as part of AVFilmGrainParams using
130+ * av_film_grain_params_alloc(). Its size is not a part of the public ABI.
131+ */
132+typedef struct AVFilmGrainH274Params {
133+ /**
134+ * Specifies the film grain simulation mode.
135+ * 0 = Frequency filtering, 1 = Auto-regression
136+ */
137+ int model_id;
138+
139+ /**
140+ * Specifies the bit depth used for the luma component.
141+ */
142+ int bit_depth_luma;
143+
144+ /**
145+ * Specifies the bit depth used for the chroma components.
146+ */
147+ int bit_depth_chroma;
148+
149+ enum AVColorRange color_range;
150+ enum AVColorPrimaries color_primaries;
151+ enum AVColorTransferCharacteristic color_trc;
152+ enum AVColorSpace color_space;
153+
154+ /**
155+ * Specifies the blending mode used to blend the simulated film grain
156+ * with the decoded images.
157+ *
158+ * 0 = Additive, 1 = Multiplicative
159+ */
160+ int blending_mode_id;
161+
162+ /**
163+ * Specifies a scale factor used in the film grain characterization equations.
164+ */
165+ int log2_scale_factor;
166+
167+ /**
168+ * Indicates if the modelling of film grain for a given component is present.
169+ */
170+ int component_model_present[3 /* y, cb, cr */];
171+
172+ /**
173+ * Specifies the number of intensity intervals for which a specific set of
174+ * model values has been estimated, with a range of [1, 256].
175+ */
176+ uint16_t num_intensity_intervals[3 /* y, cb, cr */];
177+
178+ /**
179+ * Specifies the number of model values present for each intensity interval
180+ * in which the film grain has been modelled, with a range of [1, 6].
181+ */
182+ uint8_t num_model_values[3 /* y, cb, cr */];
183+
184+ /**
185+ * Specifies the lower ounds of each intensity interval for whichthe set of
186+ * model values applies for the component.
187+ */
188+ uint8_t intensity_interval_lower_bound[3 /* y, cb, cr */][256 /* intensity interval */];
189+
190+ /**
191+ * Specifies the upper bound of each intensity interval for which the set of
192+ * model values applies for the component.
193+ */
194+ uint8_t intensity_interval_upper_bound[3 /* y, cb, cr */][256 /* intensity interval */];
195+
196+ /**
197+ * Specifies the model values for the component for each intensity interval.
198+ * - When model_id == 0, the following applies:
199+ * For comp_model_value[y], the range of values is [0, 2^bit_depth_luma - 1]
200+ * For comp_model_value[cb..cr], the range of values is [0, 2^bit_depth_chroma - 1]
201+ * - Otherwise, the following applies:
202+ * For comp_model_value[y], the range of values is [-2^(bit_depth_luma - 1), 2^(bit_depth_luma - 1) - 1]
203+ * For comp_model_value[cb..cr], the range of values is [-2^(bit_depth_chroma - 1), 2^(bit_depth_chroma - 1) - 1]
204+ */
205+ int16_t comp_model_value[3 /* y, cb, cr */][256 /* intensity interval */][6 /* model value */];
206+} AVFilmGrainH274Params;
207+
120208 /**
121209 * This structure describes how to handle film grain synthesis in video
122210 * for specific codecs. Must be present on every frame where film grain is
@@ -143,6 +231,7 @@ typedef struct AVFilmGrainParams { · 20 unmodified lines
143231 */
144232 union {
145233 AVFilmGrainAOMParams aom;
234+ AVFilmGrainH274Params h274;
146235 } codec;
147236 } AVFilmGrainParams;
148237
libavutil/version.h+1−1
@@ -79,7 +79,7 @@ · 78 unmodified lines
7979 */
8080
8181 #define LIBAVUTIL_VERSION_MAJOR 57
82−#define LIBAVUTIL_VERSION_MINOR 1
82+#define LIBAVUTIL_VERSION_MINOR 2
8383 #define LIBAVUTIL_VERSION_MICRO 100
8484
8585 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

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