[cvs] / xvidcore / src / bitstream / bitstream.c Repository:
ViewVC logotype

Diff of /xvidcore/src/bitstream/bitstream.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.26, Wed Jul 24 00:49:16 2002 UTC revision 1.28.2.3, Sat Oct 5 21:27:20 2002 UTC
# Line 41  Line 41 
41    *                                                                            *    *                                                                            *
42    *  Revision history:                                                         *    *  Revision history:                                                         *
43    *                                                                            *    *                                                                            *
44      *  04.10.2002 qpel support - Isibaar                                                                             *
45    *  11.07.2002 add VOP width & height return to dec when dec->width           *    *  11.07.2002 add VOP width & height return to dec when dec->width           *
46    *             or dec->height is 0  (for use in examples/ex1.c)               *    *             or dec->height is 0  (for use in examples/ex1.c)               *
47    *             MinChen <chenm001@163.com>                                     *    *             MinChen <chenm001@163.com>                                     *
# Line 60  Line 61 
61    *      30.02.2002     intra_dc_threshold support                             *    *      30.02.2002     intra_dc_threshold support                             *
62    *      04.12.2001     support for additional headers                         *    *      04.12.2001     support for additional headers                         *
63    *      16.12.2001     inital version                                         *    *      16.12.2001     inital version                                         *
64    *    *                                                                                                                                                        *
65    ******************************************************************************/    ******************************************************************************/
66    
67    
# Line 619  Line 620 
620                                  *intra_dc_threshold =                                  *intra_dc_threshold =
621                                          intra_dc_threshold_table[BitstreamGetBits(bs, 3)];                                          intra_dc_threshold_table[BitstreamGetBits(bs, 3)];
622    
623                                    dec->top_field_first = 0;
624                                    dec->alternate_vertical_scan = 0;
625    
626                                  if (dec->interlacing) {                                  if (dec->interlacing) {
627                                          dec->top_field_first = BitstreamGetBit(bs);                                          dec->top_field_first = BitstreamGetBit(bs);
628                                          DPRINTF(DPRINTF_HEADER, "interlace top_field_first %i", dec->top_field_first);                                          DPRINTF(DPRINTF_HEADER, "interlace top_field_first %i", dec->top_field_first);
# Line 711  Line 715 
715    
716          BitstreamPutBit(bs, 0);         // random_accessible_vol          BitstreamPutBit(bs, 0);         // random_accessible_vol
717          BitstreamPutBits(bs, 0, 8);     // video_object_type_indication          BitstreamPutBits(bs, 0, 8);     // video_object_type_indication
718    
719            if (pParam->m_quarterpel == 0)
720            {
721          BitstreamPutBit(bs, 0);         // is_object_layer_identified (0=not given)          BitstreamPutBit(bs, 0);         // is_object_layer_identified (0=not given)
722            }
723            else
724            {
725                    BitstreamPutBit(bs, 1);         // is_object_layer_identified
726                    BitstreamPutBits(bs, 2, 4);     // vol_ver_id == 2
727                    BitstreamPutBits(bs, 0, 3); // vol_ver_priority = 0 ??
728            }
729    
730          BitstreamPutBits(bs, 1, 4);     // aspect_ratio_info (1=1:1)          BitstreamPutBits(bs, 1, 4);     // aspect_ratio_info (1=1:1)
731    
 #ifdef BFRAMES  
         if (pParam->max_bframes > 0) {  
                 //DPRINTF("low_delay=1");  
732                  BitstreamPutBit(bs, 1); // vol_control_parameters                  BitstreamPutBit(bs, 1); // vol_control_parameters
733                  BitstreamPutBits(bs, 1, 2);     // chroma_format 1="4:2:0"                  BitstreamPutBits(bs, 1, 2);     // chroma_format 1="4:2:0"
734    
735    #ifdef BFRAMES
736            if (pParam->max_bframes > 0) {
737                  BitstreamPutBit(bs, 0); // low_delay                  BitstreamPutBit(bs, 0); // low_delay
                 BitstreamPutBit(bs, 0); // vbv_parameters (0=not given)  
738          } else          } else
739  #endif  #endif
740          {          {
741                  BitstreamPutBits(bs, 0, 1);     // vol_control_parameters (0=not given)                  BitstreamPutBit(bs, 1); // low_delay
742          }          }
743            BitstreamPutBit(bs, 0); // vbv_parameters (0=not given)
744    
745          BitstreamPutBits(bs, 0, 2);     // video_object_layer_shape (0=rectangular)          BitstreamPutBits(bs, 0, 2);     // video_object_layer_shape (0=rectangular)
746    
# Line 740  Line 754 
754  #ifdef BFRAMES  #ifdef BFRAMES
755          BitstreamPutBits(bs, pParam->fbase, 16);          BitstreamPutBits(bs, pParam->fbase, 16);
756  #else  #else
757          BitstreamPutBits(bs, 2, 16);          BitstreamPutBits(bs, pParam->fbase, 16);
758  #endif  #endif
759    
760          WRITE_MARKER();          WRITE_MARKER();
# Line 749  Line 763 
763          BitstreamPutBit(bs, 1);         // fixed_vop_rate = 1          BitstreamPutBit(bs, 1);         // fixed_vop_rate = 1
764          BitstreamPutBits(bs, pParam->fincr, log2bin(pParam->fbase));    // fixed_vop_time_increment          BitstreamPutBits(bs, pParam->fincr, log2bin(pParam->fbase));    // fixed_vop_time_increment
765  #else  #else
766          BitstreamPutBit(bs, 0);         // fixed_vop_rate = 0          BitstreamPutBit(bs, 1);         // fixed_vop_rate = 1
767            BitstreamPutBits(bs, pParam->fincr, log2bin(pParam->fbase));    // fixed_vop_time_increment
768  #endif  #endif
769    
770          WRITE_MARKER();          WRITE_MARKER();
# Line 760  Line 775 
775    
776          BitstreamPutBit(bs, frame->global_flags & XVID_INTERLACING);    // interlace          BitstreamPutBit(bs, frame->global_flags & XVID_INTERLACING);    // interlace
777          BitstreamPutBit(bs, 1);         // obmc_disable (overlapped block motion compensation)          BitstreamPutBit(bs, 1);         // obmc_disable (overlapped block motion compensation)
778    
779            if (pParam->m_quarterpel == 0)
780            {
781          BitstreamPutBit(bs, 0);         // sprite_enable          BitstreamPutBit(bs, 0);         // sprite_enable
782            }
783            else
784            {
785                    BitstreamPutBits(bs, 0, 2);             // sprite_enable
786            }
787    
788          BitstreamPutBit(bs, 0);         // not_in_bit          BitstreamPutBit(bs, 0);         // not_in_bit
789    
790          // quant_type   0=h.263  1=mpeg4(quantizer tables)          // quant_type   0=h.263  1=mpeg4(quantizer tables)
# Line 779  Line 803 
803    
804          }          }
805    
806            if (pParam->m_quarterpel)
807            {
808                    BitstreamPutBit(bs, 1);
809            }
810    
811          BitstreamPutBit(bs, 1);         // complexity_estimation_disable          BitstreamPutBit(bs, 1);         // complexity_estimation_disable
812          BitstreamPutBit(bs, 1);         // resync_marker_disable          BitstreamPutBit(bs, 1);         // resync_marker_disable
813          BitstreamPutBit(bs, 0);         // data_partitioned          BitstreamPutBit(bs, 0);         // data_partitioned
814    
815            if (pParam->m_quarterpel)
816            {
817                    BitstreamPutBit(bs, 0);         // newpred_enable
818                    BitstreamPutBit(bs, 0);         // reduced_resolution_vop_enabled
819            }
820    
821          BitstreamPutBit(bs, 0);         // scalability          BitstreamPutBit(bs, 0);         // scalability
822  }  }
823    
# Line 800  Line 836 
836                                                  const FRAMEINFO * frame,                                                  const FRAMEINFO * frame,
837                                                  int vop_coded)                                                  int vop_coded)
838  {  {
 #ifdef BFRAMES  
839          uint32_t i;          uint32_t i;
840  #endif  
841          BitstreamPad(bs);          BitstreamPad(bs);
842          BitstreamPutBits(bs, VOP_START_CODE, 32);          BitstreamPutBits(bs, VOP_START_CODE, 32);
843    
844          BitstreamPutBits(bs, frame->coding_type, 2);          BitstreamPutBits(bs, frame->coding_type, 2);
845    
         // time_base = 0  write n x PutBit(1), PutBit(0)  
846  #ifdef BFRAMES  #ifdef BFRAMES
847          for (i = 0; i < frame->seconds; i++) {          for (i = 0; i < frame->seconds; i++) {
848                  BitstreamPutBit(bs, 1);                  BitstreamPutBit(bs, 1);
849          }          }
850          BitstreamPutBit(bs, 0);          BitstreamPutBit(bs, 0);
851  #else  #else
852          BitstreamPutBits(bs, 0, 1);          for (i = 0; i < frame->seconds; i++) {
853                    BitstreamPutBit(bs, 1);
854            }
855            BitstreamPutBit(bs, 0);
856    //      BitstreamPutBits(bs, 0, 1);
857  #endif  #endif
858    
859          WRITE_MARKER();          WRITE_MARKER();
# Line 827  Line 865 
865                          frame->coding_type == I_VOP ? 'I' : frame->coding_type ==                          frame->coding_type == I_VOP ? 'I' : frame->coding_type ==
866                          P_VOP ? 'P' : 'B');*/                          P_VOP ? 'P' : 'B');*/
867  #else  #else
868          BitstreamPutBits(bs, 1, 1);          BitstreamPutBits(bs, frame->ticks, log2bin(pParam->fbase));
869    //      BitstreamPutBits(bs, 1, 1);
870  #endif  #endif
871    
872          WRITE_MARKER();          WRITE_MARKER();
# Line 845  Line 884 
884          BitstreamPutBits(bs, 0, 3);     // intra_dc_vlc_threshold          BitstreamPutBits(bs, 0, 3);     // intra_dc_vlc_threshold
885    
886          if (frame->global_flags & XVID_INTERLACING) {          if (frame->global_flags & XVID_INTERLACING) {
887                  BitstreamPutBit(bs, 1); // top field first                  BitstreamPutBit(bs, (frame->global_flags & XVID_TOPFIELDFIRST));
888                  BitstreamPutBit(bs, 0); // alternate vertical scan                  BitstreamPutBit(bs, (frame->global_flags & XVID_ALTERNATESCAN));
889          }          }
890    
891          BitstreamPutBits(bs, frame->quant, 5);  // quantizer          BitstreamPutBits(bs, frame->quant, 5);  // quantizer

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.28.2.3

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4