From: ashk43712 <ashk43...@gmail.com> Hi, this patch fixes the seg fault which ocuured while running libvmaf filter with option psnr=1. This also improves libvmaf doc a bit.
Signed-off-by: ashk43712 <ashk43...@gmail.com> --- doc/filters.texi | 19 ++++++------------- libavfilter/vf_libvmaf.c | 7 ++++--- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index e26dde4b1a..90790c2261 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -9885,25 +9885,16 @@ distances from the focal point in the source and target images, respectively. @section libvmaf -Obtain the average VMAF (Video Multi-Method Assessment Fusion) +Obtain the VMAF (Video Multi-Method Assessment Fusion) score between two input videos. -This filter takes two input videos. - -Both video inputs must have the same resolution and pixel format for -this filter to work correctly. Also it assumes that both inputs -have the same number of frames, which are compared one by one. - -The obtained average VMAF score is printed through the logging system. +The obtained VMAF score is printed through the logging system. It requires Netflix's vmaf library (libvmaf) as a pre-requisite. After installing the library it can be enabled using: @code{./configure --enable-libvmaf}. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}. -On the below examples the input file @file{main.mpg} being processed is -compared with the reference file @file{ref.mpg}. - The filter has following options: @table @option @@ -9934,12 +9925,14 @@ Enables computing ssim along with vmaf. Enables computing ms_ssim along with vmaf. @item pool -Set the pool method to be used for computing vmaf. +Set the pool method (mean, min or harmonic mean) to be used for computing vmaf. @end table This filter also supports the @ref{framesync} options. -For example: +On the below examples the input file @file{main.mpg} being processed is +compared with the reference file @file{ref.mpg}. + @example ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null - @end example diff --git a/libavfilter/vf_libvmaf.c b/libavfilter/vf_libvmaf.c index 2c3a9f3349..7670c51e21 100644 --- a/libavfilter/vf_libvmaf.c +++ b/libavfilter/vf_libvmaf.c @@ -40,7 +40,6 @@ typedef struct LIBVMAFContext { const AVClass *class; FFFrameSync fs; const AVPixFmtDescriptor *desc; - char *format; int width; int height; double vmaf_score; @@ -149,6 +148,7 @@ static void compute_vmaf_score(LIBVMAFContext *s) { int (*read_frame)(float *ref_data, float *main_data, float *temp_data, int stride, void *ctx); + char *format; if (s->desc->comp[0].depth <= 8) { read_frame = read_frame_8bit; @@ -156,7 +156,9 @@ static void compute_vmaf_score(LIBVMAFContext *s) read_frame = read_frame_10bit; } - s->vmaf_score = compute_vmaf(s->format, s->width, s->height, read_frame, s, + format = (char *) s->desc->name; + + s->vmaf_score = compute_vmaf(format, s->width, s->height, read_frame, s, s->model_path, s->log_path, s->log_fmt, 0, 0, s->enable_transform, s->phone_model, s->psnr, s->ssim, s->ms_ssim, s->pool); @@ -258,7 +260,6 @@ static int config_input_ref(AVFilterLink *inlink) return 0; } - static int config_output(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; -- 2.11.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel