📄 getbits.c
字号:
/************************************************************************
*
* getbits.c, bit level routines for tmndecode (H.263 decoder)
* Copyright (C) 1995, 1996 Telenor R&D, Norway
*
* Contacts:
* Robert Danielsen <Robert.Danielsen@nta.no>
*
* Telenor Research and Development http://www.nta.no/brukere/DVC/
* P.O.Box 83 tel.: +47 63 84 84 00
* N-2007 Kjeller, Norway fax.: +47 63 81 00 76
*
* Copyright (C) 1997 University of BC, Canada
* Modified by: Michael Gallant <mikeg@ee.ubc.ca>
* Guy Cote <guyc@ee.ubc.ca>
* Berna Erol <bernae@ee.ubc.ca>
*
* Contacts:
* Michael Gallant <mikeg@ee.ubc.ca>
*
* UBC Image Processing Laboratory http://www.ee.ubc.ca/image
* 2356 Main Mall tel.: +1 604 822 4051
* Vancouver BC Canada V6T1Z4 fax.: +1 604 822 5949
*
************************************************************************/
/* Disclaimer of Warranty
*
* These software programs are available to the user without any license fee
* or royalty on an "as is" basis. The University of British Columbia
* disclaims any and all warranties, whether express, implied, or
* statuary, including any implied warranties or merchantability or of
* fitness for a particular purpose. In no event shall the
* copyright-holder be liable for any incidental, punitive, or
* consequential damages of any kind whatsoever arising from the use of
* these programs.
*
* This disclaimer of warranty extends to the user of these programs and
* user's customers, employees, agents, transferees, successors, and
* assigns.
*
* The University of British Columbia does not represent or warrant that the
* programs furnished hereunder are free of infringement of any
* third-party patents.
*
* Commercial implementations of H.263, including shareware, are subject to
* royalty fees to patent holders. Many of these patents are general
* enough such that they are unavoidable regardless of implementation
* design.
*
*/
/* based on mpeg2decode, (C) 1994, MPEG Software Simulation Group and
* mpeg2play, (C) 1994 Stefan Eckart <stefan@lis.e-technik.tu-muenchen.de>
*
*/
/**
* Copyright (C) 2001 - Project Mayo
*
* adapted by Andrea Graziani (Ag)
*
* DivX Advanced Research Center <darc@projectmayo.com>
*
**/
#include <stdlib.h>
#include "mp4_vars.h"
#include "getbits.h"
#define SE_CODE 31
/* initialize buffer, call once before first getbits or showbits */
void initbits (unsigned char * stream, int length)
{
ld->incnt = 0;
ld->bitcnt = 0;
ld->rdptr = ld->rdbfr + 2048;
#ifdef _DECORE
ld->rdptr = stream;
ld->length = length;
#endif
}
/* return next bit (could be made faster than getbits(1)) */
unsigned int getbits1 ()
{
return getbits (1);
}
/* return next n bits (right adjusted) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -