ReactOS 0.4.16-dev-297-gc569aee
getbits.h File Reference
#include "mpg123lib_intern.h"
#include "debug.h"
Include dependency graph for getbits.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define backbits(fr, nob)
 
#define getbitoffset(fr)   ((-fr->bitindex)&0x7)
 
#define getbyte(fr)
 
#define skipbits(fr, nob)
 
#define getbits_fast(fr, nob)
 
#define get1bit(fr)
 

Functions

static unsigned int getbits (mpg123_handle *fr, int number_of_bits)
 

Macro Definition Documentation

◆ backbits

#define backbits (   fr,
  nob 
)
Value:
((void)( \
fr->bits_avail += nob, \
fr->bitindex -= nob, \
fr->wordpointer += (fr->bitindex>>3), \
fr->bitindex &= 0x7 ))

Definition at line 18 of file getbits.h.

◆ get1bit

#define get1bit (   fr)
Value:
( \
fr->uctmp = *fr->wordpointer << fr->bitindex, \
++fr->bitindex, --fr->bits_avail, \
fr->wordpointer += (fr->bitindex>>3), fr->bitindex &= 7, fr->uctmp>>7 )

Definition at line 97 of file getbits.h.

◆ getbitoffset

#define getbitoffset (   fr)    ((-fr->bitindex)&0x7)

Definition at line 24 of file getbits.h.

◆ getbits_fast

#define getbits_fast (   fr,
  nob 
)
Value:
( \
fr->ultmp = (unsigned char) (fr->wordpointer[0] << fr->bitindex), \
fr->ultmp |= ((unsigned long) fr->wordpointer[1]<<fr->bitindex)>>8, \
fr->ultmp <<= nob, fr->ultmp >>= 8, \
fr->bitindex += nob, fr->bits_avail -= nob, \
fr->wordpointer += (fr->bitindex>>3), \
fr->bitindex &= 7, fr->ultmp )
unsigned char
Definition: typeof.h:29
#define long
Definition: qsort.c:33

Definition at line 89 of file getbits.h.

◆ getbyte

#define getbyte (   fr)
Value:
( (fr)->bits_avail-=8, (fr)->bits_avail >= 0 \
? *((fr)->wordpointer++) \
: 0 )

Definition at line 28 of file getbits.h.

◆ skipbits

#define skipbits (   fr,
  nob 
)
Value:
fr->ultmp = ( \
fr->ultmp = fr->wordpointer[0], fr->ultmp <<= 8, fr->ultmp |= fr->wordpointer[1], \
fr->ultmp <<= 8, fr->ultmp |= fr->wordpointer[2], fr->ultmp <<= fr->bitindex, \
fr->ultmp &= 0xffffff, fr->bitindex += nob, fr->bits_avail -= nob, \
fr->ultmp >>= (24-nob), fr->wordpointer += (fr->bitindex>>3), \
fr->bitindex &= 7 )

Definition at line 82 of file getbits.h.

Function Documentation

◆ getbits()

static unsigned int getbits ( mpg123_handle fr,
int  number_of_bits 
)
static

Definition at line 32 of file getbits.h.

33{
34 unsigned long rval;
35
36#ifdef DEBUG_GETBITS
37fprintf(stderr,"g%d",number_of_bits);
38#endif
39 fr->bits_avail -= number_of_bits;
40 /* Safety catch until we got the nasty code fully figured out. */
41 /* No, that catch stays here, even if we think we got it figured out! */
42 if(fr->bits_avail < 0)
43 {
44 if(NOQUIET)
45 error2( "Tried to read %i bits with %li available."
46 , number_of_bits, fr->bits_avail );
47 return 0;
48 }
49/* This is actually slow: if(!number_of_bits)
50 return 0; */
51
52#if 0
53 check_buffer_range(number_of_bits+fr->bitindex);
54#endif
55
56 {
57 rval = fr->wordpointer[0];
58 rval <<= 8;
59 rval |= fr->wordpointer[1];
60 rval <<= 8;
61 rval |= fr->wordpointer[2];
62
63 rval <<= fr->bitindex;
64 rval &= 0xffffff;
65
66 fr->bitindex += number_of_bits;
67
68 rval >>= (24-number_of_bits);
69
70 fr->wordpointer += (fr->bitindex>>3);
71 fr->bitindex &= 7;
72 }
73
74#ifdef DEBUG_GETBITS
75fprintf(stderr,":%lx\n",rval);
76#endif
77
78 return rval;
79}
float rval
Definition: cylfrac.c:48
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define NOQUIET
#define error2(s, a, b)
Definition: debug.h:126
unsigned char * wordpointer
Definition: frame.h:229

Referenced by halfspeed_do(), I_step_two(), II_step_one(), II_step_two(), III_dequantize_sample(), III_get_side_info(), and read_frame().