6 #include <schroedinger/schro.h>
7 #include <schroedinger/schromotion.h>
8 #include <schroedinger/schrodebug.h>
9 #include <schroedinger/schroutils.h>
10 #include <schroedinger/schrooil.h>
11 #include <schroedinger/schrocuda.h>
12 #include <schroedinger/schrogpuframe.h>
17 #include <liboil/liboilrandom.h>
18 #include <liboil/liboil.h>
22 void upsample_line (uint8_t *dest
, int dstr
, uint8_t *src
, int sstr
, int n
);
23 void ref_h_upsample (SchroFrame
*dest
, SchroFrame
*src
);
24 void ref_v_upsample (SchroFrame
*dest
, SchroFrame
*src
);
26 void test (int width
, int height
);
32 SchroMemoryDomain
*cpu_domain
;
33 SchroMemoryDomain
*cuda_domain
;
36 main (int argc
, char *argv
[])
42 cpu_domain
= schro_memory_domain_new_local ();
43 cuda_domain
= schro_memory_domain_new_cuda ();
46 for(width
=1;width
<=20;width
++){
47 for(height
=1;height
<=20;height
++){
63 void test (int width
, int height
)
67 SchroFrame
*frame_ref
;
68 SchroFrame
*frame_test
;
69 SchroFrame
*frame_cuda
;
71 char name
[TEST_PATTERN_NAME_SIZE
];
75 params
.iwt_luma_width
= width
;
76 params
.iwt_luma_height
= height
;
77 params
.iwt_chroma_width
= width
/2;
78 params
.iwt_chroma_height
= height
/2;
79 params
.transform_depth
= 1;
81 frame_u8
= schro_frame_new_and_alloc (cpu_domain
,
82 SCHRO_FRAME_FORMAT_U8_420
, width
, height
);
83 frame
= schro_frame_new_and_alloc (cpu_domain
,
84 SCHRO_FRAME_FORMAT_S16_420
, width
, height
);
85 frame_cuda
= schro_frame_new_and_alloc (cuda_domain
,
86 SCHRO_FRAME_FORMAT_S16_420
, width
, height
);
87 frame_ref
= schro_frame_new_and_alloc (cpu_domain
,
88 SCHRO_FRAME_FORMAT_S16_420
, width
, height
);
89 frame_test
= schro_frame_new_and_alloc (cpu_domain
,
90 SCHRO_FRAME_FORMAT_S16_420
, width
, height
);
92 for(i
=0;i
<test_pattern_get_n_generators();i
++){
93 test_pattern_generate (frame_u8
->components
+ 0, name
, i
);
94 test_pattern_generate (frame_u8
->components
+ 1, name
, i
);
95 test_pattern_generate (frame_u8
->components
+ 2, name
, i
);
96 schro_frame_convert (frame
, frame_u8
);
98 schro_frame_convert (frame_ref
, frame_u8
);
99 schro_frame_inverse_iwt_transform (frame_ref
, ¶ms
);
101 schro_frame_to_gpu (frame_cuda
, frame
);
102 schro_gpuframe_inverse_iwt_transform (frame_cuda
, ¶ms
);
103 schro_gpuframe_to_cpu (frame_test
, frame_cuda
);
105 ok
= frame_compare (frame_ref
, frame_test
);
106 printf(" pattern %s: %s\n", name
, ok
? "OK" : "broken");
107 if (dump_all
|| !ok
) {
108 frame_data_dump_full (frame_test
->components
+ 0,
109 frame_ref
->components
+ 0, frame
->components
+ 0);
114 schro_frame_unref (frame
);
115 schro_frame_unref (frame_ref
);
116 schro_frame_unref (frame_test
);
117 schro_frame_unref (frame_cuda
);