Parent Directory | Revision Log
Revision 816 - (view) (download)
1 : | edgomez | 451 | /***************************************************************************** |
2 : | * | ||
3 : | * XVID MPEG-4 VIDEO CODEC | ||
4 : | edgomez | 453 | * - Macro Block coding functions - |
5 : | edgomez | 451 | * |
6 : | * Copyright(C) 2002 Michael Militzer <isibaar@xvid.org> | ||
7 : | * | ||
8 : | edgomez | 655 | * This file is part of XviD, a free MPEG-4 video encoder/decoder |
9 : | edgomez | 451 | * |
10 : | edgomez | 655 | * XviD is free software; you can redistribute it and/or modify it |
11 : | * under the terms of the GNU General Public License as published by | ||
12 : | edgomez | 451 | * the Free Software Foundation; either version 2 of the License, or |
13 : | * (at your option) any later version. | ||
14 : | * | ||
15 : | * This program is distributed in the hope that it will be useful, | ||
16 : | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 : | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 : | * GNU General Public License for more details. | ||
19 : | * | ||
20 : | * You should have received a copy of the GNU General Public License | ||
21 : | * along with this program; if not, write to the Free Software | ||
22 : | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 : | * | ||
24 : | edgomez | 655 | * Under section 8 of the GNU General Public License, the copyright |
25 : | * holders of XVID explicitly forbid distribution in the following | ||
26 : | * countries: | ||
27 : | edgomez | 451 | * |
28 : | edgomez | 655 | * - Japan |
29 : | * - United States of America | ||
30 : | * | ||
31 : | * Linking XviD statically or dynamically with other modules is making a | ||
32 : | * combined work based on XviD. Thus, the terms and conditions of the | ||
33 : | * GNU General Public License cover the whole combination. | ||
34 : | * | ||
35 : | * As a special exception, the copyright holders of XviD give you | ||
36 : | * permission to link XviD with independent modules that communicate with | ||
37 : | * XviD solely through the VFW1.1 and DShow interfaces, regardless of the | ||
38 : | * license terms of these independent modules, and to copy and distribute | ||
39 : | * the resulting combined work under terms of your choice, provided that | ||
40 : | * every copy of the combined work is accompanied by a complete copy of | ||
41 : | * the source code of XviD (the version of XviD used to produce the | ||
42 : | * combined work), being distributed under the terms of the GNU General | ||
43 : | * Public License plus this exception. An independent module is a module | ||
44 : | * which is not derived from or based on XviD. | ||
45 : | * | ||
46 : | * Note that people who make modified versions of XviD are not obligated | ||
47 : | * to grant this special exception for their modified versions; it is | ||
48 : | * their choice whether to do so. The GNU General Public License gives | ||
49 : | * permission to release a modified version without this exception; this | ||
50 : | * exception also makes it possible to release a modified version which | ||
51 : | * carries forward this exception. | ||
52 : | * | ||
53 : | edgomez | 816 | * $Id: mbcoding.c,v 1.40 2003-02-06 00:48:08 edgomez Exp $ |
54 : | edgomez | 655 | * |
55 : | edgomez | 451 | ****************************************************************************/ |
56 : | suxen_drol | 118 | |
57 : | Isibaar | 100 | #include <stdlib.h> |
58 : | Isibaar | 3 | #include "../portab.h" |
59 : | #include "bitstream.h" | ||
60 : | #include "zigzag.h" | ||
61 : | #include "vlc_codes.h" | ||
62 : | Isibaar | 100 | #include "mbcoding.h" |
63 : | Isibaar | 3 | |
64 : | #include "../utils/mbfunctions.h" | ||
65 : | |||
66 : | #define ABS(X) (((X)>0)?(X):-(X)) | ||
67 : | #define CLIP(X,A) (X > A) ? (A) : (X) | ||
68 : | |||
69 : | edgomez | 766 | /* #define BIGLUT */ |
70 : | edgomez | 764 | |
71 : | edgomez | 766 | #ifdef BIGLUT |
72 : | edgomez | 764 | #define LEVELOFFSET 2048 |
73 : | #else | ||
74 : | #define LEVELOFFSET 32 | ||
75 : | #endif | ||
76 : | |||
77 : | edgomez | 451 | /***************************************************************************** |
78 : | * Local data | ||
79 : | ****************************************************************************/ | ||
80 : | Isibaar | 100 | |
81 : | edgomez | 764 | static REVERSE_EVENT DCT3D[2][4096]; |
82 : | Isibaar | 3 | |
83 : | edgomez | 766 | #ifdef BIGLUT |
84 : | edgomez | 764 | static VLC coeff_VLC[2][2][4096][64]; |
85 : | edgomez | 766 | static VLC *intra_table, *inter_table; |
86 : | edgomez | 764 | #else |
87 : | static VLC coeff_VLC[2][2][64][64]; | ||
88 : | #endif | ||
89 : | edgomez | 451 | |
90 : | /***************************************************************************** | ||
91 : | edgomez | 453 | * Vector Length Coding Initialization |
92 : | edgomez | 451 | ****************************************************************************/ |
93 : | |||
94 : | edgomez | 195 | void |
95 : | init_vlc_tables(void) | ||
96 : | Isibaar | 3 | { |
97 : | edgomez | 816 | uint32_t i, j, intra, last, run, run_esc, level, level_esc, escape, escape_len, offset; |
98 : | edgomez | 78 | |
99 : | edgomez | 766 | #ifdef BIGLUT |
100 : | intra_table = (VLC*)coeff_VLC[1]; | ||
101 : | inter_table = (VLC*)coeff_VLC[0]; | ||
102 : | edgomez | 764 | #endif |
103 : | Isibaar | 3 | |
104 : | edgomez | 195 | |
105 : | edgomez | 764 | for (intra = 0; intra < 2; intra++) |
106 : | for (i = 0; i < 4096; i++) | ||
107 : | DCT3D[intra][i].event.level = 0; | ||
108 : | edgomez | 195 | |
109 : | edgomez | 764 | for (intra = 0; intra < 2; intra++) |
110 : | for (last = 0; last < 2; last++) | ||
111 : | { | ||
112 : | for (run = 0; run < 63 + last; run++) | ||
113 : | for (level = 0; level < 32 << intra; level++) | ||
114 : | { | ||
115 : | edgomez | 766 | #ifdef BIGLUT |
116 : | edgomez | 764 | offset = LEVELOFFSET; |
117 : | #else | ||
118 : | offset = !intra * LEVELOFFSET; | ||
119 : | #endif | ||
120 : | coeff_VLC[intra][last][level + offset][run].len = 128; | ||
121 : | } | ||
122 : | } | ||
123 : | Isibaar | 3 | |
124 : | edgomez | 764 | for (intra = 0; intra < 2; intra++) |
125 : | for (i = 0; i < 102; i++) | ||
126 : | { | ||
127 : | edgomez | 766 | #ifdef BIGLUT |
128 : | edgomez | 764 | offset = LEVELOFFSET; |
129 : | #else | ||
130 : | offset = !intra * LEVELOFFSET; | ||
131 : | #endif | ||
132 : | edgomez | 816 | for (j = 0; j < (uint32_t)(1 << (12 - coeff_tab[intra][i].vlc.len)); j++) |
133 : | edgomez | 764 | { |
134 : | DCT3D[intra][(coeff_tab[intra][i].vlc.code << (12 - coeff_tab[intra][i].vlc.len)) | j].len = coeff_tab[intra][i].vlc.len; | ||
135 : | DCT3D[intra][(coeff_tab[intra][i].vlc.code << (12 - coeff_tab[intra][i].vlc.len)) | j].event = coeff_tab[intra][i].event; | ||
136 : | } | ||
137 : | edgomez | 195 | |
138 : | edgomez | 764 | coeff_VLC[intra][coeff_tab[intra][i].event.last][coeff_tab[intra][i].event.level + offset][coeff_tab[intra][i].event.run].code |
139 : | = coeff_tab[intra][i].vlc.code << 1; | ||
140 : | coeff_VLC[intra][coeff_tab[intra][i].event.last][coeff_tab[intra][i].event.level + offset][coeff_tab[intra][i].event.run].len | ||
141 : | = coeff_tab[intra][i].vlc.len + 1; | ||
142 : | edgomez | 766 | #ifndef BIGLUT |
143 : | edgomez | 764 | if (!intra) |
144 : | #endif | ||
145 : | { | ||
146 : | coeff_VLC[intra][coeff_tab[intra][i].event.last][offset - coeff_tab[intra][i].event.level][coeff_tab[intra][i].event.run].code | ||
147 : | = (coeff_tab[intra][i].vlc.code << 1) | 1; | ||
148 : | coeff_VLC[intra][coeff_tab[intra][i].event.last][offset - coeff_tab[intra][i].event.level][coeff_tab[intra][i].event.run].len | ||
149 : | = coeff_tab[intra][i].vlc.len + 1; | ||
150 : | } | ||
151 : | } | ||
152 : | edgomez | 195 | |
153 : | edgomez | 764 | for (intra = 0; intra < 2; intra++) |
154 : | for (last = 0; last < 2; last++) | ||
155 : | for (run = 0; run < 63 + last; run++) | ||
156 : | { | ||
157 : | edgomez | 816 | for (level = 1; level < (uint32_t)(32 << intra); level++) |
158 : | edgomez | 764 | { |
159 : | edgomez | 766 | if (level <= max_level[intra][last][run] && run <= max_run[intra][last][level]) |
160 : | continue; | ||
161 : | |||
162 : | #ifdef BIGLUT | ||
163 : | edgomez | 764 | offset = LEVELOFFSET; |
164 : | #else | ||
165 : | offset = !intra * LEVELOFFSET; | ||
166 : | #endif | ||
167 : | edgomez | 766 | level_esc = level - max_level[intra][last][run]; |
168 : | run_esc = run - 1 - max_run[intra][last][level]; | ||
169 : | |||
170 : | if (level_esc <= max_level[intra][last][run] && run <= max_run[intra][last][level_esc]) | ||
171 : | { | ||
172 : | escape = ESCAPE1; | ||
173 : | escape_len = 7 + 1; | ||
174 : | run_esc = run; | ||
175 : | } | ||
176 : | else | ||
177 : | { | ||
178 : | edgomez | 816 | if (run_esc <= max_run[intra][last][level] && level <= max_level[intra][last][run_esc]) |
179 : | edgomez | 764 | { |
180 : | edgomez | 766 | escape = ESCAPE2; |
181 : | escape_len = 7 + 2; | ||
182 : | level_esc = level; | ||
183 : | edgomez | 764 | } |
184 : | edgomez | 766 | else |
185 : | edgomez | 764 | { |
186 : | edgomez | 766 | #ifndef BIGLUT |
187 : | edgomez | 764 | if (!intra) |
188 : | #endif | ||
189 : | { | ||
190 : | edgomez | 766 | coeff_VLC[intra][last][level + offset][run].code |
191 : | = (ESCAPE3 << 21) | (last << 20) | (run << 14) | (1 << 13) | ((level & 0xfff) << 1) | 1; | ||
192 : | coeff_VLC[intra][last][level + offset][run].len = 30; | ||
193 : | coeff_VLC[intra][last][offset - level][run].code | ||
194 : | = (ESCAPE3 << 21) | (last << 20) | (run << 14) | (1 << 13) | ((-level & 0xfff) << 1) | 1; | ||
195 : | coeff_VLC[intra][last][offset - level][run].len = 30; | ||
196 : | edgomez | 764 | } |
197 : | edgomez | 766 | continue; |
198 : | edgomez | 764 | } |
199 : | edgomez | 766 | } |
200 : | |||
201 : | coeff_VLC[intra][last][level + offset][run].code | ||
202 : | = (escape << coeff_VLC[intra][last][level_esc + offset][run_esc].len) | ||
203 : | | coeff_VLC[intra][last][level_esc + offset][run_esc].code; | ||
204 : | coeff_VLC[intra][last][level + offset][run].len | ||
205 : | = coeff_VLC[intra][last][level_esc + offset][run_esc].len + escape_len; | ||
206 : | #ifndef BIGLUT | ||
207 : | edgomez | 764 | if (!intra) |
208 : | #endif | ||
209 : | edgomez | 766 | { |
210 : | coeff_VLC[intra][last][offset - level][run].code | ||
211 : | = (escape << coeff_VLC[intra][last][level_esc + offset][run_esc].len) | ||
212 : | | coeff_VLC[intra][last][level_esc + offset][run_esc].code | 1; | ||
213 : | coeff_VLC[intra][last][offset - level][run].len | ||
214 : | = coeff_VLC[intra][last][level_esc + offset][run_esc].len + escape_len; | ||
215 : | } | ||
216 : | Isibaar | 3 | } |
217 : | edgomez | 766 | |
218 : | #ifdef BIGLUT | ||
219 : | edgomez | 816 | for (level = (uint32_t)(32 << intra); level < 2048; level++) |
220 : | edgomez | 764 | { |
221 : | coeff_VLC[intra][last][level + offset][run].code | ||
222 : | = (ESCAPE3 << 21) | (last << 20) | (run << 14) | (1 << 13) | ((level & 0xfff) << 1) | 1; | ||
223 : | coeff_VLC[intra][last][level + offset][run].len = 30; | ||
224 : | Isibaar | 100 | |
225 : | edgomez | 764 | coeff_VLC[intra][last][offset - level][run].code |
226 : | = (ESCAPE3 << 21) | (last << 20) | (run << 14) | (1 << 13) | ((-level & 0xfff) << 1) | 1; | ||
227 : | coeff_VLC[intra][last][offset - level][run].len = 30; | ||
228 : | Isibaar | 100 | } |
229 : | edgomez | 764 | #else |
230 : | if (!intra) | ||
231 : | { | ||
232 : | coeff_VLC[intra][last][0][run].code | ||
233 : | = (ESCAPE3 << 21) | (last << 20) | (run << 14) | (1 << 13) | ((-32 & 0xfff) << 1) | 1; | ||
234 : | coeff_VLC[intra][last][0][run].len = 30; | ||
235 : | } | ||
236 : | #endif | ||
237 : | Isibaar | 3 | } |
238 : | } | ||
239 : | |||
240 : | edgomez | 453 | /***************************************************************************** |
241 : | * Local inlined functions for MB coding | ||
242 : | ****************************************************************************/ | ||
243 : | |||
244 : | edgomez | 195 | static __inline void |
245 : | CodeVector(Bitstream * bs, | ||
246 : | int32_t value, | ||
247 : | int32_t f_code, | ||
248 : | Statistics * pStat) | ||
249 : | Isibaar | 3 | { |
250 : | edgomez | 78 | |
251 : | Isibaar | 3 | const int scale_factor = 1 << (f_code - 1); |
252 : | const int cmp = scale_factor << 5; | ||
253 : | |||
254 : | edgomez | 195 | if (value < (-1 * cmp)) |
255 : | Isibaar | 3 | value += 64 * scale_factor; |
256 : | edgomez | 195 | |
257 : | if (value > (cmp - 1)) | ||
258 : | Isibaar | 3 | value -= 64 * scale_factor; |
259 : | |||
260 : | edgomez | 78 | pStat->iMvSum += value * value; |
261 : | pStat->iMvCount++; | ||
262 : | Isibaar | 3 | |
263 : | edgomez | 78 | if (value == 0) { |
264 : | edgomez | 195 | BitstreamPutBits(bs, mb_motion_table[32].code, |
265 : | mb_motion_table[32].len); | ||
266 : | edgomez | 78 | } else { |
267 : | Isibaar | 3 | uint16_t length, code, mv_res, sign; |
268 : | edgomez | 195 | |
269 : | Isibaar | 3 | length = 16 << f_code; |
270 : | f_code--; | ||
271 : | edgomez | 195 | |
272 : | Isibaar | 3 | sign = (value < 0); |
273 : | |||
274 : | edgomez | 195 | if (value >= length) |
275 : | Isibaar | 3 | value -= 2 * length; |
276 : | edgomez | 195 | else if (value < -length) |
277 : | Isibaar | 3 | value += 2 * length; |
278 : | |||
279 : | edgomez | 195 | if (sign) |
280 : | Isibaar | 3 | value = -value; |
281 : | |||
282 : | value--; | ||
283 : | mv_res = value & ((1 << f_code) - 1); | ||
284 : | code = ((value - mv_res) >> f_code) + 1; | ||
285 : | |||
286 : | edgomez | 195 | if (sign) |
287 : | Isibaar | 3 | code = -code; |
288 : | |||
289 : | code += 32; | ||
290 : | edgomez | 195 | BitstreamPutBits(bs, mb_motion_table[code].code, |
291 : | mb_motion_table[code].len); | ||
292 : | |||
293 : | if (f_code) | ||
294 : | Isibaar | 3 | BitstreamPutBits(bs, mv_res, f_code); |
295 : | edgomez | 78 | } |
296 : | |||
297 : | Isibaar | 3 | } |
298 : | |||
299 : | edgomez | 766 | #ifdef BIGLUT |
300 : | edgomez | 764 | |
301 : | edgomez | 195 | static __inline void |
302 : | CodeCoeff(Bitstream * bs, | ||
303 : | const int16_t qcoeff[64], | ||
304 : | VLC * table, | ||
305 : | const uint16_t * zigzag, | ||
306 : | uint16_t intra) | ||
307 : | edgomez | 78 | { |
308 : | |||
309 : | Isibaar | 3 | uint32_t j, last; |
310 : | short v; | ||
311 : | VLC *vlc; | ||
312 : | edgomez | 195 | |
313 : | Isibaar | 3 | j = intra; |
314 : | Isibaar | 116 | last = intra; |
315 : | Isibaar | 3 | |
316 : | edgomez | 195 | while (j < 64 && (v = qcoeff[zigzag[j]]) == 0) |
317 : | j++; | ||
318 : | |||
319 : | Isibaar | 3 | do { |
320 : | edgomez | 764 | vlc = table + 64 * 2048 + (v << 6) + j - last; |
321 : | Isibaar | 116 | last = ++j; |
322 : | Isibaar | 153 | |
323 : | edgomez | 677 | /* count zeroes */ |
324 : | edgomez | 195 | while (j < 64 && (v = qcoeff[zigzag[j]]) == 0) |
325 : | j++; | ||
326 : | |||
327 : | edgomez | 677 | /* write code */ |
328 : | edgomez | 195 | if (j != 64) { |
329 : | Isibaar | 3 | BitstreamPutBits(bs, vlc->code, vlc->len); |
330 : | } else { | ||
331 : | edgomez | 764 | vlc += 64 * 4096; |
332 : | Isibaar | 3 | BitstreamPutBits(bs, vlc->code, vlc->len); |
333 : | break; | ||
334 : | } | ||
335 : | edgomez | 195 | } while (1); |
336 : | edgomez | 78 | |
337 : | Isibaar | 3 | } |
338 : | |||
339 : | edgomez | 764 | #else |
340 : | |||
341 : | static __inline void | ||
342 : | CodeCoeffInter(Bitstream * bs, | ||
343 : | const int16_t qcoeff[64], | ||
344 : | const uint16_t * zigzag) | ||
345 : | { | ||
346 : | uint32_t i, run, prev_run, code, len; | ||
347 : | int32_t level, prev_level, level_shifted; | ||
348 : | |||
349 : | i = 0; | ||
350 : | run = 0; | ||
351 : | |||
352 : | while (!(level = qcoeff[zigzag[i++]])) | ||
353 : | run++; | ||
354 : | |||
355 : | prev_level = level; | ||
356 : | prev_run = run; | ||
357 : | run = 0; | ||
358 : | |||
359 : | while (i < 64) | ||
360 : | { | ||
361 : | if ((level = qcoeff[zigzag[i++]]) != 0) | ||
362 : | { | ||
363 : | level_shifted = prev_level + 32; | ||
364 : | if (!(level_shifted & -64)) | ||
365 : | { | ||
366 : | code = coeff_VLC[0][0][level_shifted][prev_run].code; | ||
367 : | len = coeff_VLC[0][0][level_shifted][prev_run].len; | ||
368 : | } | ||
369 : | else | ||
370 : | { | ||
371 : | code = (ESCAPE3 << 21) | (prev_run << 14) | (1 << 13) | ((prev_level & 0xfff) << 1) | 1; | ||
372 : | len = 30; | ||
373 : | } | ||
374 : | BitstreamPutBits(bs, code, len); | ||
375 : | prev_level = level; | ||
376 : | prev_run = run; | ||
377 : | run = 0; | ||
378 : | } | ||
379 : | else | ||
380 : | run++; | ||
381 : | } | ||
382 : | |||
383 : | level_shifted = prev_level + 32; | ||
384 : | if (!(level_shifted & -64)) | ||
385 : | { | ||
386 : | code = coeff_VLC[0][1][level_shifted][prev_run].code; | ||
387 : | len = coeff_VLC[0][1][level_shifted][prev_run].len; | ||
388 : | } | ||
389 : | else | ||
390 : | { | ||
391 : | code = (ESCAPE3 << 21) | (1 << 20) | (prev_run << 14) | (1 << 13) | ((prev_level & 0xfff) << 1) | 1; | ||
392 : | len = 30; | ||
393 : | } | ||
394 : | BitstreamPutBits(bs, code, len); | ||
395 : | } | ||
396 : | |||
397 : | static __inline void | ||
398 : | CodeCoeffIntra(Bitstream * bs, | ||
399 : | const int16_t qcoeff[64], | ||
400 : | const uint16_t * zigzag) | ||
401 : | { | ||
402 : | uint32_t i, abs_level, run, prev_run, code, len; | ||
403 : | int32_t level, prev_level; | ||
404 : | |||
405 : | i = 1; | ||
406 : | run = 0; | ||
407 : | |||
408 : | while (!(level = qcoeff[zigzag[i++]])) | ||
409 : | run++; | ||
410 : | |||
411 : | prev_level = level; | ||
412 : | prev_run = run; | ||
413 : | run = 0; | ||
414 : | |||
415 : | while (i < 64) | ||
416 : | { | ||
417 : | if ((level = qcoeff[zigzag[i++]]) != 0) | ||
418 : | { | ||
419 : | abs_level = ABS(prev_level); | ||
420 : | abs_level = abs_level < 64 ? abs_level : 0; | ||
421 : | code = coeff_VLC[1][0][abs_level][prev_run].code; | ||
422 : | len = coeff_VLC[1][0][abs_level][prev_run].len; | ||
423 : | if (len != 128) | ||
424 : | code |= (prev_level < 0); | ||
425 : | else | ||
426 : | { | ||
427 : | code = (ESCAPE3 << 21) | (prev_run << 14) | (1 << 13) | ((prev_level & 0xfff) << 1) | 1; | ||
428 : | len = 30; | ||
429 : | } | ||
430 : | BitstreamPutBits(bs, code, len); | ||
431 : | prev_level = level; | ||
432 : | prev_run = run; | ||
433 : | run = 0; | ||
434 : | } | ||
435 : | else | ||
436 : | run++; | ||
437 : | } | ||
438 : | |||
439 : | abs_level = ABS(prev_level); | ||
440 : | abs_level = abs_level < 64 ? abs_level : 0; | ||
441 : | code = coeff_VLC[1][1][abs_level][prev_run].code; | ||
442 : | len = coeff_VLC[1][1][abs_level][prev_run].len; | ||
443 : | if (len != 128) | ||
444 : | code |= (prev_level < 0); | ||
445 : | else | ||
446 : | { | ||
447 : | code = (ESCAPE3 << 21) | (1 << 20) | (prev_run << 14) | (1 << 13) | ((prev_level & 0xfff) << 1) | 1; | ||
448 : | len = 30; | ||
449 : | } | ||
450 : | BitstreamPutBits(bs, code, len); | ||
451 : | } | ||
452 : | |||
453 : | #endif | ||
454 : | |||
455 : | edgomez | 453 | /***************************************************************************** |
456 : | * Local functions | ||
457 : | ****************************************************************************/ | ||
458 : | Isibaar | 3 | |
459 : | edgomez | 195 | static void |
460 : | CodeBlockIntra(const FRAMEINFO * frame, | ||
461 : | const MACROBLOCK * pMB, | ||
462 : | int16_t qcoeff[6 * 64], | ||
463 : | edgomez | 78 | Bitstream * bs, |
464 : | Statistics * pStat) | ||
465 : | Isibaar | 3 | { |
466 : | edgomez | 78 | |
467 : | Isibaar | 3 | uint32_t i, mcbpc, cbpy, bits; |
468 : | |||
469 : | cbpy = pMB->cbp >> 2; | ||
470 : | |||
471 : | edgomez | 677 | /* write mcbpc */ |
472 : | edgomez | 195 | if (frame->coding_type == I_VOP) { |
473 : | edgomez | 78 | mcbpc = ((pMB->mode >> 1) & 3) | ((pMB->cbp & 3) << 2); |
474 : | edgomez | 195 | BitstreamPutBits(bs, mcbpc_intra_tab[mcbpc].code, |
475 : | mcbpc_intra_tab[mcbpc].len); | ||
476 : | } else { | ||
477 : | edgomez | 78 | mcbpc = (pMB->mode & 7) | ((pMB->cbp & 3) << 3); |
478 : | edgomez | 195 | BitstreamPutBits(bs, mcbpc_inter_tab[mcbpc].code, |
479 : | mcbpc_inter_tab[mcbpc].len); | ||
480 : | Isibaar | 28 | } |
481 : | Isibaar | 3 | |
482 : | edgomez | 677 | /* ac prediction flag */ |
483 : | edgomez | 195 | if (pMB->acpred_directions[0]) |
484 : | edgomez | 78 | BitstreamPutBits(bs, 1, 1); |
485 : | Isibaar | 3 | else |
486 : | edgomez | 78 | BitstreamPutBits(bs, 0, 1); |
487 : | Isibaar | 3 | |
488 : | edgomez | 677 | /* write cbpy */ |
489 : | edgomez | 195 | BitstreamPutBits(bs, cbpy_tab[cbpy].code, cbpy_tab[cbpy].len); |
490 : | Isibaar | 3 | |
491 : | edgomez | 677 | /* write dquant */ |
492 : | edgomez | 195 | if (pMB->mode == MODE_INTRA_Q) |
493 : | Isibaar | 3 | BitstreamPutBits(bs, pMB->dquant, 2); |
494 : | |||
495 : | edgomez | 677 | /* write interlacing */ |
496 : | edgomez | 195 | if (frame->global_flags & XVID_INTERLACING) { |
497 : | h | 69 | BitstreamPutBit(bs, pMB->field_dct); |
498 : | } | ||
499 : | edgomez | 677 | /* code block coeffs */ |
500 : | edgomez | 195 | for (i = 0; i < 6; i++) { |
501 : | if (i < 4) | ||
502 : | BitstreamPutBits(bs, dcy_tab[qcoeff[i * 64 + 0] + 255].code, | ||
503 : | dcy_tab[qcoeff[i * 64 + 0] + 255].len); | ||
504 : | Isibaar | 3 | else |
505 : | edgomez | 195 | BitstreamPutBits(bs, dcc_tab[qcoeff[i * 64 + 0] + 255].code, |
506 : | dcc_tab[qcoeff[i * 64 + 0] + 255].len); | ||
507 : | |||
508 : | if (pMB->cbp & (1 << (5 - i))) { | ||
509 : | Isibaar | 3 | bits = BitstreamPos(bs); |
510 : | |||
511 : | edgomez | 766 | #ifdef BIGLUT |
512 : | edgomez | 195 | CodeCoeff(bs, &qcoeff[i * 64], intra_table, |
513 : | scan_tables[pMB->acpred_directions[i]], 1); | ||
514 : | edgomez | 764 | #else |
515 : | CodeCoeffIntra(bs, &qcoeff[i * 64], scan_tables[pMB->acpred_directions[i]]); | ||
516 : | #endif | ||
517 : | Isibaar | 3 | bits = BitstreamPos(bs) - bits; |
518 : | pStat->iTextBits += bits; | ||
519 : | } | ||
520 : | } | ||
521 : | edgomez | 78 | |
522 : | Isibaar | 3 | } |
523 : | |||
524 : | |||
525 : | edgomez | 195 | static void |
526 : | CodeBlockInter(const FRAMEINFO * frame, | ||
527 : | const MACROBLOCK * pMB, | ||
528 : | int16_t qcoeff[6 * 64], | ||
529 : | edgomez | 78 | Bitstream * bs, |
530 : | Statistics * pStat) | ||
531 : | Isibaar | 3 | { |
532 : | edgomez | 78 | |
533 : | Isibaar | 3 | int32_t i; |
534 : | uint32_t bits, mcbpc, cbpy; | ||
535 : | |||
536 : | edgomez | 78 | mcbpc = (pMB->mode & 7) | ((pMB->cbp & 3) << 3); |
537 : | Isibaar | 3 | cbpy = 15 - (pMB->cbp >> 2); |
538 : | |||
539 : | edgomez | 677 | /* write mcbpc */ |
540 : | edgomez | 195 | BitstreamPutBits(bs, mcbpc_inter_tab[mcbpc].code, |
541 : | mcbpc_inter_tab[mcbpc].len); | ||
542 : | Isibaar | 3 | |
543 : | edgomez | 677 | /* write cbpy */ |
544 : | Isibaar | 3 | BitstreamPutBits(bs, cbpy_tab[cbpy].code, cbpy_tab[cbpy].len); |
545 : | |||
546 : | edgomez | 677 | /* write dquant */ |
547 : | edgomez | 195 | if (pMB->mode == MODE_INTER_Q) |
548 : | Isibaar | 3 | BitstreamPutBits(bs, pMB->dquant, 2); |
549 : | edgomez | 195 | |
550 : | edgomez | 677 | /* interlacing */ |
551 : | edgomez | 195 | if (frame->global_flags & XVID_INTERLACING) { |
552 : | h | 388 | if (pMB->cbp) { |
553 : | BitstreamPutBit(bs, pMB->field_dct); | ||
554 : | edgomez | 514 | DPRINTF(DPRINTF_DEBUG, "codep: field_dct: %d", pMB->field_dct); |
555 : | h | 388 | } |
556 : | h | 69 | |
557 : | edgomez | 677 | /* if inter block, write field ME flag */ |
558 : | edgomez | 195 | if (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) { |
559 : | h | 69 | BitstreamPutBit(bs, pMB->field_pred); |
560 : | edgomez | 514 | DPRINTF(DPRINTF_DEBUG, "codep: field_pred: %d", pMB->field_pred); |
561 : | h | 69 | |
562 : | edgomez | 677 | /* write field prediction references */ |
563 : | edgomez | 195 | if (pMB->field_pred) { |
564 : | h | 69 | BitstreamPutBit(bs, pMB->field_for_top); |
565 : | BitstreamPutBit(bs, pMB->field_for_bot); | ||
566 : | } | ||
567 : | } | ||
568 : | } | ||
569 : | edgomez | 677 | /* code motion vector(s) */ |
570 : | edgomez | 195 | for (i = 0; i < (pMB->mode == MODE_INTER4V ? 4 : 1); i++) { |
571 : | suxen_drol | 136 | CodeVector(bs, pMB->pmvs[i].x, frame->fcode, pStat); |
572 : | CodeVector(bs, pMB->pmvs[i].y, frame->fcode, pStat); | ||
573 : | Isibaar | 3 | } |
574 : | |||
575 : | bits = BitstreamPos(bs); | ||
576 : | edgomez | 195 | |
577 : | edgomez | 677 | /* code block coeffs */ |
578 : | edgomez | 195 | for (i = 0; i < 6; i++) |
579 : | if (pMB->cbp & (1 << (5 - i))) | ||
580 : | edgomez | 766 | #ifdef BIGLUT |
581 : | edgomez | 195 | CodeCoeff(bs, &qcoeff[i * 64], inter_table, scan_tables[0], 0); |
582 : | edgomez | 764 | #else |
583 : | CodeCoeffInter(bs, &qcoeff[i * 64], scan_tables[0]); | ||
584 : | #endif | ||
585 : | Isibaar | 3 | |
586 : | bits = BitstreamPos(bs) - bits; | ||
587 : | pStat->iTextBits += bits; | ||
588 : | edgomez | 78 | |
589 : | Isibaar | 3 | } |
590 : | |||
591 : | edgomez | 453 | /***************************************************************************** |
592 : | * Macro Block bitstream encoding functions | ||
593 : | ****************************************************************************/ | ||
594 : | Isibaar | 3 | |
595 : | edgomez | 195 | void |
596 : | MBCoding(const FRAMEINFO * frame, | ||
597 : | MACROBLOCK * pMB, | ||
598 : | int16_t qcoeff[6 * 64], | ||
599 : | Bitstream * bs, | ||
600 : | Statistics * pStat) | ||
601 : | Isibaar | 3 | { |
602 : | edgomez | 78 | |
603 : | edgomez | 195 | if (frame->coding_type == P_VOP) { |
604 : | edgomez | 677 | BitstreamPutBit(bs, 0); /* coded */ |
605 : | Isibaar | 3 | } |
606 : | |||
607 : | chl | 335 | if (pMB->mode == MODE_INTRA || pMB->mode == MODE_INTRA_Q) |
608 : | suxen_drol | 136 | CodeBlockIntra(frame, pMB, qcoeff, bs, pStat); |
609 : | Isibaar | 3 | else |
610 : | suxen_drol | 136 | CodeBlockInter(frame, pMB, qcoeff, bs, pStat); |
611 : | edgomez | 78 | |
612 : | Isibaar | 3 | } |
613 : | |||
614 : | chl | 347 | |
615 : | void | ||
616 : | MBSkip(Bitstream * bs) | ||
617 : | { | ||
618 : | edgomez | 677 | BitstreamPutBit(bs, 1); /* not coded */ |
619 : | chl | 347 | return; |
620 : | } | ||
621 : | |||
622 : | edgomez | 453 | /***************************************************************************** |
623 : | * decoding stuff starts here | ||
624 : | ****************************************************************************/ | ||
625 : | suxen_drol | 118 | |
626 : | edgomez | 453 | /* |
627 : | * For IVOP addbits == 0 | ||
628 : | * For PVOP addbits == fcode - 1 | ||
629 : | * For BVOP addbits == max(fcode,bcode) - 1 | ||
630 : | * returns true or false | ||
631 : | */ | ||
632 : | Isibaar | 3 | |
633 : | suxen_drol | 248 | int |
634 : | check_resync_marker(Bitstream * bs, int addbits) | ||
635 : | { | ||
636 : | uint32_t nbits; | ||
637 : | uint32_t code; | ||
638 : | uint32_t nbitsresyncmarker = NUMBITS_VP_RESYNC_MARKER + addbits; | ||
639 : | |||
640 : | nbits = BitstreamNumBitsToByteAlign(bs); | ||
641 : | code = BitstreamShowBits(bs, nbits); | ||
642 : | |||
643 : | if (code == (((uint32_t)1 << (nbits - 1)) - 1)) | ||
644 : | { | ||
645 : | return BitstreamShowBitsFromByteAlign(bs, nbitsresyncmarker) == RESYNC_MARKER; | ||
646 : | } | ||
647 : | |||
648 : | return 0; | ||
649 : | } | ||
650 : | |||
651 : | |||
652 : | |||
653 : | edgomez | 195 | int |
654 : | get_mcbpc_intra(Bitstream * bs) | ||
655 : | Isibaar | 3 | { |
656 : | edgomez | 78 | |
657 : | Isibaar | 3 | uint32_t index; |
658 : | edgomez | 195 | |
659 : | suxen_drol | 248 | index = BitstreamShowBits(bs, 9); |
660 : | Isibaar | 3 | index >>= 3; |
661 : | |||
662 : | BitstreamSkip(bs, mcbpc_intra_table[index].len); | ||
663 : | edgomez | 78 | |
664 : | Isibaar | 3 | return mcbpc_intra_table[index].code; |
665 : | edgomez | 78 | |
666 : | Isibaar | 3 | } |
667 : | |||
668 : | edgomez | 195 | int |
669 : | get_mcbpc_inter(Bitstream * bs) | ||
670 : | Isibaar | 3 | { |
671 : | edgomez | 78 | |
672 : | Isibaar | 3 | uint32_t index; |
673 : | suxen_drol | 248 | |
674 : | index = CLIP(BitstreamShowBits(bs, 9), 256); | ||
675 : | edgomez | 195 | |
676 : | BitstreamSkip(bs, mcbpc_inter_table[index].len); | ||
677 : | edgomez | 78 | |
678 : | Isibaar | 3 | return mcbpc_inter_table[index].code; |
679 : | edgomez | 78 | |
680 : | Isibaar | 3 | } |
681 : | |||
682 : | edgomez | 195 | int |
683 : | get_cbpy(Bitstream * bs, | ||
684 : | int intra) | ||
685 : | Isibaar | 3 | { |
686 : | edgomez | 78 | |
687 : | Isibaar | 3 | int cbpy; |
688 : | uint32_t index = BitstreamShowBits(bs, 6); | ||
689 : | |||
690 : | BitstreamSkip(bs, cbpy_table[index].len); | ||
691 : | cbpy = cbpy_table[index].code; | ||
692 : | |||
693 : | edgomez | 195 | if (!intra) |
694 : | Isibaar | 3 | cbpy = 15 - cbpy; |
695 : | |||
696 : | return cbpy; | ||
697 : | edgomez | 78 | |
698 : | Isibaar | 3 | } |
699 : | |||
700 : | edgomez | 195 | int |
701 : | get_mv_data(Bitstream * bs) | ||
702 : | Isibaar | 3 | { |
703 : | edgomez | 78 | |
704 : | Isibaar | 3 | uint32_t index; |
705 : | |||
706 : | edgomez | 195 | if (BitstreamGetBit(bs)) |
707 : | Isibaar | 3 | return 0; |
708 : | edgomez | 195 | |
709 : | Isibaar | 3 | index = BitstreamShowBits(bs, 12); |
710 : | |||
711 : | edgomez | 195 | if (index >= 512) { |
712 : | Isibaar | 3 | index = (index >> 8) - 2; |
713 : | BitstreamSkip(bs, TMNMVtab0[index].len); | ||
714 : | return TMNMVtab0[index].code; | ||
715 : | } | ||
716 : | edgomez | 195 | |
717 : | if (index >= 128) { | ||
718 : | Isibaar | 3 | index = (index >> 2) - 32; |
719 : | BitstreamSkip(bs, TMNMVtab1[index].len); | ||
720 : | return TMNMVtab1[index].code; | ||
721 : | } | ||
722 : | |||
723 : | edgomez | 195 | index -= 4; |
724 : | Isibaar | 3 | |
725 : | BitstreamSkip(bs, TMNMVtab2[index].len); | ||
726 : | return TMNMVtab2[index].code; | ||
727 : | edgomez | 78 | |
728 : | Isibaar | 3 | } |
729 : | |||
730 : | edgomez | 195 | int |
731 : | get_mv(Bitstream * bs, | ||
732 : | int fcode) | ||
733 : | Isibaar | 3 | { |
734 : | edgomez | 78 | |
735 : | Isibaar | 3 | int data; |
736 : | int res; | ||
737 : | int mv; | ||
738 : | int scale_fac = 1 << (fcode - 1); | ||
739 : | |||
740 : | data = get_mv_data(bs); | ||
741 : | edgomez | 195 | |
742 : | if (scale_fac == 1 || data == 0) | ||
743 : | Isibaar | 3 | return data; |
744 : | |||
745 : | res = BitstreamGetBits(bs, fcode - 1); | ||
746 : | mv = ((ABS(data) - 1) * scale_fac) + res + 1; | ||
747 : | edgomez | 195 | |
748 : | Isibaar | 3 | return data < 0 ? -mv : mv; |
749 : | edgomez | 78 | |
750 : | Isibaar | 3 | } |
751 : | |||
752 : | edgomez | 195 | int |
753 : | get_dc_dif(Bitstream * bs, | ||
754 : | uint32_t dc_size) | ||
755 : | Isibaar | 3 | { |
756 : | edgomez | 78 | |
757 : | Isibaar | 3 | int code = BitstreamGetBits(bs, dc_size); |
758 : | int msb = code >> (dc_size - 1); | ||
759 : | |||
760 : | edgomez | 195 | if (msb == 0) |
761 : | return (-1 * (code ^ ((1 << dc_size) - 1))); | ||
762 : | Isibaar | 3 | |
763 : | return code; | ||
764 : | edgomez | 78 | |
765 : | Isibaar | 3 | } |
766 : | |||
767 : | edgomez | 195 | int |
768 : | get_dc_size_lum(Bitstream * bs) | ||
769 : | Isibaar | 3 | { |
770 : | edgomez | 78 | |
771 : | Isibaar | 3 | int code, i; |
772 : | edgomez | 195 | |
773 : | Isibaar | 3 | code = BitstreamShowBits(bs, 11); |
774 : | |||
775 : | edgomez | 195 | for (i = 11; i > 3; i--) { |
776 : | if (code == 1) { | ||
777 : | Isibaar | 3 | BitstreamSkip(bs, i); |
778 : | return i + 1; | ||
779 : | } | ||
780 : | code >>= 1; | ||
781 : | } | ||
782 : | |||
783 : | BitstreamSkip(bs, dc_lum_tab[code].len); | ||
784 : | return dc_lum_tab[code].code; | ||
785 : | edgomez | 78 | |
786 : | Isibaar | 3 | } |
787 : | |||
788 : | |||
789 : | edgomez | 195 | int |
790 : | get_dc_size_chrom(Bitstream * bs) | ||
791 : | Isibaar | 3 | { |
792 : | edgomez | 78 | |
793 : | Isibaar | 3 | uint32_t code, i; |
794 : | edgomez | 195 | |
795 : | Isibaar | 3 | code = BitstreamShowBits(bs, 12); |
796 : | |||
797 : | edgomez | 195 | for (i = 12; i > 2; i--) { |
798 : | if (code == 1) { | ||
799 : | Isibaar | 3 | BitstreamSkip(bs, i); |
800 : | return i; | ||
801 : | } | ||
802 : | code >>= 1; | ||
803 : | } | ||
804 : | |||
805 : | return 3 - BitstreamGetBits(bs, 2); | ||
806 : | edgomez | 78 | |
807 : | Isibaar | 3 | } |
808 : | |||
809 : | edgomez | 453 | /***************************************************************************** |
810 : | * Local inlined function to "decode" written vlc codes | ||
811 : | ****************************************************************************/ | ||
812 : | |||
813 : | static __inline int | ||
814 : | get_coeff(Bitstream * bs, | ||
815 : | int *run, | ||
816 : | int *last, | ||
817 : | int intra, | ||
818 : | int short_video_header) | ||
819 : | { | ||
820 : | |||
821 : | uint32_t mode; | ||
822 : | int32_t level; | ||
823 : | edgomez | 764 | REVERSE_EVENT *reverse_event; |
824 : | edgomez | 453 | |
825 : | edgomez | 677 | if (short_video_header) /* inter-VLCs will be used for both intra and inter blocks */ |
826 : | edgomez | 453 | intra = 0; |
827 : | |||
828 : | edgomez | 764 | if (BitstreamShowBits(bs, 7) != ESCAPE) { |
829 : | reverse_event = &DCT3D[intra][BitstreamShowBits(bs, 12)]; | ||
830 : | edgomez | 453 | |
831 : | edgomez | 764 | if ((level = reverse_event->event.level) == 0) |
832 : | goto error; | ||
833 : | edgomez | 453 | |
834 : | edgomez | 764 | *last = reverse_event->event.last; |
835 : | *run = reverse_event->event.run; | ||
836 : | edgomez | 453 | |
837 : | edgomez | 764 | BitstreamSkip(bs, reverse_event->len); |
838 : | |||
839 : | return BitstreamGetBits(bs, 1) ? -level : level; | ||
840 : | edgomez | 453 | } |
841 : | |||
842 : | edgomez | 764 | BitstreamSkip(bs, 7); |
843 : | |||
844 : | edgomez | 453 | if (short_video_header) { |
845 : | edgomez | 677 | /* escape mode 4 - H.263 type, only used if short_video_header = 1 */ |
846 : | edgomez | 453 | *last = BitstreamGetBit(bs); |
847 : | *run = BitstreamGetBits(bs, 6); | ||
848 : | level = BitstreamGetBits(bs, 8); | ||
849 : | |||
850 : | if (level == 0 || level == 128) | ||
851 : | edgomez | 514 | DPRINTF(DPRINTF_ERROR, "Illegal LEVEL for ESCAPE mode 4: %d", level); |
852 : | edgomez | 453 | |
853 : | edgomez | 764 | return (level << 24) >> 24; |
854 : | edgomez | 453 | } |
855 : | |||
856 : | mode = BitstreamShowBits(bs, 2); | ||
857 : | |||
858 : | if (mode < 3) { | ||
859 : | BitstreamSkip(bs, (mode == 2) ? 2 : 1); | ||
860 : | |||
861 : | edgomez | 764 | reverse_event = &DCT3D[intra][BitstreamShowBits(bs, 12)]; |
862 : | |||
863 : | if ((level = reverse_event->event.level) == 0) | ||
864 : | edgomez | 453 | goto error; |
865 : | |||
866 : | edgomez | 764 | *last = reverse_event->event.last; |
867 : | *run = reverse_event->event.run; | ||
868 : | edgomez | 453 | |
869 : | edgomez | 764 | BitstreamSkip(bs, reverse_event->len); |
870 : | edgomez | 453 | |
871 : | edgomez | 677 | if (mode < 2) /* first escape mode, level is offset */ |
872 : | edgomez | 764 | level += max_level[intra][*last][*run]; |
873 : | else /* second escape mode, run is offset */ | ||
874 : | *run += max_run[intra][*last][level] + 1; | ||
875 : | edgomez | 453 | |
876 : | edgomez | 764 | return BitstreamGetBits(bs, 1) ? -level : level; |
877 : | edgomez | 453 | } |
878 : | edgomez | 764 | |
879 : | edgomez | 677 | /* third escape mode - fixed length codes */ |
880 : | edgomez | 453 | BitstreamSkip(bs, 2); |
881 : | *last = BitstreamGetBits(bs, 1); | ||
882 : | *run = BitstreamGetBits(bs, 6); | ||
883 : | edgomez | 677 | BitstreamSkip(bs, 1); /* marker */ |
884 : | edgomez | 453 | level = BitstreamGetBits(bs, 12); |
885 : | edgomez | 677 | BitstreamSkip(bs, 1); /* marker */ |
886 : | edgomez | 453 | |
887 : | edgomez | 764 | return (level << 20) >> 20; |
888 : | edgomez | 453 | |
889 : | error: | ||
890 : | *run = VLC_ERROR; | ||
891 : | return 0; | ||
892 : | } | ||
893 : | |||
894 : | /***************************************************************************** | ||
895 : | * MB reading functions | ||
896 : | ****************************************************************************/ | ||
897 : | |||
898 : | edgomez | 195 | void |
899 : | get_intra_block(Bitstream * bs, | ||
900 : | int16_t * block, | ||
901 : | int direction, | ||
902 : | int coeff) | ||
903 : | Isibaar | 3 | { |
904 : | edgomez | 78 | |
905 : | edgomez | 195 | const uint16_t *scan = scan_tables[direction]; |
906 : | Isibaar | 3 | int level; |
907 : | int run; | ||
908 : | int last; | ||
909 : | |||
910 : | edgomez | 195 | do { |
911 : | Isibaar | 3 | level = get_coeff(bs, &run, &last, 1, 0); |
912 : | edgomez | 195 | if (run == -1) { |
913 : | edgomez | 514 | DPRINTF(DPRINTF_DEBUG, "fatal: invalid run"); |
914 : | Isibaar | 3 | break; |
915 : | } | ||
916 : | coeff += run; | ||
917 : | edgomez | 195 | block[scan[coeff]] = level; |
918 : | suxen_drol | 252 | |
919 : | DPRINTF(DPRINTF_COEFF,"block[%i] %i", scan[coeff], level); | ||
920 : | edgomez | 677 | /*DPRINTF(DPRINTF_COEFF,"block[%i] %i %08x", scan[coeff], level, BitstreamShowBits(bs, 32)); */ |
921 : | suxen_drol | 252 | |
922 : | suxen_drol | 759 | if (level < -2047 || level > 2047) { |
923 : | edgomez | 514 | DPRINTF(DPRINTF_DEBUG, "warning: intra_overflow: %d", level); |
924 : | Isibaar | 3 | } |
925 : | coeff++; | ||
926 : | } while (!last); | ||
927 : | edgomez | 78 | |
928 : | Isibaar | 3 | } |
929 : | |||
930 : | edgomez | 195 | void |
931 : | get_inter_block(Bitstream * bs, | ||
932 : | int16_t * block) | ||
933 : | Isibaar | 3 | { |
934 : | edgomez | 78 | |
935 : | edgomez | 195 | const uint16_t *scan = scan_tables[0]; |
936 : | Isibaar | 3 | int p; |
937 : | int level; | ||
938 : | int run; | ||
939 : | int last; | ||
940 : | |||
941 : | p = 0; | ||
942 : | edgomez | 195 | do { |
943 : | Isibaar | 3 | level = get_coeff(bs, &run, &last, 0, 0); |
944 : | edgomez | 195 | if (run == -1) { |
945 : | edgomez | 514 | DPRINTF(DPRINTF_ERROR, "fatal: invalid run"); |
946 : | Isibaar | 3 | break; |
947 : | } | ||
948 : | p += run; | ||
949 : | chenm001 | 161 | |
950 : | edgomez | 195 | block[scan[p]] = level; |
951 : | suxen_drol | 252 | |
952 : | DPRINTF(DPRINTF_COEFF,"block[%i] %i", scan[p], level); | ||
953 : | |||
954 : | suxen_drol | 759 | if (level < -2047 || level > 2047) { |
955 : | edgomez | 514 | DPRINTF(DPRINTF_DEBUG, "warning: inter_overflow: %d", level); |
956 : | Isibaar | 3 | } |
957 : | p++; | ||
958 : | } while (!last); | ||
959 : | edgomez | 78 | |
960 : | Isibaar | 3 | } |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |