Message ID | 0101018c1d9beab2-9b0cc1e6-c7e1-4e20-af1c-2b5bac4822f2-000000@us-west-2.amazonses.com |
---|---|
State | New |
Headers | show |
Series | consider chroma subsampling for bwdif (including CUDA and Vulkan) | expand |
Context | Check | Description |
---|---|---|
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_x86 | warning | New warnings during build |
Am Do., 30. Nov. 2023 um 01:23 Uhr schrieb Cosmin Stejerean via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>: > From: Cosmin Stejerean <cosmin@cosmin.at> > > Fixes #10688 > > Signed-off-by: Cosmin Stejerean <cosmin@cosmin.at> > --- > libavfilter/vf_bwdif.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c > index 137cd5ef13..80aa85a48b 100644 > --- a/libavfilter/vf_bwdif.c > +++ b/libavfilter/vf_bwdif.c > @@ -191,12 +191,19 @@ static int config_props(AVFilterLink *link) > return ret; > } > > - if (link->w < 3 || link->h < 4) { > - av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or 4 > lines is not supported\n"); > + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format); > + > + int h = link->h; > + int w = link->w; > + int h_chroma = AV_CEIL_RSHIFT(h, desc->log2_chroma_h); > + int w_chroma = AV_CEIL_RSHIFT(w, desc->log2_chroma_w); > + > + if (w < 3 || w_chroma < 3 || h < 4 || h_chroma < 4) { > + av_log(ctx, AV_LOG_ERROR, "Video with planes less than 3 columns > or 4 lines is not supported\n"); > return AVERROR(EINVAL); > } > > - yadif->csp = av_pix_fmt_desc_get(link->format); > + yadif->csp = desc; > yadif->filter = filter; > ff_bwdif_init_filter_line(&s->dsp, yadif->csp->comp[0].depth); > > I think mixed declarations are not allowed. Also log2_chroma_w/h should never be negative, so why not just do: if (AV_CEIL_RSHIFT(link->w, yadif->csp->log2_chroma_w) < 3 || AV_CEIL_RSHIFT(link->h, yadif->csp->log2_chroma_h) < 4) Regards, Thomas
On Nov 30, 2023, at 04:37, Thomas Mundt <tmundt75@gmail.com> wrote: Am Do., 30. Nov. 2023 um 01:23 Uhr schrieb Cosmin Stejerean via ffmpeg-devel <ffmpeg-devel@ffmpeg.org <mailto:ffmpeg-devel@ffmpeg.org> >: From: Cosmin Stejerean <cosmin@cosmin.at <mailto:cosmin@cosmin.at> > Fixes #10688 Signed-off-by: Cosmin Stejerean <cosmin@cosmin.at <mailto:cosmin@cosmin.at> > --- libavfilter/vf_bwdif.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c index 137cd5ef13..80aa85a48b 100644 --- a/libavfilter/vf_bwdif.c +++ b/libavfilter/vf_bwdif.c @@ -191,12 +191,19 @@ static int config_props(AVFilterLink *link) return ret; } - if (link->w < 3 || link->h < 4) { - av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or 4 lines is not supported\n"); + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format); + + int h = link->h; + int w = link->w; + int h_chroma = AV_CEIL_RSHIFT(h, desc->log2_chroma_h); + int w_chroma = AV_CEIL_RSHIFT(w, desc->log2_chroma_w); + + if (w < 3 || w_chroma < 3 || h < 4 || h_chroma < 4) { + av_log(ctx, AV_LOG_ERROR, "Video with planes less than 3 columns or 4 lines is not supported\n"); return AVERROR(EINVAL); } - yadif->csp = av_pix_fmt_desc_get(link->format); + yadif->csp = desc; yadif->filter = filter; ff_bwdif_init_filter_line(&s->dsp, yadif->csp->comp[0].depth); I think mixed declarations are not allowed. Also log2_chroma_w/h should never be negative, so why not just do: if (AV_CEIL_RSHIFT(link->w, yadif->csp->log2_chroma_w) < 3 || AV_CEIL_RSHIFT(link->h, yadif->csp->log2_chroma_h) < 4) Thank you for the prompt feedback, makes a lot of sense to me, will update in v3. - Cosmin
diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c index 137cd5ef13..80aa85a48b 100644 --- a/libavfilter/vf_bwdif.c +++ b/libavfilter/vf_bwdif.c @@ -191,12 +191,19 @@ static int config_props(AVFilterLink *link) return ret; } - if (link->w < 3 || link->h < 4) { - av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or 4 lines is not supported\n"); + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format); + + int h = link->h; + int w = link->w; + int h_chroma = AV_CEIL_RSHIFT(h, desc->log2_chroma_h); + int w_chroma = AV_CEIL_RSHIFT(w, desc->log2_chroma_w); + + if (w < 3 || w_chroma < 3 || h < 4 || h_chroma < 4) { + av_log(ctx, AV_LOG_ERROR, "Video with planes less than 3 columns or 4 lines is not supported\n"); return AVERROR(EINVAL); } - yadif->csp = av_pix_fmt_desc_get(link->format); + yadif->csp = desc; yadif->filter = filter; ff_bwdif_init_filter_line(&s->dsp, yadif->csp->comp[0].depth);