forked from FFmpeg/FFmpeg
avutil/film_grain_params: add support for H.274 Film Grain Characteristics
Used by codecs like H.264, HEVC, and VVC. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
41d1dba4d2
commit
e3b5ff17c2
3 changed files with 93 additions and 1 deletions
|
@ -13,6 +13,9 @@ libavutil: 2021-04-27
|
|||
|
||||
|
||||
API changes, most recent first:
|
||||
2021-07-22 - xxxxxxxxxx - lavu 57.2.100 - film_grain_params.h
|
||||
Add AV_FILM_GRAIN_PARAMS_H274, AVFilmGrainH274Params
|
||||
|
||||
2021-07-19 - xxxxxxxxxx - lavu 57.1.100 - cpu.h
|
||||
Add av_cpu_force_count()
|
||||
|
||||
|
|
|
@ -28,6 +28,11 @@ enum AVFilmGrainParamsType {
|
|||
* The union is valid when interpreted as AVFilmGrainAOMParams (codec.aom)
|
||||
*/
|
||||
AV_FILM_GRAIN_PARAMS_AV1,
|
||||
|
||||
/**
|
||||
* The union is valid when interpreted as AVFilmGrainH274Params (codec.h274)
|
||||
*/
|
||||
AV_FILM_GRAIN_PARAMS_H274,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -117,6 +122,89 @@ typedef struct AVFilmGrainAOMParams {
|
|||
int limit_output_range;
|
||||
} AVFilmGrainAOMParams;
|
||||
|
||||
/**
|
||||
* This structure describes how to handle film grain synthesis for codecs using
|
||||
* the ITU-T H.274 Versatile suplemental enhancement information message.
|
||||
*
|
||||
* @note The struct must be allocated as part of AVFilmGrainParams using
|
||||
* av_film_grain_params_alloc(). Its size is not a part of the public ABI.
|
||||
*/
|
||||
typedef struct AVFilmGrainH274Params {
|
||||
/**
|
||||
* Specifies the film grain simulation mode.
|
||||
* 0 = Frequency filtering, 1 = Auto-regression
|
||||
*/
|
||||
int model_id;
|
||||
|
||||
/**
|
||||
* Specifies the bit depth used for the luma component.
|
||||
*/
|
||||
int bit_depth_luma;
|
||||
|
||||
/**
|
||||
* Specifies the bit depth used for the chroma components.
|
||||
*/
|
||||
int bit_depth_chroma;
|
||||
|
||||
enum AVColorRange color_range;
|
||||
enum AVColorPrimaries color_primaries;
|
||||
enum AVColorTransferCharacteristic color_trc;
|
||||
enum AVColorSpace color_space;
|
||||
|
||||
/**
|
||||
* Specifies the blending mode used to blend the simulated film grain
|
||||
* with the decoded images.
|
||||
*
|
||||
* 0 = Additive, 1 = Multiplicative
|
||||
*/
|
||||
int blending_mode_id;
|
||||
|
||||
/**
|
||||
* Specifies a scale factor used in the film grain characterization equations.
|
||||
*/
|
||||
int log2_scale_factor;
|
||||
|
||||
/**
|
||||
* Indicates if the modelling of film grain for a given component is present.
|
||||
*/
|
||||
int component_model_present[3 /* y, cb, cr */];
|
||||
|
||||
/**
|
||||
* Specifies the number of intensity intervals for which a specific set of
|
||||
* model values has been estimated, with a range of [1, 256].
|
||||
*/
|
||||
uint16_t num_intensity_intervals[3 /* y, cb, cr */];
|
||||
|
||||
/**
|
||||
* Specifies the number of model values present for each intensity interval
|
||||
* in which the film grain has been modelled, with a range of [1, 6].
|
||||
*/
|
||||
uint8_t num_model_values[3 /* y, cb, cr */];
|
||||
|
||||
/**
|
||||
* Specifies the lower ounds of each intensity interval for whichthe set of
|
||||
* model values applies for the component.
|
||||
*/
|
||||
uint8_t intensity_interval_lower_bound[3 /* y, cb, cr */][256 /* intensity interval */];
|
||||
|
||||
/**
|
||||
* Specifies the upper bound of each intensity interval for which the set of
|
||||
* model values applies for the component.
|
||||
*/
|
||||
uint8_t intensity_interval_upper_bound[3 /* y, cb, cr */][256 /* intensity interval */];
|
||||
|
||||
/**
|
||||
* Specifies the model values for the component for each intensity interval.
|
||||
* - When model_id == 0, the following applies:
|
||||
* For comp_model_value[y], the range of values is [0, 2^bit_depth_luma - 1]
|
||||
* For comp_model_value[cb..cr], the range of values is [0, 2^bit_depth_chroma - 1]
|
||||
* - Otherwise, the following applies:
|
||||
* For comp_model_value[y], the range of values is [-2^(bit_depth_luma - 1), 2^(bit_depth_luma - 1) - 1]
|
||||
* For comp_model_value[cb..cr], the range of values is [-2^(bit_depth_chroma - 1), 2^(bit_depth_chroma - 1) - 1]
|
||||
*/
|
||||
int16_t comp_model_value[3 /* y, cb, cr */][256 /* intensity interval */][6 /* model value */];
|
||||
} AVFilmGrainH274Params;
|
||||
|
||||
/**
|
||||
* This structure describes how to handle film grain synthesis in video
|
||||
* for specific codecs. Must be present on every frame where film grain is
|
||||
|
@ -143,6 +231,7 @@ typedef struct AVFilmGrainParams {
|
|||
*/
|
||||
union {
|
||||
AVFilmGrainAOMParams aom;
|
||||
AVFilmGrainH274Params h274;
|
||||
} codec;
|
||||
} AVFilmGrainParams;
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
*/
|
||||
|
||||
#define LIBAVUTIL_VERSION_MAJOR 57
|
||||
#define LIBAVUTIL_VERSION_MINOR 1
|
||||
#define LIBAVUTIL_VERSION_MINOR 2
|
||||
#define LIBAVUTIL_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
||||
|
|
Loading…
Add table
Reference in a new issue