1 
2 #ifndef __SCHRO_PARAMS_H__
3 #define __SCHRO_PARAMS_H__
4 
5 #include <schroedinger/schroutils.h>
6 #include <schroedinger/schrobitstream.h>
7 #include <schroedinger/schroframe.h>
8 #include <schroedinger/schrolimits.h>
9 #include <schroedinger/schrovideoformat.h>
10 
11 SCHRO_BEGIN_DECLS
12 
13 typedef struct _SchroParams SchroParams;
14 typedef struct _SchroGlobalMotion SchroGlobalMotion;
15 
16 #ifdef SCHRO_ENABLE_UNSTABLE_API
17 
18 struct _SchroGlobalMotion {
19   int b0;
20   int b1;
21   int a_exp;
22   int a00;
23   int a01;
24   int a10;
25   int a11;
26   int c_exp;
27   int c0;
28   int c1;
29 };
30 
31 struct _SchroParams {
32   /*< private >*/
33   SchroVideoFormat *video_format;
34   int is_noarith;
35 
36   /* transform parameters */
37   int wavelet_filter_index;
38   int transform_depth;
39   int horiz_codeblocks[SCHRO_LIMIT_TRANSFORM_DEPTH + 1];
40   int vert_codeblocks[SCHRO_LIMIT_TRANSFORM_DEPTH + 1];
41   int codeblock_mode_index;
42 
43   /* motion prediction parameters */
44   int num_refs;
45   int have_global_motion; /* using_global_motion */
46   int xblen_luma;
47   int yblen_luma;
48   int xbsep_luma;
49   int ybsep_luma;
50   int mv_precision;
51   SchroGlobalMotion global_motion[2];
52   int picture_pred_mode;
53   int picture_weight_bits;
54   int picture_weight_1;
55   int picture_weight_2;
56 
57   /* DiracPro parameters */
58   int is_lowdelay;
59   int n_horiz_slices; /* slices_x */
60   int n_vert_slices; /* slices_y */
61   int slice_bytes_num;
62   int slice_bytes_denom;
63   int quant_matrix[3*SCHRO_LIMIT_TRANSFORM_DEPTH+1];
64 
65   /* calculated sizes */
66   int iwt_chroma_width;
67   int iwt_chroma_height;
68   int iwt_luma_width;
69   int iwt_luma_height;
70   int x_num_blocks;
71   int y_num_blocks;
72   int x_offset;
73   int y_offset;
74 };
75 
76 #define SCHRO_SUBBAND_IS_HORIZONTALLY_ORIENTED(position) (((position)&3) == 2)
77 #define SCHRO_SUBBAND_IS_VERTICALLY_ORIENTED(position) (((position)&3) == 1)
78 #define SCHRO_SUBBAND_IS_DIAGONALLY_ORIENTED(position) (((position)&3) == 3)
79 #define SCHRO_SUBBAND_SHIFT(position) ((position)>>2)
80 
81 extern const int schro_tables_lowdelay_quants[7][4][9];
82 
83 void schro_params_init (SchroParams *params, int video_format);
84 
85 void schro_params_calculate_iwt_sizes (SchroParams *params);
86 void schro_params_calculate_mc_sizes (SchroParams *params);
87 
88 int schro_params_set_block_params (SchroParams *params, int index);
89 int schro_params_get_block_params (SchroParams *params);
90 int schro_params_verify_block_params (SchroParams *params);
91 
92 void schro_params_set_default_codeblock (SchroParams *params);
93 schro_bool schro_params_is_default_codeblock (SchroParams *params);
94 
95 void schro_subband_get_frame_data (SchroFrameData *dest,
96     SchroFrame *frame, int component, int position, SchroParams *params);
97 int schro_subband_get_position (int index);
98 void schro_params_set_default_quant_matrix (SchroParams *params);
99 schro_bool schro_params_is_default_quant_matrix (SchroParams *params);
100 
101 /* FIXME should be SchroFrameFormat */
102 int schro_params_get_frame_format (int depth,
103     SchroChromaFormat chroma_format);
104 
105 /* FIXME should be moved */
106 void schro_frame_iwt_transform (SchroFrame *frame, SchroParams *params);
107 
108 #endif
109 
110 SCHRO_END_DECLS
111 
112 #endif
113 
114