mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
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>
This commit is contained in:
parent
e85eb7cb04
commit
887db36821
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user