119 |
} |
} |
120 |
} |
} |
121 |
|
|
122 |
|
|
123 |
|
|
124 |
|
// for PVOP addbits == fcode - 1 |
125 |
|
// for BVOP addbits == max(fcode,bcode) - 1 |
126 |
|
// returns mbpos |
127 |
|
int |
128 |
|
read_video_packet_header(Bitstream *bs, int addbits) |
129 |
|
{ |
130 |
|
int nbits; |
131 |
|
int mbnum; |
132 |
|
int quant; |
133 |
|
int hec; |
134 |
|
|
135 |
|
nbits = NUMBITS_VP_RESYNC_MARKER; |
136 |
|
|
137 |
|
BitstreamSkip(bs, BitstreamNumBitsToByteAlign(bs)); |
138 |
|
BitstreamSkip(bs, nbits); |
139 |
|
|
140 |
|
// if (dec->shape != VIDOBJLAY_SHAPE_RECTANGULAR) { |
141 |
|
// hec |
142 |
|
// vop_width |
143 |
|
// marker_bit |
144 |
|
// vop_height |
145 |
|
// marker_bit |
146 |
|
|
147 |
|
//} |
148 |
|
|
149 |
|
mbnum = BitstreamGetBits(bs, 9); |
150 |
|
//printf("mbnum %i [%i,%i]\n", mbnum, mbnum % dec->mb_width, mbnum / dec->mb_width); |
151 |
|
|
152 |
|
// if (dec->shape != VIDOBJLAY_SHAPE_BINARYONLY) |
153 |
|
quant = BitstreamGetBits(bs, 5); |
154 |
|
|
155 |
|
// if (dec->shape != VIDOBJLAY_SHAPE_RECTANGULAR) |
156 |
|
hec = BitstreamGetBit(bs); |
157 |
|
// if (hec) |
158 |
|
// .. decoder hec-header ... |
159 |
|
|
160 |
|
return mbnum; |
161 |
|
} |
162 |
|
|
163 |
|
|
164 |
|
|
165 |
/* |
/* |
166 |
decode headers |
decode headers |
167 |
returns coding_type, or -1 if error |
returns coding_type, or -1 if error |
493 |
|
|
494 |
READ_MARKER(); |
READ_MARKER(); |
495 |
|
|
|
//DPRINTF("time_inc_bits %i", dec->time_inc_bits); |
|
|
//DPRINTF("vop_time_incr %i", BitstreamShowBits(bs, dec->time_inc_bits)); |
|
496 |
if (dec->time_inc_bits) { |
if (dec->time_inc_bits) { |
|
//BitstreamSkip(bs, dec->time_inc_bits); // vop_time_increment |
|
497 |
time_increment = (BitstreamGetBits(bs, dec->time_inc_bits)); // vop_time_increment |
time_increment = (BitstreamGetBits(bs, dec->time_inc_bits)); // vop_time_increment |
498 |
} |
} |
499 |
|
|
500 |
|
/* |
501 |
|
DPRINTF("%c %i:%i", |
502 |
|
coding_type == I_VOP ? 'I' : coding_type == P_VOP ? 'P' : 'B', |
503 |
|
time_incr, time_increment); |
504 |
|
*/ |
505 |
|
|
506 |
if (coding_type != B_VOP) { |
if (coding_type != B_VOP) { |
507 |
dec->last_time_base = dec->time_base; |
dec->last_time_base = dec->time_base; |
508 |
dec->time_base += time_incr; |
dec->time_base += time_incr; |
523 |
|
|
524 |
if (!BitstreamGetBit(bs)) // vop_coded |
if (!BitstreamGetBit(bs)) // vop_coded |
525 |
{ |
{ |
526 |
|
//DPRINTF("**NOT CODED**"); |
527 |
return N_VOP; |
return N_VOP; |
528 |
} |
} |
529 |
|
|
695 |
|
|
696 |
WRITE_MARKER(); |
WRITE_MARKER(); |
697 |
|
|
698 |
// fixed_vop_rate |
#ifdef BFRAMES |
699 |
BitstreamPutBit(bs, 0); |
BitstreamPutBit(bs, 1); // fixed_vop_rate = 1 |
700 |
|
BitstreamPutBits(bs, pParam->fincr, log2bin(pParam->fbase)); // fixed_vop_time_increment |
701 |
// fixed_time_increment: value=nth_of_sec, nbits = log2(resolution) |
#else |
702 |
// BitstreamPutBits(bs, 0, 15); |
BitstreamPutBit(bs, 0); // fixed_vop_rate = 0 |
703 |
|
#endif |
704 |
|
|
705 |
WRITE_MARKER(); |
WRITE_MARKER(); |
706 |
BitstreamPutBits(bs, pParam->width, 13); // width |
BitstreamPutBits(bs, pParam->width, 13); // width |