History

avfilter/vsrc_mptestsrc: add options to set the maximum number of frames

Limin Wang committed 7 years ago

Commit 6079bd51 parent 7a477c42 files · +20 −12Browse files

Unified · Split

2 files
  1. doc/filters.texi +3 −0
  2. libavfilter/vsrc_mptestsrc.c +17 −12
doc/filters.texi+3−0
@@ -20940,6 +20940,9 @@ Set the number or the name of the test to perform. Supported tests are: · 20939 unmodified lines
2094020940 @item ring2
2094120941 @item all
2094220942
20943+@item max_frames, m
20944+Set the maximum number of frames generated for each test, default value is 30.
20945+
2094320946 @end table
2094420947
2094520948 Default value is "all", which will cycle through the list of all tests.
libavfilter/vsrc_mptestsrc.c+17−12
@@ -54,6 +54,7 @@ typedef struct MPTestContext { · 53 unmodified lines
5454 const AVClass *class;
5555 AVRational frame_rate;
5656 int64_t pts, max_pts, duration;
57+ int64_t max_frames;
5758 int hsub, vsub;
5859 int test; ///< test_type
5960 } MPTestContext;
@@ -79,6 +80,10 @@ static const AVOption mptestsrc_options[]= { · 19 unmodified lines
7980 { "ring1", "", 0, AV_OPT_TYPE_CONST, {.i64=TEST_RING1}, INT_MIN, INT_MAX, FLAGS, "test" },
8081 { "ring2", "", 0, AV_OPT_TYPE_CONST, {.i64=TEST_RING2}, INT_MIN, INT_MAX, FLAGS, "test" },
8182 { "all", "", 0, AV_OPT_TYPE_CONST, {.i64=TEST_ALL}, INT_MIN, INT_MAX, FLAGS, "test" },
83+ { "max_frames", "Set the maximum number of frames generated for each test", OFFSET(max_frames),
84+ AV_OPT_TYPE_INT64, {.i64 = 30}, 1, INT64_MAX, FLAGS },
85+ { "m", "Set the maximum number of frames generated for each test", OFFSET(max_frames),
86+ AV_OPT_TYPE_INT64, {.i64 = 30}, 1, INT64_MAX, FLAGS },
8287 { NULL }
8388 };
8489
@@ -322,20 +327,20 @@ static int request_frame(AVFilterLink *outlink) · 237 unmodified lines
322327 memset(picref->data[2] + i*picref->linesize[2], 128, cw);
323328 }
324329
325− if (tt == TEST_ALL && frame%30) /* draw a black frame at the beginning of each test */
326− tt = (frame/30)%(TEST_NB-1);
330+ if (tt == TEST_ALL && frame%test->max_frames) /* draw a black frame at the beginning of each test */
331+ tt = (frame/test->max_frames)%(TEST_NB-1);
327332
328333 switch (tt) {
329− case TEST_DC_LUMA: dc_test(picref->data[0], picref->linesize[0], 256, 256, frame%30); break;
330− case TEST_DC_CHROMA: dc_test(picref->data[1], picref->linesize[1], 256, 256, frame%30); break;
331− case TEST_FREQ_LUMA: freq_test(picref->data[0], picref->linesize[0], frame%30); break;
332− case TEST_FREQ_CHROMA: freq_test(picref->data[1], picref->linesize[1], frame%30); break;
333− case TEST_AMP_LUMA: amp_test(picref->data[0], picref->linesize[0], frame%30); break;
334− case TEST_AMP_CHROMA: amp_test(picref->data[1], picref->linesize[1], frame%30); break;
335− case TEST_CBP: cbp_test(picref->data , picref->linesize , frame%30); break;
336− case TEST_MV: mv_test(picref->data[0], picref->linesize[0], frame%30); break;
337− case TEST_RING1: ring1_test(picref->data[0], picref->linesize[0], frame%30); break;
338− case TEST_RING2: ring2_test(picref->data[0], picref->linesize[0], frame%30); break;
334+ case TEST_DC_LUMA: dc_test(picref->data[0], picref->linesize[0], 256, 256, frame%test->max_frames); break;
335+ case TEST_DC_CHROMA: dc_test(picref->data[1], picref->linesize[1], 256, 256, frame%test->max_frames); break;
336+ case TEST_FREQ_LUMA: freq_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break;
337+ case TEST_FREQ_CHROMA: freq_test(picref->data[1], picref->linesize[1], frame%test->max_frames); break;
338+ case TEST_AMP_LUMA: amp_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break;
339+ case TEST_AMP_CHROMA: amp_test(picref->data[1], picref->linesize[1], frame%test->max_frames); break;
340+ case TEST_CBP: cbp_test(picref->data , picref->linesize , frame%test->max_frames); break;
341+ case TEST_MV: mv_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break;
342+ case TEST_RING1: ring1_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break;
343+ case TEST_RING2: ring2_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break;
339344 }
340345
341346 return ff_filter_frame(outlink, picref);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t