Parent Directory | Revision Log
Revision 20 - (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 : | 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 : | }; | ||
18 : | |||
19 : | Isibaar | 4 | int16_t intra_matrix[64] = { |
20 : | Isibaar | 3 | 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 : | }; | ||
29 : | |||
30 : | Isibaar | 4 | int16_t intra_matrix_fix[64] = { |
31 : | 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 : | }; | ||
40 : | |||
41 : | Isibaar | 20 | uint8_t default_inter_matrix[64] = { |
42 : | 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 : | }; | ||
51 : | |||
52 : | Isibaar | 4 | int16_t inter_matrix[64] = { |
53 : | Isibaar | 3 | 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 : | }; | ||
62 : | |||
63 : | Isibaar | 4 | int16_t inter_matrix_fix[64] = { |
64 : | 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 : | }; | ||
73 : | Isibaar | 3 | |
74 : | Isibaar | 4 | uint8_t get_intra_matrix_status(void) { |
75 : | Isibaar | 20 | return custom_intra_matrix; |
76 : | Isibaar | 4 | } |
77 : | |||
78 : | uint8_t get_inter_matrix_status(void) { | ||
79 : | Isibaar | 20 | return custom_inter_matrix; |
80 : | Isibaar | 4 | } |
81 : | |||
82 : | void set_intra_matrix_status(uint8_t status) { | ||
83 : | Isibaar | 20 | custom_intra_matrix = status; |
84 : | Isibaar | 4 | } |
85 : | |||
86 : | void set_inter_matrix_status(uint8_t status) { | ||
87 : | Isibaar | 20 | custom_inter_matrix = status; |
88 : | Isibaar | 4 | } |
89 : | |||
90 : | int16_t *get_intra_matrix(void) { | ||
91 : | return intra_matrix; | ||
92 : | } | ||
93 : | |||
94 : | Isibaar | 20 | uint8_t *get_default_intra_matrix(void) { |
95 : | return default_intra_matrix; | ||
96 : | Isibaar | 4 | } |
97 : | |||
98 : | Isibaar | 20 | uint8_t *get_default_inter_matrix(void) { |
99 : | return default_inter_matrix; | ||
100 : | } | ||
101 : | |||
102 : | Isibaar | 4 | uint8_t set_intra_matrix(uint8_t *matrix) |
103 : | Isibaar | 3 | { |
104 : | Isibaar | 20 | int i, change = 0; |
105 : | Isibaar | 4 | |
106 : | Isibaar | 20 | custom_intra_matrix = 0; |
107 : | Isibaar | 3 | |
108 : | Isibaar | 4 | for(i = 0; i < 64; i++) { |
109 : | Isibaar | 20 | if((int16_t) default_intra_matrix[i] != matrix[i]) |
110 : | custom_intra_matrix = 1; | ||
111 : | Isibaar | 4 | if(intra_matrix[i] != matrix[i]) |
112 : | Isibaar | 20 | change = 1; |
113 : | Isibaar | 3 | |
114 : | Isibaar | 4 | intra_matrix[i] = (int16_t) matrix[i]; |
115 : | intra_matrix_fix[i] = FIX(intra_matrix[i]); | ||
116 : | } | ||
117 : | Isibaar | 20 | return custom_intra_matrix | change; |
118 : | Isibaar | 3 | } |
119 : | |||
120 : | |||
121 : | Isibaar | 4 | uint8_t set_inter_matrix(uint8_t *matrix) |
122 : | Isibaar | 3 | { |
123 : | Isibaar | 20 | int i, change = 0; |
124 : | Isibaar | 4 | |
125 : | Isibaar | 20 | custom_inter_matrix = 0; |
126 : | Isibaar | 4 | |
127 : | for(i = 0; i < 64; i++) { | ||
128 : | Isibaar | 20 | if((int16_t) default_inter_matrix[i] != matrix[i]) |
129 : | custom_inter_matrix = 1; | ||
130 : | Isibaar | 4 | if(inter_matrix[i] != matrix[i]) |
131 : | Isibaar | 20 | change = 1; |
132 : | Isibaar | 4 | |
133 : | inter_matrix[i] = (int16_t) matrix[i]; | ||
134 : | inter_matrix_fix[i] = FIX(inter_matrix[i]); | ||
135 : | Isibaar | 3 | } |
136 : | Isibaar | 20 | return custom_inter_matrix | change; |
137 : | Isibaar | 3 | } |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |