[FFmpeg-devel] [PATCH] Fix vf_cropdetect returning negative rectangles
Michael Niedermayer
michaelni at gmx.at
Wed Sep 10 03:29:10 CEST 2014
On Tue, Sep 09, 2014 at 06:10:01PM -0700, hjiodjf 97xgw46 wrote:
> On Mon, Sep 8, 2014 at 5:21 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > On Mon, Sep 08, 2014 at 11:16:49AM -0700, hjiodjf 97xgw46 wrote:
> >> On Thu, Sep 4, 2014 at 1:08 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> >> > On Tue, Sep 02, 2014 at 02:20:40PM -0700, hjiodjf 97xgw46 wrote:
> > [...]
> >
> >> Moreover, as you said, this patch reduces the number of passes through
> >> a blank frame from 4 to 2, which should improve performance on movies
> >> with many dark scenes.
> >
> > yes but thats seperate from what values are output for blank frames
> >
> > should be fixed so it only needs 2 passes now
> >
> > [...]
> >
> > --
> > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >
> > When the tyrant has disposed of foreign enemies by conquest or treaty, and
> > there is nothing more to fear from them, then he is always stirring up
> > some war or other, in order that the people may require a leader. -- Plato
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
>
> I was not aware that the cropdetect filter was designed to prevent
> shrinking the window over a given number of frames. I have attached a
> revised patch that prevents negative window sizes based on your patch.
> I still believe that negative windows should be avoided. My reasoning
> for this was provided in my previous email.
> vf_cropdetect.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
> 9b9f96427726e38cd3ae5d1f2fc7d77307bbc366 0001-Avoid-returning-negative-rectangles-from-cropdetect.patch
> From e86c0bd1b2f855c53c78be0a7269e1132bc1daf6 Mon Sep 17 00:00:00 2001
> From: tue46wsdgxfjrt <jfbvxt at gmail.com>
> Date: Tue, 9 Sep 2014 18:05:44 -0700
> Subject: [PATCH] Avoid returning negative rectangles from cropdetect
>
> ---
> libavfilter/vf_cropdetect.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c
> index 76aa7b2..4b6ee91 100644
> --- a/libavfilter/vf_cropdetect.c
> +++ b/libavfilter/vf_cropdetect.c
> @@ -106,8 +106,8 @@ static int config_input(AVFilterLink *inlink)
>
> s->x1 = inlink->w - 1;
> s->y1 = inlink->h - 1;
> - s->x2 = 0;
> - s->y2 = 0;
> + s->x2 = s->x1;
> + s->y2 = s->y1;
>
> return 0;
> }
> @@ -131,8 +131,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
> if (s->reset_count > 0 && s->frame_nb > s->reset_count) {
> s->x1 = frame->width - 1;
> s->y1 = frame->height - 1;
> - s->x2 = 0;
> - s->y2 = 0;
> + s->x2 = s->x1;
> + s->y2 = s->y1;
> s->frame_nb = 1;
> }
this will simply break the code, not just affect negative dimensions
just compare the output of cropdetect from before this change to
afterwards
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Those who are best at talking, realize last or never when they are wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140910/2978d791/attachment.asc>
More information about the ffmpeg-devel
mailing list