1 #ifndef _VIDEO_GEN_SAD_H_
2 #define _VIDEO_GEN_SAD_H_
4 // Returns the sum of absolute difference between reference and source
5 typedef uint32_t (*sad_fn)(void* ref, void* src);
8 // bytes1 : number of bytes for ref (1-bytes)
9 // offset_ref : number of elements to skip to process next row ( 176 in QCIF for example, or at least row_length for a contiguous array )
10 // square_length : number of elements per row or column
11 // offset_ref & offset_src must be less than 1024
13 sad_fn gen_sad( uint32_t* buffer, uint32_t buffer_length,
14 uint32_t bytes_per_entry_ref, uint32_t bytes_per_entry_src,
15 uint16_t offset_ref, uint16_t offset_src,
16 uint32_t square_length);
21 int32_t sad_ref[] = { 1, 2, 3, 4, 5, 6, 7, 8,
22 1, 2, 3, 4, 5, 6, 7, 8,
23 1, 2, 3, 4, 5, 6, 7, 8,
24 1, 2, 3, 4, 5, 6, 7, 8,
25 1, 2, 3, 4, 5, 6, 7, 8,
26 1, 2, 3, 4, 5, 6, 7, 8,
27 1, 2, 3, 4, 5, 6, 7, 8,
28 1, 2, 3, 4, 5, 6, 7, 8 };
30 int16_t sad_mem[] = { 9, 2, 3, 4, 5, 6, 7, 8,
31 1, 2, 3, 4, 5, 6, 7, 8,
32 1, 2, 3, 4, 5, 6, 7, 8,
33 1, 2, 3, 4, 5, 6, 7, 8,
34 1, 2, 3, 12, 5, 6, 7, 8,
35 1, 2, 3, 4, 5, 6, 7, 8,
36 1, 2, 3, 4, 5, 6, 7, 8,
37 1, 2, 3, 4, 5, 6, 7, 8 };
39 uint32_t ramcode_buffer_sad[256];
40 sad_fn sad_8_32_16 = gen_sad( ramcode_buffer_sad, 256, MEM_FMT_32, MEM_FMT_16, 8, 8, 8);
42 uint32_t sum = sad_8_32_16(sad_ref, sad_mem);
46 #endif // _VIDEO_GENSAD_H_