diff mbox

[FFmpeg-devel,4/4] lavfi/opencl: remove peak option of tonemap_opencl

Message ID 1540790282-29764-4-git-send-email-ruiling.song@intel.com
State New
Headers show

Commit Message

Ruiling Song Oct. 29, 2018, 5:18 a.m. UTC
Since the filter use auto-calculate the peak value,
the option does not work as expected. So, remove it.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
---
 libavfilter/vf_tonemap_opencl.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

mypopy@gmail.com Oct. 30, 2018, 7:43 a.m. UTC | #1
On Mon, Oct 29, 2018 at 1:21 PM Ruiling Song <ruiling.song@intel.com> wrote:
>
> Since the filter use auto-calculate the peak value,
> the option does not work as expected. So, remove it.
>
> Signed-off-by: Ruiling Song <ruiling.song@intel.com>
> ---
>  libavfilter/vf_tonemap_opencl.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/libavfilter/vf_tonemap_opencl.c
b/libavfilter/vf_tonemap_opencl.c
> index cd293c2..88b3107 100644
> --- a/libavfilter/vf_tonemap_opencl.c
> +++ b/libavfilter/vf_tonemap_opencl.c
> @@ -62,7 +62,6 @@ typedef struct TonemapOpenCLContext {
>
>      enum TonemapAlgorithm tonemap;
>      enum AVPixelFormat    format;
> -    double                peak;
>      double                param;
>      double                desat_param;
>      double                target_peak;
> @@ -349,7 +348,7 @@ static int tonemap_opencl_filter_frame(AVFilterLink
*inlink, AVFrame *input)
>      AVFrame *output = NULL;
>      cl_int cle;
>      int err;
> -    double peak = ctx->peak;
> +    double peak;
>
>      AVHWFramesContext *input_frames_ctx =
>          (AVHWFramesContext*)input->hw_frames_ctx->data;
> @@ -371,8 +370,7 @@ static int tonemap_opencl_filter_frame(AVFilterLink
*inlink, AVFrame *input)
>      if (err < 0)
>          goto fail;
>
> -    if (!peak)
> -        peak = ff_determine_signal_peak(input);
> +    peak = ff_determine_signal_peak(input);
>
>      if (ctx->trc != -1)
>          output->color_trc = ctx->trc;
> @@ -518,7 +516,6 @@ static const AVOption tonemap_opencl_options[] = {
>      {     "limited",       0,       0,
AV_OPT_TYPE_CONST, {.i64 = AVCOL_RANGE_MPEG},         0, 0, FLAGS, "range"
},
>      {     "full",          0,       0,
AV_OPT_TYPE_CONST, {.i64 = AVCOL_RANGE_JPEG},         0, 0, FLAGS, "range"
},
>      { "format",    "output pixel format", OFFSET(format),
AV_OPT_TYPE_PIXEL_FMT, {.i64 = AV_PIX_FMT_NONE}, AV_PIX_FMT_NONE, INT_MAX,
FLAGS, "fmt" },
> -    { "peak",      "signal peak override", OFFSET(peak),
AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, DBL_MAX, FLAGS },
>      { "param",     "tonemap parameter",   OFFSET(param),
AV_OPT_TYPE_DOUBLE, {.dbl = NAN}, DBL_MIN, DBL_MAX, FLAGS },
>      { "desat",     "desaturation parameter",   OFFSET(desat_param),
AV_OPT_TYPE_DOUBLE, {.dbl = 0.5}, 0, DBL_MAX, FLAGS },
>      { "threshold", "scene detection threshold",
OFFSET(scene_threshold), AV_OPT_TYPE_DOUBLE, {.dbl = 0.2}, 0, DBL_MAX,
FLAGS },
> --
LGTM if we don't use this option
diff mbox

Patch

diff --git a/libavfilter/vf_tonemap_opencl.c b/libavfilter/vf_tonemap_opencl.c
index cd293c2..88b3107 100644
--- a/libavfilter/vf_tonemap_opencl.c
+++ b/libavfilter/vf_tonemap_opencl.c
@@ -62,7 +62,6 @@  typedef struct TonemapOpenCLContext {
 
     enum TonemapAlgorithm tonemap;
     enum AVPixelFormat    format;
-    double                peak;
     double                param;
     double                desat_param;
     double                target_peak;
@@ -349,7 +348,7 @@  static int tonemap_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
     AVFrame *output = NULL;
     cl_int cle;
     int err;
-    double peak = ctx->peak;
+    double peak;
 
     AVHWFramesContext *input_frames_ctx =
         (AVHWFramesContext*)input->hw_frames_ctx->data;
@@ -371,8 +370,7 @@  static int tonemap_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
     if (err < 0)
         goto fail;
 
-    if (!peak)
-        peak = ff_determine_signal_peak(input);
+    peak = ff_determine_signal_peak(input);
 
     if (ctx->trc != -1)
         output->color_trc = ctx->trc;
@@ -518,7 +516,6 @@  static const AVOption tonemap_opencl_options[] = {
     {     "limited",       0,       0,                 AV_OPT_TYPE_CONST, {.i64 = AVCOL_RANGE_MPEG},         0, 0, FLAGS, "range" },
     {     "full",          0,       0,                 AV_OPT_TYPE_CONST, {.i64 = AVCOL_RANGE_JPEG},         0, 0, FLAGS, "range" },
     { "format",    "output pixel format", OFFSET(format), AV_OPT_TYPE_PIXEL_FMT, {.i64 = AV_PIX_FMT_NONE}, AV_PIX_FMT_NONE, INT_MAX, FLAGS, "fmt" },
-    { "peak",      "signal peak override", OFFSET(peak), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, DBL_MAX, FLAGS },
     { "param",     "tonemap parameter",   OFFSET(param), AV_OPT_TYPE_DOUBLE, {.dbl = NAN}, DBL_MIN, DBL_MAX, FLAGS },
     { "desat",     "desaturation parameter",   OFFSET(desat_param), AV_OPT_TYPE_DOUBLE, {.dbl = 0.5}, 0, DBL_MAX, FLAGS },
     { "threshold", "scene detection threshold",   OFFSET(scene_threshold), AV_OPT_TYPE_DOUBLE, {.dbl = 0.2}, 0, DBL_MAX, FLAGS },