diff mbox series

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

Message ID 9EA48E88-54C5-45DD-81BE-EC486940112D@amazon.com
State New
Headers show
Series [FFmpeg-devel,1/3] - libavcodec/aom_film_grain: Handle byte alignment when multiple film grain parameters sets are present in the bitstream | expand

Checks

Context Check Description
yinshiyou/configure_loongarch64 warning Failed to apply patch
andriy/configure_x86 warning Failed to apply patch

Commit Message

Segall, Andrew via ffmpeg-devel Sept. 20, 2024, 12:45 a.m. UTC
Details: Limit selection of the film grain parameters to (only) those received in the current message.

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


*/
diff mbox series

Patch

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)