From patchwork Wed Oct 11 13:53:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashish Singh X-Patchwork-Id: 5534 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp727336jah; Wed, 11 Oct 2017 06:54:27 -0700 (PDT) X-Received: by 10.223.132.135 with SMTP id 7mr9631684wrg.74.1507730067054; Wed, 11 Oct 2017 06:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507730067; cv=none; d=google.com; s=arc-20160816; b=Xdj+vlxdNQ7Honf7nzqr6zWVVg0U5i8bli60Rg34cgSiLW5j+NW+X837uHLndlo9du cJSyQbTbIPtD30MZq3p7YMzaqSFn2aiGXxBBZjTCNDB4lraEasHwI2Nr0zQx7dKOFolt a79I9P4lZ1kNBJQklubsEZZxdVjU2WYh8UCr6YFcDd+jVN4BLbMcOJtbNbFYLuot67Ox x2gPdZ8492DfnCtZSJ+LqTOKCkDtTqIPWIsyuzHMQzpdktr2FRwtY8GwfaQtePxe41z/ V5TCsXba7nGLS7MDuK6RvPBq1DbJSdPc3dgeXi/jSf62D9gPsWvHOvzszNgWMzNu8gwo yTKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=UsRYaMuDDQAHrbJCEL/ewaKcnupbRInIniFva93jKtI=; b=sz27B2BG4vo2OJ8fdJHEmF5UIFelx60NJ3YuSa1ZH0FptSPvo2pjeKW2pJE8YPBUqi hsO4AMYgYEZOi2e7MX7ml/1bQ0OzNsqRwgeWkGCee1wc0bChLJelsQHyn4VPj6M7tAf0 MAZH20+RjFviJsaqs2z05Y1vk7MOosXT4nFJrA7MhczhO8sTrGJPFD9kSpNGkHfmbfkC qjBOjlGAf7FYr0Nar5phHp5Ki1f4cc2XRL7Shydimmlmxz549NNKHeDw1Su0OXrWSiPz X59WS8y44/K6Be/n7yfa+eXy4J16NhJNRUZdypiwYrN6Q9SR+Iq1QwjiIV34qH/8Lus6 2sjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=DliNo5L5; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p11si10117733wre.361.2017.10.11.06.54.26; Wed, 11 Oct 2017 06:54:27 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=DliNo5L5; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 32C2A689BC9; Wed, 11 Oct 2017 16:54:20 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg0-f66.google.com (mail-pg0-f66.google.com [74.125.83.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9975168992B for ; Wed, 11 Oct 2017 16:54:13 +0300 (EEST) Received: by mail-pg0-f66.google.com with SMTP id o1so2180201pga.4 for ; Wed, 11 Oct 2017 06:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=MxQqKHOvioiVc5/slB1nozPx1z3L/e54gh6m6Tc+I2M=; b=DliNo5L5/sFdNdFrCGpmn7E1OrQqr1tSnw0c6Rkx1uL2ZrCUXqNDcnTRQH9Qf3FW50 exGKqQY7qV/hVufJIxRNfi0yBQsI7R19h+qKEUsWH/ql0pXMQE57M5mMJWV0UEYQIZ+j UcXaqUOEPPEI6JkdFG6ozTA6Sa/HAshVW+eNBYcAGvS0yP7am7dQeZdo0QLcjinUowkR bcxjrW560+nrLOUzKN9c/OXZ8bX1D6BvY1EWRRuNTCDBfX1d0O7ZPdnjFDGxATwI81LJ P2YenRcpdIzG9JoeUbvXdfxsmjYJWpMSMvWeCGG+B1pY7+cNmkmHDd/P3BEUpvDK/ePI h9dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MxQqKHOvioiVc5/slB1nozPx1z3L/e54gh6m6Tc+I2M=; b=dNOOJFsgLt8Nq0pF0liQyuu3Pk3YcItcFWwHFgmFjpJuaSKsoW6NbwTZczHmWsqweG e1a1LqKr1b0zSUJkMG6J6VlY7mfA2FQv+u+OJ+oTe8KI0cpoUwzMf5eHqEX+8VxQ4FRr QYOoqXhH/TdWphNacADwxpu61syYToVkIW6G4Rt9TiKJbED3BSZC8H/3CuB/qymcADU0 8q6QIQEUjO83geWHiu9akdNH65jUGxGPkVJr6vGnvVvVzzdrYtib9Elwvz8j5pDEhfJs Pcqdi9K2dsDsOjkt3CuAL7RkjGuFND3W2u7e5bdlIV3wd82U7/GpHJu3w14M+K3K5bpb 4k4w== X-Gm-Message-State: AMCzsaUiJZa3LIGWhSzMlRJFVTfuePuweuJvKwujj0ztN7LozsLLgY0N BIK0CmAIvdAJHQYw41P7LzfzTg== X-Google-Smtp-Source: AOwi7QD65vrlbNwN5DqpQGrDmkzcMTtNXnev4RDO2UT45h5GHfxCEry3WQYizoeG2eln8rqJRYKmpg== X-Received: by 10.98.24.80 with SMTP id 77mr16814602pfy.195.1507730053964; Wed, 11 Oct 2017 06:54:13 -0700 (PDT) Received: from localhost.localdomain ([202.94.162.83]) by smtp.gmail.com with ESMTPSA id j6sm24126555pgn.68.2017.10.11.06.54.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Oct 2017 06:54:13 -0700 (PDT) From: Ashish Pratap Singh To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Oct 2017 19:23:48 +0530 Message-Id: <20171011135348.4347-1-ashk43712@gmail.com> X-Mailer: git-send-email 2.11.0 Subject: [FFmpeg-devel] [PATCH] avfilter:vf_libvmaf: fix errors while running with psnr=1 and improve docs X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: ashk43712 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: ashk43712 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 --- 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;