diff options
author | Paul B Mahol <onemda@gmail.com> | 2023-02-06 14:57:50 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2023-02-12 13:32:00 +0100 |
commit | e506ea3ce1de0c782b2b833398240c8e19a02bb4 (patch) | |
tree | 09a019d09e096300024c435d15c3485d319bad04 /libavfilter/vf_signalstats.c | |
parent | 78f46065d861eb8487124e92ab46a459426eb89c (diff) | |
download | ffmpeg-e506ea3ce1de0c782b2b833398240c8e19a02bb4.tar.gz |
avfilter: use ff_inlink_make_frame_writable()
Diffstat (limited to 'libavfilter/vf_signalstats.c')
-rw-r--r-- | libavfilter/vf_signalstats.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/libavfilter/vf_signalstats.c b/libavfilter/vf_signalstats.c index e6f84be9ba..b4d1029296 100644 --- a/libavfilter/vf_signalstats.c +++ b/libavfilter/vf_signalstats.c @@ -23,6 +23,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" +#include "filters.h" #include "internal.h" enum FilterMode { @@ -565,7 +566,7 @@ static int filter_frame8(AVFilterLink *link, AVFrame *in) int tothue = 0; int dify = 0, difu = 0, difv = 0; uint16_t masky = 0, masku = 0, maskv = 0; - + int ret; int filtot[FILT_NUMB] = {0}; AVFrame *prev; @@ -588,7 +589,16 @@ static int filter_frame8(AVFilterLink *link, AVFrame *in) if (s->outfilter != FILTER_NONE) { out = av_frame_clone(in); - av_frame_make_writable(out); + if (!out) { + av_frame_free(&in); + return AVERROR(ENOMEM); + } + ret = ff_inlink_make_frame_writable(link, &out); + if (ret < 0) { + av_frame_free(&out); + av_frame_free(&in); + return ret; + } } ff_filter_execute(ctx, compute_sat_hue_metrics8, &td_huesat, @@ -790,7 +800,7 @@ static int filter_frame16(AVFilterLink *link, AVFrame *in) int filtot[FILT_NUMB] = {0}; AVFrame *prev; - + int ret; AVFrame *sat = s->frame_sat; AVFrame *hue = s->frame_hue; const uint16_t *p_sat = (uint16_t *)sat->data[0]; @@ -810,7 +820,16 @@ static int filter_frame16(AVFilterLink *link, AVFrame *in) if (s->outfilter != FILTER_NONE) { out = av_frame_clone(in); - av_frame_make_writable(out); + if (!out) { + av_frame_free(&in); + return AVERROR(ENOMEM); + } + ret = ff_inlink_make_frame_writable(link, &out); + if (ret < 0) { + av_frame_free(&out); + av_frame_free(&in); + return ret; + } } ff_filter_execute(ctx, compute_sat_hue_metrics16, &td_huesat, |