1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
21 {
23
25
27
32
33 for (
i = 0;
i < current->Nf;
i++) {
37 us(8, Tq[
i],
i, 0, 3);
38 }
39
40 return 0;
41 }
42
45 {
47
50
51 if (current->Pq) {
52 for (
i = 0;
i < 64;
i++)
53 us(16,
Q[
i],
i, 1, 255);
54 } else {
55 for (
i = 0;
i < 64;
i++)
56 us(8,
Q[
i],
i, 1, 255);
57 }
58
59 return 0;
60 }
61
64 {
66
67 HEADER(
"Quantisation Tables");
68
69 u(16, Lq, 2, 2 + 4 * 65);
70 n = current->Lq / 65;
71
72 for (
i = 0;
i < n;
i++)
74
75 return 0;
76 }
77
80 {
82
85
86 for (
i = 0;
i < 16;
i++)
87 us(8,
L[
i],
i, 0, 255);
88
89 ij = 0;
90 for (
i = 0;
i < 16;
i++) {
91 for (j = 0; j < current->L[
i]; j++) {
94 us(8,
V[ij], ij, 0, 255);
95 ++ij;
96 }
97 }
98
99 return 0;
100 }
101
104 {
106
108
109 u(16, Lh, 2, 2 + 8 * (1 + 16 + 256));
110
111 n = 2;
112 for (
i = 0; n < current->Lh;
i++) {
115
117
118 ++n;
119 for (j = 0; j < 16; j++)
120 n += 1 + current->table[
i].L[j];
121 }
122
123 return 0;
124 }
125
128 {
129 int err, j;
130
132
134
136 for (j = 0; j < current->Ns; j++) {
138 us(4, Td[j], j, 0, 3);
139 us(4, Ta[j], j, 0, 3);
140 }
141
146
147 return 0;
148 }
149
152 {
154
155 HEADER(
"Application Data");
156
158
159 if (current->Lp > 2) {
160 #ifdef READ
162 if (!current->Ap_ref)
164 current->Ap = current->Ap_ref->data;
165 #endif
166
167 for (
i = 0;
i < current->Lp - 2;
i++)
168 us(8, Ap[
i],
i, 0, 255);
169 }
170
171 return 0;
172 }
173
176 {
178
180
182
183 if (current->Lc > 2) {
184 #ifdef READ
186 if (!current->Cm_ref)
188 current->Cm = current->Cm_ref->data;
189 #endif
190
191 for (
i = 0;
i < current->Lc - 2;
i++)
192 us(8, Cm[
i],
i, 0, 255);
193 }
194
195 return 0;
196 }