aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2021-07-23 11:06:31 -0300
committerJames Almer <jamrial@gmail.com>2021-07-23 11:06:31 -0300
commite3b5ff17c2e54d557d2c897aa7e491ea4d3df708 (patch)
tree9b44d30ae13b79c29fec9e03530ad138e2393619
parent41d1dba4d281aafc4c67aa24ddb1798b25f1e27f (diff)
downloadffmpeg-e3b5ff17c2e54d557d2c897aa7e491ea4d3df708.tar.gz
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>
-rw-r--r--doc/APIchanges3
-rw-r--r--libavutil/film_grain_params.h89
-rw-r--r--libavutil/version.h2
3 files changed, 93 insertions, 1 deletions
diff --git a/doc/APIchanges b/doc/APIchanges
index 308e2d5061..9506059ac0 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -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()
diff --git a/libavutil/film_grain_params.h b/libavutil/film_grain_params.h
index 7629e3a041..7350dfc5b8 100644
--- a/libavutil/film_grain_params.h
+++ b/libavutil/film_grain_params.h
@@ -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,
};
/**
@@ -118,6 +123,89 @@ typedef struct AVFilmGrainAOMParams {
} 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
* meant to be synthesised for correct presentation.
@@ -143,6 +231,7 @@ typedef struct AVFilmGrainParams {
*/
union {
AVFilmGrainAOMParams aom;
+ AVFilmGrainH274Params h274;
} codec;
} AVFilmGrainParams;
diff --git a/libavutil/version.h b/libavutil/version.h
index 34b83112de..77ca4becd6 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -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, \