[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.6, Tue Apr 16 00:17:35 2002 UTC revision 1.8, Wed May 1 13:00:02 2002 UTC
# Line 41  Line 41 
41    *                                                                                                                                                        *    *                                                                                                                                                        *
42    *  Revision history:                                                         *    *  Revision history:                                                         *
43    *                                                                                                                                                        *    *                                                                                                                                                        *
44      *  01.05.2002 added BVOP support to BitstreamWriteVopHeader
45    *  15.04.2002 rewrite log2bin use asm386  By MinChen <chenm001@163.com>      *    *  15.04.2002 rewrite log2bin use asm386  By MinChen <chenm001@163.com>      *
46    *  26.03.2002 interlacing support                                                                                        *    *  26.03.2002 interlacing support                                                                                        *
47    *  03.03.2002 qmatrix writing                                                                                            *    *  03.03.2002 qmatrix writing                                                                                            *
# Line 599  Line 600 
600          write vol header          write vol header
601  */  */
602  void BitstreamWriteVolHeader(Bitstream * const bs,  void BitstreamWriteVolHeader(Bitstream * const bs,
603                                                  const MBParam * pParam)                                                  const MBParam * pParam,  const FRAMEINFO * frame)
604  {  {
605          // video object_start_code & vo_id          // video object_start_code & vo_id
606      BitstreamPad(bs);      BitstreamPad(bs);
# Line 640  Line 641 
641          BitstreamPutBits(bs, pParam->height, 13);               // height          BitstreamPutBits(bs, pParam->height, 13);               // height
642          WRITE_MARKER();          WRITE_MARKER();
643    
644          BitstreamPutBit(bs, pParam->global_flags & XVID_INTERLACING);           // interlace          BitstreamPutBit(bs, frame->global_flags & XVID_INTERLACING);            // interlace
645          BitstreamPutBit(bs, 1);         // obmc_disable (overlapped block motion compensation)          BitstreamPutBit(bs, 1);         // obmc_disable (overlapped block motion compensation)
646          BitstreamPutBit(bs, 0);         // sprite_enable          BitstreamPutBit(bs, 0);         // sprite_enable
647          BitstreamPutBit(bs, 0);         // not_in_bit          BitstreamPutBit(bs, 0);         // not_in_bit
648    
649          // quant_type   0=h.263  1=mpeg4(quantizer tables)          // quant_type   0=h.263  1=mpeg4(quantizer tables)
650          BitstreamPutBit(bs, pParam->quant_type);          BitstreamPutBit(bs, pParam->m_quant_type);
651    
652          if (pParam->quant_type)          if (pParam->m_quant_type)
653          {          {
654                  BitstreamPutBit(bs, get_intra_matrix_status()); // load_intra_quant_mat                  BitstreamPutBit(bs, get_intra_matrix_status()); // load_intra_quant_mat
655                  if (get_intra_matrix_status())                  if (get_intra_matrix_status())
# Line 680  Line 681 
681    (decoder uses these values to determine precise time since last resync)    (decoder uses these values to determine precise time since last resync)
682  */  */
683  void BitstreamWriteVopHeader(Bitstream * const bs,  void BitstreamWriteVopHeader(Bitstream * const bs,
684                                                  const MBParam * pParam)                                                  const MBParam * pParam,
685                                                    const FRAMEINFO * frame)
686  {  {
687    #ifdef BFRAMES
688            uint32_t i;
689    #endif
690      BitstreamPad(bs);      BitstreamPad(bs);
691      BitstreamPutBits(bs, VOP_START_CODE, 32);      BitstreamPutBits(bs, VOP_START_CODE, 32);
692    
693      BitstreamPutBits(bs, pParam->coding_type, 2);      BitstreamPutBits(bs, frame->coding_type, 2);
694    
695          // time_base = 0  write n x PutBit(1), PutBit(0)          // time_base = 0  write n x PutBit(1), PutBit(0)
696    #ifdef BFRAMES
697            for (i = 0; i < frame->seconds; i++)
698            {
699                    BitstreamPutBit(bs, 1);
700            }
701            BitstreamPutBit(bs, 0);
702    #else
703          BitstreamPutBits(bs, 0, 1);          BitstreamPutBits(bs, 0, 1);
704    #endif
705    
706          WRITE_MARKER();          WRITE_MARKER();
707    
708          // time_increment: value=nth_of_sec, nbits = log2(resolution)          // time_increment: value=nth_of_sec, nbits = log2(resolution)
709    #ifdef BFRAMES
710            BitstreamPutBits(bs, frame->ticks, 5);
711            dprintf("[%i:%i] %c\n", frame->seconds, frame->ticks, frame->coding_type == I_VOP ? 'I' : frame->coding_type == P_VOP ? 'P' : 'B');
712    #else
713          BitstreamPutBits(bs, 1, 1);          BitstreamPutBits(bs, 1, 1);
714    #endif
715    
716          WRITE_MARKER();          WRITE_MARKER();
717    
718          BitstreamPutBits(bs, 1, 1);                             // vop_coded          BitstreamPutBits(bs, 1, 1);                             // vop_coded
719    
720          if (pParam->coding_type != I_VOP)          if (frame->coding_type != I_VOP)
721                  BitstreamPutBits(bs, pParam->rounding_type, 1);                  BitstreamPutBits(bs, frame->rounding_type, 1);
722    
723          BitstreamPutBits(bs, 0, 3);                             // intra_dc_vlc_threshold          BitstreamPutBits(bs, 0, 3);                             // intra_dc_vlc_threshold
724    
725          if (pParam->global_flags & XVID_INTERLACING)          if (frame->global_flags & XVID_INTERLACING)
726          {          {
727                  BitstreamPutBit(bs, 1);         // top field first                  BitstreamPutBit(bs, 1);         // top field first
728                  BitstreamPutBit(bs, 0);         // alternate vertical scan                  BitstreamPutBit(bs, 0);         // alternate vertical scan
729          }          }
730    
731          BitstreamPutBits(bs, pParam->quant, 5);                 // quantizer          BitstreamPutBits(bs, frame->quant, 5);                  // quantizer
732    
733            if (frame->coding_type != I_VOP)
734                    BitstreamPutBits(bs, frame->fcode, 3);          // forward_fixed_code
735    
736            if (frame->coding_type == B_VOP)
737                    BitstreamPutBits(bs, frame->bcode, 3);          // backward_fixed_code
738    
         if (pParam->coding_type != I_VOP)  
                 BitstreamPutBits(bs, pParam->fixed_code, 3);            // fixed_code = [1,4]  
739  }  }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.8

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