[FFmpeg-cvslog] avfilter/vsrc_mptestsrc: simplify the code and change the type of frame
Limin Wang
git at videolan.org
Tue Oct 22 00:16:17 EEST 2019
ffmpeg | branch: master | Limin Wang <lance.lmwang at gmail.com> | Mon Oct 21 18:12:12 2019 +0800| [887db368212bb0a66360f70ad636cadbe310997b] | committer: Michael Niedermayer
avfilter/vsrc_mptestsrc: simplify the code and change the type of frame
Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=887db368212bb0a66360f70ad636cadbe310997b
---
libavfilter/vsrc_mptestsrc.c | 27 ++++++++++++++-------------
1 file 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);
More information about the ffmpeg-cvslog
mailing list