Imported Debian version 1.0~trusty
[deb_vid.stab.git] / tests / generate.c
CommitLineData
80f575fc
DM
1#define NUM_RECTANGLES 100
2void generateFrames(TestData* testdata, int num){
3 int i;
4 for(i=0; i<num; i++){
5 vsFrameAllocate(&testdata->frames[i],&testdata->fi);
6 }
7 // first frame noise
8 fillArrayWithNoise(testdata->frames[0].data[0],
9 testdata->fi.width*testdata->fi.height, 10);
10 fillArrayWithNoise(testdata->frames[0].data[1],
11 testdata->fi.width/2*testdata->fi.height/2, 5);
12 fillArrayWithNoise(testdata->frames[0].data[2],
13 testdata->fi.width/2*testdata->fi.height/2, 5);
14
15 // add rectangles
16 int k;
17 for(k=0; k<NUM_RECTANGLES; k++){
18 paintRectangle(testdata->frames[0].data[0],&testdata->fi,
19 randUpTo(testdata->fi.width), randUpTo(testdata->fi.height),
20 randUpTo((testdata->fi.width>>4)+4),
21 randUpTo((testdata->fi.height>>4)+4),randPixel());
22
23 }
24
25 VSTransformConfig conf = vsTransformGetDefaultConfig("test_generate");
26 conf.interpolType=VS_Zero;
27 VSTransformData td;
28 test_bool(vsTransformDataInit(&td, &conf, &testdata->fi, &testdata->fi) == VS_OK);
29
30 fprintf(stderr, "testframe transforms\n");
31
32 for(i=1; i<num; i++){
33 VSTransform t = getTestFrameTransform(i);
34 fprintf(stderr,"%i: ",i);
35 storeVSTransform(stderr,&t);
36
37 test_bool(vsTransformPrepare(&td,&testdata->frames[i-1],&testdata->frames[i])== VS_OK);
38 test_bool(transformPlanar_float(&td, t)== VS_OK);
39 test_bool(vsTransformFinish(&td)== VS_OK);
40 }
41 vsTransformDataCleanup(&td);
42}
43
44/*
45 * Local variables:
46 * c-file-style: "stroustrup"
47 * c-file-offsets: ((case-label . *) (statement-case-intro . *))
48 * indent-tabs-mode: nil
49 * c-basic-offset: 2 t
50 * End:
51 *
52 * vim: expandtab shiftwidth=2:
53 */