Esempio n. 1
0
File: vlc.c Progetto: YouZhang/JM
/*! 
 *************************************************************************************
 * \brief
 *    ue_v, reads an u(v) syntax element, the length in bits is stored in 
 *    the global UsedBits variable
 *
 * \param LenInBits
 *    length of the syntax element
 *
 * \param tracestring
 *    the string for the trace file
 *
 * \param bitstream
 *    the stream to be read from
 *
 * \return
 *    the value of the coded syntax element
 *
 *************************************************************************************
 */
int u_v (int LenInBits, char*tracestring, Bitstream *bitstream)
{
  SyntaxElement symbol, *sym=&symbol;

  assert (bitstream->streamBuffer != NULL);
  sym->type = SE_HEADER;
  sym->mapping = linfo_ue;   // Mapping rule
  sym->len = LenInBits;
  SYMTRACESTRING(tracestring);
  readSyntaxElement_FLC (sym, bitstream);
  UsedBits+=sym->len;
  return sym->inf;
};
Esempio n. 2
0
/*!
 *************************************************************************************
 * \brief
 *    ue_v, reads an u(v) syntax element, the length in bits is stored in
 *    the global p_Dec->UsedBits variable
 *
 * \param LenInBits
 *    length of the syntax element
 *
 * \param tracestring
 *    the string for the trace file
 *
 * \param bitstream
 *    the stream to be read from
 *
 * \return
 *    the value of the coded syntax element
 *
 *************************************************************************************
 */
int u_v (int LenInBits, char*tracestring, Bitstream *bitstream)
{
  SyntaxElement symbol;
  symbol.inf = 0;

  //assert (bitstream->streamBuffer != NULL);
  symbol.type = SE_HEADER;
  symbol.mapping = linfo_ue;   // Mapping rule
  symbol.len = LenInBits;
  SYMTRACESTRING(tracestring);
  readSyntaxElement_FLC (&symbol, bitstream);
  p_Dec->UsedBits+=symbol.len;

  return symbol.inf;
}
Esempio n. 3
0
int read_u_v (int LenInBits, char*tracestring, Bitstream *bitstream, int *used_bits)
{
	SyntaxElement symbol;
	symbol.inf = 0;

	//assert (bitstream->streamBuffer != NULL);
//	symbol.type = SE_HEADER;
	symbol.mapping = linfo_ue;   // Mapping rule
	symbol.len = LenInBits;
	//SYMTRACESTRING(tracestring);
	readSyntaxElement_FLC (&symbol, bitstream);
	*used_bits+=symbol.len;
#if TRACE
	printf("%s=%d\n",tracestring,symbol.inf);
#endif

	return symbol.inf;
}
Esempio n. 4
0
/*!
 *************************************************************************************
 * \brief
 *    read_i_v, reads an i(v) syntax element, the length in bits is stored in
 *    the global p_Dec->UsedBits variable
 *
 * \param LenInBits
 *    length of the syntax element
 *
 * \param tracestring
 *    the string for the trace file
 *
 * \param bitstream
 *    the stream to be read from
 *
 * \return
 *    the value of the coded syntax element
 *
 *************************************************************************************
 */
int read_i_v (int LenInBits, char*tracestring, Bitstream *bitstream, int *used_bits)
{
  SyntaxElement symbol;
  symbol.inf = 0;

  //assert (bitstream->streamBuffer != NULL);
  symbol.type = SE_HEADER;
  symbol.mapping = linfo_ue;   // Mapping rule
  symbol.len = LenInBits;
  //SYMTRACESTRING(tracestring);
  readSyntaxElement_FLC (&symbol, bitstream);
  *used_bits+=symbol.len;

  // can be negative
  symbol.inf = -( symbol.inf & (1 << (LenInBits - 1)) ) | symbol.inf;

  return symbol.inf;
}