[FFmpeg-devel] [PATCH 2/3] avcodec/aom_film_grain: use av_frame_side_data_add() where useful

James Almer jamrial at gmail.com
Thu Jan 2 17:10:18 EET 2025


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/aom_film_grain.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/libavcodec/aom_film_grain.c b/libavcodec/aom_film_grain.c
index 1b1693dcd9..d5ea75f61c 100644
--- a/libavcodec/aom_film_grain.c
+++ b/libavcodec/aom_film_grain.c
@@ -362,17 +362,13 @@ int ff_aom_attach_film_grain_sets(const AVFilmGrainAFGS1Params *s, AVFrame *fram
         return 0;
 
     for (int i = 0; i < FF_ARRAY_ELEMS(s->sets); i++) {
-        AVBufferRef *buf;
-
         if (!s->sets[i])
             continue;
 
-        buf = av_buffer_ref(s->sets[i]);
-        if (!buf || !av_frame_new_side_data_from_buf(frame,
-                                                     AV_FRAME_DATA_FILM_GRAIN_PARAMS, buf)) {
-            av_buffer_unref(&buf);
+        if (!av_frame_side_data_add(&frame->side_data, &frame->nb_side_data,
+                                    AV_FRAME_DATA_FILM_GRAIN_PARAMS, &s->sets[i],
+                                    AV_FRAME_SIDE_DATA_FLAG_NEW_REF))
             return AVERROR(ENOMEM);
-        }
     }
 
     return 0;
-- 
2.47.1



More information about the ffmpeg-devel mailing list