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
13 13
14 14
15API changes, most recent first:15API changes, most recent first:
162021-07-22 - xxxxxxxxxx - lavu 57.2.100 - film_grain_params.h
17 Add AV_FILM_GRAIN_PARAMS_H274, AVFilmGrainH274Params
18
162021-07-19 - xxxxxxxxxx - lavu 57.1.100 - cpu.h192021-07-19 - xxxxxxxxxx - lavu 57.1.100 - cpu.h
17 Add av_cpu_force_count()20 Add av_cpu_force_count()
18 21
libavutil/film_grain_params.h+89−0
@@ -28,6 +28,11 @@ enum AVFilmGrainParamsType { · 27 unmodified lines
28 * The union is valid when interpreted as AVFilmGrainAOMParams (codec.aom)28 * The union is valid when interpreted as AVFilmGrainAOMParams (codec.aom)
29 */29 */
30 AV_FILM_GRAIN_PARAMS_AV1,30 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,
31};36};
32 37
33/**38/**
@@ -117,6 +122,89 @@ typedef struct AVFilmGrainAOMParams { · 83 unmodified lines
117 int limit_output_range;122 int limit_output_range;
118} AVFilmGrainAOMParams;123} AVFilmGrainAOMParams;
119 124
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 */
132typedef 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
120/**208/**
121 * This structure describes how to handle film grain synthesis in video209 * This structure describes how to handle film grain synthesis in video
122 * for specific codecs. Must be present on every frame where film grain is210 * for specific codecs. Must be present on every frame where film grain is
@@ -143,6 +231,7 @@ typedef struct AVFilmGrainParams { · 20 unmodified lines
143 */231 */
144 union {232 union {
145 AVFilmGrainAOMParams aom;233 AVFilmGrainAOMParams aom;
234 AVFilmGrainH274Params h274;
146 } codec;235 } codec;
147} AVFilmGrainParams;236} AVFilmGrainParams;
148 237
libavutil/version.h+1−1
@@ -79,7 +79,7 @@ · 78 unmodified lines
79 */79 */
80 80
81#define LIBAVUTIL_VERSION_MAJOR 5781#define LIBAVUTIL_VERSION_MAJOR 57
82#define LIBAVUTIL_VERSION_MINOR 182#define LIBAVUTIL_VERSION_MINOR 2
83#define LIBAVUTIL_VERSION_MICRO 10083#define LIBAVUTIL_VERSION_MICRO 100
84 84
85#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \85#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