Ejemplo n.º 1
0
unsigned char ec_byte_look_at_end(ec_byte_buffer *_b){
  if (_b->end_ptr < _b->buf)
  {
    celt_fatal("Trying to read raw bits before the beginning of the stream");
  }
  return *(_b->end_ptr--);
}
Ejemplo n.º 2
0
void ec_byte_write1(ec_byte_buffer *_b,unsigned _value){
  ptrdiff_t endbyte;
  endbyte=_b->ptr-_b->buf;
  if(endbyte>=_b->storage){
    if (_b->resizable){
      _b->buf=celt_realloc(_b->buf,(_b->storage+EC_BUFFER_INCREMENT)*sizeof(char));
      _b->storage+=EC_BUFFER_INCREMENT;
      _b->ptr=_b->buf+endbyte;
    } else {
      celt_fatal("range encoder overflow\n");
    }
  }
  *(_b->ptr++)=(unsigned char)_value;
}
Ejemplo n.º 3
0
void ec_byte_writecopy(ec_byte_buffer *_b,void *_source,long _bytes){
  ptrdiff_t endbyte;
  endbyte=_b->ptr-_b->buf;
  if(endbyte+_bytes>_b->storage){
    if (_b->resizable){
      _b->storage=endbyte+_bytes+EC_BUFFER_INCREMENT;
      _b->buf=celt_realloc(_b->buf,_b->storage*sizeof(char));
      _b->ptr=_b->buf+endbyte;
    } else {
      celt_fatal("range encoder overflow\n");
    }
  }
  memmove(_b->ptr,_source,_bytes);
  _b->ptr+=_bytes;
}