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
20940@item ring220940@item ring2
20941@item all20941@item all
20942 20942
20943@item max_frames, m
20944Set the maximum number of frames generated for each test, default value is 30.
20945
20943@end table20946@end table
20944 20947
20945Default value is "all", which will cycle through the list of all tests.20948Default 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
54 const AVClass *class;54 const AVClass *class;
55 AVRational frame_rate;55 AVRational frame_rate;
56 int64_t pts, max_pts, duration;56 int64_t pts, max_pts, duration;
57 int64_t max_frames;
57 int hsub, vsub;58 int hsub, vsub;
58 int test; ///< test_type59 int test; ///< test_type
59} MPTestContext;60} MPTestContext;
@@ -79,6 +80,10 @@ static const AVOption mptestsrc_options[]= { · 19 unmodified lines
79 { "ring1", "", 0, AV_OPT_TYPE_CONST, {.i64=TEST_RING1}, INT_MIN, INT_MAX, FLAGS, "test" },80 { "ring1", "", 0, AV_OPT_TYPE_CONST, {.i64=TEST_RING1}, INT_MIN, INT_MAX, FLAGS, "test" },
80 { "ring2", "", 0, AV_OPT_TYPE_CONST, {.i64=TEST_RING2}, INT_MIN, INT_MAX, FLAGS, "test" },81 { "ring2", "", 0, AV_OPT_TYPE_CONST, {.i64=TEST_RING2}, INT_MIN, INT_MAX, FLAGS, "test" },
81 { "all", "", 0, AV_OPT_TYPE_CONST, {.i64=TEST_ALL}, INT_MIN, INT_MAX, FLAGS, "test" },82 { "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 },
82 { NULL }87 { NULL }
83};88};
84 89
@@ -322,20 +327,20 @@ static int request_frame(AVFilterLink *outlink) · 237 unmodified lines
322 memset(picref->data[2] + i*picref->linesize[2], 128, cw);327 memset(picref->data[2] + i*picref->linesize[2], 128, cw);
323 }328 }
324 329
325 if (tt == TEST_ALL && frame%30) /* draw a black frame at the beginning of each test */330 if (tt == TEST_ALL && frame%test->max_frames) /* draw a black frame at the beginning of each test */
326 tt = (frame/30)%(TEST_NB-1);331 tt = (frame/test->max_frames)%(TEST_NB-1);
327 332
328 switch (tt) {333 switch (tt) {
329 case TEST_DC_LUMA: dc_test(picref->data[0], picref->linesize[0], 256, 256, frame%30); break;334 case TEST_DC_LUMA: dc_test(picref->data[0], picref->linesize[0], 256, 256, frame%test->max_frames); break;
330 case TEST_DC_CHROMA: dc_test(picref->data[1], picref->linesize[1], 256, 256, frame%30); break;335 case TEST_DC_CHROMA: dc_test(picref->data[1], picref->linesize[1], 256, 256, frame%test->max_frames); break;
331 case TEST_FREQ_LUMA: freq_test(picref->data[0], picref->linesize[0], frame%30); break;336 case TEST_FREQ_LUMA: freq_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break;
332 case TEST_FREQ_CHROMA: freq_test(picref->data[1], picref->linesize[1], frame%30); break;337 case TEST_FREQ_CHROMA: freq_test(picref->data[1], picref->linesize[1], frame%test->max_frames); break;
333 case TEST_AMP_LUMA: amp_test(picref->data[0], picref->linesize[0], frame%30); break;338 case TEST_AMP_LUMA: amp_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break;
334 case TEST_AMP_CHROMA: amp_test(picref->data[1], picref->linesize[1], frame%30); break;339 case TEST_AMP_CHROMA: amp_test(picref->data[1], picref->linesize[1], frame%test->max_frames); break;
335 case TEST_CBP: cbp_test(picref->data , picref->linesize , frame%30); break;340 case TEST_CBP: cbp_test(picref->data , picref->linesize , frame%test->max_frames); break;
336 case TEST_MV: mv_test(picref->data[0], picref->linesize[0], frame%30); break;341 case TEST_MV: mv_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break;
337 case TEST_RING1: ring1_test(picref->data[0], picref->linesize[0], frame%30); break;342 case TEST_RING1: ring1_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break;
338 case TEST_RING2: ring2_test(picref->data[0], picref->linesize[0], frame%30); break;343 case TEST_RING2: ring2_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break;
339 }344 }
340 345
341 return ff_filter_frame(outlink, picref);346 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