コード例 #1
0
ファイル: xpp.c プロジェクト: pmolfese/nidb
int pp_ifndef(char *p)
{
  parse_id(p, m_id_buf);
  if (get_symbol_index(m_id_buf) < 0) {
    return XPP_OUTP;
  }
  else {
    return XPP_SKIP;
  }
}
コード例 #2
0
ファイル: xpp.c プロジェクト: pmolfese/nidb
void pp_undef(char *p)
{
  int si;

  p = parse_id(p, m_id_buf);
  si = get_symbol_index(m_id_buf);
  if (si >= 0) {
    strcpy(m_symbol[si].id, XPP_UNDEFINED);
    m_symbol[si].val[0] = 0; // empty str
  }
}
コード例 #3
0
ファイル: xpp.c プロジェクト: pmolfese/nidb
void pp_define(char *p, bool ww)
{
  int i, si;

  p = parse_id(p, m_id_buf);
  si = get_symbol_index(m_id_buf);
  if (si < 0) {
    si = m_symbol_len; // not defined so add it
    strcpy(m_symbol[si].id, m_id_buf);
    m_symbol[si].val[0] = 0; // default val is empty str
    ++m_symbol_len;
  }                   // else if defined change its value

  if (!is_line_end(*p)) {
    skip_white_space(&p);
    i = 0;
    while (!is_line_end(*p)) { // get pp value, to end of line
      m_symbol[si].val[i++] = *p++;
    }
    m_symbol[si].val[i] = 0; // terminate string
  }
  m_symbol[si].ww = ww; // to use whole-word search or not
}
コード例 #4
0
ファイル: qv_codebook.c プロジェクト: iochoa/cbc
/**
 * Get a quantizer by its left context symbol
 */
struct quantizer_t *get_cond_quantizer(struct cond_quantizer_list_t *list, uint32_t column, symbol_t prev) {
	uint32_t idx = get_symbol_index(list->input_alphabets[column], prev);
	if (idx != ALPHABET_SYMBOL_NOT_FOUND)
		return get_cond_quantizer_indexed(list, column, idx);
	return NULL;
}
コード例 #5
0
ファイル: qv_codebook.c プロジェクト: iochoa/cbc
/**
 * Get a quantizer by its left context symbol
 */
struct quantizer_t *get_cond_quantizer(struct cond_quantizer_list_t *list, uint32_t column, symbol_t prev) {
	uint32_t idx = get_symbol_index(list->input_alphabets[column], prev);
	if (idx != ALPHABET_SYMBOL_NOT_FOUND)
		return get_cond_quantizer_indexed(list, column, idx);
	return NULL;
}

/**
 * Stores the given quantizers at the appropriate index corresponding to the left context symbol given
 * for the specific column
 */
void store_cond_quantizers(struct quantizer_t *restrict lo, struct quantizer_t *restrict hi, double ratio, struct cond_quantizer_list_t *list, uint32_t column, symbol_t prev) {
	uint32_t idx = get_symbol_index(list->input_alphabets[column], prev);
	store_cond_quantizers_indexed(lo, hi, ratio, list, column, idx);
}

/**
 * Stores the given quantizers directly at the given index based on the previous context symbol. Faster when
 * we know what the previous index was in addition to what the previous symbol was
 */
void store_cond_quantizers_indexed(struct quantizer_t *restrict lo, struct quantizer_t *restrict hi, double ratio, struct cond_quantizer_list_t *list, uint32_t column, uint32_t idx) {
    list->q[column][2*idx] = lo;
	list->q[column][2*idx + 1] = hi;
    list->ratio[column][idx] = ratio;
	list->qratio[column][idx] = (uint8_t) (ratio * 128.);
}

/**