当前位置: 首页>>代码示例>>C++>>正文


C++ DIV函数代码示例

本文整理汇总了C++中DIV函数的典型用法代码示例。如果您正苦于以下问题:C++ DIV函数的具体用法?C++ DIV怎么用?C++ DIV使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DIV函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: prepareSfbPe

/* constants that do not change during successive pe calculations */
void prepareSfbPe(PE_CHANNEL_DATA *peChanData,
                  const float *sfbEnergy,
                  const float *sfbThreshold,
                  const float *sfbFormFactor,
                  const int     *sfbOffset,
                  const int     sfbCnt,
                  const int     sfbPerGroup,
                  const int     maxSfbPerGroup)
{
   int sfbGrp,sfb;
   int sfbWidth;
   float avgFormFactor;

   COUNT_sub_start("prepareSfbPe");

   LOOP(1);
   for(sfbGrp = 0;sfbGrp < sfbCnt;sfbGrp+=sfbPerGroup){

    PTR_INIT(6); /* pointers for sfbEnergy[],
                                 sfbThreshold[],
                                 sfbOffset[],
                                 sfbFormFactor[],
                                 peChanData->sfbNLines[],
                                 peChanData->sfbLdEnergy[]
                 */
    LOOP(1);
    for (sfb=0; sfb<maxSfbPerGroup; sfb++) {

      ADD(1); BRANCH(1);
      if (sfbEnergy[sfbGrp+sfb] > sfbThreshold[sfbGrp+sfb]) {

         ADD(1);
         sfbWidth = sfbOffset[sfbGrp+sfb+1] - sfbOffset[sfbGrp+sfb];

         /* estimate number of active lines */
         DIV(1); TRANS(1);
         avgFormFactor = (float) pow(sfbEnergy[sfbGrp+sfb]/(float)sfbWidth, 0.25f);

         DIV(1); STORE(1);
         peChanData->sfbNLines[sfbGrp+sfb] =

         sfbFormFactor[sfbGrp+sfb]/avgFormFactor;

          /* ld(sfbEn) */
         TRANS(1); MULT(1); STORE(1);
         peChanData->sfbLdEnergy[sfbGrp+sfb] = (float) (log(sfbEnergy[sfbGrp+sfb]) * LOG2_1);
      }
      else {

         MOVE(2);
         peChanData->sfbNLines[sfbGrp+sfb] = 0.0f;
         peChanData->sfbLdEnergy[sfbGrp+sfb] = 0.0f;
      }
    }
   }

   COUNT_sub_end();
}
开发者ID:KISSMonX,项目名称:aacplusenc,代码行数:59,代码来源:line_pe.c

示例2: xavs_cqm_init

int
xavs_cqm_init (xavs_t * h)
{
  int def_quant8[64][64];
  int def_dequant8[64][64];
  int q, i, i_list;
  int pos;
  int deadzone[4] = { h->param.analyse.i_luma_deadzone[0],
    h->param.analyse.i_luma_deadzone[1],
    32 - 11, 32 - 21
  };                            /*intra Y; inter Y; intra C; inter C */
  int max_qp_err = -1;

  //initial the dequant and quant table with q for 8x8 
  for (q = 0; q < 64; q++)
  {
    for (i = 0; i < 64; i++)
    {
      def_dequant8[q][i] = dequant8_table[q];
      def_quant8[q][i] = quant8_scale[i];
    }
  }

  //i_list =0 Intra Y ; i_list = 1 inter Y ; i_list =2 Intra C ; i_list =3 Inter C;
  for (i_list = 0; i_list < 4; i_list++)
  {
    for (q = 0; q < 64; q++)
    {
      for (pos = 0; pos < 64; pos++)
      {
        int xx = pos % 8;
        int yy = pos / 8;
        int mf;
        h->dequant8_mf[i_list][q][yy][xx] = DIV (def_dequant8[q][pos] * 16, h->pps->scaling_list[i_list][pos]);
        h->quant8_mf[i_list][q][pos] = mf = DIV (def_quant8[q][pos] * 16, h->pps->scaling_list[i_list][pos]);

        //here the deadzone is a value from 0~32 2~5  
        //deadzone 1/2, deadzone should be 0.5 * 1<<15  = (1<<5) * (1<<9)
        //typical value intra  f=(1<<15)*10/31  inter  f=(1<<15)*10/62
        if (i_list % 2 == 0)    /*intra */
          h->quant8_bias[i_list][q][pos] = XAVS_MIN (deadzone[i_list] << 9, (1 << 15) * 10 / 31);
        else                    /*inter */
          h->quant8_bias[i_list][q][pos] = XAVS_MIN (deadzone[i_list] << 9, (1 << 15) * 10 / 62);
      }
    }
  }

  if (!h->mb.b_lossless && max_qp_err >= h->param.rc.i_qp_min)
  {
    xavs_log (h, XAVS_LOG_ERROR, "Quantization overflow.\n");
    xavs_log (h, XAVS_LOG_ERROR, "Your CQM is incompatible with QP < %d, but min QP is set to %d\n", max_qp_err + 1, h->param.rc.i_qp_min);

    return -1;
  }
  return 0;
}
开发者ID:Distrotech,项目名称:xavs,代码行数:56,代码来源:set.c

