21 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
22 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 |
* |
* |
24 |
* $Id: mbtransquant.c,v 1.21.2.6 2003-03-30 13:16:41 edgomez Exp $ |
* $Id: mbtransquant.c,v 1.21.2.8 2003-04-13 16:18:09 syskin Exp $ |
25 |
* |
* |
26 |
****************************************************************************/ |
****************************************************************************/ |
27 |
|
|
28 |
#include <string.h> |
#include <string.h> |
29 |
|
#include <stdlib.h> |
30 |
|
|
31 |
#include "../portab.h" |
#include "../portab.h" |
32 |
#include "mbfunctions.h" |
#include "mbfunctions.h" |
69 |
|
|
70 |
/* Performs Forward DCT on all blocks */ |
/* Performs Forward DCT on all blocks */ |
71 |
static __inline void |
static __inline void |
72 |
MBfDCT(const MBParam * pParam, |
MBfDCT(const MBParam * const pParam, |
73 |
FRAMEINFO * frame, |
const FRAMEINFO * const frame, |
74 |
MACROBLOCK * pMB, |
MACROBLOCK * const pMB, |
75 |
uint32_t x_pos, |
uint32_t x_pos, |
76 |
uint32_t y_pos, |
uint32_t y_pos, |
77 |
int16_t data[6 * 64]) |
int16_t data[6 * 64]) |
235 |
|
|
236 |
|
|
237 |
static __inline void |
static __inline void |
238 |
MBTrans8to16(const MBParam * pParam, |
MBTrans8to16(const MBParam * const pParam, |
239 |
FRAMEINFO * frame, |
const FRAMEINFO * const frame, |
240 |
MACROBLOCK * pMB, |
const MACROBLOCK * const pMB, |
241 |
const uint32_t x_pos, |
const uint32_t x_pos, |
242 |
const uint32_t y_pos, |
const uint32_t y_pos, |
243 |
int16_t data[6 * 64]) |
int16_t data[6 * 64]) |
247 |
uint32_t next_block = stride * 8; |
uint32_t next_block = stride * 8; |
248 |
int32_t cst; |
int32_t cst; |
249 |
uint8_t *pY_Cur, *pU_Cur, *pV_Cur; |
uint8_t *pY_Cur, *pU_Cur, *pV_Cur; |
250 |
IMAGE *pCurrent = &frame->image; |
const IMAGE * const pCurrent = &frame->image; |
251 |
transfer_operation_8to16_t *transfer_op = NULL; |
transfer_operation_8to16_t *transfer_op = NULL; |
252 |
|
|
253 |
if ((frame->vop_flags & XVID_VOP_REDUCED)) { |
if ((frame->vop_flags & XVID_VOP_REDUCED)) { |
288 |
} |
} |
289 |
|
|
290 |
static __inline void |
static __inline void |
291 |
MBTrans16to8(const MBParam * pParam, |
MBTrans16to8(const MBParam * const pParam, |
292 |
FRAMEINFO * frame, |
const FRAMEINFO * const frame, |
293 |
MACROBLOCK * pMB, |
const MACROBLOCK * const pMB, |
294 |
const uint32_t x_pos, |
const uint32_t x_pos, |
295 |
const uint32_t y_pos, |
const uint32_t y_pos, |
296 |
int16_t data[6 * 64], |
int16_t data[6 * 64], |
302 |
uint32_t stride2 = stride / 2; |
uint32_t stride2 = stride / 2; |
303 |
uint32_t next_block = stride * 8; |
uint32_t next_block = stride * 8; |
304 |
uint32_t cst; |
uint32_t cst; |
305 |
IMAGE *pCurrent = &frame->image; |
const IMAGE * const pCurrent = &frame->image; |
306 |
transfer_operation_16to8_t *transfer_op = NULL; |
transfer_operation_16to8_t *transfer_op = NULL; |
307 |
|
|
308 |
if (pMB->field_dct) { |
if (pMB->field_dct) { |
358 |
****************************************************************************/ |
****************************************************************************/ |
359 |
|
|
360 |
void |
void |
361 |
MBTransQuantIntra(const MBParam * pParam, |
MBTransQuantIntra(const MBParam * const pParam, |
362 |
FRAMEINFO * frame, |
const FRAMEINFO * const frame, |
363 |
MACROBLOCK * pMB, |
MACROBLOCK * const pMB, |
364 |
const uint32_t x_pos, |
const uint32_t x_pos, |
365 |
const uint32_t y_pos, |
const uint32_t y_pos, |
366 |
int16_t data[6 * 64], |
int16_t data[6 * 64], |
388 |
|
|
389 |
|
|
390 |
uint8_t |
uint8_t |
391 |
MBTransQuantInter(const MBParam * pParam, |
MBTransQuantInter(const MBParam * const pParam, |
392 |
FRAMEINFO * frame, |
const FRAMEINFO * const frame, |
393 |
MACROBLOCK * pMB, |
MACROBLOCK * const pMB, |
394 |
const uint32_t x_pos, |
const uint32_t x_pos, |
395 |
const uint32_t y_pos, |
const uint32_t y_pos, |
396 |
int16_t data[6 * 64], |
int16_t data[6 * 64], |
487 |
for (i = 0; i < 7; ++i) { |
for (i = 0; i < 7; ++i) { |
488 |
for (j = 0; j < 8; ++j) { |
for (j = 0; j < 8; ++j) { |
489 |
frame += |
frame += |
490 |
ABS(data[0 * 64 + (i + 1) * 8 + j] - data[0 * 64 + i * 8 + j]); |
abs(data[0 * 64 + (i + 1) * 8 + j] - data[0 * 64 + i * 8 + j]); |
491 |
frame += |
frame += |
492 |
ABS(data[1 * 64 + (i + 1) * 8 + j] - data[1 * 64 + i * 8 + j]); |
abs(data[1 * 64 + (i + 1) * 8 + j] - data[1 * 64 + i * 8 + j]); |
493 |
frame += |
frame += |
494 |
ABS(data[2 * 64 + (i + 1) * 8 + j] - data[2 * 64 + i * 8 + j]); |
abs(data[2 * 64 + (i + 1) * 8 + j] - data[2 * 64 + i * 8 + j]); |
495 |
frame += |
frame += |
496 |
ABS(data[3 * 64 + (i + 1) * 8 + j] - data[3 * 64 + i * 8 + j]); |
abs(data[3 * 64 + (i + 1) * 8 + j] - data[3 * 64 + i * 8 + j]); |
497 |
|
|
498 |
field += |
field += |
499 |
ABS(data[blocks[i + 1] + lines[i + 1] + j] - |
abs(data[blocks[i + 1] + lines[i + 1] + j] - |
500 |
data[blocks[i] + lines[i] + j]); |
data[blocks[i] + lines[i] + j]); |
501 |
field += |
field += |
502 |
ABS(data[blocks[i + 1] + lines[i + 1] + 8 + j] - |
abs(data[blocks[i + 1] + lines[i + 1] + 8 + j] - |
503 |
data[blocks[i] + lines[i] + 8 + j]); |
data[blocks[i] + lines[i] + 8 + j]); |
504 |
field += |
field += |
505 |
ABS(data[blocks[i + 1] + 64 + lines[i + 1] + j] - |
abs(data[blocks[i + 1] + 64 + lines[i + 1] + j] - |
506 |
data[blocks[i] + 64 + lines[i] + j]); |
data[blocks[i] + 64 + lines[i] + j]); |
507 |
field += |
field += |
508 |
ABS(data[blocks[i + 1] + 64 + lines[i + 1] + 8 + j] - |
abs(data[blocks[i + 1] + 64 + lines[i + 1] + 8 + j] - |
509 |
data[blocks[i] + 64 + lines[i] + 8 + j]); |
data[blocks[i] + 64 + lines[i] + 8 + j]); |
510 |
} |
} |
511 |
} |
} |