--- bitstream.c 2002/06/22 07:23:10 1.18 +++ bitstream.c 2002/06/28 15:14:40 1.21 @@ -119,6 +119,49 @@ } } + + +// for PVOP addbits == fcode - 1 +// for BVOP addbits == max(fcode,bcode) - 1 +// returns mbpos +int +read_video_packet_header(Bitstream *bs, int addbits) +{ + int nbits; + int mbnum; + int quant; + int hec; + + nbits = NUMBITS_VP_RESYNC_MARKER; + + BitstreamSkip(bs, BitstreamNumBitsToByteAlign(bs)); + BitstreamSkip(bs, nbits); + + // if (dec->shape != VIDOBJLAY_SHAPE_RECTANGULAR) { + // hec + // vop_width + // marker_bit + // vop_height + // marker_bit + + //} + + mbnum = BitstreamGetBits(bs, 9); + //printf("mbnum %i [%i,%i]\n", mbnum, mbnum % dec->mb_width, mbnum / dec->mb_width); + + // if (dec->shape != VIDOBJLAY_SHAPE_BINARYONLY) + quant = BitstreamGetBits(bs, 5); + + // if (dec->shape != VIDOBJLAY_SHAPE_RECTANGULAR) + hec = BitstreamGetBit(bs); + // if (hec) + // .. decoder hec-header ... + + return mbnum; +} + + + /* decode headers returns coding_type, or -1 if error @@ -450,12 +493,16 @@ READ_MARKER(); - //DPRINTF("time_inc_bits %i", dec->time_inc_bits); - //DPRINTF("vop_time_incr %i", BitstreamShowBits(bs, dec->time_inc_bits)); if (dec->time_inc_bits) { - //BitstreamSkip(bs, dec->time_inc_bits); // vop_time_increment time_increment = (BitstreamGetBits(bs, dec->time_inc_bits)); // vop_time_increment } + + /* + DPRINTF("%c %i:%i", + coding_type == I_VOP ? 'I' : coding_type == P_VOP ? 'P' : 'B', + time_incr, time_increment); + */ + if (coding_type != B_VOP) { dec->last_time_base = dec->time_base; dec->time_base += time_incr; @@ -476,6 +523,7 @@ if (!BitstreamGetBit(bs)) // vop_coded { + //DPRINTF("**NOT CODED**"); return N_VOP; } @@ -647,11 +695,12 @@ WRITE_MARKER(); - // fixed_vop_rate - BitstreamPutBit(bs, 0); - - // fixed_time_increment: value=nth_of_sec, nbits = log2(resolution) - // BitstreamPutBits(bs, 0, 15); +#ifdef BFRAMES + BitstreamPutBit(bs, 1); // fixed_vop_rate = 1 + BitstreamPutBits(bs, pParam->fincr, log2bin(pParam->fbase)); // fixed_vop_time_increment +#else + BitstreamPutBit(bs, 0); // fixed_vop_rate = 0 +#endif WRITE_MARKER(); BitstreamPutBits(bs, pParam->width, 13); // width