示例3: reducec

static void  reducec(NUM_TYPE* l1,NUM_TYPE * l2)
{ NUM_TYPE    c, i1, i2;

   i1 = ABS(*l1); i2 = ABS(*l2);
   if (i2 > i1) { c = i1; i1 = i2; i2 = c; }
   while (i2 != 0) { c = i2; i2 = REST(i1,i2); i1 = c; }
   (*l1) = DIV(*l1,i1);
   (*l2) = DIV(*l2,i1);

}
开发者ID:cbpark,项目名称:twoscale_softsusy,代码行数:10,代码来源:rfactor.c

示例4: get_timer_raw

ulong get_timer_raw(void)
{
	ulong now = DIV(READ_TIMER);

	if (now >= lastinc) {
		/* normal mode */
		timestamp += now - lastinc;
	} else {
		/* overflow ... */
		timestamp += now + DIV(TIMER_LOAD_VAL) - lastinc;
	}
	lastinc = now;
	return timestamp;
}
开发者ID:CharlieWood,项目名称:uboot-imx,代码行数:14,代码来源:timer.c

示例5: aravdebug

    aravdebug(const char * userfile, int lineno, const char *PATH) {

        dataPath = getenv("DLOG_OUTPUT_FOLDER") + std::string(PATH);

        //llvm::errs()<<"Data path ::"<<dataPath;
        datatempPath = dataPath + ".temp";
//		tagPath = dataPath + ".tag";

        std::string syscall = "rm -f " + dataPath;

        int status = system(syscall.c_str());
        if (status < 0)
            std::cout << "DLOG Error: " << strerror(errno) << '\n';

        OS.reset((new llvm::raw_fd_ostream(datatempPath.c_str(), ErrorInfo)));

        llvm::errs() << ErrorInfo;

        id = gid++;

        //llvm::errs()<<"created DLOG with id "<<id<<"\n";
        tagset.insert("SYSTEM");
        (*OS) << DIV("SYSTEM")<< "Created Debugger " << GREEN(id)
              << CALLINFO
              << EDIV;

        tagset.insert("CALLINFO");

        (*OS).flush();
    }
开发者ID:rata,项目名称:DLOG,代码行数:30,代码来源:mydebug.hpp

示例6: tmr0_init

void tmr0_init(void)
{
    // Select asynchronous timer 0 operation to use external 32.768 kHz crystal
    BIT_SET_HI(ASSR,AS0);

    // Reset time
    TCNT0 = 0;

    // Calculate and set period
    OCR0 = (uint16)DIV(((F_RTC/8)*TMR0_PERIOD_MS),1000) - 1;

    /* Start timer 0 with clock prescaler CLK/8 and CTC Mode ("Clear Timer on Compare")*/
    /* Resolution is 244.14 us */
    /* Maximum period is 62.5 ms */
    TCCR0 = TMR0_TCCR0_VALUE;

    // Wait for "update busy" flags to clear
    while(ASSR&((1<<TCN0UB)|(1<<OCR0UB)|(1<<TCR0UB)))
    {
        ;
    }

    // Enable interrupt on compare match
    BIT_SET_HI(TIMSK,OCIE0);
}
开发者ID:BackupTheBerlios,项目名称:piconomic-svn,代码行数:25,代码来源:Power.c

示例7: calcPeCorrection

