tests: fix build on os/x
[schroedinger.git] / schroedinger / schrometric.h
blob2cac600bb0877f9abbbba36aefd4b5bb6dd135a6
2 #ifndef SCHRO_METRIC_H
3 #define SCHRO_METRIC_H
5 #include <schroedinger/schroutils.h>
6 #include <schroedinger/schroframe.h>
7 #include <limits.h>
9 SCHRO_BEGIN_DECLS
11 typedef struct _SchroMetricScan SchroMetricScan;
12 typedef struct _SchroMetricInfo SchroMetricInfo;
14 #ifdef SCHRO_ENABLE_UNSTABLE_API
16 #define SCHRO_LIMIT_METRIC_SCAN 42
18 struct _SchroMetricInfo {
19 SchroFrame *frame;
20 SchroFrame *ref_frame;
22 int block_width[3];
23 int block_height[3];
24 int h_shift[3];
25 int v_shift[3];
27 int (*metric) (SchroMetricInfo *info, int ref_x, int ref_y,
28 int dx, int dy);
29 int (*metric_right) (SchroMetricInfo *info, int ref_x, int ref_y,
30 int dx, int dy);
31 int (*metric_bottom) (SchroMetricInfo *info, int ref_x, int ref_y,
32 int dx, int dy);
33 int (*metric_corner) (SchroMetricInfo *info, int ref_x, int ref_y,
34 int dx, int dy);
38 struct _SchroMetricScan {
39 SchroFrame *frame;
40 SchroFrame *ref_frame;
41 int block_width;
42 int block_height;
43 int x, y;
44 int ref_x, ref_y;
45 int scan_width;
46 int scan_height;
47 int gravity_scale;
48 int gravity_x, gravity_y;
49 int use_chroma;
50 /* output */
51 uint32_t metrics[SCHRO_LIMIT_METRIC_SCAN*SCHRO_LIMIT_METRIC_SCAN];
52 uint32_t chroma_metrics[SCHRO_LIMIT_METRIC_SCAN*SCHRO_LIMIT_METRIC_SCAN];
55 #define SCHRO_METRIC_INVALID INT_MAX
57 int schro_metric_absdiff_u8 (uint8_t *a, int a_stride, uint8_t *b,
58 int b_stride, int width, int height);
59 int schro_metric_haar (uint8_t *src1, int stride1, uint8_t *src2, int stride2,
60 int width, int height);
61 int schro_metric_haar_const (uint8_t *data, int stride, int dc_value,
62 int width, int height);
63 int schro_metric_abssum_s16 (int16_t *data, int stride, int width, int height);
64 int schro_metric_sum_u8 (uint8_t *data, int stride, int width, int height);
66 void schro_metric_scan_do_scan (SchroMetricScan *scan);
67 int schro_metric_scan_get_min (SchroMetricScan *scan, int *dx, int *dy
68 , uint32_t* chroma_metric);
69 void schro_metric_scan_setup (SchroMetricScan *scan, int dx, int dy, int dist
70 , int use_chroma);
72 int schro_metric_get (SchroFrameData *src1, SchroFrameData *src2, int width, int height);
73 int schro_metric_get_biref (SchroFrameData *fd, SchroFrameData *src1,
74 int weight1, SchroFrameData *src2, int weight2, int shift, int width,
75 int height);
76 int schro_metric_get_dc (SchroFrameData *src, int value, int width, int height);
78 void schro_metric_info_init (SchroMetricInfo *info, SchroFrame *frame,
79 SchroFrame *ref_frame, int block_width, int block_height);
81 int schro_metric_fast_block (SchroMetricInfo *info, int x, int y,
82 int dx, int dy);
83 int schro_metric_fast_subsuperblock (SchroMetricInfo *info, int x, int y,
84 int dx, int dy);
85 int schro_metric_fast_superblock (SchroMetricInfo *info, int x, int y,
86 int dx, int dy);
89 #endif
91 SCHRO_END_DECLS
93 #endif