Commit 887db368 authored by Limin Wang's avatar Limin Wang Committed by Michael Niedermayer

avfilter/vsrc_mptestsrc: simplify the code and change the type of frame

Signed-off-by: 's avatarLimin Wang <lance.lmwang@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent e85eb7cb
...@@ -308,7 +308,8 @@ static int request_frame(AVFilterLink *outlink) ...@@ -308,7 +308,8 @@ static int request_frame(AVFilterLink *outlink)
AVFrame *picref; AVFrame *picref;
int w = WIDTH, h = HEIGHT, int w = WIDTH, h = HEIGHT,
cw = AV_CEIL_RSHIFT(w, test->hsub), ch = AV_CEIL_RSHIFT(h, test->vsub); cw = AV_CEIL_RSHIFT(w, test->hsub), ch = AV_CEIL_RSHIFT(h, test->vsub);
unsigned int frame = outlink->frame_count_in; uint64_t frame = outlink->frame_count_in / test->max_frames;
uint64_t mod = outlink->frame_count_in % test->max_frames;
enum test_type tt = test->test; enum test_type tt = test->test;
int i; int i;
...@@ -327,20 +328,20 @@ static int request_frame(AVFilterLink *outlink) ...@@ -327,20 +328,20 @@ static int request_frame(AVFilterLink *outlink)
memset(picref->data[2] + i*picref->linesize[2], 128, cw); memset(picref->data[2] + i*picref->linesize[2], 128, cw);
} }
if (tt == TEST_ALL && frame%test->max_frames) /* draw a black frame at the beginning of each test */ if (tt == TEST_ALL && mod) /* draw a black frame at the beginning of each test */
tt = (frame/test->max_frames)%(TEST_NB-1); tt = frame%(TEST_NB-1);
switch (tt) { switch (tt) {
case TEST_DC_LUMA: dc_test(picref->data[0], picref->linesize[0], 256, 256, frame%test->max_frames); break; case TEST_DC_LUMA: dc_test(picref->data[0], picref->linesize[0], 256, 256, mod); break;
case TEST_DC_CHROMA: dc_test(picref->data[1], picref->linesize[1], 256, 256, frame%test->max_frames); break; case TEST_DC_CHROMA: dc_test(picref->data[1], picref->linesize[1], 256, 256, mod); break;
case TEST_FREQ_LUMA: freq_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break; case TEST_FREQ_LUMA: freq_test(picref->data[0], picref->linesize[0], mod); break;
case TEST_FREQ_CHROMA: freq_test(picref->data[1], picref->linesize[1], frame%test->max_frames); break; case TEST_FREQ_CHROMA: freq_test(picref->data[1], picref->linesize[1], mod); break;
case TEST_AMP_LUMA: amp_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break; case TEST_AMP_LUMA: amp_test(picref->data[0], picref->linesize[0], mod); break;
case TEST_AMP_CHROMA: amp_test(picref->data[1], picref->linesize[1], frame%test->max_frames); break; case TEST_AMP_CHROMA: amp_test(picref->data[1], picref->linesize[1], mod); break;
case TEST_CBP: cbp_test(picref->data , picref->linesize , frame%test->max_frames); break; case TEST_CBP: cbp_test(picref->data , picref->linesize , mod); break;
case TEST_MV: mv_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break; case TEST_MV: mv_test(picref->data[0], picref->linesize[0], mod); break;
case TEST_RING1: ring1_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break; case TEST_RING1: ring1_test(picref->data[0], picref->linesize[0], mod); break;
case TEST_RING2: ring2_test(picref->data[0], picref->linesize[0], frame%test->max_frames); break; case TEST_RING2: ring2_test(picref->data[0], picref->linesize[0], mod); break;
} }
return ff_filter_frame(outlink, picref); return ff_filter_frame(outlink, picref);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment