[FFmpeg-devel] [PATCH] Fix vf_cropdetect returning negative rectangles
hjiodjf 97xgw46
jfbvxt at gmail.com
Mon Sep 8 20:16:49 CEST 2014
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:
>> The cropdetect filter is prone to reporting negative-sized rectangles,
>> particularly for dark images. This patch adjusts the limits of the
>> filter loops, preventing the left/right and top/bottom offsets from
>> crossing each other, so that such a zero-sized rectangle is reported
>> instead of a negative one. This improves the reliability of using
>> cropdetect to find a maximum bounding rectangle.
>
> why would this improve the reliability of using the values ?
>
> i think its mostly a question if when no rectangle is found
> negative w/h is returned or 0,0 with a random x/y
> i dont know which is better but this patch also reduces the amount
> of computations in that case so i tend toward applying it
>
>
>> vf_cropdetect.c | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>> 07877d20186041d6ad44359d10c2c079ba954d06 0001-Prevent-vf_cropdetect-from-returning-negative-rectan.patch
>> From 971e0ec056e6200064598dbca49c18b8653e08d4 Mon Sep 17 00:00:00 2001
>> From: tue46wsdgxfjrt <jfbvxt at gmail.com>
>> Date: Tue, 2 Sep 2014 13:57:45 -0700
>> Subject: [PATCH] Prevent vf_cropdetect from returning negative rectangle
>> sizes.
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Into a blind darkness they enter who follow after the Ignorance,
> they as if into a greater darkness enter who devote themselves
> to the Knowledge alone. -- Isha Upanishad
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
I think this change should be made because I don't see a reason not to
make it. Negative values are confusing (and not documented), and if
the parameters are passed directly into another application (e.g.
Avisynth), unexpected behavior could occur instead of just getting an
empty frame or error message.
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.
More information about the ffmpeg-devel
mailing list