[FFmpeg-devel] [PATCH 3/4] avfilter/vf_exposure: calculate scale when initializing filter

Wu Jianhua jianhua.wu at intel.com
Fri Oct 22 11:52:30 EEST 2021


Signed-off-by: Wu Jianhua <jianhua.wu at intel.com>
---
 libavfilter/vf_exposure.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavfilter/vf_exposure.c b/libavfilter/vf_exposure.c
index 045ae710d3..9fd9f88293 100644
--- a/libavfilter/vf_exposure.c
+++ b/libavfilter/vf_exposure.c
@@ -57,6 +57,7 @@ static int exposure_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
 
 void ff_exposure_init(ExposureContext *s)
 {
+    s->scale = 1.f / (exp2f(-s->exposure) - s->black);
     s->exposure_func = exposure_c;
 
     if (ARCH_X86)
@@ -66,9 +67,7 @@ void ff_exposure_init(ExposureContext *s)
 static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
 {
     AVFilterContext *ctx = inlink->dst;
-    ExposureContext *s = ctx->priv;
 
-    s->scale = 1.f / (exp2f(-s->exposure) - s->black);
     ff_filter_execute(ctx, exposure_slice, frame, NULL,
                       FFMIN(frame->height, ff_filter_get_nb_threads(ctx)));
 
-- 
2.17.1



More information about the ffmpeg-devel mailing list