[FFmpeg-cvslog] avcodec/aom_film_grain: use av_frame_side_data_add() where useful

James Almer git at videolan.org
Fri Jan 10 20:14:46 EET 2025


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Jan  2 12:10:18 2025 -0300| [f635f19537bd6f34ce05e685e1f5fa61cb0e5cca] | committer: James Almer

avcodec/aom_film_grain: use av_frame_side_data_add() where useful

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f635f19537bd6f34ce05e685e1f5fa61cb0e5cca
---

 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;



More information about the ffmpeg-cvslog mailing list