547 |
#endif |
#endif |
548 |
|
|
549 |
if (dec->time_inc_resolution > 0) { |
if (dec->time_inc_resolution > 0) { |
550 |
dec->time_inc_bits = log2bin(dec->time_inc_resolution-1); |
dec->time_inc_bits = MAX(log2bin(dec->time_inc_resolution-1), 1); |
551 |
} else { |
} else { |
552 |
#if 0 |
#if 0 |
553 |
dec->time_inc_bits = 0; |
dec->time_inc_bits = 0; |
814 |
if (coding_type != B_VOP) { |
if (coding_type != B_VOP) { |
815 |
dec->last_time_base = dec->time_base; |
dec->last_time_base = dec->time_base; |
816 |
dec->time_base += time_incr; |
dec->time_base += time_incr; |
817 |
dec->time = time_increment; |
dec->time = dec->time_base*dec->time_inc_resolution + time_increment; |
818 |
|
dec->time_pp = (int32_t)(dec->time - dec->last_non_b_time); |
|
#if 0 |
|
|
dec->time_base * dec->time_inc_resolution + |
|
|
time_increment; |
|
|
#endif |
|
|
dec->time_pp = (uint32_t) |
|
|
(dec->time_inc_resolution + dec->time - dec->last_non_b_time)%dec->time_inc_resolution; |
|
819 |
dec->last_non_b_time = dec->time; |
dec->last_non_b_time = dec->time; |
820 |
} else { |
} else { |
821 |
dec->time = time_increment; |
dec->time = (dec->last_time_base + time_incr)*dec->time_inc_resolution + time_increment; |
822 |
#if 0 |
dec->time_bp = dec->time_pp - (int32_t)(dec->last_non_b_time - dec->time); |
|
(dec->last_time_base + |
|
|
time_incr) * dec->time_inc_resolution + time_increment; |
|
|
#endif |
|
|
dec->time_bp = (uint32_t) |
|
|
(dec->time_inc_resolution + dec->last_non_b_time - dec->time)%dec->time_inc_resolution; |
|
823 |
} |
} |
824 |
DPRINTF(XVID_DEBUG_HEADER,"time_pp=%i\n", dec->time_pp); |
DPRINTF(XVID_DEBUG_HEADER,"time_pp=%i\n", dec->time_pp); |
825 |
DPRINTF(XVID_DEBUG_HEADER,"time_bp=%i\n", dec->time_bp); |
DPRINTF(XVID_DEBUG_HEADER,"time_bp=%i\n", dec->time_bp); |
1012 |
else |
else |
1013 |
sscanf(tmp, "XviD%d", &dec->bs_version); |
sscanf(tmp, "XviD%d", &dec->bs_version); |
1014 |
|
|
1015 |
DPRINTF(XVID_DEBUG_HEADER, "xvid bitstream version=%i", dec->bs_version); |
DPRINTF(XVID_DEBUG_HEADER, "xvid bitstream version=%i\n", dec->bs_version); |
1016 |
} |
} |
1017 |
|
|
1018 |
/* divx detection */ |
/* divx detection */ |
1186 |
|
|
1187 |
if (pParam->fincr>0) { |
if (pParam->fincr>0) { |
1188 |
BitstreamPutBit(bs, 1); /* fixed_vop_rate = 1 */ |
BitstreamPutBit(bs, 1); /* fixed_vop_rate = 1 */ |
1189 |
BitstreamPutBits(bs, pParam->fincr, log2bin(pParam->fbase-1)); /* fixed_vop_time_increment */ |
BitstreamPutBits(bs, pParam->fincr, MAX(log2bin(pParam->fbase-1),1)); /* fixed_vop_time_increment */ |
1190 |
}else{ |
}else{ |
1191 |
BitstreamPutBit(bs, 0); /* fixed_vop_rate = 0 */ |
BitstreamPutBit(bs, 0); /* fixed_vop_rate = 0 */ |
1192 |
} |
} |
1261 |
} |
} |
1262 |
|
|
1263 |
/* xvid id */ |
/* xvid id */ |
|
#define XVID_ID "XviD" XVID_BS_VERSION |
|
1264 |
{ |
{ |
1265 |
char xvid_id_string[100]; |
const char xvid_user_format[] = "XviD%04d%c"; |
1266 |
|
char xvid_user_data[100]; |
1267 |
if (frame->vop_flags & XVID_VOP_CARTOON) |
sprintf(xvid_user_data, |
1268 |
sprintf(xvid_id_string, "%sC", XVID_ID); |
xvid_user_format, |
1269 |
else |
XVID_BS_VERSION, |
1270 |
sprintf(xvid_id_string, "%s", XVID_ID); |
(frame->vop_flags & XVID_VOP_CARTOON)?'C':'\0'); |
1271 |
|
BitstreamWriteUserData(bs, xvid_user_data, strlen(xvid_user_data)); |
|
BitstreamWriteUserData(bs, xvid_id_string, strlen(xvid_id_string)); |
|
1272 |
} |
} |
1273 |
} |
} |
1274 |
|
|
1310 |
WRITE_MARKER(); |
WRITE_MARKER(); |
1311 |
|
|
1312 |
/* time_increment: value=nth_of_sec, nbits = log2(resolution) */ |
/* time_increment: value=nth_of_sec, nbits = log2(resolution) */ |
1313 |
|
BitstreamPutBits(bs, frame->ticks, MAX(log2bin(pParam->fbase-1), 1)); |
|
BitstreamPutBits(bs, frame->ticks, log2bin(pParam->fbase-1)); |
|
1314 |
#if 0 |
#if 0 |
1315 |
DPRINTF("[%i:%i] %c", |
DPRINTF("[%i:%i] %c", |
1316 |
frame->seconds, frame->ticks, |
frame->seconds, frame->ticks, |