From patchwork Thu May 14 21:03:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 19700 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:bac9:0:0:0:0:0 with SMTP id a9csp7150ybk; Thu, 14 May 2020 14:04:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrkewVP/F5pysj3lom1B+rI+uwji2xlepgGXIfPuRu9JO4ZlcWz/+bryO3IMdrVu3x4vZT X-Received: by 2002:adf:f487:: with SMTP id l7mr307834wro.381.1589490272251; Thu, 14 May 2020 14:04:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589490272; cv=none; d=google.com; s=arc-20160816; b=aLfepZZZUCHnh8UnV4PTmg22T4ZGtXqCI/PEUCcsKAnfcoQ7GAD3pzaIbtLE5o/dur vqlqqqPbFvpt7qLMqAfC4SgFHABw4TPw/9kpL0eDM65SuMBhbhqexmpDg4BuR2kHi6Qe lDcZoZNzemzefS15XGDBh+Ec4IKCeXTueGNId9T8Zq/yotccSQEFw6CrKKQHW6EIR8Tw DhbeZh4mI9wz0cgHS0hUMy4tPYvDFEz8UnfRIJfTvAzpZHJrw2U5RIz5xBTl9b5ZrLuX 0O3x6owdaJJy9tscQz2wrrUBxbDO9Mq494aViDWKqokUx2ZTEG5QgZhUgAbGkw7nGkwT A46A== 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:delivered-to; bh=rX6aP38O/STetDyPh9WgPQf9KJHTbiU4LJld8uPMSxM=; b=qjUzrBMLFX+S+LmeAMnSIfvytrxiqxDSrcLhZBrbWeRfYQ3n+MUcvUHlfWYiCGPvMI XyoQrvYyzLN+Bjermm8xPGC3O5upNrXA9FT1Ai3l7zldgsDrHyEz88l0KffftqfPiEV2 vFMPZxYlGo/OSOa4tMzzI0sqVeTTgSYDN4GUlBfOXrBV0Z1aFuy1OdZAzYdpLXLYtnRb azIZiS85dR3ZVDjZKitPEmWsawMidP4FgAf36Lkg+Pw127RrRW1oAxmk9J0lnYaN/aO6 1+AY1FbumjygeJN9/DbnFmxuQnTWZyq5agc6wg5k5H9GM/5QO1F5QKWaGbc0Kc11dQrM fiWg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b188si141039wmd.74.2020.05.14.14.04.10; Thu, 14 May 2020 14:04:32 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 558B868A67E; Fri, 15 May 2020 00:04:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C5816687F7E for ; Fri, 15 May 2020 00:03:58 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 9AD0EE37E8; Thu, 14 May 2020 23:03:58 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fNpBWbPGsv0Z; Thu, 14 May 2020 23:03:53 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id C1FE7E34A9; Thu, 14 May 2020 23:03:52 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Thu, 14 May 2020 23:03:48 +0200 Message-Id: <20200514210349.12825-1-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 Subject: [FFmpeg-devel] [PATCH 1/2] Revert avfilter/vf_minterpolate: if metadata lavfi.scd.mafd exists, we'll use it first 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: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: waM73yYl2buw This reverts commit d88e1c9838dbcfe29d7835f2705ffc9ee6a36bf3. Fixes null pointer dereference. Signed-off-by: Marton Balint --- libavfilter/vf_minterpolate.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/libavfilter/vf_minterpolate.c b/libavfilter/vf_minterpolate.c index ef47140946..c9ce80420d 100644 --- a/libavfilter/vf_minterpolate.c +++ b/libavfilter/vf_minterpolate.c @@ -834,19 +834,11 @@ static int detect_scene_change(MIContext *mi_ctx) ptrdiff_t linesize2 = mi_ctx->frames[2].avf->linesize[0]; if (mi_ctx->scd_method == SCD_METHOD_FDIFF) { - double ret = 0, mafd = HUGE_VAL, diff; + double ret = 0, mafd, diff; uint64_t sad; - AVDictionaryEntry *e_mafd = NULL; - char *tail = NULL; - - e_mafd = av_dict_get(mi_ctx->frames[2].avf->metadata, "lavfi.scd.mafd", NULL, AV_DICT_MATCH_CASE); - if (e_mafd) - mafd = strtod(e_mafd->value, &tail); - if (*tail || mafd == HUGE_VAL) { - mi_ctx->sad(p1, linesize1, p2, linesize2, me_ctx->width, me_ctx->height, &sad); - emms_c(); - mafd = (double) sad * 100.0 / (me_ctx->height * me_ctx->width) / (1 << mi_ctx->bitdepth); - } + mi_ctx->sad(p1, linesize1, p2, linesize2, me_ctx->width, me_ctx->height, &sad); + emms_c(); + mafd = (double) sad * 100.0 / (me_ctx->height * me_ctx->width) / (1 << mi_ctx->bitdepth); diff = fabs(mafd - mi_ctx->prev_mafd); ret = av_clipf(FFMIN(mafd, diff), 0, 100.0); mi_ctx->prev_mafd = mafd;