195 |
dec->low_delay = 0; |
dec->low_delay = 0; |
196 |
dec->packed_mode = 0; |
dec->packed_mode = 0; |
197 |
dec->time_inc_resolution = 1; /* until VOL header says otherwise */ |
dec->time_inc_resolution = 1; /* until VOL header says otherwise */ |
198 |
|
dec->ver_id = 1; |
199 |
|
|
200 |
dec->bs_version = 0xffff; /* Initialize to very high value -> assume bugfree stream */ |
dec->bs_version = 0xffff; /* Initialize to very high value -> assume bugfree stream */ |
201 |
|
|
1335 |
return -1; |
return -1; |
1336 |
} |
} |
1337 |
|
|
1338 |
|
static int __inline get_resync_len_b(const int fcode_backward, |
1339 |
|
const int fcode_forward) { |
1340 |
|
int resync_len = ((fcode_forward>fcode_backward) ? fcode_forward : fcode_backward) - 1; |
1341 |
|
if (resync_len < 1) resync_len = 1; |
1342 |
|
return resync_len; |
1343 |
|
} |
1344 |
|
|
1345 |
static void |
static void |
1346 |
decoder_bframe(DECODER * dec, |
decoder_bframe(DECODER * dec, |
1347 |
Bitstream * bs, |
Bitstream * bs, |
1353 |
VECTOR mv; |
VECTOR mv; |
1354 |
const VECTOR zeromv = {0,0}; |
const VECTOR zeromv = {0,0}; |
1355 |
int i; |
int i; |
1356 |
|
int resync_len; |
1357 |
|
|
1358 |
if (!dec->is_edged[0]) { |
if (!dec->is_edged[0]) { |
1359 |
start_timer(); |
start_timer(); |
1371 |
stop_edges_timer(); |
stop_edges_timer(); |
1372 |
} |
} |
1373 |
|
|
1374 |
|
resync_len = get_resync_len_b(fcode_backward, fcode_forward); |
1375 |
for (y = 0; y < dec->mb_height; y++) { |
for (y = 0; y < dec->mb_height; y++) { |
1376 |
/* Initialize Pred Motion Vector */ |
/* Initialize Pred Motion Vector */ |
1377 |
dec->p_fmv = dec->p_bmv = zeromv; |
dec->p_fmv = dec->p_bmv = zeromv; |
1378 |
for (x = 0; x < dec->mb_width; x++) { |
for (x = 0; x < dec->mb_width; x++) { |
1379 |
MACROBLOCK *mb = &dec->mbs[y * dec->mb_width + x]; |
MACROBLOCK *mb = &dec->mbs[y * dec->mb_width + x]; |
1380 |
MACROBLOCK *last_mb = &dec->last_mbs[y * dec->mb_width + x]; |
MACROBLOCK *last_mb = &dec->last_mbs[y * dec->mb_width + x]; |
|
const int fcode_max = (fcode_forward>fcode_backward) ? fcode_forward : fcode_backward; |
|
1381 |
int intra_dc_threshold; /* fake variable */ |
int intra_dc_threshold; /* fake variable */ |
1382 |
|
|
1383 |
if (check_resync_marker(bs, fcode_max - 1)) { |
if (check_resync_marker(bs, resync_len)) { |
1384 |
int bound = read_video_packet_header(bs, dec, fcode_max - 1, &quant, |
int bound = read_video_packet_header(bs, dec, resync_len, &quant, |
1385 |
&fcode_forward, &fcode_backward, &intra_dc_threshold); |
&fcode_forward, &fcode_backward, &intra_dc_threshold); |
1386 |
x = bound % dec->mb_width; |
x = bound % dec->mb_width; |
1387 |
y = bound / dec->mb_width; |
y = bound / dec->mb_width; |
1388 |
/* reset predicted macroblocks */ |
/* reset predicted macroblocks */ |
1389 |
dec->p_fmv = dec->p_bmv = zeromv; |
dec->p_fmv = dec->p_bmv = zeromv; |
1390 |
|
/* update resync len with new fcodes */ |
1391 |
|
resync_len = get_resync_len_b(fcode_backward, fcode_forward); |
1392 |
} |
} |
1393 |
|
|
1394 |
mv = |
mv = |
1628 |
if (coding_type == -2 || coding_type == -3) { /* vol and/or resize */ |
if (coding_type == -2 || coding_type == -3) { /* vol and/or resize */ |
1629 |
|
|
1630 |
if (coding_type == -3) |
if (coding_type == -3) |
1631 |
decoder_resize(dec); |
if (decoder_resize(dec)) return XVID_ERR_MEMORY; |
1632 |
|
|
1633 |
if(stats) { |
if(stats) { |
1634 |
stats->type = XVID_TYPE_VOL; |
stats->type = XVID_TYPE_VOL; |