This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 6a56bd03620f7a6cdc934a34f17568e95f25fe19 Author: Niklas Haas <[email protected]> AuthorDate: Fri Jul 24 14:34:46 2026 +0200 Commit: Niklas Haas <[email protected]> CommitDate: Mon Aug 3 09:32:30 2026 +0000 swscale/lut3d: use refstruct for 3D LUT allocations Needed anyways for the upcoming SWS_OP_LUT_3D. Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas <[email protected]> --- libswscale/graph.c | 6 +++--- libswscale/lut3d.c | 10 ++++------ libswscale/lut3d.h | 4 +++- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libswscale/graph.c b/libswscale/graph.c index b9d5df3b48..4cfe87ea31 100644 --- a/libswscale/graph.c +++ b/libswscale/graph.c @@ -682,7 +682,7 @@ static int add_convert_pass(SwsGraph *graph, const SwsFormat *src, static void free_lut3d(void *priv) { SwsLut3D *lut = priv; - ff_sws_lut3d_free(&lut); + av_refstruct_unref(&lut); } static int setup_lut3d(const SwsFrame *out, const SwsFrame *in, const SwsPass *pass) @@ -753,14 +753,14 @@ static int adapt_colors(SwsGraph *graph, const SwsFormat *src_fmt, tmp.format = fmt_in; ret = add_convert_pass(graph, &src, &tmp, input, &input); if (ret < 0) { - ff_sws_lut3d_free(&lut); + av_refstruct_unref(&lut); return ret; } } ret = ff_sws_lut3d_generate(lut, fmt_in, fmt_out, &map); if (ret < 0) { - ff_sws_lut3d_free(&lut); + av_refstruct_unref(&lut); return ret; } diff --git a/libswscale/lut3d.c b/libswscale/lut3d.c index e521bc4439..1b1b11aa4c 100644 --- a/libswscale/lut3d.c +++ b/libswscale/lut3d.c @@ -24,6 +24,7 @@ #include "libavutil/attributes.h" #include "libavutil/avassert.h" #include "libavutil/mem.h" +#include "libavutil/refstruct.h" #include "cms.h" #include "csputils.h" @@ -31,19 +32,16 @@ SwsLut3D *ff_sws_lut3d_alloc(void) { - SwsLut3D *lut3d = av_malloc(sizeof(*lut3d)); + const int flags = AV_REFSTRUCT_FLAG_NO_ZEROING; + SwsLut3D *lut3d = av_refstruct_alloc_ext(sizeof(*lut3d), flags, NULL, NULL); if (!lut3d) return NULL; + lut3d->map = (SwsColorMap) {0}; lut3d->dynamic = false; return lut3d; } -void ff_sws_lut3d_free(SwsLut3D **plut3d) -{ - av_freep(plut3d); -} - bool ff_sws_lut3d_test_fmt(enum AVPixelFormat fmt, int output) { return fmt == AV_PIX_FMT_RGBA64; diff --git a/libswscale/lut3d.h b/libswscale/lut3d.h index 9e8381a2c0..660dc08f26 100644 --- a/libswscale/lut3d.h +++ b/libswscale/lut3d.h @@ -59,8 +59,10 @@ typedef struct SwsLut3D { v2u16_t tone_map[TONE_LUT_SIZE + 1]; /* new luma, desaturation */ } SwsLut3D; +/** + * Allocates a refstruct. Note that the LUT contents are not initialized. + */ SwsLut3D *ff_sws_lut3d_alloc(void); -void ff_sws_lut3d_free(SwsLut3D **lut3d); /** * Test to see if a given format is supported by the 3DLUT input/output code. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
