diff mbox series

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

Message ID 20211022085231.93931-3-jianhua.wu@intel.com
State New
Headers show
Series [FFmpeg-devel,1/4] avfilter/x86/vf_exposure: add x86 SIMD optimization
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Wu Jianhua Oct. 22, 2021, 8:52 a.m. UTC
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
---
 libavfilter/vf_exposure.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Paul B Mahol Oct. 22, 2021, 8:58 a.m. UTC | #1
NACK, exposure can be changed at runtime.
Wu Jianhua Oct. 22, 2021, 9:51 a.m. UTC | #2
Paul B Mahol wrote:
> Sent: Friday, October 22, 2021 4:59 PM
> To: FFmpeg development discussions and patches <ffmpeg-
> devel@ffmpeg.org>
> Cc: Wu, Jianhua <jianhua.wu@intel.com>
> Subject: Re: [FFmpeg-devel] [PATCH 3/4] avfilter/vf_exposure: calculate
> scale when initializing filter
> 
> NACK, exposure can be changed at runtime.
> 
Yeah, my bad. I noticed the AV_OPT_FLAG_RUNTIME_PARAM flag. I have an idea of it now.

Thanks,
Jianhua
diff mbox series

Patch

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)));