diff options
author | Limin Wang <lance.lmwang@gmail.com> | 2019-10-21 18:12:12 +0800 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-10-21 22:57:10 +0200 |
commit | 887db368212bb0a66360f70ad636cadbe310997b (patch) | |
tree | 1b35520f305efe8c7fa47055ebcf827aae244784 /libavfilter/vsrc_mptestsrc.c | |
parent | e85eb7cb04cefa37c7f8e78aac381aa8377dea0f (diff) | |
download | ffmpeg-887db368212bb0a66360f70ad636cadbe310997b.tar.gz |
avfilter/vsrc_mptestsrc: simplify the code and change the type of frame
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavfilter/vsrc_mptestsrc.c')
-rw-r--r-- | libavfilter/vsrc_mptestsrc.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/libavfilter/vsrc_mptestsrc.c b/libavfilter/vsrc_mptestsrc.c index 31c68939e4..2ea736b0b2 100644 --- a/libavfilter/vsrc_mptestsrc.c +++ b/libavfilter/vsrc_mptestsrc.c @@ -308,7 +308,8 @@ static int request_frame(AVFilterLink *outlink) AVFrame *picref; int w = WIDTH, h = HEIGHT, 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; int i; @@ -327,20 +328,20 @@ static int request_frame(AVFilterLink *outlink) 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 */ - tt = (frame/test->max_frames)%(TEST_NB-1); + if (tt == TEST_ALL && mod) /* draw a black frame at the beginning of each test */ + tt = frame%(TEST_NB-1); switch (tt) { - 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; + 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, mod); 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], mod); 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], mod); break; + case TEST_CBP: cbp_test(picref->data , picref->linesize , mod); 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], mod); break; + case TEST_RING2: ring2_test(picref->data[0], picref->linesize[0], mod); break; } return ff_filter_frame(outlink, picref); |