static void calcPeCorrection(float *correctionFac,
                             const float peAct,
                             const float peLast, 
                             const int bitsLast) 
{
  COUNT_sub_start("calcPeCorrection");

  ADD(4); FUNC(1); FUNC(1); MULT(4); LOGIC(4); BRANCH(1);
  if ((bitsLast > 0) && (peAct < (float)1.5f*peLast) && (peAct > (float)0.7f*peLast) &&
      ((float)1.2f*bits2pe((float)bitsLast) > peLast) && 
      ((float)0.65f*bits2pe((float)bitsLast) < peLast))
  {
    float newFac = peLast / bits2pe((float)bitsLast);

    FUNC(1); DIV(1); /* counting previous operation */

    /* dead zone */
    ADD(1); BRANCH(1);
    if (newFac < (float)1.0f) {

      MULT(1); ADD(1); BRANCH(1); MOVE(1);
      newFac = min((float)1.1f*newFac, (float)1.0f);

      ADD(1); BRANCH(1); MOVE(1);
      newFac = max(newFac, (float)0.85f);
    }
    else {
      MULT(1); ADD(1); BRANCH(1); MOVE(1);
      newFac = max((float)0.9f*newFac, (float)1.0f);

      ADD(1); BRANCH(1); MOVE(1);
      newFac = min(newFac, (float)1.15f);
    }
    ADD(4); LOGIC(3); BRANCH(1);
    if (((newFac > (float)1.0f) && (*correctionFac < (float)1.0f)) ||
        ((newFac < (float)1.0f) && (*correctionFac > (float)1.0f))) {

      MOVE(1);
      *correctionFac = (float)1.0f;
    }

    /* faster adaptation towards 1.0, slower in the other direction */
    ADD(3); LOGIC(3); BRANCH(1); /* if() */ MULT(1); MAC(1); STORE(1);
    if ((*correctionFac < (float)1.0f && newFac < *correctionFac) ||
        (*correctionFac > (float)1.0f && newFac > *correctionFac))
      *correctionFac = (float)0.85f * (*correctionFac) + (float)0.15f * newFac;
    else
      *correctionFac = (float)0.7f * (*correctionFac) + (float)0.3f * newFac;

    ADD(2); BRANCH(2); MOVE(2);
    *correctionFac = min(*correctionFac, (float)1.15f);
    *correctionFac = max(*correctionFac, (float)0.85f);
  }
  else {
    MOVE(1);
    *correctionFac = (float)1.0f;
  }

  COUNT_sub_end();
}
开发者ID:KISSMonX,项目名称:aacplusenc,代码行数:60,代码来源:adj_thr.c

示例8: llvm_print

	void llvm_print(const char *userfile, int lineno, T &obj, const char* tag,
			ADDON addon = ADDON())
	{

		std::string unformatted = llvm_to_str(obj);
		std::string formatted = dlog_format_string_to_html(unformatted);

		if (outputmode == DLOG_OUTPUT_BOTH || outputmode == DLOG_OUTPUT_FILE)

		{
			tag_handler(tag);
			fdata << DIV(
					tag) << BOLD("<br>Tag : ") << RED(tag) << NBSP << br << CALLINFO
			<< BROWN(addon.getString()) << NBSP << NBSP
			<< BOLD(" Data : <br>") << formatted << EDIV;
		}
		if (outputmode == DLOG_OUTPUT_BOTH || outputmode == DLOG_OUTPUT_STDOUT)
		{
			std::cout << "Tag : " << tag << "\t";
			if (addon.getString().length() != 0)
			std::cout << "\t Addon: " << addon.getString() << "\n";
			std::cout << unformatted << "\n";
		}

		fdata.flush();
	}
开发者ID:intelaravind,项目名称:DLOG,代码行数:26,代码来源:DLOG.hpp

示例9: current

/*
  The function creates the interpolated spectral data according to the 
  energy of the last good frame and the current (good) frame.
*/
void CConcealment_InterpolateBuffer (float       *spectrum,
                                     float       *enPrev,
                                     float       *enAct,
                                     int          sfbCnt,
                                     const short *pSfbOffset)
{
  int    sfb, line = 0;
  float  multiplier;

  FLC_sub_start("CConcealment_InterpolateBuffer");

  MOVE(1); /* counting previous operation */

  PTR_INIT(3); /* enAct[]
                  enPrev[]
                  spectrum[]
               */
  LOOP(1);
  for(sfb = 0; sfb < sfbCnt; sfb++) {

    DIV(1); TRANS(1);
    multiplier = (float) pow(enAct[sfb] / enPrev[sfb], 0.25f);

    LOOP(1);
    for(; line < pSfbOffset[sfb+1]; line++) {

      MULT(1); STORE(1);
      spectrum [line] = spectrum[line] * multiplier;
    }
  }

  FLC_sub_end();
}
开发者ID:wonktnodi,项目名称:webrtc_port,代码行数:37,代码来源:conceal.c

示例10: assert

