Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter/vf_bwdif: consider chroma subsampling when enforcing minimum dimensions
On Nov 30, 2023, at 04:37, Thomas Mundt wrote: Am Do., 30. Nov. 2023 um 01:23 Uhr schrieb Cosmin Stejerean via ffmpeg-devel mailto:ffmpeg-devel@ffmpeg.org> >: From: Cosmin Stejerean mailto:cos...@cosmin.at> > Fixes #10688 Signed-off-by: Cosmin Stejerean mailto:cos...@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(>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 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter/vf_bwdif: consider chroma subsampling when enforcing minimum dimensions
Am Do., 30. Nov. 2023 um 01:23 Uhr schrieb Cosmin Stejerean via ffmpeg-devel : > From: Cosmin Stejerean > > Fixes #10688 > > Signed-off-by: Cosmin Stejerean > --- > 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(>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 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 1/3] avfilter/vf_bwdif: consider chroma subsampling when enforcing minimum dimensions
From: Cosmin Stejerean Fixes #10688 Signed-off-by: Cosmin Stejerean --- 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(>dsp, yadif->csp->comp[0].depth); -- 2.42.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".