From patchwork Mon Aug 12 11:21:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 14436 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 97B14449B7B for ; Mon, 12 Aug 2019 14:22:02 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6CB39689C61; Mon, 12 Aug 2019 14:22:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3B52F689882 for ; Mon, 12 Aug 2019 14:21:56 +0300 (EEST) Received: by mail-pl1-f170.google.com with SMTP id m12so9130716plt.5 for ; Mon, 12 Aug 2019 04:21:56 -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=5OM1NTyYl+xtP4bJMCT4gmtTAA9pMFRdeRVJAVAPY6w=; b=IubP9PnCnfM5pQps5Kj7BVmPqlqVkO/kwY5DD2X3XEkVftOn5Vukdo+QKy/rxNKapf MFJSADKx0ITilWBFjS6xMUpx2RDv/dOchwvmp0+acreRjUOoYJeYyXJQmDnR5KcBVaKv crvvf296xy8kge1UbD1DU3O/6waigkeddXljSx0XzMeaWV4mqz4Fb+3rK9KqSyFxN7d9 Km0CZR46AD+kRrDuq2cRSa4FVkn7bJlNo4OXYTuqKcLkxvgz+ALJEPcLhVhuEgE4jOr3 qwn0MoFuT+P0WPyc4HNVBKAkmARtylB/TJ5Rgb/TAUmgjcFcPLMGQ0PIEVYTCaMfYWls vWaA== 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=5OM1NTyYl+xtP4bJMCT4gmtTAA9pMFRdeRVJAVAPY6w=; b=dcOQaY9E7ARXh+JMmSbaJX+UuBpnk1JNuJqHb/Pwy9knrp8vPCNctVRm+IFh/a4Y8R DGRZbdx07O3NO0qc84j4xo+4yNHt5ia3303yBO5/wcAnuZWAM6U0kO/AIWIk/UqBI5w2 3cn5EUeUFpZ8coxbp3UQd3X2E6ITub2iFhuKmMJjDcGNF26xMD2UAyswcPwUB8ZITp0p qxSCi+aE/qpNOptqeUmV3re4MCwgl7pSoXHn2ZRSOPqVxHMzPMm41ZfQwqki9B4HXxK5 hPXsqPRKnlpzA4+iqyvsyo2oeU8hBZ/pT//Bcqu+Xk+AJYem/1gANrioUSXHegZ4rnIf 6hcA== X-Gm-Message-State: APjAAAXi5AiodlY012e2XSIcfVEO1jc52TbOrr0Qj4x4X3IUAzE8SU7O ADxRw89s+2Z46QBPTrs6y487W+hc X-Google-Smtp-Source: APXvYqyviyRdNZRZC3MiVzyyAgpse3BLB3U3oTYistEOCTxYjDfV7bADX+SQpUxhprrxwDyYFdYecQ== X-Received: by 2002:a17:902:40e:: with SMTP id 14mr22790384ple.323.1565608914014; Mon, 12 Aug 2019 04:21:54 -0700 (PDT) Received: from vpn.localdomain ([47.90.99.151]) by smtp.gmail.com with ESMTPSA id bt18sm3905230pjb.1.2019.08.12.04.21.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Aug 2019 04:21:53 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Aug 2019 19:21:45 +0800 Message-Id: <20190812112146.15922-1-lance.lmwang@gmail.com> X-Mailer: git-send-email 2.9.5 Subject: [FFmpeg-devel] [PATCH v1 1/2] avfilter/vsrc_mptestsrc: add option to set the max number frames generated for each tests 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 | 27 +++++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index e081cdc7bc..d3d468b445 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 max number frames generated for each tests: + @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 c5fdea75dc..f399e43b0b 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,8 @@ 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 max number frames generated for each tests", OFFSET(max_frames), AV_OPT_TYPE_INT, {.i64 = 30}, 1, INT64_MAX, FLAGS }, + { "m", " Set the max number frames generated for each tests", OFFSET(max_frames), AV_OPT_TYPE_INT, {.i64 = 30}, 1, INT64_MAX, FLAGS }, { NULL } }; @@ -322,20 +325,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);