Logo Search packages:      
Sourcecode: blender version File versions  Download package

static int get_prefix ( GetBitContext *  gb,
int  stop,
int  len 
) [static]

Get unary code of limited length FIXME Slow and ugly

Parameters:
gb GetBitContext
[in] stop The bitstop value (unary code of 1's or 0's)
[in] len Maximum length
Returns:
Unary length/index

Definition at line 341 of file vc9.c.

Referenced by decode_b_picture_primary_header(), and decode_p_picture_primary_header().

{
#if 1
  int i = 0, tmp = !stop;

  while (i != len && tmp != stop)
  {
    tmp = get_bits(gb, 1);
    i++;
  }
  if (i == len && tmp != stop) return len+1;
  return i;
#else
  unsigned int buf;
  int log;

  OPEN_READER(re, gb);
  UPDATE_CACHE(re, gb);
  buf=GET_CACHE(re, gb); //Still not sure
  if (stop) buf = ~buf;

  log= av_log2(-buf); //FIXME: -?
  if (log < limit){
    LAST_SKIP_BITS(re, gb, log+1);
    CLOSE_READER(re, gb);
    return log;
  }

  LAST_SKIP_BITS(re, gb, limit);
  CLOSE_READER(re, gb);
  return limit;
#endif
}


Generated by  Doxygen 1.6.0   Back to index