Parent Directory | Revision Log
Revision 195 - (view) (download)
1 : | Isibaar | 4 | #include "quant_matrix.h" |
2 : | Isibaar | 3 | |
3 : | Isibaar | 4 | #define FIX(X) (1 << 16) / (X) + 1 |
4 : | Isibaar | 3 | |
5 : | Isibaar | 20 | uint8_t custom_intra_matrix = 0; |
6 : | uint8_t custom_inter_matrix = 0; | ||
7 : | Isibaar | 3 | |
8 : | Isibaar | 20 | uint8_t default_intra_matrix[64] = { |
9 : | edgomez | 195 | 8, 17, 18, 19, 21, 23, 25, 27, |
10 : | 17, 18, 19, 21, 23, 25, 27, 28, | ||
11 : | 20, 21, 22, 23, 24, 26, 28, 30, | ||
12 : | 21, 22, 23, 24, 26, 28, 30, 32, | ||
13 : | 22, 23, 24, 26, 28, 30, 32, 35, | ||
14 : | 23, 24, 26, 28, 30, 32, 35, 38, | ||
15 : | 25, 26, 28, 30, 32, 35, 38, 41, | ||
16 : | 27, 28, 30, 32, 35, 38, 41, 45 | ||
17 : | Isibaar | 20 | }; |
18 : | |||
19 : | Isibaar | 4 | int16_t intra_matrix[64] = { |
20 : | edgomez | 195 | 8, 17, 18, 19, 21, 23, 25, 27, |
21 : | 17, 18, 19, 21, 23, 25, 27, 28, | ||
22 : | 20, 21, 22, 23, 24, 26, 28, 30, | ||
23 : | 21, 22, 23, 24, 26, 28, 30, 32, | ||
24 : | 22, 23, 24, 26, 28, 30, 32, 35, | ||
25 : | 23, 24, 26, 28, 30, 32, 35, 38, | ||
26 : | 25, 26, 28, 30, 32, 35, 38, 41, | ||
27 : | 27, 28, 30, 32, 35, 38, 41, 45 | ||
28 : | Isibaar | 3 | }; |
29 : | |||
30 : | Isibaar | 4 | int16_t intra_matrix_fix[64] = { |
31 : | edgomez | 195 | FIX(8), FIX(17), FIX(18), FIX(19), FIX(21), FIX(23), FIX(25), FIX(27), |
32 : | FIX(17), FIX(18), FIX(19), FIX(21), FIX(23), FIX(25), FIX(27), FIX(28), | ||
33 : | FIX(20), FIX(21), FIX(22), FIX(23), FIX(24), FIX(26), FIX(28), FIX(30), | ||
34 : | FIX(21), FIX(22), FIX(23), FIX(24), FIX(26), FIX(28), FIX(30), FIX(32), | ||
35 : | FIX(22), FIX(23), FIX(24), FIX(26), FIX(28), FIX(30), FIX(32), FIX(35), | ||
36 : | FIX(23), FIX(24), FIX(26), FIX(28), FIX(30), FIX(32), FIX(35), FIX(38), | ||
37 : | FIX(25), FIX(26), FIX(28), FIX(30), FIX(32), FIX(35), FIX(38), FIX(41), | ||
38 : | FIX(27), FIX(28), FIX(30), FIX(32), FIX(35), FIX(38), FIX(41), FIX(45) | ||
39 : | Isibaar | 4 | }; |
40 : | |||
41 : | Isibaar | 20 | uint8_t default_inter_matrix[64] = { |
42 : | edgomez | 195 | 16, 17, 18, 19, 20, 21, 22, 23, |
43 : | 17, 18, 19, 20, 21, 22, 23, 24, | ||
44 : | 18, 19, 20, 21, 22, 23, 24, 25, | ||
45 : | 19, 20, 21, 22, 23, 24, 26, 27, | ||
46 : | 20, 21, 22, 23, 25, 26, 27, 28, | ||
47 : | 21, 22, 23, 24, 26, 27, 28, 30, | ||
48 : | 22, 23, 24, 26, 27, 28, 30, 31, | ||
49 : | 23, 24, 25, 27, 28, 30, 31, 33 | ||
50 : | Isibaar | 20 | }; |
51 : | |||
52 : | Isibaar | 4 | int16_t inter_matrix[64] = { |
53 : | edgomez | 195 | 16, 17, 18, 19, 20, 21, 22, 23, |
54 : | 17, 18, 19, 20, 21, 22, 23, 24, | ||
55 : | 18, 19, 20, 21, 22, 23, 24, 25, | ||
56 : | 19, 20, 21, 22, 23, 24, 26, 27, | ||
57 : | 20, 21, 22, 23, 25, 26, 27, 28, | ||
58 : | 21, 22, 23, 24, 26, 27, 28, 30, | ||
59 : | 22, 23, 24, 26, 27, 28, 30, 31, | ||
60 : | 23, 24, 25, 27, 28, 30, 31, 33 | ||
61 : | Isibaar | 3 | }; |
62 : | |||
63 : | Isibaar | 4 | int16_t inter_matrix_fix[64] = { |
64 : | edgomez | 195 | FIX(16), FIX(17), FIX(18), FIX(19), FIX(20), FIX(21), FIX(22), FIX(23), |
65 : | FIX(17), FIX(18), FIX(19), FIX(20), FIX(21), FIX(22), FIX(23), FIX(24), | ||
66 : | FIX(18), FIX(19), FIX(20), FIX(21), FIX(22), FIX(23), FIX(24), FIX(25), | ||
67 : | FIX(19), FIX(20), FIX(21), FIX(22), FIX(23), FIX(24), FIX(26), FIX(27), | ||
68 : | FIX(20), FIX(21), FIX(22), FIX(23), FIX(25), FIX(26), FIX(27), FIX(28), | ||
69 : | FIX(21), FIX(22), FIX(23), FIX(24), FIX(26), FIX(27), FIX(28), FIX(30), | ||
70 : | FIX(22), FIX(23), FIX(24), FIX(26), FIX(27), FIX(28), FIX(30), FIX(31), | ||
71 : | FIX(23), FIX(24), FIX(25), FIX(27), FIX(28), FIX(30), FIX(31), FIX(33) | ||
72 : | Isibaar | 4 | }; |
73 : | Isibaar | 3 | |
74 : | edgomez | 195 | uint8_t |
75 : | get_intra_matrix_status(void) | ||
76 : | { | ||
77 : | Isibaar | 20 | return custom_intra_matrix; |
78 : | Isibaar | 4 | } |
79 : | |||
80 : | edgomez | 195 | uint8_t |
81 : | get_inter_matrix_status(void) | ||
82 : | { | ||
83 : | Isibaar | 20 | return custom_inter_matrix; |
84 : | Isibaar | 4 | } |
85 : | |||
86 : | edgomez | 195 | void |
87 : | set_intra_matrix_status(uint8_t status) | ||
88 : | { | ||
89 : | Isibaar | 20 | custom_intra_matrix = status; |
90 : | Isibaar | 4 | } |
91 : | |||
92 : | edgomez | 195 | void |
93 : | set_inter_matrix_status(uint8_t status) | ||
94 : | { | ||
95 : | Isibaar | 20 | custom_inter_matrix = status; |
96 : | Isibaar | 4 | } |
97 : | |||
98 : | edgomez | 195 | int16_t * |
99 : | get_intra_matrix(void) | ||
100 : | { | ||
101 : | Isibaar | 4 | return intra_matrix; |
102 : | } | ||
103 : | |||
104 : | edgomez | 195 | int16_t * |
105 : | get_inter_matrix(void) | ||
106 : | { | ||
107 : | Isibaar | 21 | return inter_matrix; |
108 : | } | ||
109 : | |||
110 : | edgomez | 195 | uint8_t * |
111 : | get_default_intra_matrix(void) | ||
112 : | { | ||
113 : | Isibaar | 20 | return default_intra_matrix; |
114 : | Isibaar | 4 | } |
115 : | |||
116 : | edgomez | 195 | uint8_t * |
117 : | get_default_inter_matrix(void) | ||
118 : | { | ||
119 : | Isibaar | 20 | return default_inter_matrix; |
120 : | } | ||
121 : | |||
122 : | edgomez | 195 | uint8_t |
123 : | set_intra_matrix(uint8_t * matrix) | ||
124 : | Isibaar | 3 | { |
125 : | Isibaar | 20 | int i, change = 0; |
126 : | edgomez | 195 | |
127 : | Isibaar | 20 | custom_intra_matrix = 0; |
128 : | Isibaar | 3 | |
129 : | edgomez | 195 | for (i = 0; i < 64; i++) { |
130 : | if ((int16_t) default_intra_matrix[i] != matrix[i]) | ||
131 : | Isibaar | 20 | custom_intra_matrix = 1; |
132 : | edgomez | 195 | if (intra_matrix[i] != matrix[i]) |
133 : | Isibaar | 20 | change = 1; |
134 : | Isibaar | 3 | |
135 : | Isibaar | 4 | intra_matrix[i] = (int16_t) matrix[i]; |
136 : | intra_matrix_fix[i] = FIX(intra_matrix[i]); | ||
137 : | } | ||
138 : | Isibaar | 20 | return custom_intra_matrix | change; |
139 : | Isibaar | 3 | } |
140 : | |||
141 : | |||
142 : | edgomez | 195 | uint8_t |
143 : | set_inter_matrix(uint8_t * matrix) | ||
144 : | Isibaar | 3 | { |
145 : | Isibaar | 20 | int i, change = 0; |
146 : | edgomez | 195 | |
147 : | Isibaar | 20 | custom_inter_matrix = 0; |
148 : | Isibaar | 4 | |
149 : | edgomez | 195 | for (i = 0; i < 64; i++) { |
150 : | if ((int16_t) default_inter_matrix[i] != matrix[i]) | ||
151 : | Isibaar | 20 | custom_inter_matrix = 1; |
152 : | edgomez | 195 | if (inter_matrix[i] != matrix[i]) |
153 : | Isibaar | 20 | change = 1; |
154 : | Isibaar | 4 | |
155 : | inter_matrix[i] = (int16_t) matrix[i]; | ||
156 : | inter_matrix_fix[i] = FIX(inter_matrix[i]); | ||
157 : | Isibaar | 3 | } |
158 : | Isibaar | 20 | return custom_inter_matrix | change; |
159 : | Isibaar | 3 | } |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |