48 |
#include "image/interpolate8x8.h" |
#include "image/interpolate8x8.h" |
49 |
#include "image/reduced.h" |
#include "image/reduced.h" |
50 |
#include "image/font.h" |
#include "image/font.h" |
51 |
|
#include "image/qpel.h" |
52 |
|
|
53 |
#include "bitstream/mbcoding.h" |
#include "bitstream/mbcoding.h" |
54 |
#include "prediction/mbprediction.h" |
#include "prediction/mbprediction.h" |
62 |
#include "image/postprocessing.h" |
#include "image/postprocessing.h" |
63 |
#include "utils/mem_align.h" |
#include "utils/mem_align.h" |
64 |
|
|
65 |
|
#ifdef ARCH_IS_IA32 |
66 |
|
#define interpolate16x16_quarterpel new_interpolate16x16_quarterpel |
67 |
|
#define interpolate8x8_quarterpel new_interpolate8x8_quarterpel |
68 |
|
#endif |
69 |
|
|
70 |
static int |
static int |
71 |
decoder_resize(DECODER * dec) |
decoder_resize(DECODER * dec) |
72 |
{ |
{ |
399 |
const int reduced_resolution, |
const int reduced_resolution, |
400 |
const MACROBLOCK * pMB) |
const MACROBLOCK * pMB) |
401 |
{ |
{ |
|
DECLARE_ALIGNED_MATRIX(block, 1, 64, int16_t, CACHE_LINE); |
|
402 |
DECLARE_ALIGNED_MATRIX(data, 6, 64, int16_t, CACHE_LINE); |
DECLARE_ALIGNED_MATRIX(data, 6, 64, int16_t, CACHE_LINE); |
403 |
|
|
404 |
int stride = dec->edged_width; |
int stride = dec->edged_width; |
407 |
int i; |
int i; |
408 |
const uint32_t iQuant = pMB->quant; |
const uint32_t iQuant = pMB->quant; |
409 |
const int direction = dec->alternate_vertical_scan ? 2 : 0; |
const int direction = dec->alternate_vertical_scan ? 2 : 0; |
410 |
const quant_interFuncPtr dequant = dec->quant_type == 0 ? dequant_h263_inter : dequant_mpeg_inter; |
typedef void (*get_inter_block_function_t)( |
411 |
|
Bitstream * bs, |
412 |
|
int16_t * block, |
413 |
|
int direction, |
414 |
|
const int quant, |
415 |
|
const uint16_t *matrix); |
416 |
|
|
417 |
|
const get_inter_block_function_t get_inter_block = (dec->quant_type == 0) |
418 |
|
? get_inter_block_h263 |
419 |
|
: get_inter_block_mpeg; |
420 |
|
|
421 |
|
memset(&data[0], 0, 6*64*sizeof(int16_t)); /* clear */ |
422 |
|
|
423 |
for (i = 0; i < 6; i++) { |
for (i = 0; i < 6; i++) { |
424 |
|
|
425 |
if (cbp & (1 << (5 - i))) { /* coded */ |
if (cbp & (1 << (5 - i))) { /* coded */ |
426 |
|
|
|
memset(block, 0, 64 * sizeof(int16_t)); /* clear */ |
|
427 |
|
|
428 |
|
/* Decode coeffs and dequantize on the fly */ |
429 |
start_timer(); |
start_timer(); |
430 |
get_inter_block(bs, block, direction); |
get_inter_block(bs, &data[i*64], direction, iQuant, get_inter_matrix(dec->mpeg_quant_matrices)); |
431 |
stop_coding_timer(); |
stop_coding_timer(); |
432 |
|
|
433 |
start_timer(); |
start_timer(); |
|
dequant(&data[i * 64], block, iQuant, dec->mpeg_quant_matrices); |
|
|
stop_iquant_timer(); |
|
|
|
|
|
start_timer(); |
|
434 |
idct(&data[i * 64]); |
idct(&data[i * 64]); |
435 |
stop_idct_timer(); |
stop_idct_timer(); |
436 |
} |
} |
1044 |
if (!direct) { |
if (!direct) { |
1045 |
uv_dx = pMB->mvs[0].x; |
uv_dx = pMB->mvs[0].x; |
1046 |
uv_dy = pMB->mvs[0].y; |
uv_dy = pMB->mvs[0].y; |
|
|
|
1047 |
b_uv_dx = pMB->b_mvs[0].x; |
b_uv_dx = pMB->b_mvs[0].x; |
1048 |
b_uv_dy = pMB->b_mvs[0].y; |
b_uv_dy = pMB->b_mvs[0].y; |
1049 |
|
|
1056 |
|
|
1057 |
uv_dx = (uv_dx >> 1) + roundtab_79[uv_dx & 0x3]; |
uv_dx = (uv_dx >> 1) + roundtab_79[uv_dx & 0x3]; |
1058 |
uv_dy = (uv_dy >> 1) + roundtab_79[uv_dy & 0x3]; |
uv_dy = (uv_dy >> 1) + roundtab_79[uv_dy & 0x3]; |
|
|
|
1059 |
b_uv_dx = (b_uv_dx >> 1) + roundtab_79[b_uv_dx & 0x3]; |
b_uv_dx = (b_uv_dx >> 1) + roundtab_79[b_uv_dx & 0x3]; |
1060 |
b_uv_dy = (b_uv_dy >> 1) + roundtab_79[b_uv_dy & 0x3]; |
b_uv_dy = (b_uv_dy >> 1) + roundtab_79[b_uv_dy & 0x3]; |
1061 |
|
|
1062 |
} else { |
} else { |
|
if(dec->quarterpel) { |
|
|
uv_dx = (pMB->mvs[0].x / 2) + (pMB->mvs[1].x / 2) + (pMB->mvs[2].x / 2) + (pMB->mvs[3].x / 2); |
|
|
uv_dy = (pMB->mvs[0].y / 2) + (pMB->mvs[1].y / 2) + (pMB->mvs[2].y / 2) + (pMB->mvs[3].y / 2); |
|
|
b_uv_dx = (pMB->b_mvs[0].x / 2) + (pMB->b_mvs[1].x / 2) + (pMB->b_mvs[2].x / 2) + (pMB->b_mvs[3].x / 2); |
|
|
b_uv_dy = (pMB->b_mvs[0].y / 2) + (pMB->b_mvs[1].y / 2) + (pMB->b_mvs[2].y / 2) + (pMB->b_mvs[3].y / 2); |
|
|
} else { |
|
1063 |
uv_dx = pMB->mvs[0].x + pMB->mvs[1].x + pMB->mvs[2].x + pMB->mvs[3].x; |
uv_dx = pMB->mvs[0].x + pMB->mvs[1].x + pMB->mvs[2].x + pMB->mvs[3].x; |
1064 |
uv_dy = pMB->mvs[0].y + pMB->mvs[1].y + pMB->mvs[2].y + pMB->mvs[3].y; |
uv_dy = pMB->mvs[0].y + pMB->mvs[1].y + pMB->mvs[2].y + pMB->mvs[3].y; |
1065 |
b_uv_dx = pMB->b_mvs[0].x + pMB->b_mvs[1].x + pMB->b_mvs[2].x + pMB->b_mvs[3].x; |
b_uv_dx = pMB->b_mvs[0].x + pMB->b_mvs[1].x + pMB->b_mvs[2].x + pMB->b_mvs[3].x; |
1066 |
b_uv_dy = pMB->b_mvs[0].y + pMB->b_mvs[1].y + pMB->b_mvs[2].y + pMB->b_mvs[3].y; |
b_uv_dy = pMB->b_mvs[0].y + pMB->b_mvs[1].y + pMB->b_mvs[2].y + pMB->b_mvs[3].y; |
1067 |
|
|
1068 |
|
if (dec->quarterpel) { |
1069 |
|
uv_dx /= 2; |
1070 |
|
uv_dy /= 2; |
1071 |
|
b_uv_dx /= 2; |
1072 |
|
b_uv_dy /= 2; |
1073 |
} |
} |
1074 |
|
|
1075 |
uv_dx = (uv_dx >> 3) + roundtab_76[uv_dx & 0xf]; |
uv_dx = (uv_dx >> 3) + roundtab_76[uv_dx & 0xf]; |
1583 |
|
|
1584 |
if (dec->low_delay) { |
if (dec->low_delay) { |
1585 |
DPRINTF(XVID_DEBUG_ERROR, "warning: bvop found in low_delay==1 stream\n"); |
DPRINTF(XVID_DEBUG_ERROR, "warning: bvop found in low_delay==1 stream\n"); |
1586 |
dec->low_delay = 1; |
dec->low_delay = 0; |
1587 |
} |
} |
1588 |
|
|
1589 |
if (dec->frames < 2) { |
if (dec->frames < 2) { |