[FFmpeg-devel] [PATCH] avfilter/vf_cropdetect: add ability to change limit/reset at runtime

Jeffrey Chapuis ashyni1987 at gmail.com
Thu Jan 19 14:11:25 EET 2023


On 17/01/2023 19:11, Paul B Mahol wrote:
> On 1/17/23, Jeffrey Chapuis <ashyni1987 at gmail.com> wrote:
>> I'm getting there, don't give up on me.
>>
>> Now 'limit_upscaled' become the variable used in filter_frame() and
>> 'limit' is never change, unless by user
>> We only have to update 'limit_upscaled' if 'limit' really changes.
> 
> probably ok

>-    if (s->limit < 1.0)
>-        s->limit *= (1 << desc->comp[0].depth) - 1;
>+    s->bitdepth = desc->comp[0].depth;
>+    s->limit_upscaled = s->limit;
>+    if (s->limit_upscaled < 1.0)
>+        s->limit_upscaled *= (1 << s->bitdepth) - 1;

Is it better like this? we avoid a double assignment.

-    if (s->limit < 1.0)
-        s->limit *= (1 << desc->comp[0].depth) - 1;
+    s->bitdepth = desc->comp[0].depth;
+
+    if (s->limit_upscaled < 1.0)
+        s->limit_upscaled = s->limit * (1 << s->bitdepth) - 1;
+    else
+        s->limit_upscaled = s->limit;

The full patch without this change is in the previous reply
(https://ffmpeg.org/pipermail/ffmpeg-devel/2023-January/305806.html),
let me know if there is other change to make with formatting/renaming.
I really appreciate your patience with this patch.


More information about the ffmpeg-devel mailing list