[svn] / branches / release-0_9_1-fixes / xvidcore / src / bitstream / bitstream.h Repository:
ViewVC logotype

Diff of /branches/release-0_9_1-fixes/xvidcore/src/bitstream/bitstream.h

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

revision 1097, Mon Jul 28 12:29:07 2003 UTC revision 1098, Mon Jul 28 12:39:32 2003 UTC
# Line 50  Line 50 
50   *  exception also makes it possible to release a modified version which   *  exception also makes it possible to release a modified version which
51   *  carries forward this exception.   *  carries forward this exception.
52   *   *
53   * $Id: bitstream.h,v 1.16.2.1 2003-04-04 22:12:07 edgomez Exp $   * $Id: bitstream.h,v 1.16.2.2 2003-07-28 12:39:32 edgomez Exp $
54   *   *
55   ****************************************************************************/   ****************************************************************************/
56    
# Line 363  Line 363 
363          }          }
364  }  }
365    
   
 /* pad bitstream to the next byte boundary */  
   
 static void __inline  
 BitstreamPad(Bitstream * const bs)  
 {  
         uint32_t remainder = bs->pos % 8;  
   
         if (remainder) {  
                 BitstreamForward(bs, 8 - remainder);  
         }  
 }  
   
   
366  /* read n bits from bitstream */  /* read n bits from bitstream */
367    
368  static uint32_t __inline  static uint32_t __inline
# Line 439  Line 425 
425          }          }
426  }  }
427    
428    static const int stuffing_codes[8] =
429    {
430                    /* nbits     stuffing code */
431            0,              /* 1          0 */
432            1,              /* 2          01 */
433            3,              /* 3          011 */
434            7,              /* 4          0111 */
435            0xf,    /* 5          01111 */
436            0x1f,   /* 6          011111 */
437            0x3f,   /* 7          0111111 */
438            0x7f,   /* 8          01111111 */
439    };
440    
441    /* pad bitstream to the next byte boundary */
442    
443    static void __inline
444    BitstreamPad(Bitstream * const bs)
445    {
446            int bits = 8 - (bs->pos % 8);
447            if (bits < 8)
448                    BitstreamPutBits(bs, stuffing_codes[bits - 1], bits);
449    }
450    
451    /*
452     * pad bitstream to the next byte boundary
453     * alway pad: even if currently at the byte boundary
454     */
455    
456    static void __inline
457    BitstreamPadAlways(Bitstream * const bs)
458    {
459            int bits = 8 - (bs->pos % 8);
460            BitstreamPutBits(bs, stuffing_codes[bits - 1], bits);
461    }
462    
463  #endif /* _BITSTREAM_H_ */  #endif /* _BITSTREAM_H_ */

Legend:
Removed from v.1097  
changed lines
  Added in v.1098

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