[svn] / branches / dev-api-4 / xvidcore / src / utils / mbtransquant.c Repository:
ViewVC logotype

Annotation of /branches/dev-api-4/xvidcore/src/utils/mbtransquant.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 982 - (view) (download)

1 : edgomez 965 /*****************************************************************************
2 :     *
3 :     * XVID MPEG-4 VIDEO CODEC
4 :     * - MB Transfert/Quantization functions -
5 :     *
6 :     * Copyright(C) 2001-2003 Peter Ross <pross@xvid.org>
7 :     * 2001-2003 Michael Militzer <isibaar@xvid.org>
8 :     * 2003 Edouard Gomez <ed.gomez@free.fr>
9 :     *
10 :     * This program is free software ; you can redistribute it and/or modify
11 :     * it under the terms of the GNU General Public License as published by
12 :     * 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 982 * $Id: mbtransquant.c,v 1.21.2.7 2003-04-10 13:05:54 edgomez Exp $
25 : edgomez 965 *
26 :     ****************************************************************************/
27 : Isibaar 3
28 : edgomez 78 #include <string.h>
29 : edgomez 982 #include <stdlib.h>
30 : edgomez 78
31 : Isibaar 3 #include "../portab.h"
32 :     #include "mbfunctions.h"
33 :    
34 :     #include "../global.h"
35 :     #include "mem_transfer.h"
36 :     #include "timer.h"
37 :     #include "../dct/fdct.h"
38 :     #include "../dct/idct.h"
39 :     #include "../quant/quant_mpeg4.h"
40 :     #include "../quant/quant_h263.h"
41 :     #include "../encoder.h"
42 :    
43 : edgomez 851 #include "../image/reduced.h"
44 : Isibaar 3
45 : edgomez 851 MBFIELDTEST_PTR MBFieldTest;
46 : Isibaar 3
47 : edgomez 965 /*
48 :     * Skip blocks having a coefficient sum below this value. This value will be
49 :     * corrected according to the MB quantizer to avoid artifacts for quant==1
50 :     */
51 :     #define PVOP_TOOSMALL_LIMIT 1
52 :     #define BVOP_TOOSMALL_LIMIT 3
53 : Isibaar 3
54 : edgomez 965 /*****************************************************************************
55 :     * Local functions
56 :     ****************************************************************************/
57 :    
58 :     /* permute block and return field dct choice */
59 :     static __inline uint32_t
60 :     MBDecideFieldDCT(int16_t data[6 * 64])
61 : Isibaar 3 {
62 : edgomez 965 uint32_t field = MBFieldTest(data);
63 : edgomez 78
64 : edgomez 965 if (field)
65 :     MBFrameToField(data);
66 : Isibaar 3
67 : edgomez 965 return field;
68 :     }
69 : h 69
70 : edgomez 965 /* Performs Forward DCT on all blocks */
71 :     static __inline void
72 :     MBfDCT(const MBParam * pParam,
73 :     FRAMEINFO * frame,
74 :     MACROBLOCK * pMB,
75 :     uint32_t x_pos,
76 :     uint32_t y_pos,
77 :     int16_t data[6 * 64])
78 :     {
79 :     /* Handles interlacing */
80 : h 69 start_timer();
81 :     pMB->field_dct = 0;
82 : edgomez 949 if ((frame->vol_flags & XVID_VOL_INTERLACING) &&
83 : h 390 (x_pos>0) && (x_pos<pParam->mb_width-1) &&
84 :     (y_pos>0) && (y_pos<pParam->mb_height-1)) {
85 : h 69 pMB->field_dct = MBDecideFieldDCT(data);
86 :     }
87 :     stop_interlacing_timer();
88 :    
89 : edgomez 965 /* Perform DCT */
90 :     start_timer();
91 :     fdct(&data[0 * 64]);
92 :     fdct(&data[1 * 64]);
93 :     fdct(&data[2 * 64]);
94 :     fdct(&data[3 * 64]);
95 :     fdct(&data[4 * 64]);
96 :     fdct(&data[5 * 64]);
97 :     stop_dct_timer();
98 :     }
99 :    
100 :     /* Performs Inverse DCT on all blocks */
101 :     static __inline void
102 :     MBiDCT(int16_t data[6 * 64],
103 :     const uint8_t cbp)
104 :     {
105 :     start_timer();
106 :     if(cbp & (1 << (5 - 0))) idct(&data[0 * 64]);
107 :     if(cbp & (1 << (5 - 1))) idct(&data[1 * 64]);
108 :     if(cbp & (1 << (5 - 2))) idct(&data[2 * 64]);
109 :     if(cbp & (1 << (5 - 3))) idct(&data[3 * 64]);
110 :     if(cbp & (1 << (5 - 4))) idct(&data[4 * 64]);
111 :     if(cbp & (1 << (5 - 5))) idct(&data[5 * 64]);
112 :     stop_idct_timer();
113 :     }
114 :    
115 :     /* Quantize all blocks -- Intra mode */
116 :     static __inline void
117 :     MBQuantIntra(const MBParam * pParam,
118 :     const MACROBLOCK * pMB,
119 :     int16_t qcoeff[6 * 64],
120 :     int16_t data[6*64])
121 :     {
122 :     int i;
123 :    
124 : edgomez 195 for (i = 0; i < 6; i++) {
125 : edgomez 965 uint32_t iDcScaler = get_dc_scaler(pMB->quant, i < 4);
126 :    
127 :     /* Quantize the block */
128 :     start_timer();
129 :     if (!(pParam->vol_flags & XVID_VOL_MPEGQUANT))
130 :     quant_intra(&data[i * 64], &qcoeff[i * 64], pMB->quant, iDcScaler);
131 :     else
132 :     quant4_intra(&data[i * 64], &qcoeff[i * 64], pMB->quant, iDcScaler);
133 :     stop_quant_timer();
134 :     }
135 :     }
136 :    
137 :     /* DeQuantize all blocks -- Intra mode */
138 :     static __inline void
139 :     MBDeQuantIntra(const MBParam * pParam,
140 :     const int iQuant,
141 :     int16_t qcoeff[6 * 64],
142 :     int16_t data[6*64])
143 :     {
144 :     int i;
145 :    
146 :     for (i = 0; i < 6; i++) {
147 : Isibaar 3 uint32_t iDcScaler = get_dc_scaler(iQuant, i < 4);
148 :    
149 :     start_timer();
150 : edgomez 965 if (!(pParam->vol_flags & XVID_VOL_MPEGQUANT))
151 :     dequant_intra(&qcoeff[i * 64], &data[i * 64], iQuant, iDcScaler);
152 :     else
153 :     dequant4_intra(&qcoeff[i * 64], &data[i * 64], iQuant, iDcScaler);
154 :     stop_iquant_timer();
155 :     }
156 :     }
157 : Isibaar 3
158 : edgomez 965 /* Quantize all blocks -- Inter mode */
159 :     static __inline uint8_t
160 :     MBQuantInter(const MBParam * pParam,
161 :     const MACROBLOCK * pMB,
162 :     int16_t data[6 * 64],
163 :     int16_t qcoeff[6 * 64],
164 :     int bvop,
165 :     int limit)
166 :     {
167 :    
168 :     int i;
169 :     uint8_t cbp = 0;
170 :     int sum;
171 :     int code_block;
172 :    
173 :     for (i = 0; i < 6; i++) {
174 :    
175 :     /* Quantize the block */
176 :     start_timer();
177 :     if (!(pParam->vol_flags & XVID_VOL_MPEGQUANT))
178 :     sum = quant_inter(&qcoeff[i * 64], &data[i * 64], pMB->quant);
179 :     else
180 :     sum = quant4_inter(&qcoeff[i * 64], &data[i * 64], pMB->quant);
181 :     stop_quant_timer();
182 :    
183 :     /*
184 :     * We code the block if the sum is higher than the limit and if the first
185 :     * two AC coefficients in zig zag order are not zero.
186 :     */
187 :     code_block = 0;
188 :     if ((sum >= limit) || (qcoeff[i*64+1] != 0) || (qcoeff[i*64+8] != 0)) {
189 :     code_block = 1;
190 : edgomez 195 } else {
191 : Isibaar 3
192 : edgomez 965 if (bvop && (pMB->mode == MODE_DIRECT || pMB->mode == MODE_DIRECT_NO4V)) {
193 :     /* dark blocks prevention for direct mode */
194 :     if ((qcoeff[i*64] < -1) || (qcoeff[i*64] > 0))
195 :     code_block = 1;
196 : edgomez 851 } else {
197 : edgomez 965 /* not direct mode */
198 :     if (qcoeff[i*64] != 0)
199 :     code_block = 1;
200 : edgomez 851 }
201 : Isibaar 3 }
202 :    
203 : edgomez 965 /* Set the corresponding cbp bit */
204 :     cbp |= code_block << (5 - i);
205 : edgomez 851
206 : edgomez 965 }
207 : edgomez 851
208 : edgomez 965 return(cbp);
209 :     }
210 : Isibaar 3
211 : edgomez 965 /* DeQuantize all blocks -- Inter mode */
212 :     static __inline void
213 :     MBDeQuantInter(const MBParam * pParam,
214 :     const int iQuant,
215 :     int16_t data[6 * 64],
216 :     int16_t qcoeff[6 * 64],
217 :     const uint8_t cbp)
218 :     {
219 :     int i;
220 :    
221 :     for (i = 0; i < 6; i++) {
222 :     if (cbp & (1 << (5 - i))) {
223 :     start_timer();
224 :     if (!(pParam->vol_flags & XVID_VOL_MPEGQUANT))
225 :     dequant_inter(&data[i * 64], &qcoeff[i * 64], iQuant);
226 :     else
227 :     dequant4_inter(&data[i * 64], &qcoeff[i * 64], iQuant);
228 :     stop_iquant_timer();
229 : edgomez 851 }
230 : h 69 }
231 : Isibaar 3 }
232 :    
233 : edgomez 965 typedef void (transfer_operation_8to16_t) (int16_t *Dst, const uint8_t *Src, int BpS);
234 :     typedef void (transfer_operation_16to8_t) (uint8_t *Dst, const int16_t *Src, int BpS);
235 : Isibaar 3
236 : edgomez 78
237 : edgomez 965 static __inline void
238 :     MBTrans8to16(const MBParam * pParam,
239 :     FRAMEINFO * frame,
240 :     MACROBLOCK * pMB,
241 :     const uint32_t x_pos,
242 :     const uint32_t y_pos,
243 :     int16_t data[6 * 64])
244 :     {
245 : h 82 uint32_t stride = pParam->edged_width;
246 :     uint32_t stride2 = stride / 2;
247 : edgomez 965 uint32_t next_block = stride * 8;
248 :     int32_t cst;
249 : Isibaar 3 uint8_t *pY_Cur, *pU_Cur, *pV_Cur;
250 : edgomez 195 IMAGE *pCurrent = &frame->image;
251 : edgomez 965 transfer_operation_8to16_t *transfer_op = NULL;
252 : edgomez 195
253 : edgomez 965 if ((frame->vop_flags & XVID_VOP_REDUCED)) {
254 :    
255 :     /* Image pointers */
256 :     pY_Cur = pCurrent->y + (y_pos << 5) * stride + (x_pos << 5);
257 : edgomez 851 pU_Cur = pCurrent->u + (y_pos << 4) * stride2 + (x_pos << 4);
258 :     pV_Cur = pCurrent->v + (y_pos << 4) * stride2 + (x_pos << 4);
259 : edgomez 965
260 :     /* Block size */
261 :     cst = 16;
262 :    
263 :     /* Operation function */
264 :     transfer_op = (transfer_operation_8to16_t*)filter_18x18_to_8x8;
265 :     } else {
266 :    
267 :     /* Image pointers */
268 :     pY_Cur = pCurrent->y + (y_pos << 4) * stride + (x_pos << 4);
269 : edgomez 851 pU_Cur = pCurrent->u + (y_pos << 3) * stride2 + (x_pos << 3);
270 :     pV_Cur = pCurrent->v + (y_pos << 3) * stride2 + (x_pos << 3);
271 : edgomez 965
272 :     /* Block size */
273 :     cst = 8;
274 :    
275 :     /* Operation function */
276 :     transfer_op = (transfer_operation_8to16_t*)transfer_8to16copy;
277 : edgomez 851 }
278 : Isibaar 3
279 : edgomez 965 /* Do the transfer */
280 : h 69 start_timer();
281 : edgomez 965 transfer_op(&data[0 * 64], pY_Cur, stride);
282 :     transfer_op(&data[1 * 64], pY_Cur + cst, stride);
283 :     transfer_op(&data[2 * 64], pY_Cur + next_block, stride);
284 :     transfer_op(&data[3 * 64], pY_Cur + next_block + cst, stride);
285 :     transfer_op(&data[4 * 64], pU_Cur, stride2);
286 :     transfer_op(&data[5 * 64], pV_Cur, stride2);
287 :     stop_transfer_timer();
288 :     }
289 :    
290 :     static __inline void
291 :     MBTrans16to8(const MBParam * pParam,
292 :     FRAMEINFO * frame,
293 :     MACROBLOCK * pMB,
294 :     const uint32_t x_pos,
295 :     const uint32_t y_pos,
296 :     int16_t data[6 * 64],
297 :     const uint32_t add,
298 :     const uint8_t cbp)
299 :     {
300 :     uint8_t *pY_Cur, *pU_Cur, *pV_Cur;
301 :     uint32_t stride = pParam->edged_width;
302 :     uint32_t stride2 = stride / 2;
303 :     uint32_t next_block = stride * 8;
304 :     uint32_t cst;
305 :     IMAGE *pCurrent = &frame->image;
306 :     transfer_operation_16to8_t *transfer_op = NULL;
307 :    
308 :     if (pMB->field_dct) {
309 :     next_block = stride;
310 :     stride *= 2;
311 : h 69 }
312 :    
313 : edgomez 965 if ((frame->vop_flags & XVID_VOP_REDUCED)) {
314 : edgomez 851
315 : edgomez 965 /* Image pointers */
316 :     pY_Cur = pCurrent->y + (y_pos << 5) * stride + (x_pos << 5);
317 :     pU_Cur = pCurrent->u + (y_pos << 4) * stride2 + (x_pos << 4);
318 :     pV_Cur = pCurrent->v + (y_pos << 4) * stride2 + (x_pos << 4);
319 : Isibaar 3
320 : edgomez 965 /* Block size */
321 :     cst = 16;
322 : Isibaar 3
323 : edgomez 965 /* Operation function */
324 :     if(add)
325 :     transfer_op = (transfer_operation_16to8_t*)add_upsampled_8x8_16to8;
326 :     else
327 :     transfer_op = (transfer_operation_16to8_t*)copy_upsampled_8x8_16to8;
328 :     } else {
329 : Isibaar 3
330 : edgomez 965 /* Image pointers */
331 :     pY_Cur = pCurrent->y + (y_pos << 4) * stride + (x_pos << 4);
332 :     pU_Cur = pCurrent->u + (y_pos << 3) * stride2 + (x_pos << 3);
333 :     pV_Cur = pCurrent->v + (y_pos << 3) * stride2 + (x_pos << 3);
334 : Isibaar 3
335 : edgomez 965 /* Block size */
336 :     cst = 8;
337 : Isibaar 3
338 : edgomez 965 /* Operation function */
339 :     if(add)
340 :     transfer_op = (transfer_operation_16to8_t*)transfer_16to8add;
341 :     else
342 :     transfer_op = (transfer_operation_16to8_t*)transfer_16to8copy;
343 : Isibaar 3 }
344 : h 69
345 : edgomez 965 /* Do the operation */
346 : h 69 start_timer();
347 : edgomez 965 if (cbp&32) transfer_op(pY_Cur, &data[0 * 64], stride);
348 :     if (cbp&16) transfer_op(pY_Cur + cst, &data[1 * 64], stride);
349 :     if (cbp& 8) transfer_op(pY_Cur + next_block, &data[2 * 64], stride);
350 :     if (cbp& 4) transfer_op(pY_Cur + next_block + cst, &data[3 * 64], stride);
351 :     if (cbp& 2) transfer_op(pU_Cur, &data[4 * 64], stride2);
352 :     if (cbp& 1) transfer_op(pV_Cur, &data[5 * 64], stride2);
353 : h 69 stop_transfer_timer();
354 : Isibaar 3 }
355 : h 69
356 : edgomez 965 /*****************************************************************************
357 :     * Module functions
358 :     ****************************************************************************/
359 :    
360 : chl 368 void
361 : edgomez 965 MBTransQuantIntra(const MBParam * pParam,
362 : chl 368 FRAMEINFO * frame,
363 :     MACROBLOCK * pMB,
364 :     const uint32_t x_pos,
365 :     const uint32_t y_pos,
366 :     int16_t data[6 * 64],
367 :     int16_t qcoeff[6 * 64])
368 :     {
369 : h 69
370 : edgomez 965 /* Transfer data */
371 :     MBTrans8to16(pParam, frame, pMB, x_pos, y_pos, data);
372 : chl 368
373 : edgomez 965 /* Perform DCT (and field decision) */
374 :     MBfDCT(pParam, frame, pMB, x_pos, y_pos, data);
375 : chl 368
376 : edgomez 965 /* Quantize the block */
377 :     MBQuantIntra(pParam, pMB, data, qcoeff);
378 :    
379 :     /* DeQuantize the block */
380 :     MBDeQuantIntra(pParam, pMB->quant, data, qcoeff);
381 :    
382 :     /* Perform inverse DCT*/
383 :     MBiDCT(data, 0x3F);
384 :    
385 :     /* Transfer back the data -- Don't add data */
386 :     MBTrans16to8(pParam, frame, pMB, x_pos, y_pos, data, 0, 0x3F);
387 : chl 368 }
388 :    
389 : edgomez 965
390 : chl 368 uint8_t
391 : edgomez 965 MBTransQuantInter(const MBParam * pParam,
392 : chl 368 FRAMEINFO * frame,
393 :     MACROBLOCK * pMB,
394 : edgomez 914 const uint32_t x_pos,
395 :     const uint32_t y_pos,
396 : chl 368 int16_t data[6 * 64],
397 :     int16_t qcoeff[6 * 64])
398 :     {
399 :     uint8_t cbp;
400 : edgomez 965 uint32_t limit;
401 : chl 368
402 : edgomez 914 /*
403 : edgomez 965 * There is no MBTrans8to16 for Inter block, that's done in motion compensation
404 :     * already
405 : edgomez 914 */
406 : chl 368
407 : edgomez 965 /* Perform DCT (and field decision) */
408 :     MBfDCT(pParam, frame, pMB, x_pos, y_pos, data);
409 : edgomez 914
410 : edgomez 965 /* Set the limit threshold */
411 :     limit = PVOP_TOOSMALL_LIMIT + ((pMB->quant == 1)? 1 : 0);
412 : chl 368
413 : edgomez 965 /* Quantize the block */
414 :     cbp = MBQuantInter(pParam, pMB, data, qcoeff, 0, limit);
415 : chl 368
416 : edgomez 965 /* DeQuantize the block */
417 :     MBDeQuantInter(pParam, pMB->quant, data, qcoeff, cbp);
418 : chl 368
419 : edgomez 965 /* Perform inverse DCT*/
420 :     MBiDCT(data, cbp);
421 : chl 368
422 : edgomez 965 /* Transfer back the data -- Add the data */
423 :     MBTrans16to8(pParam, frame, pMB, x_pos, y_pos, data, 1, cbp);
424 : chl 368
425 : edgomez 965 return(cbp);
426 : chl 368 }
427 :    
428 : edgomez 965 uint8_t
429 :     MBTransQuantInterBVOP(const MBParam * pParam,
430 : chl 368 FRAMEINFO * frame,
431 :     MACROBLOCK * pMB,
432 :     const uint32_t x_pos,
433 :     const uint32_t y_pos,
434 :     int16_t data[6 * 64],
435 : edgomez 965 int16_t qcoeff[6 * 64])
436 : chl 368 {
437 : edgomez 965 uint8_t cbp;
438 :     uint32_t limit;
439 :    
440 :     /*
441 :     * There is no MBTrans8to16 for Inter block, that's done in motion compensation
442 :     * already
443 :     */
444 : chl 368
445 : edgomez 965 /* Perform DCT (and field decision) */
446 :     MBfDCT(pParam, frame, pMB, x_pos, y_pos, data);
447 : chl 368
448 : edgomez 965 /* Set the limit threshold */
449 :     limit = BVOP_TOOSMALL_LIMIT;
450 : chl 368
451 : edgomez 965 /* Quantize the block */
452 :     cbp = MBQuantInter(pParam, pMB, data, qcoeff, 1, limit);
453 : chl 368
454 : edgomez 965 /*
455 :     * History comment:
456 :     * We don't have to DeQuant, iDCT and Transfer back data for B-frames.
457 :     *
458 :     * BUT some plugins require the original frame to be passed so we have
459 :     * to take care of that here
460 :     */
461 :     if((pParam->plugin_flags & XVID_REQORIGINAL)) {
462 : chl 368
463 : edgomez 965 /* DeQuantize the block */
464 :     MBDeQuantInter(pParam, pMB->quant, data, qcoeff, cbp);
465 : chl 368
466 : edgomez 965 /* Perform inverse DCT*/
467 :     MBiDCT(data, cbp);
468 : h 69
469 : edgomez 965 /* Transfer back the data -- Add the data */
470 :     MBTrans16to8(pParam, frame, pMB, x_pos, y_pos, data, 1, cbp);
471 : edgomez 851 }
472 :    
473 : edgomez 965 return(cbp);
474 : edgomez 851 }
475 :    
476 :     /* if sum(diff between field lines) < sum(diff between frame lines), use field dct */
477 :     uint32_t
478 :     MBFieldTest_c(int16_t data[6 * 64])
479 :     {
480 : edgomez 195 const uint8_t blocks[] =
481 :     { 0 * 64, 0 * 64, 0 * 64, 0 * 64, 2 * 64, 2 * 64, 2 * 64, 2 * 64 };
482 :     const uint8_t lines[] = { 0, 16, 32, 48, 0, 16, 32, 48 };
483 : edgomez 78
484 : h 69 int frame = 0, field = 0;
485 :     int i, j;
486 :    
487 : edgomez 195 for (i = 0; i < 7; ++i) {
488 :     for (j = 0; j < 8; ++j) {
489 :     frame +=
490 : edgomez 982 abs(data[0 * 64 + (i + 1) * 8 + j] - data[0 * 64 + i * 8 + j]);
491 : edgomez 195 frame +=
492 : edgomez 982 abs(data[1 * 64 + (i + 1) * 8 + j] - data[1 * 64 + i * 8 + j]);
493 : edgomez 195 frame +=
494 : edgomez 982 abs(data[2 * 64 + (i + 1) * 8 + j] - data[2 * 64 + i * 8 + j]);
495 : edgomez 195 frame +=
496 : edgomez 982 abs(data[3 * 64 + (i + 1) * 8 + j] - data[3 * 64 + i * 8 + j]);
497 : h 69
498 : edgomez 195 field +=
499 : edgomez 982 abs(data[blocks[i + 1] + lines[i + 1] + j] -
500 : edgomez 195 data[blocks[i] + lines[i] + j]);
501 :     field +=
502 : edgomez 982 abs(data[blocks[i + 1] + lines[i + 1] + 8 + j] -
503 : edgomez 195 data[blocks[i] + lines[i] + 8 + j]);
504 :     field +=
505 : edgomez 982 abs(data[blocks[i + 1] + 64 + lines[i + 1] + j] -
506 : edgomez 195 data[blocks[i] + 64 + lines[i] + j]);
507 :     field +=
508 : edgomez 982 abs(data[blocks[i + 1] + 64 + lines[i + 1] + 8 + j] -
509 : edgomez 195 data[blocks[i] + 64 + lines[i] + 8 + j]);
510 : h 69 }
511 :     }
512 :    
513 : edgomez 851 return (frame >= (field + 350));
514 : h 69 }
515 :    
516 :    
517 :     /* deinterlace Y blocks vertically */
518 :    
519 :     #define MOVLINE(X,Y) memcpy(X, Y, sizeof(tmp))
520 : edgomez 78 #define LINE(X,Y) &data[X*64 + Y*8]
521 : h 69
522 : edgomez 195 void
523 :     MBFrameToField(int16_t data[6 * 64])
524 : h 69 {
525 :     int16_t tmp[8];
526 :    
527 :     /* left blocks */
528 :    
529 : edgomez 851 // 1=2, 2=4, 4=8, 8=1
530 : edgomez 195 MOVLINE(tmp, LINE(0, 1));
531 :     MOVLINE(LINE(0, 1), LINE(0, 2));
532 :     MOVLINE(LINE(0, 2), LINE(0, 4));
533 :     MOVLINE(LINE(0, 4), LINE(2, 0));
534 :     MOVLINE(LINE(2, 0), tmp);
535 : h 69
536 : edgomez 851 // 3=6, 6=12, 12=9, 9=3
537 : edgomez 195 MOVLINE(tmp, LINE(0, 3));
538 :     MOVLINE(LINE(0, 3), LINE(0, 6));
539 :     MOVLINE(LINE(0, 6), LINE(2, 4));
540 :     MOVLINE(LINE(2, 4), LINE(2, 1));
541 :     MOVLINE(LINE(2, 1), tmp);
542 : h 69
543 : edgomez 851 // 5=10, 10=5
544 : edgomez 195 MOVLINE(tmp, LINE(0, 5));
545 :     MOVLINE(LINE(0, 5), LINE(2, 2));
546 :     MOVLINE(LINE(2, 2), tmp);
547 : h 69
548 : edgomez 851 // 7=14, 14=13, 13=11, 11=7
549 : edgomez 195 MOVLINE(tmp, LINE(0, 7));
550 :     MOVLINE(LINE(0, 7), LINE(2, 6));
551 :     MOVLINE(LINE(2, 6), LINE(2, 5));
552 :     MOVLINE(LINE(2, 5), LINE(2, 3));
553 :     MOVLINE(LINE(2, 3), tmp);
554 : h 69
555 :     /* right blocks */
556 :    
557 : edgomez 851 // 1=2, 2=4, 4=8, 8=1
558 : edgomez 195 MOVLINE(tmp, LINE(1, 1));
559 :     MOVLINE(LINE(1, 1), LINE(1, 2));
560 :     MOVLINE(LINE(1, 2), LINE(1, 4));
561 :     MOVLINE(LINE(1, 4), LINE(3, 0));
562 :     MOVLINE(LINE(3, 0), tmp);
563 : h 69
564 : edgomez 851 // 3=6, 6=12, 12=9, 9=3
565 : edgomez 195 MOVLINE(tmp, LINE(1, 3));
566 :     MOVLINE(LINE(1, 3), LINE(1, 6));
567 :     MOVLINE(LINE(1, 6), LINE(3, 4));
568 :     MOVLINE(LINE(3, 4), LINE(3, 1));
569 :     MOVLINE(LINE(3, 1), tmp);
570 : h 69
571 : edgomez 851 // 5=10, 10=5
572 : edgomez 195 MOVLINE(tmp, LINE(1, 5));
573 :     MOVLINE(LINE(1, 5), LINE(3, 2));
574 :     MOVLINE(LINE(3, 2), tmp);
575 : h 69
576 : edgomez 851 // 7=14, 14=13, 13=11, 11=7
577 : edgomez 195 MOVLINE(tmp, LINE(1, 7));
578 :     MOVLINE(LINE(1, 7), LINE(3, 6));
579 :     MOVLINE(LINE(3, 6), LINE(3, 5));
580 :     MOVLINE(LINE(3, 5), LINE(3, 3));
581 :     MOVLINE(LINE(3, 3), tmp);
582 : h 69 }

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4