Parent Directory | Revision Log
Revision 4 - (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 | 4 | uint8_t intra_matrix_changed; |
6 : | uint8_t inter_matrix_changed; | ||
7 : | Isibaar | 3 | |
8 : | Isibaar | 4 | int16_t intra_matrix[64] = { |
9 : | Isibaar | 3 | 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_fix[64] = { |
20 : | FIX(8),FIX(17),FIX(18),FIX(19),FIX(21),FIX(23),FIX(25),FIX(27), | ||
21 : | FIX(17),FIX(18),FIX(19),FIX(21),FIX(23),FIX(25),FIX(27),FIX(28), | ||
22 : | FIX(20),FIX(21),FIX(22),FIX(23),FIX(24),FIX(26),FIX(28),FIX(30), | ||
23 : | FIX(21),FIX(22),FIX(23),FIX(24),FIX(26),FIX(28),FIX(30),FIX(32), | ||
24 : | FIX(22),FIX(23),FIX(24),FIX(26),FIX(28),FIX(30),FIX(32),FIX(35), | ||
25 : | FIX(23),FIX(24),FIX(26),FIX(28),FIX(30),FIX(32),FIX(35),FIX(38), | ||
26 : | FIX(25),FIX(26),FIX(28),FIX(30),FIX(32),FIX(35),FIX(38),FIX(41), | ||
27 : | FIX(27),FIX(28),FIX(30),FIX(32),FIX(35),FIX(38),FIX(41),FIX(45) | ||
28 : | }; | ||
29 : | |||
30 : | int16_t inter_matrix[64] = { | ||
31 : | Isibaar | 3 | 16,17,18,19,20,21,22,23, |
32 : | 17,18,19,20,21,22,23,24, | ||
33 : | 18,19,20,21,22,23,24,25, | ||
34 : | 19,20,21,22,23,24,26,27, | ||
35 : | 20,21,22,23,25,26,27,28, | ||
36 : | 21,22,23,24,26,27,28,30, | ||
37 : | 22,23,24,26,27,28,30,31, | ||
38 : | 23,24,25,27,28,30,31,33 | ||
39 : | }; | ||
40 : | |||
41 : | Isibaar | 4 | int16_t inter_matrix_fix[64] = { |
42 : | FIX(16),FIX(17),FIX(18),FIX(19),FIX(20),FIX(21),FIX(22),FIX(23), | ||
43 : | FIX(17),FIX(18),FIX(19),FIX(20),FIX(21),FIX(22),FIX(23),FIX(24), | ||
44 : | FIX(18),FIX(19),FIX(20),FIX(21),FIX(22),FIX(23),FIX(24),FIX(25), | ||
45 : | FIX(19),FIX(20),FIX(21),FIX(22),FIX(23),FIX(24),FIX(26),FIX(27), | ||
46 : | FIX(20),FIX(21),FIX(22),FIX(23),FIX(25),FIX(26),FIX(27),FIX(28), | ||
47 : | FIX(21),FIX(22),FIX(23),FIX(24),FIX(26),FIX(27),FIX(28),FIX(30), | ||
48 : | FIX(22),FIX(23),FIX(24),FIX(26),FIX(27),FIX(28),FIX(30),FIX(31), | ||
49 : | FIX(23),FIX(24),FIX(25),FIX(27),FIX(28),FIX(30),FIX(31),FIX(33) | ||
50 : | }; | ||
51 : | Isibaar | 3 | |
52 : | Isibaar | 4 | uint8_t get_intra_matrix_status(void) { |
53 : | return intra_matrix_changed; | ||
54 : | } | ||
55 : | |||
56 : | uint8_t get_inter_matrix_status(void) { | ||
57 : | return inter_matrix_changed; | ||
58 : | } | ||
59 : | |||
60 : | void set_intra_matrix_status(uint8_t status) { | ||
61 : | intra_matrix_changed = status; | ||
62 : | } | ||
63 : | |||
64 : | void set_inter_matrix_status(uint8_t status) { | ||
65 : | inter_matrix_changed = status; | ||
66 : | } | ||
67 : | |||
68 : | int16_t *get_intra_matrix(void) { | ||
69 : | return intra_matrix; | ||
70 : | } | ||
71 : | |||
72 : | int16_t *get_inter_matrix(void) { | ||
73 : | return inter_matrix; | ||
74 : | } | ||
75 : | |||
76 : | uint8_t set_intra_matrix(uint8_t *matrix) | ||
77 : | Isibaar | 3 | { |
78 : | Isibaar | 4 | int i; |
79 : | |||
80 : | intra_matrix_changed = 0; | ||
81 : | Isibaar | 3 | |
82 : | Isibaar | 4 | for(i = 0; i < 64; i++) { |
83 : | if(intra_matrix[i] != matrix[i]) | ||
84 : | intra_matrix_changed = 1; | ||
85 : | Isibaar | 3 | |
86 : | Isibaar | 4 | intra_matrix[i] = (int16_t) matrix[i]; |
87 : | intra_matrix_fix[i] = FIX(intra_matrix[i]); | ||
88 : | } | ||
89 : | return intra_matrix_changed; | ||
90 : | Isibaar | 3 | } |
91 : | |||
92 : | |||
93 : | Isibaar | 4 | uint8_t set_inter_matrix(uint8_t *matrix) |
94 : | Isibaar | 3 | { |
95 : | Isibaar | 4 | int i; |
96 : | |||
97 : | inter_matrix_changed = 0; | ||
98 : | |||
99 : | for(i = 0; i < 64; i++) { | ||
100 : | if(inter_matrix[i] != matrix[i]) | ||
101 : | inter_matrix_changed = 1; | ||
102 : | |||
103 : | inter_matrix[i] = (int16_t) matrix[i]; | ||
104 : | inter_matrix_fix[i] = FIX(inter_matrix[i]); | ||
105 : | Isibaar | 3 | } |
106 : | Isibaar | 4 | return inter_matrix_changed; |
107 : | Isibaar | 3 | } |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |