[FFmpeg-devel] [PATCH 1/3] - libavcodec/aom_film_grain: Handle byte alignment when multiple film grain parameters sets are present in the bitstream

Segall, Andrew asegall at amazon.com
Fri Sep 20 03:42:47 EEST 2024


More info: Series of patches to align the implementation of aom_film_grain.c with the AOM specification.

First time committing.  Suggestions very welcome.

Signed-off-by: Andrew Segall <asegall at amazon.com <mailto:asegall at amazon.com>>
---
libavcodec/aom_film_grain.c | 12 ++++++++++++
1 file changed, 12 insertions(+)


diff --git a/libavcodec/aom_film_grain.c b/libavcodec/aom_film_grain.c
index e302567ba5..fdfa3dbf77 100644
--- a/libavcodec/aom_film_grain.c
+++ b/libavcodec/aom_film_grain.c
@@ -151,12 +151,24 @@ int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s,


fgp->type = get_bits1(gb) ? AV_FILM_GRAIN_PARAMS_AV1 : AV_FILM_GRAIN_PARAMS_NONE;
if (!fgp->type)
+ {
+ payload_bits = get_bits_count(gb) - start_position;
+ if (payload_bits > payload_size * 8)
+ goto error;
+ skip_bits(gb, payload_size * 8 - payload_bits);
continue;
+ }


fgp->seed = get_bits(gb, 16);
update_grain = get_bits1(gb);
if (!update_grain)
+ {
+ payload_bits = get_bits_count(gb) - start_position;
+ if (payload_bits > payload_size * 8)
+ goto error;
+ skip_bits(gb, payload_size * 8 - payload_bits);
continue;
+ }


apply_units_log2 = get_bits(gb, 4);
fgp->width = get_bits(gb, 12) << apply_units_log2;
-- 
2.46.0







More information about the ffmpeg-devel mailing list