static Value *binaryExprInterp(Node *node, void *parser)
{
#ifndef NDEBUG
	assert(node->type == NT_BINARY_EXPR);
#endif
	BinaryExpr *e = (BinaryExpr *)node;
#ifdef LOG_INTERP
	logInterpPrefix(parser);
	rawlog("binaryExprInterp\n");
	((Parser *)parser)->interpDepth++;
#endif
	assert(e->lhs && e->rhs);
	Value *lhs = e->lhs->interp(e->lhs, parser);
	Value *rhs = e->rhs->interp(e->rhs, parser);
	switch (e->op) {
	case TK_ADD: e->value = ADD(lhs, rhs, e->value); break; /* + */
	case TK_SUB: e->value = SUB(lhs, rhs, e->value); break; /* - */
	case TK_MUL: e->value = MUL(lhs, rhs, e->value); break; /* * */
	case TK_DIV: e->value = DIV(lhs, rhs, e->value); break; /* / */
	default:
		assert(0);
		break;
	}
#ifdef LOG_INTERP
	logInterpPrefix(parser);
	rawlog("%s\n", token2str(e->op));
	((Parser *)parser)->interpDepth--;
#endif
	return e->value;
}
开发者ID:wfwt,项目名称:jszb,代码行数:30,代码来源:parser.cpp

示例11: yes

/*!

  \brief  Is SBR setting available.
  \return a flag indicating success: yes (1) or no (0)

****************************************************************************/
unsigned int
IsSbrSettingAvail (unsigned int bitrate,
                   unsigned int numOutputChannels,
                   unsigned int sampleRateInput,
                   unsigned int *sampleRateCore
                   )
{
  int idx = INVALID_TABLE_IDX;

  COUNT_sub_start("IsSbrSettingAvail");

  MOVE(1); /* counting previous operation */

  ADD(1); BRANCH(1);
  if (sampleRateInput < 32000)
  {
    COUNT_sub_end();
    return 0;
  }

  DIV(1); STORE(1);
  *sampleRateCore = sampleRateInput/2;

  FUNC(3);
  idx = getSbrTuningTableIndex(bitrate,numOutputChannels, *sampleRateCore);

  ADD(1); BRANCH(1); /* counting post-operation */

  COUNT_sub_end();

  return (idx == INVALID_TABLE_IDX) ? 0 : 1;
}
开发者ID:cpopescu,项目名称:whispermedialib,代码行数:38,代码来源:sbr_main.c

示例12: print_to_file

    void print_to_file(const char * userfile, int lineno, T obj, ADDON addon =
                           ADDON()) {

        tagset.insert("notag");
        (*OS) << DIV("notag") << br << BLUE( obj) << NBSP << CALLINFO << NBSP
              << BROWN(addon.getString()) << NBSP << EDIV;
        (*OS).flush();
    }
开发者ID:rata,项目名称:DLOG,代码行数:8,代码来源:mydebug.hpp

示例13: srslte_binsource_cache_gen

/**
 * Generates a sequence of nbits random bits
 */
int srslte_binsource_cache_gen(srslte_binsource_t* q, int nbits) {
  if (gen_seq_buff(q,DIV(nbits,32))) {
    return -1;
  }
  q->seq_cache_nbits = nbits;
  q->seq_cache_rp = 0;
  return 0;
}
开发者ID:HankW507,项目名称:srsLTE,代码行数:11,代码来源:binsource.c

示例14: srslte_binsource_generate

/**
 * Stores in the bits buffer a sequence of nbits pseudo-random bits.
 * Overwrites the bits generated using srslte_binsource_cache_gen.
 */
int srslte_binsource_generate(srslte_binsource_t* q, uint8_t *bits, int nbits) {

  if (gen_seq_buff(q,DIV(nbits,32))) {
    return -1;
  }
  int_2_bits(q->seq_buff,bits,nbits);
  return 0;
}
开发者ID:HankW507,项目名称:srsLTE,代码行数:12,代码来源:binsource.c

示例15: binsource_generate

/**
 * Stores in the bits buffer a sequence of nbits pseudo-random bits.
 * Overwrites the bits generated using binsource_cache_gen.
 */
int binsource_generate(binsource_t* q, char *bits, int nbits) {

  if (gen_seq_buff(q,DIV(nbits,32))) {
    return -1;
  }
  int_2_bits(q->seq_buff,bits,nbits);
  return 0;
}
开发者ID:SPLURGE831,项目名称:libLTE,代码行数:12,代码来源:binsource.c


注:本文中的DIV函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。