From patchwork Fri Jul 19 11:18:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 13991 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 E3E6B447A0F for ; Fri, 19 Jul 2019 14:24:57 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C349B68ACBC; Fri, 19 Jul 2019 14:24:57 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-vk1-f193.google.com (mail-vk1-f193.google.com [209.85.221.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0E52D68AC7D for ; Fri, 19 Jul 2019 14:24:51 +0300 (EEST) Received: by mail-vk1-f193.google.com with SMTP id b64so6426551vke.13 for ; Fri, 19 Jul 2019 04:24:50 -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:in-reply-to:references; bh=c/RRkJb7qrd+36YAx2Fa0/Fb/9KIJ7jRLtoYWzEiDyQ=; b=ZTw45JY/7K7pCPyZfDU6k2SD2Rq+yR44fDb2peP7h7H2vtecyntIFkKdY1Z8YN7319 yPIe2vemuZHuD4cKth+mXyp6Z2RbxEaKU1fMkyMj1Mt03QB7PNvRyzZ4hEoL6vnA2utM zsxVYrG0zXeYHKYzFEABboMvBi+UyTHbnhZy0zdP9K+0fP3CyL37GIMhULNJitzVpWEN UoTr0rDg1vxhr7wfc1uEe3RgGwuZS0DihJOXLA1GLsTQnHfXX6CO22L2YDBrmNfHmuA9 uHLZ5BAoXHheoaleXfYr47gtDg/04QLFbbKlG6uo5ri18esjMJ2SP/SJmLwLBN4HFLXK R/jQ== 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:in-reply-to :references; bh=c/RRkJb7qrd+36YAx2Fa0/Fb/9KIJ7jRLtoYWzEiDyQ=; b=Gri8Fe65iopL/iu9ZyCPxhH54cJAFJbJ04ZSPK+iNklVobOeOpfMOxIxBHoTP+NCsc sh9Ei6sfPgT53iwu6NWpc8cmM7LCULQrAHTLxsEiSDG99VGb7D4B7x/UWnYFXpBEChTI ruE17TWhgHLZx9U4cBkWYQL31jzeZEgJTe2dcUICnge29Q4U9MtBTSIK8y7mV9qLA5PR zeiKLJPoBXTsy2xfTyE5iM39pUm+cIsRRMTpYhInNTyD/4/2UIfmB87Q6it5qOKdhLGf PszCIel/vP4b6wAnLv6oy2UfhImwbF8ImReBSaqVG0Q3mF0ny6kcjVkSwxwqIXer1z9p uOaw== X-Gm-Message-State: APjAAAVwQZGe90fGy4wNXMTCKqBhD5h+mDwW4bbPUY7RDyMGFLsLxv48 Mzg2189HHL8tx6a3eaREAYya1j1x X-Google-Smtp-Source: APXvYqx1zQcS31pMCdYwKmMnn3JmOyCSWV35CD9sAgxRH1RkdZwZ+1jPe8x5hXDRatslkJ8AdQ1xrw== X-Received: by 2002:a63:181:: with SMTP id 123mr54851275pgb.63.1563535144965; Fri, 19 Jul 2019 04:19:04 -0700 (PDT) Received: from vpn.localdomain ([47.90.99.151]) by smtp.gmail.com with ESMTPSA id m4sm58989760pff.108.2019.07.19.04.19.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Jul 2019 04:19:04 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 19 Jul 2019 19:18:48 +0800 Message-Id: <20190719111848.9009-3-lance.lmwang@gmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190719111848.9009-1-lance.lmwang@gmail.com> References: <1563231238-20966-1-git-send-email-lance.lmwang@gmail.com> <20190719111848.9009-1-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v2 3/3] lavf/f_select: make the more pixel format usable to avoid autoscale to rgb 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 Below is the tested results for the new added pixel format without autoscale to rgb24: 1. AV_PIX_FMT_YUVJ420P time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f lavfi \ "sws_flags=+accurate_rnd+bitexact;movie=../fate-suite/svq3/Vertical400kbit.sorenson3.mov,select=gt(scene\,.25)" master: pkt_pts=1620|tag:lavfi.scene_score=1.000000 pkt_pts=4140|tag:lavfi.scene_score=0.875036 pkt_pts=5800|tag:lavfi.scene_score=1.000000 pkt_pts=6720|tag:lavfi.scene_score=0.461625 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.838916 pkt_pts=15700|tag:lavfi.scene_score=1.000000 pkt_pts=18500|tag:lavfi.scene_score=0.474948 pkt_pts=20040|tag:lavfi.scene_score=0.379700 pkt_pts=21760|tag:lavfi.scene_score=1.000000 ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f 0.71s user 0.01s system 99% cpu 0.721 total patch applied: 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=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=21760|tag:lavfi.scene_score=1.000000 ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f 0.19s user 0.01s system 81% cpu 0.240 total 2. AV_PIX_FMT_YUV420P time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f lavfi \ "sws_flags=+accurate_rnd+bitexact;movie=../Passengers_Breakfast_1080-sdr.mkv,select=gt(scene\,.2)" master: pkt_pts=3587|tag:lavfi.scene_score=0.462364 pkt_pts=4838|tag:lavfi.scene_score=0.419519 pkt_pts=6548|tag:lavfi.scene_score=0.397027 pkt_pts=9968|tag:lavfi.scene_score=0.419245 pkt_pts=12471|tag:lavfi.scene_score=0.413084 pkt_pts=16225|tag:lavfi.scene_score=0.506370 pkt_pts=19645|tag:lavfi.scene_score=0.507538 pkt_pts=22314|tag:lavfi.scene_score=0.504319 pkt_pts=24817|tag:lavfi.scene_score=0.417544 pkt_pts=25651|tag:lavfi.scene_score=0.413916 pkt_pts=26652|tag:lavfi.scene_score=0.487707 18.58s user 0.07s system 99% cpu 18.663 total patch applied: pkt_pts=3587|tag:lavfi.scene_score=0.272173 pkt_pts=4838|tag:lavfi.scene_score=0.247841 pkt_pts=6548|tag:lavfi.scene_score=0.233134 pkt_pts=9968|tag:lavfi.scene_score=0.247253 pkt_pts=12471|tag:lavfi.scene_score=0.244129 pkt_pts=16225|tag:lavfi.scene_score=0.302531 pkt_pts=19645|tag:lavfi.scene_score=0.303560 pkt_pts=22314|tag:lavfi.scene_score=0.301861 pkt_pts=24817|tag:lavfi.scene_score=0.249331 pkt_pts=25651|tag:lavfi.scene_score=0.247096 pkt_pts=26652|tag:lavfi.scene_score=0.287728 10.90s user 0.06s system 99% cpu 10.967 total 3. AV_PIX_FMT_YUV422P time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f lavfi \ "sws_flags=+accurate_rnd+bitexact;movie=../Passengers_Breakfast_1080-sdr.mkv,format=yuv422p,select=gt(scene\,.2)" master: patched applied: pkt_pts=3587|tag:lavfi.scene_score=0.224017 pkt_pts=4838|tag:lavfi.scene_score=0.204225 pkt_pts=9968|tag:lavfi.scene_score=0.204636 pkt_pts=12471|tag:lavfi.scene_score=0.202772 pkt_pts=16225|tag:lavfi.scene_score=0.248765 pkt_pts=19645|tag:lavfi.scene_score=0.250144 pkt_pts=22314|tag:lavfi.scene_score=0.248802 pkt_pts=24817|tag:lavfi.scene_score=0.208362 pkt_pts=25651|tag:lavfi.scene_score=0.205777 pkt_pts=26652|tag:lavfi.scene_score=0.230742 4. AV_PIX_FMT_YUV420P10LE time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f lavfi \ "sws_flags=+accurate_rnd+bitexact;movie=../Passengers_Breakfast_4k.mkv,select=gt(scene\,.2)" master: pkt_pts=3587|tag:lavfi.scene_score=0.269890 pkt_pts=4838|tag:lavfi.scene_score=0.248957 pkt_pts=6548|tag:lavfi.scene_score=0.234619 pkt_pts=9969|tag:lavfi.scene_score=0.224912 pkt_pts=12471|tag:lavfi.scene_score=0.225158 pkt_pts=16225|tag:lavfi.scene_score=0.289809 pkt_pts=19645|tag:lavfi.scene_score=0.285013 pkt_pts=22314|tag:lavfi.scene_score=0.280295 pkt_pts=24817|tag:lavfi.scene_score=0.206486 pkt_pts=25651|tag:lavfi.scene_score=0.208556 pkt_pts=26652|tag:lavfi.scene_score=0.249577 ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f 76.03s user 0.22s system 99% cpu 1:16.27 total patch applied pkt_pts=3587|tag:lavfi.scene_score=0.630004 pkt_pts=4838|tag:lavfi.scene_score=0.580807 pkt_pts=6548|tag:lavfi.scene_score=0.548095 pkt_pts=9969|tag:lavfi.scene_score=0.529728 pkt_pts=12471|tag:lavfi.scene_score=0.529921 pkt_pts=16225|tag:lavfi.scene_score=0.680033 pkt_pts=19645|tag:lavfi.scene_score=0.670753 pkt_pts=22314|tag:lavfi.scene_score=0.660605 pkt_pts=24817|tag:lavfi.scene_score=0.490141 pkt_pts=25651|tag:lavfi.scene_score=0.494594 pkt_pts=26652|tag:lavfi.scene_score=0.584942 ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f 50.27s user 0.20s system 99% cpu 50.476 total 5. AV_PIX_FMT_RGBA, AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8 are tested by format= with the fate sample: Vertical400kbit.sorenson3.mov like below: time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f lavfi \ "sws_flags=+accurate_rnd+bitexact;movie=../fate-suite/svq3/Vertical400kbit.sorenson3.mov,format=rgba,select=gt(scene\,.25)" patch applied: pkt_pts=1620|tag:lavfi.scene_score=1.000000 pkt_pts=4140|tag:lavfi.scene_score=0.656277 pkt_pts=5800|tag:lavfi.scene_score=1.000000 pkt_pts=6720|tag:lavfi.scene_score=0.346218 pkt_pts=8160|tag:lavfi.scene_score=0.987686 pkt_pts=9760|tag:lavfi.scene_score=1.000000 pkt_pts=14080|tag:lavfi.scene_score=0.629187 pkt_pts=15700|tag:lavfi.scene_score=1.000000 pkt_pts=18500|tag:lavfi.scene_score=0.356211 pkt_pts=20040|tag:lavfi.scene_score=0.284775 pkt_pts=21760|tag:lavfi.scene_score=1.000000 6. AV_PIX_FMT_YUVJ422P time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f lavfi \ "sws_flags=+accurate_rnd+bitexact;movie=../fate-suite/svq3/Vertical400kbit.sorenson3.mov,format=yuvj422p,select=gt(scene\,.25)" patch applied: pkt_pts=1620|tag:lavfi.scene_score=0.838281 pkt_pts=4140|tag:lavfi.scene_score=0.541382 pkt_pts=5800|tag:lavfi.scene_score=0.780588 pkt_pts=6720|tag:lavfi.scene_score=0.298274 pkt_pts=8160|tag:lavfi.scene_score=0.699106 pkt_pts=9760|tag:lavfi.scene_score=0.730136 pkt_pts=14080|tag:lavfi.scene_score=0.537742 pkt_pts=15700|tag:lavfi.scene_score=0.811946 pkt_pts=18500|tag:lavfi.scene_score=0.263382 pkt_pts=21760|tag:lavfi.scene_score=0.880773 7. Remove the P10LE, NV12, NV16 hardware format support, it can't use the 100 for [0,1] normalized. Signed-off-by: Limin Wang --- libavfilter/f_select.c | 6 +++++- tests/ref/fate/filter-metadata-scenedetect | 16 ++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c index eed8df34cb..b9cb5f08eb 100644 --- a/libavfilter/f_select.c +++ b/libavfilter/f_select.c @@ -498,7 +498,11 @@ static int query_formats(AVFilterContext *ctx) } else { int ret; static const enum AVPixelFormat pix_fmts[] = { - AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, + AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_RGBA, + AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8, + AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVJ420P, + AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVJ422P, + AV_PIX_FMT_YUV420P10LE, AV_PIX_FMT_NONE }; AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); diff --git a/tests/ref/fate/filter-metadata-scenedetect b/tests/ref/fate/filter-metadata-scenedetect index 67c23b3c32..7ce2d6794e 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.875036 -pkt_pts=5800|tag:lavfi.scene_score=1.000000 -pkt_pts=6720|tag:lavfi.scene_score=0.461625 -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.838916 +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=15700|tag:lavfi.scene_score=1.000000 -pkt_pts=18500|tag:lavfi.scene_score=0.474948 -pkt_pts=20040|tag:lavfi.scene_score=0.379700 +pkt_pts=18500|tag:lavfi.scene_score=0.316402 +pkt_pts=20040|tag:lavfi.scene_score=0.269509 pkt_pts=21760|tag:lavfi.scene_score=1.000000