From patchwork Sat Aug 10 16:02:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 14379 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id A4DDD4497ED for ; Sat, 10 Aug 2019 19:03:33 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 88EFC68AB7E; Sat, 10 Aug 2019 19:03:33 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C592468AABF for ; Sat, 10 Aug 2019 19:03:26 +0300 (EEST) Received: by mail-pg1-f195.google.com with SMTP id x15so36983119pgg.8 for ; Sat, 10 Aug 2019 09:03:26 -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=oDqnNhwEa7voNuj+8NrY4OiaJRJqMJHmzNSmv3rmpUo=; b=RgOZNpHeEtN/aVw6qu5koepIwPHJD2se4v05B03BqSOOgFkXnnOWUVlSpqxpKki8C3 vpjXmFlTWokjup+L5qZ6DrUTupwRLb9J+Ujg6st5+Wxos4+OsgHmnW9c0tPPdnyxWuN2 cIpO90ABRRzop7HkBES+szbOOqyMl6TxrJ7e5rY08VxJ5fJIinBfjT9Jth5f/edqAcTV AFGX2wRxTutjFXS2LmX/+8QEOKexAOAplcgQbTsLt2ExSMmZS5pwi0Mb9HxjXUXQkatu SrOg8ruzZXdlf3bVpVq6sQw659SiNf6XwlrDmxb31OdyoOmAAoDZ5n4l/XFkZj6PNGEx 7ezw== 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=oDqnNhwEa7voNuj+8NrY4OiaJRJqMJHmzNSmv3rmpUo=; b=UmlOqsk1zochujWXgUqiAr5mo397b+7dmHmE1WaUCcBUTEU3BkbM5dhAebxDTK1d3T iApmSuoTxQANqBmjOSfFOoNyQdHD4fOD+cotRshmqUMrPgRTolAr+BdoDcproqtlCMPt Av9lf+gA8QxW7eZ9vQsyjtR2fjB9+RFAibV5HkbnzFrk+qUwgHT49vk20ecZeEqirRQa 6iWgWAcojTVnbAN1REXD98haHH/yRmM5HinWNHQzVooq1lQupGeSVtVLeXn5o8cn6VsC U5xuMCI9Wci3UP4abYygiQQ9BJQ0i4SlwpBftMoQcbMIil6z12nazgL9QIhRnZneFGnj g6XQ== X-Gm-Message-State: APjAAAWGwO7jpNgNRi0RTUq0bpcq2++5FL5yOGuvqOEaWrh3jdJ1Zakp Wl+T+eltPCqwiLy8e1QA5OS47/l7 X-Google-Smtp-Source: APXvYqxrE2hqMuWq9NAEWz27U7uhc/49VQ9UBcVnlfBksTtb+8en289TYyiuG0XECVTL5OnJu5e2vw== X-Received: by 2002:a63:1d4:: with SMTP id 203mr22444764pgb.441.1565453004991; Sat, 10 Aug 2019 09:03:24 -0700 (PDT) Received: from vpn.localdomain ([47.90.99.151]) by smtp.gmail.com with ESMTPSA id b37sm10572214pjc.15.2019.08.10.09.03.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Aug 2019 09:03:24 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Sun, 11 Aug 2019 00:02:03 +0800 Message-Id: <20190810160203.12754-1-lance.lmwang@gmail.com> X-Mailer: git-send-email 2.9.5 Subject: [FFmpeg-devel] [PATCH v1] avfilter/f_select: yuv will use Y plane only for scenecut detect 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: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang It'll improve about +0.1 threshold for scenecut detect Signed-off-by: Limin Wang --- libavfilter/f_select.c | 5 ++++- tests/ref/fate/filter-metadata-scenedetect | 16 ++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c index 5c7372c..bd40b3b 100644 --- a/libavfilter/f_select.c +++ b/libavfilter/f_select.c @@ -148,6 +148,7 @@ typedef struct SelectContext { double var_values[VAR_VARS_NB]; int bitdepth; int nb_planes; + int is_yuv; ptrdiff_t width[4]; ptrdiff_t height[4]; int do_scene_detect; ///< 1 if the expression requires scene detection variables, 0 otherwise @@ -211,7 +212,9 @@ static int config_input(AVFilterLink *inlink) const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); select->bitdepth = desc->comp[0].depth; - select->nb_planes = av_pix_fmt_count_planes(inlink->format); + select->is_yuv = !(desc->flags & AV_PIX_FMT_FLAG_RGB); + select->nb_planes = select->is_yuv ? 1 : av_pix_fmt_count_planes(inlink->format); + for (int plane = 0; plane < select->nb_planes; plane++) { ptrdiff_t line_size = av_image_get_linesize(inlink->format, inlink->w, plane); int vsub = desc->log2_chroma_h; diff --git a/tests/ref/fate/filter-metadata-scenedetect b/tests/ref/fate/filter-metadata-scenedetect index 7ce2d67..36c033b 100644 --- a/tests/ref/fate/filter-metadata-scenedetect +++ b/tests/ref/fate/filter-metadata-scenedetect @@ -1,11 +1,11 @@ pkt_pts=1620|tag:lavfi.scene_score=1.000000 -pkt_pts=4140|tag:lavfi.scene_score=0.668643 -pkt_pts=5800|tag:lavfi.scene_score=0.996721 -pkt_pts=6720|tag:lavfi.scene_score=0.357390 -pkt_pts=8160|tag:lavfi.scene_score=0.886268 -pkt_pts=9760|tag:lavfi.scene_score=0.926219 -pkt_pts=14080|tag:lavfi.scene_score=0.650033 +pkt_pts=4140|tag:lavfi.scene_score=0.923403 +pkt_pts=5800|tag:lavfi.scene_score=1.000000 +pkt_pts=6720|tag:lavfi.scene_score=0.475643 +pkt_pts=8160|tag:lavfi.scene_score=1.000000 +pkt_pts=9760|tag:lavfi.scene_score=1.000000 +pkt_pts=14080|tag:lavfi.scene_score=0.874623 pkt_pts=15700|tag:lavfi.scene_score=1.000000 -pkt_pts=18500|tag:lavfi.scene_score=0.316402 -pkt_pts=20040|tag:lavfi.scene_score=0.269509 +pkt_pts=18500|tag:lavfi.scene_score=0.422509 +pkt_pts=20040|tag:lavfi.scene_score=0.352360 pkt_pts=21760|tag:lavfi.scene_score=1.000000