[FFmpeg-devel] [PATCH 3/3] - libavcodec/aom_film_grain: Mark AFGS1 parameters in the current message as eligible for selection

Segall, Andrew asegall at amazon.com
Fri Sep 20 03:45:31 EEST 2024


Details: Limit selection of the film grain parameters to (only) those received in the current message.

Signed-off-by: Andrew Segall <asegall at amazon.com <mailto:asegall at amazon.com>>
---
libavcodec/aom_film_grain.c | 7 +++++++
libavutil/film_grain_params.h | 5 +++++
2 files changed, 12 insertions(+)


diff --git a/libavcodec/aom_film_grain.c b/libavcodec/aom_film_grain.c
index 251a2793ac..1096069922 100644
--- a/libavcodec/aom_film_grain.c
+++ b/libavcodec/aom_film_grain.c
@@ -127,6 +127,12 @@ int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s,
AVFilmGrainParams *fgp, *ref = NULL;
int ret, num_sets, n, i, uv, num_y_coeffs, update_grain, luma_only;


+ // Mark existing film grain parameters as ineligible for use in the current frame
+ for(n =0; n < 8; n++) {
+ if( s->sets[n].type == AV_FILM_GRAIN_PARAMS_AV1 )
+ s->sets[n].type = AV_FILM_GRAIN_PARAMS_AV1_INACTIVE;
+ }
+
ret = init_get_bits8(gb, payload, payload_size);
if (ret < 0)
return ret;
@@ -149,6 +155,7 @@ int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s,
fgp = &s->sets[set_idx];
aom = &fgp->codec.aom;


+ // Mark current film grain parameters as eligible for selection in the current frame
fgp->type = AV_FILM_GRAIN_PARAMS_AV1;


fgp->apply_grain = get_bits1(gb);
diff --git a/libavutil/film_grain_params.h b/libavutil/film_grain_params.h
index f3275923e1..1b507829fe 100644
--- a/libavutil/film_grain_params.h
+++ b/libavutil/film_grain_params.h
@@ -29,6 +29,11 @@ enum AVFilmGrainParamsType {
*/
AV_FILM_GRAIN_PARAMS_AV1,


+ /**
+ *
+ */
+ AV_FILM_GRAIN_PARAMS_AV1_INACTIVE,
+
/**
* The union is valid when interpreted as AVFilmGrainH274Params (codec.h274)
*/
-- 
2.46.0







More information about the ffmpeg-devel mailing list