--- bitstream.c 2002/07/19 13:34:32 1.25 +++ bitstream.c 2002/09/28 13:01:02 1.28.2.2 @@ -446,13 +446,12 @@ if (vol_ver_id != 1) { - dec->quarterpel = BitstreamGetBit(bs); // quarter_sampe - if (dec->quarterpel) { - DPRINTF(DPRINTF_ERROR, "quarter_sample not supported"); - } - } else { - dec->quarterpel = 0; + DEBUG("QUARTERPEL BITSTREAM"); + dec->quarterpel = BitstreamGetBit(bs); // quarter_sample } + else + dec->quarterpel = 0; + if (!BitstreamGetBit(bs)) // complexity_estimation_disable { @@ -620,6 +619,9 @@ *intra_dc_threshold = intra_dc_threshold_table[BitstreamGetBits(bs, 3)]; + dec->top_field_first = 0; + dec->alternate_vertical_scan = 0; + if (dec->interlacing) { dec->top_field_first = BitstreamGetBit(bs); DPRINTF(DPRINTF_HEADER, "interlace top_field_first %i", dec->top_field_first); @@ -715,19 +717,18 @@ BitstreamPutBit(bs, 0); // is_object_layer_identified (0=not given) BitstreamPutBits(bs, 1, 4); // aspect_ratio_info (1=1:1) + BitstreamPutBit(bs, 1); // vol_control_parameters + BitstreamPutBits(bs, 1, 2); // chroma_format 1="4:2:0" + #ifdef BFRAMES if (pParam->max_bframes > 0) { - //DPRINTF("low_delay=1"); - BitstreamPutBit(bs, 1); // vol_control_parameters - BitstreamPutBits(bs, 1, 2); // chroma_format 1="4:2:0" BitstreamPutBit(bs, 0); // low_delay - BitstreamPutBit(bs, 0); // vbv_parameters (0=not given) } else #endif { - BitstreamPutBits(bs, 0, 1); // vol_control_parameters (0=not given) + BitstreamPutBit(bs, 1); // low_delay } - + BitstreamPutBit(bs, 0); // vbv_parameters (0=not given) BitstreamPutBits(bs, 0, 2); // video_object_layer_shape (0=rectangular) @@ -741,7 +742,7 @@ #ifdef BFRAMES BitstreamPutBits(bs, pParam->fbase, 16); #else - BitstreamPutBits(bs, 2, 16); + BitstreamPutBits(bs, pParam->fbase, 16); #endif WRITE_MARKER(); @@ -750,7 +751,8 @@ 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 + BitstreamPutBit(bs, 1); // fixed_vop_rate = 1 + BitstreamPutBits(bs, pParam->fincr, log2bin(pParam->fbase)); // fixed_vop_time_increment #endif WRITE_MARKER(); @@ -801,22 +803,24 @@ const FRAMEINFO * frame, int vop_coded) { -#ifdef BFRAMES uint32_t i; -#endif + BitstreamPad(bs); BitstreamPutBits(bs, VOP_START_CODE, 32); BitstreamPutBits(bs, frame->coding_type, 2); - // time_base = 0 write n x PutBit(1), PutBit(0) #ifdef BFRAMES for (i = 0; i < frame->seconds; i++) { BitstreamPutBit(bs, 1); } BitstreamPutBit(bs, 0); #else - BitstreamPutBits(bs, 0, 1); + for (i = 0; i < frame->seconds; i++) { + BitstreamPutBit(bs, 1); + } + BitstreamPutBit(bs, 0); +// BitstreamPutBits(bs, 0, 1); #endif WRITE_MARKER(); @@ -828,7 +832,8 @@ frame->coding_type == I_VOP ? 'I' : frame->coding_type == P_VOP ? 'P' : 'B');*/ #else - BitstreamPutBits(bs, 1, 1); + BitstreamPutBits(bs, frame->ticks, log2bin(pParam->fbase)); +// BitstreamPutBits(bs, 1, 1); #endif WRITE_MARKER(); @@ -846,8 +851,8 @@ BitstreamPutBits(bs, 0, 3); // intra_dc_vlc_threshold if (frame->global_flags & XVID_INTERLACING) { - BitstreamPutBit(bs, 1); // top field first - BitstreamPutBit(bs, 0); // alternate vertical scan + BitstreamPutBit(bs, (frame->global_flags & XVID_TOPFIELDFIRST)); + BitstreamPutBit(bs, (frame->global_flags & XVID_ALTERNATESCAN)); } BitstreamPutBits(bs, frame->quant, 5); // quantizer