From patchwork Mon Aug 12 15:39:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 14439 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 692F644823E for ; Mon, 12 Aug 2019 18:40:09 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 42AAA68ABD0; Mon, 12 Aug 2019 18:40:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ECDC768AAE6 for ; Mon, 12 Aug 2019 18:40:02 +0300 (EEST) Received: by mail-pg1-f169.google.com with SMTP id z14so12447695pga.5 for ; Mon, 12 Aug 2019 08:40:02 -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=AQOjQwVWs12Q3qWzOhXx/zJfB9pB7/coPA2FSdbTF4k=; b=RFhGa+Zedr3Ye9Gu+03uMq57qS/5oexNEj05FlgPiWG7MVnOV55oxJRc3BOdbTfkdP 7auwKU7UkP+hsB+vYRQdwW6rYtXWz1zgiyIXMappM7f9PIBJemzHS5erX3GGCZcW32gv 1nW2Fmb0MGviCnZ44yRx2oO2fAGgkC7j1LyykJVYJisyMiOVe9N9tLnvAEDEBsk20YsN znMYYs6K8ef41nIxC8fIDSK01IEmX30sJSWlijSZVXT6c+IipDHtgZ329/W/p1DIc3+J buR43cSGv3XhVqvGKEZvCsyHE2tZ6sE13KT7kSU42SqHohdnqJzkhvacNtS6Q4tDx7Qz ETZg== 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=AQOjQwVWs12Q3qWzOhXx/zJfB9pB7/coPA2FSdbTF4k=; b=piKiWelHBZMGHl95vHWp74WE/0QFokyXh5G7oGljJt7P1C9cAxrHU1OCEbI/9Uoyme Ztl3jBUdaiLfuNLUAqWK0X/gnoOzCIYBRKtjqApGE5h1LtYrWSzAVz3iae6OTjAbfVyI lLqvjd4QtxopBgx9Vy1onGLtDlpRMm3kep/8Zu2b07eGUiP2C3YTPrT8PwCyadIcsWm8 bJ3Ee9gtvnUGQEA6EXkr7H7kt/JramYIi3fXYWecg/HqdhlllgUYxdDd29iq/HQPQwS6 CFVrcWoL/TX+5i6YuIhnovXwoLqTkFnz2CYcocF3yWDK9hizEmjI0/AakPGfmeMcVLP6 quQw== X-Gm-Message-State: APjAAAWjAdm3c+25c7rEq15b38Sw0TtP41IaI75//CAbGO/x/wVSSBQG G//aio6hir1B99dtJR2+TGxYNd89 X-Google-Smtp-Source: APXvYqwUGs5b/y9ign4MUi7ylZcuDy3AfmyCFXXSS/+PT2jVGtABazRLzEkyPpkzV74u+iGT1mtsmw== X-Received: by 2002:a63:4a50:: with SMTP id j16mr30351127pgl.126.1565624400992; Mon, 12 Aug 2019 08:40:00 -0700 (PDT) Received: from vpn.localdomain ([47.90.99.151]) by smtp.gmail.com with ESMTPSA id a4sm2389781pfi.55.2019.08.12.08.39.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Aug 2019 08:40:00 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Aug 2019 23:39:51 +0800 Message-Id: <20190812153953.11839-1-lance.lmwang@gmail.com> X-Mailer: git-send-email 2.9.5 Subject: [FFmpeg-devel] [PATCH v2 1/3] avfilter/vsrc_mptestsrc: add options to set the maximum number of frames 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 Signed-off-by: Limin Wang --- doc/filters.texi | 3 +++ libavfilter/vsrc_mptestsrc.c | 29 +++++++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index e081cdc..902e5bf 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -20246,6 +20246,9 @@ Set the number or the name of the test to perform. Supported tests are: @item ring2 @item all +@item max_frames, m +Set the maximum number of frames generated for each test, default value is 30. + @end table Default value is "all", which will cycle through the list of all tests. diff --git a/libavfilter/vsrc_mptestsrc.c b/libavfilter/vsrc_mptestsrc.c index c5fdea7..4a2db18 100644 --- a/libavfilter/vsrc_mptestsrc.c +++ b/libavfilter/vsrc_mptestsrc.c @@ -54,6 +54,7 @@ typedef struct MPTestContext { const AVClass *class; AVRational frame_rate; int64_t pts, max_pts, duration; + int64_t max_frames; int hsub, vsub; int test; ///< test_type } MPTestContext; @@ -79,6 +80,10 @@ static const AVOption mptestsrc_options[]= { { "ring1", "", 0, AV_OPT_TYPE_CONST, {.i64=TEST_RING1}, INT_MIN, INT_MAX, FLAGS, "test" }, { "ring2", "", 0, AV_OPT_TYPE_CONST, {.i64=TEST_RING2}, INT_MIN, INT_MAX, FLAGS, "test" }, { "all", "", 0, AV_OPT_TYPE_CONST, {.i64=TEST_ALL}, INT_MIN, INT_MAX, FLAGS, "test" }, + { "max_frames", "Set the maximum number of frames generated for each test", OFFSET(max_frames), + AV_OPT_TYPE_INT, {.i64 = 30}, 1, INT64_MAX, FLAGS }, + { "m", "Set the maximum number of frames generated for each test", OFFSET(max_frames), + AV_OPT_TYPE_INT, {.i64 = 30}, 1, INT64_MAX, FLAGS }, { NULL } }; @@ -322,20 +327,20 @@ static int request_frame(AVFilterLink *outlink) memset(picref->data[2] + i*picref->linesize[2], 128, cw); } - if (tt == TEST_ALL && frame%30) /* draw a black frame at the beginning of each test */ - tt = (frame/30)%(TEST_NB-1); + if (tt == TEST_ALL && frame%test->max_frames) /* draw a black frame at the beginning of each test */ + tt = (frame/test->max_frames)%(TEST_NB-1); switch (tt) { - case TEST_DC_LUMA: dc_test(picref->data[0], picref->linesize[0], 256, 256, frame%30); break; - case TEST_DC_CHROMA: dc_test(picref->data[1], picref->linesize[1], 256, 256, frame%30); break; - case TEST_FREQ_LUMA: freq_test(picref->data[0], picref->linesize[0], frame%30); break; - case TEST_FREQ_CHROMA: freq_test(picref->data[1], picref->linesize[1], frame%30); break; - case TEST_AMP_LUMA: amp_test(picref->data[0], picref->linesize[0], frame%30); break; - case TEST_AMP_CHROMA: amp_test(picref->data[1], picref->linesize[1], frame%30); break; - case TEST_CBP: cbp_test(picref->data , picref->linesize , frame%30); break; - case TEST_MV: mv_test(picref->data[0], picref->linesize[0], frame%30); break; - case TEST_RING1: ring1_test(picref->data[0], picref->linesize[0], frame%30); break; - case TEST_RING2: ring2_test(picref->data[0], picref->linesize[0], frame%30); break; + case TEST_DC_LUMA: dc_test(picref->data[0], picref->linesize[0], 256, 256, frame%test->max_frames); break; + case TEST_DC_CHROMA: dc_test(picref->data[1], picref->linesize[1], 256, 256, frame%test->max_frames); break; + case TEST_FREQ_LUMA: freq_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break; + case TEST_FREQ_CHROMA: freq_test(picref->data[1], picref->linesize[1], frame%test->max_frames); break; + case TEST_AMP_LUMA: amp_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break; + case TEST_AMP_CHROMA: amp_test(picref->data[1], picref->linesize[1], frame%test->max_frames); break; + case TEST_CBP: cbp_test(picref->data , picref->linesize , frame%test->max_frames); break; + case TEST_MV: mv_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break; + case TEST_RING1: ring1_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break; + case TEST_RING2: ring2_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break; } return ff_filter_frame(outlink, picref);