From patchwork Fri Aug 23 12:17:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 14676 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 AEE5B449496 for ; Fri, 23 Aug 2019 15:24:18 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8AA5068A706; Fri, 23 Aug 2019 15:24:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0A47F689A7D for ; Fri, 23 Aug 2019 15:24:12 +0300 (EEST) Received: by mail-io1-f46.google.com with SMTP id t3so19519981ioj.12 for ; Fri, 23 Aug 2019 05:24:11 -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=zpBpXqoJKYQL26fSs5zqFZUk2dfl9b++NWBWdrJ6FiE=; b=Dums5MzuDpu6PcjcPwnLf1mY9gJkq+1bwtSoAQJP5L8N4eDTXwGxck4Fp3iEbBxLHH tRC/P/lYK16u/XuK7cUkHY44BjL4Vo9hpxQGnw08egMlvSWidCNkW/ZmdAQGHVem3XTd u0KYEshzl6KUGIyUNOq3HIV/3eWFvq3EO8uaB45CLQdFZ6eq0ERhgqeLgEO+fZdvdeb+ soqTTgDdfGztbqwKLrOhTrI7PEHXM8kgCgw5Wf4ge3ClM6zBEVfcE6FBv9p0d/Zrc1IB o8q9EQiObymt61/vw2YRWnwbV6roVb1ve1+o1eR2ApZxAQl+oosqG+GjR/nmozScVegM 5zVA== 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=zpBpXqoJKYQL26fSs5zqFZUk2dfl9b++NWBWdrJ6FiE=; b=qZJC/lDR7u6ybb9By5FvdcfXb/uawyAoxOXVwQdKlsUS1oSnje9MPooUdX8Ivw13Ac JzN6cSJsgxKdh2joeJ3Z4U8FOwBN4l6GVYVXJom5vPw2/3o5VsS0iqtf0mOLbIgtR+so /uNcKlAIINSxxxH136JmAPNmxTMUuucY5AJRlQ7x86ourtUpCNyrp5XLegLg1hVn+m/k bFD9txGtHI6APLepfk9iigLBg28/A5fLvrGRnadiwpUtmTpYHx9Rk7prQDpeOhyqq4Gs Rd92HT4yNEQ9cvW+V8Xl3pBs79sMNbgLRHyCpLCrHC3772gH4mncF9IFXcnJ4wgGDeEZ oo+A== X-Gm-Message-State: APjAAAXu5fNLkLlBtDA+V48Lyi31BgCwX/Htv+wvpdfTEfh5MRSraw0o u9JsBofay2lkFB450BkLMvegw0OT X-Google-Smtp-Source: APXvYqxq0EKbz40fKQEhZmOJsu/qZ591n6msr7B/nhBcmbcHFmbm0cOGizd49n2WRUds3qxwBCNElw== X-Received: by 2002:a63:b919:: with SMTP id z25mr3663714pge.201.1566562634776; Fri, 23 Aug 2019 05:17:14 -0700 (PDT) Received: from vpn.localdomain ([47.90.99.151]) by smtp.gmail.com with ESMTPSA id t15sm2292955pfc.47.2019.08.23.05.17.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Aug 2019 05:17:14 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 23 Aug 2019 20:17:07 +0800 Message-Id: <20190823121709.4227-1-lance.lmwang@gmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190812153953.11839-2-lance.lmwang@gmail.com> References: <20190812153953.11839-2-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v3 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 01262d8..a6371e4 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -20258,6 +20258,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);