> -----Original Message----- > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf > Of myp...@gmail.com > Sent: Tuesday, May 29, 2018 3:40 PM > To: FFmpeg development discussions and patches <ffmpeg- > de...@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [PATCH] lavfi: add opencl tonemap filter. > > 2018-05-29 13:54 GMT+08:00 Ruiling Song <ruiling.s...@intel.com>: > > This filter does HDR(HDR10/HLG) to SDR conversion with tone-mapping. > > > > An example command to use this filter with vaapi codecs: > > FFMPEG -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device \ > > opencl=ocl@va -hwaccel vaapi -hwaccel_device va - > hwaccel_output_format \ > > vaapi -i INPUT -filter_hw_device ocl -filter_complex \ > > '[0:v]hwmap,tonemap_opencl=t=bt2020:tonemap=linear:format=p010[x1]; > \ > > [x1]hwmap=derive_device=vaapi:reverse=1' -c:v hevc_vaapi -profile 2 > OUTPUT > > > > v2: > > add peak detection. > > > > Signed-off-by: Ruiling Song <ruiling.s...@intel.com> > > +static int tonemap_opencl_config_output(AVFilterLink *outlink) > > +{ > > + AVFilterContext *avctx = outlink->src; > > + TonemapOpenCLContext *s = avctx->priv; > > + int ret; > > + if (s->format == AV_PIX_FMT_NONE) > > + av_log(avctx, AV_LOG_WARNING, "format not set, use default > format NV12\n"); > I think we can give a default format with AV_PIX_FMT_NV12 in > tonemap_opencl_options[] for this case > and I think now we only support NV12/P010 output in current implement. Sounds good.
> > + { "format", "output pixel format", OFFSET(format), > AV_OPT_TYPE_PIXEL_FMT, {.i64 = AV_PIX_FMT_NONE}, > AV_PIX_FMT_NONE, AV_PIX_FMT_GBRAP12LE, FLAGS, "fmt" }, > Missing the sub-option nv12 and p010 ? Seems like using AV_OPT_TYPE_PIXEL_FMT, the framework parsed the user format argument correctly. So I think no need to add sub-options? Thanks! Ruiling > > + { "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 }, > > + { NULL } > > +}; > > + > > +AVFILTER_DEFINE_CLASS(tonemap_opencl); > > + > > +static const AVFilterPad tonemap_opencl_inputs[] = { > > + { > > + .name = "default", > > + .type = AVMEDIA_TYPE_VIDEO, > > + .filter_frame = &tonemap_opencl_filter_frame, > > + .config_props = &ff_opencl_filter_config_input, > > + }, > > + { NULL } > > +}; > > + > > +static const AVFilterPad tonemap_opencl_outputs[] = { > > + { > > + .name = "default", > > + .type = AVMEDIA_TYPE_VIDEO, > > + .config_props = &tonemap_opencl_config_output, > > + }, > > + { NULL } > > +}; > > + > > +AVFilter ff_vf_tonemap_opencl = { > > + .name = "tonemap_opencl", > > + .description = NULL_IF_CONFIG_SMALL("perform HDR to SDR > conversion with tonemapping"), > > + .priv_size = sizeof(TonemapOpenCLContext), > > + .priv_class = &tonemap_opencl_class, > > + .init = &ff_opencl_filter_init, > > + .uninit = &tonemap_opencl_uninit, > > + .query_formats = &ff_opencl_filter_query_formats, > > + .inputs = tonemap_opencl_inputs, > > + .outputs = tonemap_opencl_outputs, > > + .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, > > +}; > > -- > > 2.7.4 > > > > _______________________________________________ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel