| @@ -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 | */ |
| | 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 | |
| 120 | /** | 208 | /** |
| 121 | * This structure describes how to handle film grain synthesis in video | 209 | * This structure describes how to handle film grain synthesis in video |
| 122 | * for specific codecs. Must be present on every frame where film grain is | 210 | * 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 | |