32 |
* |
* |
33 |
* History: |
* History: |
34 |
* |
* |
35 |
|
* 29.03.2002 interlacing fix - compensated block wasn't being used when |
36 |
|
* reconstructing blocks, thus artifacts |
37 |
|
* interlacing speedup - used transfers to re-interlace |
38 |
|
* interlaced decoding should be as fast as progressive now |
39 |
* 26.03.2002 interlacing support - moved transfers outside decode loop |
* 26.03.2002 interlacing support - moved transfers outside decode loop |
40 |
* 26.12.2001 decoder_mbinter: dequant/idct moved within if(coded) block |
* 26.12.2001 decoder_mbinter: dequant/idct moved within if(coded) block |
41 |
* 22.12.2001 block based interpolation |
* 22.12.2001 block based interpolation |
59 |
#include "dct/fdct.h" |
#include "dct/fdct.h" |
60 |
#include "utils/mem_transfer.h" |
#include "utils/mem_transfer.h" |
61 |
#include "image/interpolate8x8.h" |
#include "image/interpolate8x8.h" |
|
#include "utils/mbfunctions.h" |
|
62 |
|
|
63 |
#include "bitstream/mbcoding.h" |
#include "bitstream/mbcoding.h" |
64 |
#include "prediction/mbprediction.h" |
#include "prediction/mbprediction.h" |
111 |
} |
} |
112 |
|
|
113 |
init_timer(); |
init_timer(); |
|
create_vlc_tables(); |
|
114 |
|
|
115 |
return XVID_ERR_OK; |
return XVID_ERR_OK; |
116 |
} |
} |
123 |
image_destroy(&dec->cur, dec->edged_width, dec->edged_height); |
image_destroy(&dec->cur, dec->edged_width, dec->edged_height); |
124 |
xvid_free(dec); |
xvid_free(dec); |
125 |
|
|
|
destroy_vlc_tables(); |
|
|
|
|
126 |
write_timer(); |
write_timer(); |
127 |
return XVID_ERR_OK; |
return XVID_ERR_OK; |
128 |
} |
} |
151 |
DECLARE_ALIGNED_MATRIX(block, 6, 64, int16_t, CACHE_LINE); |
DECLARE_ALIGNED_MATRIX(block, 6, 64, int16_t, CACHE_LINE); |
152 |
DECLARE_ALIGNED_MATRIX(data, 6, 64, int16_t, CACHE_LINE); |
DECLARE_ALIGNED_MATRIX(data, 6, 64, int16_t, CACHE_LINE); |
153 |
|
|
154 |
const uint32_t stride = dec->edged_width; |
uint32_t stride = dec->edged_width; |
155 |
|
uint32_t stride2 = stride / 2; |
156 |
|
uint32_t next_block = stride * 8; |
157 |
uint32_t i; |
uint32_t i; |
158 |
uint32_t iQuant = pMB->quant; |
uint32_t iQuant = pMB->quant; |
159 |
uint8_t *pY_Cur, *pU_Cur, *pV_Cur; |
uint8_t *pY_Cur, *pU_Cur, *pV_Cur; |
160 |
|
|
161 |
pY_Cur = dec->cur.y + (y_pos << 4) * stride + (x_pos << 4); |
pY_Cur = dec->cur.y + (y_pos << 4) * stride + (x_pos << 4); |
162 |
pU_Cur = dec->cur.u + (y_pos << 3) * (stride >> 1) + (x_pos << 3); |
pU_Cur = dec->cur.u + (y_pos << 3) * stride2 + (x_pos << 3); |
163 |
pV_Cur = dec->cur.v + (y_pos << 3) * (stride >> 1) + (x_pos << 3); |
pV_Cur = dec->cur.v + (y_pos << 3) * stride2 + (x_pos << 3); |
164 |
|
|
165 |
memset(block, 0, 6*64*sizeof(int16_t)); // clear |
memset(block, 0, 6*64*sizeof(int16_t)); // clear |
166 |
|
|
226 |
stop_idct_timer(); |
stop_idct_timer(); |
227 |
} |
} |
228 |
|
|
|
start_timer(); |
|
229 |
if (dec->interlacing && pMB->field_dct) |
if (dec->interlacing && pMB->field_dct) |
230 |
{ |
{ |
231 |
MBFieldToFrame(data); |
next_block = stride; |
232 |
|
stride *= 2; |
233 |
} |
} |
|
stop_interlacing_timer(); |
|
234 |
|
|
235 |
start_timer(); |
start_timer(); |
236 |
transfer_16to8copy(pY_Cur, &data[0*64], stride); |
transfer_16to8copy(pY_Cur, &data[0*64], stride); |
237 |
transfer_16to8copy(pY_Cur + 8, &data[1*64], stride); |
transfer_16to8copy(pY_Cur + 8, &data[1*64], stride); |
238 |
transfer_16to8copy(pY_Cur + 8 * stride, &data[2*64], stride); |
transfer_16to8copy(pY_Cur + next_block, &data[2*64], stride); |
239 |
transfer_16to8copy(pY_Cur + 8 + 8 * stride, &data[3*64], stride); |
transfer_16to8copy(pY_Cur + 8 + next_block, &data[3*64], stride); |
240 |
transfer_16to8copy(pU_Cur, &data[4*64], stride / 2); |
transfer_16to8copy(pU_Cur, &data[4*64], stride2); |
241 |
transfer_16to8copy(pV_Cur, &data[5*64], stride / 2); |
transfer_16to8copy(pV_Cur, &data[5*64], stride2); |
242 |
stop_transfer_timer(); |
stop_transfer_timer(); |
243 |
} |
} |
244 |
|
|
268 |
DECLARE_ALIGNED_MATRIX(block,6, 64, int16_t, CACHE_LINE); |
DECLARE_ALIGNED_MATRIX(block,6, 64, int16_t, CACHE_LINE); |
269 |
DECLARE_ALIGNED_MATRIX(data, 6, 64, int16_t, CACHE_LINE); |
DECLARE_ALIGNED_MATRIX(data, 6, 64, int16_t, CACHE_LINE); |
270 |
|
|
271 |
const uint32_t stride = dec->edged_width; |
uint32_t stride = dec->edged_width; |
272 |
const uint32_t stride2 = dec->edged_width / 2; |
uint32_t stride2 = stride / 2; |
273 |
|
uint32_t next_block = stride * 8; |
274 |
uint32_t i; |
uint32_t i; |
275 |
uint32_t iQuant = pMB->quant; |
uint32_t iQuant = pMB->quant; |
276 |
uint8_t *pY_Cur, *pU_Cur, *pV_Cur; |
uint8_t *pY_Cur, *pU_Cur, *pV_Cur; |
277 |
int uv_dx, uv_dy; |
int uv_dx, uv_dy; |
278 |
|
|
279 |
pY_Cur = dec->cur.y + (y_pos << 4) * stride + (x_pos << 4); |
pY_Cur = dec->cur.y + (y_pos << 4) * stride + (x_pos << 4); |
280 |
pU_Cur = dec->cur.u + (y_pos << 3) * (stride >> 1) + (x_pos << 3); |
pU_Cur = dec->cur.u + (y_pos << 3) * stride2 + (x_pos << 3); |
281 |
pV_Cur = dec->cur.v + (y_pos << 3) * (stride >> 1) + (x_pos << 3); |
pV_Cur = dec->cur.v + (y_pos << 3) * stride2 + (x_pos << 3); |
282 |
|
|
283 |
if (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) |
if (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) |
284 |
{ |
{ |
334 |
} |
} |
335 |
} |
} |
336 |
|
|
337 |
start_timer(); |
if (dec->interlacing && pMB->field_dct) |
|
if (pMB->field_dct) |
|
338 |
{ |
{ |
339 |
MBFieldToFrame(data); |
next_block = stride; |
340 |
|
stride *= 2; |
341 |
} |
} |
|
stop_interlacing_timer(); |
|
342 |
|
|
343 |
start_timer(); |
start_timer(); |
344 |
if (cbp & 32) |
if (cbp & 32) |
346 |
if (cbp & 16) |
if (cbp & 16) |
347 |
transfer_16to8add(pY_Cur + 8, &data[1*64], stride); |
transfer_16to8add(pY_Cur + 8, &data[1*64], stride); |
348 |
if (cbp & 8) |
if (cbp & 8) |
349 |
transfer_16to8add(pY_Cur + 8 * stride, &data[2*64], stride); |
transfer_16to8add(pY_Cur + next_block, &data[2*64], stride); |
350 |
if (cbp & 4) |
if (cbp & 4) |
351 |
transfer_16to8add(pY_Cur + 8 + 8 * stride, &data[3*64], stride); |
transfer_16to8add(pY_Cur + 8 + next_block, &data[3*64], stride); |
352 |
if (cbp & 2) |
if (cbp & 2) |
353 |
transfer_16to8add(pU_Cur, &data[4*64], stride / 2); |
transfer_16to8add(pU_Cur, &data[4*64], stride2); |
354 |
if (cbp & 1) |
if (cbp & 1) |
355 |
transfer_16to8add(pV_Cur, &data[5*64], stride / 2); |
transfer_16to8add(pV_Cur, &data[5*64], stride2); |
356 |
stop_transfer_timer(); |
stop_transfer_timer(); |
357 |
} |
} |
358 |
|
|