您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ sub函数代码示例

51自学网 2021-06-03 08:32:58
  C++
这篇教程C++ sub函数代码示例写得很实用,希望能帮到您。

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

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

示例1: build_code

static void build_code (    Word16 codvec[], /* (i)  : position of pulses                           */    Word16 sign[],   /* (i)  : sign of d[n]                                 */    Word16 cod[],    /* (o)  : innovative code vector                       */    Word16 h[],      /* (i)  : impulse response of weighted synthesis filter*/    Word16 y[],      /* (o)  : filtered innovative code                     */    Word16 indx[]    /* (o)  : index of 10 pulses (sign+position)           */){    Word16 i, j, k, track, index, _sign[NB_PULSE];    Word16 *p0, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9;    Word32 s;    Set_zero(cod, L_CODE);    for (i = 0; i < NB_TRACK; i++)    {        indx[i] = -1;    }        for (k = 0; k < NB_PULSE; k++)    {        /* read pulse position */                    i = codvec[k];        /* read sign           */                j = sign[i];                index = mult (i, 6554);                  /* index = pos/5       */        /* track = pos%5 */        track = sub (i, extract_l (L_shr (L_mult (index, 5), 1)));        if (j > 0)        {            cod[i] = cod[i] + 4096;            _sign[k] = 8192;                    }        else        {            cod[i] = cod[i] - 4096;            _sign[k] = -8192;            index += 8;        }                if (indx[track] < 0)        {            indx[track] = index;        }        else        {            if (((index ^ indx[track]) & 8) == 0)            {                /* sign of 1st pulse == sign of 2nd pulse */                                if (indx[track] <= index)                {                    indx[track + 5] = index;                }                else                {                    indx[track + 5] = indx[track];                    indx[track] = index;                }            }            else            {                /* sign of 1st pulse != sign of 2nd pulse */                if ((indx[track] & 7) <= (index & 7))                {                    indx[track + 5] = indx[track];                    indx[track] = index;                }                else                {                    indx[track + 5] = index;                }            }        }    }        p0 = h - codvec[0];    p1 = h - codvec[1];    p2 = h - codvec[2];    p3 = h - codvec[3];    p4 = h - codvec[4];    p5 = h - codvec[5];    p6 = h - codvec[6];    p7 = h - codvec[7];    p8 = h - codvec[8];    p9 = h - codvec[9];         for (i = 0; i < L_CODE; i++)    {        s = 0;        s = L_mac (s, *p0++, _sign[0]);        s = L_mac (s, *p1++, _sign[1]);//.........这里部分代码省略.........
开发者ID:2831942318,项目名称:siphon,代码行数:101,


示例2: sub

/*inline*/ vertex3f vertex3f::operator-(const vertex3f &op) const {    return sub(op);}
开发者ID:scaytrase,项目名称:simple-raytracer,代码行数:3,


示例3: pulsesequence

//.........这里部分代码省略.........  neby2=ceil(ne/2.0 - US); // US to handle precision errors  crush_step=gcrush/neby2;  for (i=0; i<ne; i++) {    crush_ind = (1.0-2.0*(i%2))*(neby2-floor(i/2));    crushtab[i] = (int)(crush_ind);  }  settable(t6,(int)ne,crushtab);  /* PULSE SEQUENCE ***************************************/  status(A);  rotate();  triggerSelect(trigger);       // Select trigger input 1/2/3  obsoffset(resto);  delay(GRADIENT_RES);  initval(fabs(ssc),vssc);      // Compressed steady-state counter  if (seqcon[2]=='s') assign(zero,vssc); // Zero for standard peloop  assign(one,vacquire);         // real-time acquire flag  setacqvar(vacquire);          // Turn on acquire when vacquire is zero  /* Phase for excitation pulse */  assign(zero,vphase90);  /* trigger */  if (ticks > 0) F_initval((double)nsblock,vtrigblock);      /* Begin phase-encode loop ****************************/  peloop(seqcon[2],pe_steps,vpe_steps,vpe_ctr);    if (trtype) delay(ns*tr_delay);   // relaxation delay    /* Compressed steady-states: 1st array & transient, all arrays if ssc is negative */    if ((ix > 1) && (ssc > 0))      assign(zero,vssc);    sub(vpe_ctr,vssc,vpe_ctr);  // vpe_ctr counts up from -ssc    assign(zero,vssc);    if (seqcon[2] == 's')      assign(zero,vacquire);    // Always acquire for non-compressed loop    else {      ifzero(vpe_ctr);        assign(zero,vacquire);  // Start acquiring when vpe_ctr reaches zero      endif(vpe_ctr);    }    /* Read external kspace table if set ******************/          if (table)      getelem(t1,vpe_ctr,vpe_mult);    else {      ifzero(vacquire);        sub(vpe_ctr,vpe_offset,vpe_mult);      elsenz(vacquire);        sub(zero,vpe_offset,vpe_mult);  // Hold PE mult at initial value for steady states      endif(vacquire);    }    msloop(seqcon[1],ns,vms_slices,vms_ctr);      if (!trtype) delay(tr_delay);   // Relaxation delay      if (ticks > 0) {        modn(vms_ctr,vtrigblock,vtest);        ifzero(vtest);                // if the beginning of an trigger block          xgate(ticks);          grad_advance(gpropdelay);          delay(GRADIENT_RES);        elsenz(vtest);          delay(GRADIENT_RES);
开发者ID:timburrow,项目名称:ovj3,代码行数:67,


示例4: MR795_gain_code_quant_mod

//.........这里部分代码省略.........    /* scale c[1]         (requires no further multiplication) */    tmp = e_max - exp_coeff[1];    L_t1 = L_shr(L_t1, tmp, pOverflow);    /* scale c[2..4] (used in Mpy_32_16 in the quantizer loop) */    for (i = 2; i <= 4; i++)    {        tmp = e_max - exp_coeff[i];        L_tmp = ((Word32)coeff[i] << 16);        L_tmp = L_shr(L_tmp, tmp, pOverflow);        L_Extract(L_tmp, &coeff[i], &coeff_lo[i], pOverflow);    }    /* scale c[0]         (requires no further multiplication) */    exp = e_max - 31;              /* new exponent */    tmp = exp - exp_coeff[0];    L_t0 = L_shr(L_t0, shr(tmp, 1, pOverflow), pOverflow);    /* perform correction by 1/sqrt(2) if exponent difference is odd */    if ((tmp & 0x1) != 0)    {        L_Extract(L_t0, &coeff[0], &coeff_lo[0], pOverflow);        L_t0 = Mpy_32_16(coeff[0], coeff_lo[0],                         23170, pOverflow);                    /* 23170 Q15 = 1/sqrt(2)*/    }    /* search the quantizer table for the lowest value       of the search criterion                           */    dist_min = MAX_32;    index = 0;    p = &qua_gain_code_ptr[0];    for (i = 0; i < NB_QUA_CODE; i++)    {        g_code = *p++;                   /* this is g_fac (Q11)  */        p++;                             /* skip log2(g_fac)     */        p++;                             /* skip 20*log10(g_fac) */        g_code = mult(g_code, gcode0, pOverflow);        /* only continue if    gc[i]            < 2.0*gc           which is equiv. to  g_code (Q10-ec0) < gain_code (Q11-ec0) */        if (g_code >= gain_code)        {            break;        }        L_tmp = L_mult(g_code, g_code, pOverflow);        L_Extract(L_tmp, &g2_code_h, &g2_code_l, pOverflow);        tmp = sub(g_code, gain_cod_unq, pOverflow);        L_tmp = L_mult(tmp, tmp, pOverflow);        L_Extract(L_tmp, &d2_code_h, &d2_code_l, pOverflow);        /* t2, t3, t4 */        L_tmp = Mac_32_16(L_t1, coeff[2], coeff_lo[2], g_code, pOverflow);        L_tmp = Mac_32(L_tmp,    coeff[3], coeff_lo[3], g2_code_h, g2_code_l, pOverflow);        L_tmp = sqrt_l_exp(L_tmp, &exp, pOverflow);        L_tmp = L_shr(L_tmp, shr(exp, 1, pOverflow), pOverflow);        /* d2 */        tmp = pv_round(L_sub(L_tmp, L_t0, pOverflow), pOverflow);        L_tmp = L_mult(tmp, tmp, pOverflow);        /* dist */        L_tmp = Mac_32(L_tmp, coeff[4], coeff_lo[4], d2_code_h, d2_code_l, pOverflow);        /* store table index if distance measure for this            index is lower than the minimum seen so far   */        if (L_tmp < dist_min)        {            dist_min = L_tmp;            index = i;        }    }    /*------------------------------------------------------------------*     *  read quantized gains and new values for MA predictor memories   *     *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   *     *------------------------------------------------------------------*/    /* Read the quantized gains */    p = &qua_gain_code_ptr[(index<<2) - index];    g_code = *p++;    *qua_ener_MR122 = *p++;    *qua_ener = *p;    /*------------------------------------------------------------------*     *  calculate final fixed codebook gain:                            *     *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                            *     *                                                                  *     *   gc = gc0 * g                                                   *     *------------------------------------------------------------------*/    L_tmp = L_mult(g_code, gcode0, pOverflow);    L_tmp = L_shr(L_tmp, 9 - exp_gcode0, pOverflow);    *gain_cod = (Word16)(L_tmp >> 16);    return index;}
开发者ID:acassis,项目名称:emlinux-ssd1935,代码行数:101,


示例5: pulsesequence

pulsesequence(){   char            sspul[MAXSTR];   double         pwClvl=getval("pwClvl");/* LOAD VARIABLES AND CHECK CONDITIONS */   getstr("sspul", sspul);/* STEADY-STATE PHASECYCLING *//* This section determines if the phase calculations trigger off of (SS - SSCTR)   or off of CT */   ifzero(ssctr);      hlv(ct, v4);      mod4(ct, v3);   elsenz(ssctr);      sub(ssval, ssctr, v12);	/* v12 = 0,...,ss-1 */      hlv(v12, v4);      mod4(v12, v3);   endif(ssctr);/* CALCULATE PHASECYCLE *//* The phasecycle first performs a 4-step cycle on the third pulse in order   to select for DQC.  Second, the 2-step QIS cycle is added in.  Third, a   2-step cycle for axial peak suppression is performed on the second pulse.   Fourth, a 2-step cycle for axial peak suppression is performed on the   first pulse.  If P-type peaks only are being selected, the 2-step cycle   for P-type peak selection is performed on the first pulse immediately   after the 4-step cycle on the third pulse. */   hlv(v4, v4);   if (phase1 == 0)   {      assign(v4, v6);      hlv(v4, v4);      mod2(v6, v6);		/* v6 = P-type peak selection in w1 */   }   hlv(v4, v2);   mod4(v4, v4);		/* v4 = quadrature image suppression */   hlv(v2, v1);   mod2(v1, v1);   dbl(v1, v1);   mod2(v2, v2);   dbl(v2, v2);   dbl(v3, v5);   add(v3, v5, v5);   add(v1, v5, v5);   add(v2, v5, v5);   add(v4, v5, v5);   add(v4, v1, v1);   add(v4, v2, v2);   add(v4, v3, v3);   if (phase1 == 0)   {      add(v6, v1, v1);      add(v6, v5, v5);   }   if (phase1 == 2)      incr(v1);   if (phase1 == 3)      add(id2, v1, v1);		/* adds TPPI increment to the phase of the				 * first pulse */   assign(v5, oph);  /* FOR HYPERCOMPLEX, USE STATES-TPPI TO MOVE AXIALS TO EDGE */     if ((phase1==2)||(phase1==1))   {      initval(2.0*(double)(d2_index%2),v9);  /* moves axials */      add(v1,v9,v1); add(oph,v9,oph);   }/* BEGIN ACTUAL PULSE SEQUENCE CODE */   status(A);   if (sspul[0] == 'y')   {      obspower(pwClvl-12);      rgpulse(200*pw, one, 10.0e-6, 0.0e-6);      rgpulse(200*pw, zero, 0.0e-6, 1.0e-6);      obspower(pwClvl);   }   delay(d1);   status(B);   rgpulse(pw, v1, rof1, 1.0e-6);   if (d2>0.0)      delay(d2 - rof1 - 1.0e-6 -(4*pw)/3.1416);   rgpulse(pw, v2, rof1, 0.0);   rgpulse(pw, v3, 1.0e-6, rof2);   add(v3,one,v8);   delay(d3);   rgpulse(2.0*pw,v8,rof1,rof1);   delay(d3);   status(C);}
开发者ID:timburrow,项目名称:ovj3,代码行数:94,


示例6: build_code_8i40_31bits

void build_code_8i40_31bits (    Word16 codvec[],    /* i : position of pulses                           */    Word16 sign[],      /* i : sign of d[n]                                 */    Word16 cod[],       /* o : innovative code vector                       */    Word16 h[],         /* i : impulse response of weighted synthesis filter*/    Word16 y[],         /* o : filtered innovative code                     */    Word16 sign_indx[], /* o : signs of 4  pulses (signs only)              */    Word16 pos_indx[]   /* o : position index of 8 pulses(position only)    */){    Word16 i, j, k, track, sign_index, pos_index, _sign[NB_PULSE8];    Word16 *p0, *p1, *p2, *p3, *p4, *p5, *p6, *p7;    Word32 s;    for (i = 0; i < L_CODE; i++)    {        cod[i] = 0;                                   }    for (i = 0; i < NB_TRACK_MR102; i++)    {        pos_indx[i] = -1;                                     sign_indx[i] = -1;                                 }        for (k = 0; k < NB_PULSE8; k++)    {       /* read pulse position */                   i = codvec[k];                                  /* read sign           */               j = sign[i];                                            pos_index = i >> 2;                      /* index = pos/4 */       track = i & 3;                   /* track = pos%4 */                      if (j > 0)       {          cod[i] = cod[i] + POS_CODE;                   _sign[k] = POS_SIGN;                                sign_index = 0;  /* bit=0 -> positive pulse */          }       else       {          cod[i] = cod[i] - NEG_CODE;                   _sign[k] = NEG_SIGN;                                sign_index = 1;      /* bit=1 => negative pulse */           /* index = add (index, 8); 1 = negative  old code */       }                      if (pos_indx[track] < 0)       {   /* first set first NB_TRACK pulses  */          pos_indx[track] = pos_index;                            sign_indx[track] = sign_index;                      }       else       {   /* 2nd row of pulses , test if positions needs to be switched */                       if (((sign_index ^ sign_indx[track]) & 1) == 0)          {             /* sign of 1st pulse == sign of 2nd pulse */                                        if (sub (pos_indx[track], pos_index) <= 0)             {   /* no swap */                pos_indx[track + NB_TRACK_MR102] = pos_index;                   }             else             {   /* swap*/                pos_indx[track + NB_TRACK_MR102] = pos_indx[track];                                                 pos_indx[track] = pos_index;                         sign_indx[track] = sign_index;                    }          }          else          {             /* sign of 1st pulse != sign of 2nd pulse */                                        if (pos_indx[track] <= pos_index)             {  /*swap*/                pos_indx[track + NB_TRACK_MR102] = pos_indx[track];                                                 pos_indx[track] = pos_index;                          sign_indx[track] = sign_index;                     }             else             {   /*no swap */                pos_indx[track + NB_TRACK_MR102] = pos_index;                   }          }       }    }        p0 = h - codvec[0];                               p1 = h - codvec[1];                               p2 = h - codvec[2];                           //.........这里部分代码省略.........
开发者ID:NearZhxiAo,项目名称:3730,代码行数:101,


示例7: pollard

// Actually this is not correct. Need to use schoof's to make the group prime first!BigNum pollard(Node P, Node Q, BigNum a, BigNum b, BigNum p, BigNum P_order){	//P's order <= p	BigNum ret;	initBigNum(&ret);	// generate random X_0 = ap*P + bp*Q	BigNum _0 = int2BigNum(0, P_order);	BigNum ap = rdm2(_0, P_order);	BigNum bp = rdm2(_0, P_order);	BigNum _1 = int2BigNum(1, p);	BigNum _2 = int2BigNum(2, p);	Node a_P = eccMul(ap, P, a, b, p);	Node b_P = eccMul(bp, Q, a, b, p);	Node X_0 = eccAdd(a_P, b_P, a, b, p);	BigNum k = copyBigNum(_0);	// insert X_0 and start the random walk	addNodeHT(X_0, ap, bp);	// add the first Node	unsigned int num_X;	Node X_i = copyNode(X_0);	num_X = HASH_COUNT(ht);	while(true){		k = add(k, _1, p);		// split into 3 sets by x mod 3		int t = rand_range(0, 2);	// this is not the same as the paper...		if(t == 0){	// add P			X_i = eccAdd(X_i, P, a, b, p);			ap = add(ap, _1, P_order);		}		else if(t == 1){	// 2X_i			X_i = eccMul( _2, X_i, a, b, p);			ap = mul(ap, _2, P_order);			bp = mul(bp, _2, P_order);		}		else if(t == 2){	// add Q			X_i = eccAdd(X_i, Q, a, b, p);			bp = add(bp, _1, P_order);		}		if(X_i.inf){			printf("X_i hits infinity!/n");			BigNum b2_b1 = sub(P_order, bp, P_order);			BigNum inv_b2_b1 = invFermat(b2_b1, P_order);			BigNum a1_a2 = copyBigNum(ap);			ret = mul(a1_a2, inv_b2_b1, P_order);			break;		}		NodeHT *r = findNodeHT(X_i);		if(r){	// found a collision!			if(compareBigNum(r->bp, bp) != 0){	// b1 != b2				// d = (a1 - a2) / (b2 - b1);	a1 is r->ap				BigNum b2_b1 = sub(bp, r->bp, P_order);				BigNum inv_b2_b1 = invFermat(b2_b1, P_order);				BigNum a1_a2 = sub(r->ap, ap, P_order);				ret = mul(a1_a2, inv_b2_b1, P_order);				break;			}		}		else			addNodeHT(X_i, ap, bp);		num_X = HASH_COUNT(ht);	}	printf("Pollard Rounds:/n");	printBigNum(k);	return ret;}
开发者ID:fatestudio,项目名称:ZMP,代码行数:70,


示例8: encoder

void encoder(Word16  number_of_available_bits,             Word16  number_of_regions,             Word16  *mlt_coefs,             Word16  mag_shift,             Word16  *out_words){    Word16  num_categorization_control_bits;    Word16  num_categorization_control_possibilities;    Word16  number_of_bits_per_frame;    Word16  number_of_envelope_bits;    Word16  categorization_control;    Word16  region;    Word16  absolute_region_power_index[MAX_NUMBER_OF_REGIONS];    Word16  power_categories[MAX_NUMBER_OF_REGIONS];    Word16  category_balances[MAX_NUM_CATEGORIZATION_CONTROL_POSSIBILITIES-1];    Word16  drp_num_bits[MAX_NUMBER_OF_REGIONS+1];    UWord16 drp_code_bits[MAX_NUMBER_OF_REGIONS+1];    Word16  region_mlt_bit_counts[MAX_NUMBER_OF_REGIONS];    UWord32 region_mlt_bits[4*MAX_NUMBER_OF_REGIONS];    Word16  mag_shift_offset;    Word16 temp;    /* initialize variables */    test();    if (number_of_regions == NUMBER_OF_REGIONS)    {        num_categorization_control_bits = NUM_CATEGORIZATION_CONTROL_BITS;        move16();        num_categorization_control_possibilities = NUM_CATEGORIZATION_CONTROL_POSSIBILITIES;        move16();    }     else    {        num_categorization_control_bits = MAX_NUM_CATEGORIZATION_CONTROL_BITS;        move16();        num_categorization_control_possibilities = MAX_NUM_CATEGORIZATION_CONTROL_POSSIBILITIES;        move16();    }    number_of_bits_per_frame = number_of_available_bits;    move16();    for (region=0; region<number_of_regions; region++)    {        region_mlt_bit_counts[region] = 0;        move16();    }        /* Estimate power envelope. */    number_of_envelope_bits = compute_region_powers(mlt_coefs,                                                    mag_shift,                                                    drp_num_bits,                                                    drp_code_bits,                                                    absolute_region_power_index,                                                    number_of_regions);    /* Adjust number of available bits based on power envelope estimate */    temp = sub(number_of_available_bits,number_of_envelope_bits);    number_of_available_bits = sub(temp,num_categorization_control_bits);    /* get categorizations */    categorize(number_of_available_bits,               number_of_regions,               num_categorization_control_possibilities,               absolute_region_power_index,               power_categories,               category_balances);    /* Adjust absolute_region_category_index[] for mag_shift.       This assumes that REGION_POWER_STEPSIZE_DB is defined       to be exactly 3.010299957 or 20.0 times log base 10       of square root of 2. */    temp = shl(mag_shift,1);    mag_shift_offset = add(temp,REGION_POWER_TABLE_NUM_NEGATIVES);        for (region=0; region<number_of_regions; region++)    {        absolute_region_power_index[region] = add(absolute_region_power_index[region],mag_shift_offset);        move16();    }    /* adjust the absolute power region index based on the mlt coefs */    adjust_abs_region_power_index(absolute_region_power_index,mlt_coefs,number_of_regions);    /* quantize and code the mlt coefficients based on categorizations */    vector_quantize_mlts(number_of_available_bits,                         number_of_regions,                         num_categorization_control_possibilities,                         mlt_coefs,                         absolute_region_power_index,                         power_categories,                         category_balances,                         &categorization_control,                         region_mlt_bit_counts,                         region_mlt_bits);    /* stuff bits into words *///.........这里部分代码省略.........
开发者ID:Distrotech,项目名称:h323plus,代码行数:101,


示例9: vector_quantize_mlts

void vector_quantize_mlts(Word16 number_of_available_bits,                          Word16 number_of_regions,                          Word16 num_categorization_control_possibilities,                          Word16 *mlt_coefs,                          Word16 *absolute_region_power_index,                          Word16 *power_categories,                          Word16 *category_balances,                          Word16 *p_categorization_control,                          Word16 *region_mlt_bit_counts,                          UWord32 *region_mlt_bits){    Word16 *raw_mlt_ptr;    Word16 region;    Word16 category;    Word16 total_mlt_bits = 0;    Word16 temp;    Word16 temp1;    Word16 temp2;    /* Start in the middle of the categorization control range. */    temp = shr(num_categorization_control_possibilities,1);    temp = sub(temp,1);    for (*p_categorization_control = 0; *p_categorization_control < temp; (*p_categorization_control)++)    {        region = category_balances[*p_categorization_control];        move16();        power_categories[region] = add(power_categories[region],1);        move16();    }    for (region=0; region<number_of_regions; region++)    {        category = power_categories[region];        move16();        temp = extract_l(L_mult0(region,REGION_SIZE));        raw_mlt_ptr = &mlt_coefs[temp];        move16();        temp = sub(category,(NUM_CATEGORIES-1));        test();        if (temp < 0)        {            region_mlt_bit_counts[region] =            vector_huffman(category, absolute_region_power_index[region],raw_mlt_ptr,                           &region_mlt_bits[shl(region,2)]);        }        else        {            region_mlt_bit_counts[region] = 0;            move16();        }        total_mlt_bits = add(total_mlt_bits,region_mlt_bit_counts[region]);    }    /* If too few bits... */    temp = sub(total_mlt_bits,number_of_available_bits);    test();    test();    logic16();    while ((temp < 0) && (*p_categorization_control > 0))    {        test();        test();        logic16();        (*p_categorization_control)--;        region = category_balances[*p_categorization_control];        move16();                power_categories[region] = sub(power_categories[region],1);        move16();        total_mlt_bits = sub(total_mlt_bits,region_mlt_bit_counts[region]);        category = power_categories[region];        move16();                raw_mlt_ptr = &mlt_coefs[region*REGION_SIZE];        move16();                temp = sub(category,(NUM_CATEGORIES-1));        test();        if (temp < 0)        {            region_mlt_bit_counts[region] =                vector_huffman(category, absolute_region_power_index[region],raw_mlt_ptr,                           &region_mlt_bits[shl(region,2)]);        }        else        {            region_mlt_bit_counts[region] = 0;            move16();        }        total_mlt_bits = add(total_mlt_bits,region_mlt_bit_counts[region]);        temp = sub(total_mlt_bits,number_of_available_bits);    }    /* If too many bits... */    /* Set up for while loop test */    temp1 = sub(total_mlt_bits,number_of_available_bits);//.........这里部分代码省略.........
开发者ID:Distrotech,项目名称:h323plus,代码行数:101,


示例10: bits_to_words

/*************************************************************************** Function:    bits_to_words Syntax:      bits_to_words(UWord32 *region_mlt_bits,                                          Word16  *region_mlt_bit_counts,                                                                                         Word16  *drp_num_bits,                                                                                                  UWord16 *drp_code_bits,                                                                                                 Word16  *out_words,                                                                                                     Word16  categorization_control,                                                                                                     Word16  number_of_regions,                            Word16  num_categorization_control_bits,                            Word16  number_of_bits_per_frame)                                                                                                                                                                                                  Description: Stuffs the bits into words for output WMOPS:     7kHz |    24kbit    |      32kbit          -------|--------------|----------------            AVG  |    0.09      |     0.12          -------|--------------|----------------              MAX  |    0.10      |     0.13          -------|--------------|----------------                      14kHz |    24kbit    |     32kbit     |     48kbit          -------|--------------|----------------|----------------            AVG  |    0.12      |     0.15       |     0.19          -------|--------------|----------------|----------------            MAX  |    0.14      |     0.17       |     0.21          -------|--------------|----------------|----------------***************************************************************************/void bits_to_words(UWord32 *region_mlt_bits,                   Word16  *region_mlt_bit_counts,                   Word16  *drp_num_bits,                   UWord16 *drp_code_bits,                   Word16  *out_words,                   Word16  categorization_control,                   Word16  number_of_regions,                   Word16  num_categorization_control_bits,                   Word16  number_of_bits_per_frame){    Word16  out_word_index = 0;    Word16  j;    Word16  region;    Word16  out_word;    Word16  region_bit_count;    Word16  current_word_bits_left;    UWord16 slice;    Word16  out_word_bits_free = 16;    UWord32 *in_word_ptr;    UWord32 current_word;        Word32  acca;    Word32  accb;    Word16  temp;    /* First set up the categorization control bits to look like one more set of region power bits. */    out_word = 0;    move16();    drp_num_bits[number_of_regions] = num_categorization_control_bits;    move16();        drp_code_bits[number_of_regions] = (UWord16)categorization_control;    move16();    /* These code bits are right justified. */    for (region=0; region <= number_of_regions; region++)    {        current_word_bits_left = drp_num_bits[region];        move16();                current_word = (UWord32)drp_code_bits[region];        move16();                j = sub(current_word_bits_left,out_word_bits_free);        test();        if (j >= 0)        {            temp = extract_l(L_shr(current_word,j));            out_word = add(out_word,temp);            out_words[out_word_index++] = out_word;            move16();                        out_word_bits_free = 16;            move16();                        out_word_bits_free = sub(out_word_bits_free,j);                        acca = (current_word << out_word_bits_free);            out_word = extract_l(acca);        }        else        {            j = negate(j);            acca = (current_word << j);            accb = L_deposit_l(out_word);//.........这里部分代码省略.........
开发者ID:Distrotech,项目名称:h323plus,代码行数:101,


示例11: compute_region_powers

Word16 compute_region_powers(Word16  *mlt_coefs,                             Word16  mag_shift,                             Word16  *drp_num_bits,                             UWord16 *drp_code_bits,                             Word16  *absolute_region_power_index,                             Word16  number_of_regions){    Word16 *input_ptr;    Word32 long_accumulator;    Word16 itemp1;    Word16 power_shift;    Word16 region;    Word16 j;    Word16 differential_region_power_index[MAX_NUMBER_OF_REGIONS];    Word16 number_of_bits;        Word32 acca;    Word16 temp;    Word16 temp1;    Word16 temp2;    input_ptr = mlt_coefs;    for (region=0; region<number_of_regions; region++)    {        long_accumulator = L_deposit_l(0);        for (j=0; j<REGION_SIZE; j++)        {            itemp1 = *input_ptr++;            move16();            long_accumulator = L_mac0(long_accumulator,itemp1,itemp1);        }        power_shift = 0;        move16();        acca = (long_accumulator & 0x7fff0000L);        logic32();        test();        while (acca > 0)        {            test();            long_accumulator = L_shr(long_accumulator,1);                        acca = (long_accumulator & 0x7fff0000L);            logic32();            power_shift = add(power_shift,1);        }                acca = L_sub(long_accumulator,32767);                temp = add(power_shift,15);        test();        test();        logic16();        while ((acca <= 0) && (temp >= 0))        {            test();            test();            logic16();                        long_accumulator = L_shl(long_accumulator,1);            acca = L_sub(long_accumulator,32767);            power_shift--;            temp = add(power_shift,15);        }        long_accumulator = L_shr(long_accumulator,1);        /* 28963 corresponds to square root of 2 times REGION_SIZE(20). */        acca = L_sub(long_accumulator,28963);                test();        if (acca >= 0)            power_shift = add(power_shift,1);                acca = L_deposit_l(mag_shift);        acca = L_shl(acca,1);        acca = L_sub(power_shift,acca);        acca = L_add(35,acca);        acca = L_sub(acca,REGION_POWER_TABLE_NUM_NEGATIVES);        absolute_region_power_index[region] = extract_l(acca);    }    /* Before we differentially encode the quantized region powers, adjust upward the    valleys to make sure all the peaks can be accurately represented. */    temp = sub(number_of_regions,2);    for (region = temp; region >= 0; region--)    {        temp1 = sub(absolute_region_power_index[region+1],DRP_DIFF_MAX);        temp2 = sub(absolute_region_power_index[region],temp1);        test();        if (temp2 < 0)        {            absolute_region_power_index[region] = temp1;            move16();//.........这里部分代码省略.........
开发者ID:Distrotech,项目名称:h323plus,代码行数:101,


示例12: sub

voidShapesDialog::onSubscribeButtonClicked(){    dds::topic::qos::TopicQos topicQos = dp_.default_topic_qos()                                         << dds::core::policy::Durability::Persistent()                                         << dds::core::policy::DurabilityService(                                                    dds::core::Duration(3600,0),                                                    dds::core::policy::HistoryKind::KEEP_LAST,                                                    100,                                                    8192,                                                    4196,                                                    8192);    dds::sub::qos::SubscriberQos SQos = dp_.default_subscriber_qos() << gQos_;    dds::sub::Subscriber sub(dp_, SQos);    int d = mainWidget.sizeSlider->value();    QRect rect(0, 0, d, d);    QRect constr(0, 0, IS_WIDTH, IS_HEIGHT);    int x = static_cast<int>(constr.width() * ((float)rand() / RAND_MAX)*0.9F);    int y = static_cast<int>(constr.height() * ((float)rand() / RAND_MAX)*0.9F);    int sIdx = mainWidget.rShapeList->currentIndex();    QColor gray = QColor(0x99, 0x99, 0x99);    QBrush brush(gray, Qt::SolidPattern);    QPen pen(QColor(0xff,0xff,0xff), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);    std::vector<std::string> empty;    filterParams_ = empty;    std::string filterS;    if (filterDialog_->isEnabled())    {        QRect rect =  filterDialog_->getFilterBounds();        std::string x0 = lexicalCast(rect.x());        std::string x1 = lexicalCast(rect.x() + rect.width() -d);        std::string y0 = lexicalCast(rect.y());        std::string y1 = lexicalCast(rect.y() + rect.height() -d);        filterParams_.push_back(x0);        filterParams_.push_back(x1);        filterParams_.push_back(y0);        filterParams_.push_back(y1);        filterS = "(x BETWEEN "            + filterParams_[0]            + " AND "            + filterParams_[1]            + ") AND (y BETWEEN "            + filterParams_[2]            + " AND "            + filterParams_[3]            + ")";        if (filterDialog_->filterOutside() == false)        {             filterS = "(x < "                 + filterParams_[0]                 + " ) OR ( x > "                 + filterParams_[1]                 + " ) OR (y < "                 + filterParams_[2]                 + ") OR ( y > "                 + filterParams_[3]                 + ")";        }    }    switch (sIdx)    {        case CIRCLE:        {            dds::topic::Topic<ShapeType> circle_(dp_, circleTopicName, topicQos);	        dds::topic::ContentFilteredTopic<ShapeType> cfcircle_(dds::core::null);            dds::sub::DataReader<ShapeType> dr(sub, circle_, readerQos_.get_qos());            if (filterDialog_->isEnabled())            {                std::string tname = "CFCircle";                const dds::topic::Filter filter(filterS);                std::cout << filterS << std::endl;                dds::topic::ContentFilteredTopic<ShapeType> cfcircle_(circle_, "CFCircle", filter);	            dds::sub::DataReader<ShapeType> dr2(sub, cfcircle_, readerQos_.get_qos());                dr = dr2;            }            for (int i = 0; i < CN; ++i)            {                std::string colorStr(colorString_[i]);                DDSShapeDynamics::ref_type                dynamics(new DDSShapeDynamics(x, y, dr, colorStr, i));                Shape::ref_type                circle(new Circle(rect, dynamics, pen, brush, true));                dynamics->setShape(circle);                shapesWidget->addShape(circle);            }            break;        }        case SQUARE://.........这里部分代码省略.........
开发者ID:AmitShah,项目名称:opensplice,代码行数:101,


示例13: sub2

intsub2 (void){  return sub (0x7fffffff);}
开发者ID:0day-ci,项目名称:gcc,代码行数:5,


示例14: root_node

T& root_node(treetree::tree<T>& tr) {  treetree::subtree<T> sub(tr);  return root_node(sub);}
开发者ID:richfitz,项目名称:forest,代码行数:4,


示例15: normal_vector

vec3 normal_vector(vec3 *a, vec3 *b, vec3 *c) {    return normalize(cross(sub(*b, *a), sub(*c, *a)));}
开发者ID:a-johnston,项目名称:5kgl,代码行数:3,


示例16: vector_huffman

//.........这里部分代码省略.........        signs_index = 0;        move16();                number_of_non_zero = 0;        move16();                for (j=0; j<vec_dim; j++)        {            k = abs_s(*raw_mlt_ptr);                        acca = L_mult(k,inv_of_step_size_times_std_dev);            acca = L_shr(acca,1);		    			/*			 *  The next four lines are new to Release 1.2			 */			myacca = (Word16)L_mult(k,mytemp);			myacca = (Word16)L_shr(myacca,1);			myacca = (Word16)L_add(myacca,int_dead_zone_low_bits[category]);			myacca = (Word16)L_shr(myacca,2);            acca = L_add(acca,int_dead_zone[category]);			/*			 *  The next two lines are new to Release 1.2			 */			acca = L_add(acca,myacca);			acca = L_shr(acca,13);            k = extract_l(acca);            test();            if (k != 0)            {                number_of_non_zero = add(number_of_non_zero,1);                signs_index = shl(signs_index,1);                                test();                if (*raw_mlt_ptr > 0)                {                    signs_index = add(signs_index,1);                }                                temp = sub(k,kmax);                test();                if (temp > 0)                {                    k = kmax;                    move16();                }            }            acca = L_shr(L_mult(index,(kmax_plus_one)),1);            index = extract_l(acca);            index = add(index,k);            raw_mlt_ptr++;        }        code_bits = *(code_table_ptr+index);        number_of_code_bits = add((*(bitcount_table_ptr+index)),number_of_non_zero);        number_of_region_bits = add(number_of_region_bits,number_of_code_bits);        acca = code_bits << number_of_non_zero;        accb = L_deposit_l(signs_index);        acca = L_add(acca,accb);        code_bits = acca;        move32();        /* msb of codebits is transmitted first. */        j = sub(current_word_bits_free,number_of_code_bits);        test();        if (j >= 0)        {            test();            acca = code_bits << j;            current_word = L_add(current_word,acca);            current_word_bits_free = j;            move16();        }        else        {            j = negate(j);            acca = L_shr(code_bits,j);            current_word = L_add(current_word,acca);                        *word_ptr++ = current_word;            move16();            current_word_bits_free = sub(32,j);            test();            current_word = code_bits << current_word_bits_free;        }    }    *word_ptr++ = current_word;    move16();    return (number_of_region_bits);}
开发者ID:Distrotech,项目名称:h323plus,代码行数:101,


示例17: vec3_distance

double vec3_distance(vec3 a, vec3 b) {    return norm_vec3(sub(a, b));}
开发者ID:a-johnston,项目名称:5kgl,代码行数:3,


示例18: D4i40_17

static Word16 D4i40_17( /* (o)    : Index of pulses positions.               */  Word16 Dn[],          /* (i)    : Correlations between h[] and Xn[].       */  Word16 rr[],          /* (i)    : Correlations of impulse response h[].    */  Word16 h[],           /* (i) Q12: Impulse response of filters.             */  Word16 cod[],         /* (o) Q13: Selected algebraic codeword.             */  Word16 y[],           /* (o) Q12: Filtered algebraic codeword.             */  Word16 *sign,         /* (o)    : Signs of 4 pulses.                       */  Word16 i_subfr        /* (i)    : subframe flag                            */){   Word16  i0, i1, i2, i3, ip0, ip1, ip2, ip3;   Word16  i, j, time;   Word16  ps0, ps1, ps2, ps3, alp, alp0;   Word32  alp1, alp2, alp3, L32;   Word16  ps3c, psc, alpha;   Word16  average, max0, max1, max2, thres;   Word32  L_temp;   Word16 *rri0i0, *rri1i1, *rri2i2, *rri3i3, *rri4i4;   Word16 *rri0i1, *rri0i2, *rri0i3, *rri0i4;   Word16 *rri1i2, *rri1i3, *rri1i4;   Word16 *rri2i3, *rri2i4;   Word16 *ptr_ri0i0, *ptr_ri1i1, *ptr_ri2i2, *ptr_ri3i3, *ptr_ri4i4;   Word16 *ptr_ri0i1, *ptr_ri0i2, *ptr_ri0i3, *ptr_ri0i4;   Word16 *ptr_ri1i2, *ptr_ri1i3, *ptr_ri1i4;   Word16 *ptr_ri2i3, *ptr_ri2i4;   Word16  p_sign[L_SUBFR];   /* Init pointers */   rri0i0 = rr;   rri1i1 = rri0i0 + NB_POS;   rri2i2 = rri1i1 + NB_POS;   rri3i3 = rri2i2 + NB_POS;   rri4i4 = rri3i3 + NB_POS;   rri0i1 = rri4i4 + NB_POS;   rri0i2 = rri0i1 + MSIZE;   rri0i3 = rri0i2 + MSIZE;   rri0i4 = rri0i3 + MSIZE;   rri1i2 = rri0i4 + MSIZE;   rri1i3 = rri1i2 + MSIZE;   rri1i4 = rri1i3 + MSIZE;   rri2i3 = rri1i4 + MSIZE;   rri2i4 = rri2i3 + MSIZE; /*-----------------------------------------------------------------------*  * Reset max_time for 1st subframe.                                      *//.........这里部分代码省略.........
开发者ID:SibghatullahSheikh,项目名称:codecs,代码行数:101,


示例19: gain_adapt

/************************************************************************* * *  Function:   gain_adapt() *  Purpose:    calculate pitch/codebook gain adaptation factor alpha *              (and update the adaptor state) * ************************************************************************** */void gain_adapt(    GainAdaptState *st,  /* i  : state struct                  */    Word16 ltpg,         /* i  : ltp coding gain (log2()), Q13 */    Word16 gain_cod,     /* i  : code gain,                Q1  */    Word16 *alpha        /* o  : gain adaptation factor,   Q15 */){    Word16 adapt;      /* adaptdation status; 0, 1, or 2       */    Word16 result;     /* alpha factor, Q13                    */    Word16 filt;       /* median-filtered LTP coding gain, Q13 */    Word16 tmp, i;        /* basic adaptation */    test ();    if (sub (ltpg, LTP_GAIN_THR1) <= 0)    {        adapt = 0;                            move16 ();    }    else    {        test ();        if (sub (ltpg, LTP_GAIN_THR2) <= 0)        {            adapt = 1;                        move16 ();        }        else        {            adapt = 2;                        move16 ();        }    }    /*     * // onset indicator     * if ((cbGain > onFact * cbGainMem[0]) && (cbGain > 100.0))     *     onset = 8;     * else     *     if (onset)     *         onset--;     */    /* tmp = cbGain / onFact; onFact = 2.0; 200 Q1 = 100.0 */    tmp = shr_r (gain_cod, 1);    test (); test ();    if ((sub (tmp, st->prev_gc) > 0) && sub(gain_cod, 200) > 0)    {        st->onset = 8;                            move16 ();    }    else    {        test ();        if (st->onset != 0)        {            st->onset = sub (st->onset, 1);       move16 ();        }    }    /*     *  // if onset, increase adaptor state     *  if (onset && (gainAdapt < 2)) gainAdapt++;     */    test(); test ();    if ((st->onset != 0) && (sub (adapt, 2) < 0))    {        adapt = add (adapt, 1);    }    st->ltpg_mem[0] = ltpg;                       move16 ();    filt = gmed_n (st->ltpg_mem, 5);   move16 (); /* function result */    test ();    if (adapt == 0)    {        test ();        if (sub (filt, 5443) > 0) /* 5443 Q13 = 0.66443... */        {            result = 0; move16 ();        }        else        {            test ();            if (filt < 0)            {                result = 16384; move16 ();  /* 16384 Q15 = 0.5 */            }            else            {   /* result       =   0.5 - 0.75257499*filt     */                /* result (Q15) = 16384 - 24660 * (filt << 2) */                filt = shl (filt, 2); /* Q15 */                result = sub (16384, mult (24660, filt));            }        }    }    else//.........这里部分代码省略.........
开发者ID:DanielGit,项目名称:Intrisit201202,代码行数:101,


示例20: D2i40_11

//.........这里部分代码省略.........        *ptr_Ri0i2 = mult(*ptr_Ri0i2, mult(p_sign[i0], p_sign[i1]));         ptr_Ri0i2++;      }   }     /*-------------------------------------------------------------------*   * The actual search.                                                *   *-------------------------------------------------------------------*/   ip0 = 1;                     /* Set to any valid pulse position */   ip1 = 0;                     /* Set to any valid pulse position */   psc = 0;   alpha = MAX_16;   ptr_ri0i1 = rri0i1;   outPtr_ri1i1 = rri1i1;       /* Initial values for tripple loop below */   p0=0;                        /* Search i0,sub0 vs. i1,sub0 */    p1=1;   ptr_ri0i0 = rri0i0;   for (i = 0; i<9; i++) {      if (i == 4) i++;          /* To get right exchange sequence */      swap = i & 1;      if (i == 1) p0=1;         /* Search i0,sub1 vs. i1,sub0 */      else if (i == 2) {        /* Search i0,sub0 vs. i1,sub1 */         outPtr_ri1i1 = rri3i3;         p0=0;         p1=3;         ptr_ri0i0 = rri0i0;      }
开发者ID:SibghatullahSheikh,项目名称:codecs,代码行数:67,


示例21: sub

vec_RR operator-(const vec_RR& a, const vec_RR& b){   vec_RR res;   sub(res, a, b);   NTL_OPT_RETURN(vec_RR, res);}
开发者ID:Brainloop-Security,项目名称:secret-sharing,代码行数:6,


示例22: Cor_h_X

static void Cor_h_X(     Word16 h[],        /* (i) Q12 :Impulse response of filters      */     Word16 X[],        /* (i)     :Target vector                    */     Word16 D[]         /* (o)     :Correlations between h[] and D[] */                        /*          Normalized to 13 bits            */){   Word16 i, j;   Word32 s, max, L_temp;   Word32 y32[L_SUBFR];   /* first keep the result on 32 bits and find absolute maximum */   max = 0;   for (i = 0; i < L_SUBFR; i++)   {     s = 0;     for (j = i; j <  L_SUBFR; j++)       s = L_mac(s, X[j], h[j-i]);     y32[i] = s;     s = L_abs(s);     L_temp =L_sub(s,max);     if(L_temp>0L) {        max = s;     }   }   /* Find the number of right shifts to do on y32[]  */   /* so that maximum is on 13 bits                   */   j = norm_l(max);   if( sub(j,16) > 0) {    j = 16;   }   j = sub(18, j);   for(i=0; i<L_SUBFR; i++) {     D[i] = extract_l( L_shr(y32[i], j) );   }   return;}
开发者ID:SibghatullahSheikh,项目名称:codecs,代码行数:93,


示例23: MR795_gain_quant

voidMR795_gain_quant(    GainAdaptState *adapt_st, /* i/o: gain adapter state structure       */    Word16 res[],             /* i  : LP residual,                  Q0   */    Word16 exc[],             /* i  : LTP excitation (unfiltered),  Q0   */    Word16 code[],            /* i  : CB innovation (unfiltered),   Q13  */    Word16 frac_coeff[],      /* i  : coefficients (5),             Q15  */    Word16 exp_coeff[],       /* i  : energy coefficients (5),      Q0   */    /*      coefficients from calc_filt_ener() */    Word16 exp_code_en,       /* i  : innovation energy (exponent), Q0   */    Word16 frac_code_en,      /* i  : innovation energy (fraction), Q15  */    Word16 exp_gcode0,        /* i  : predicted CB gain (exponent), Q0   */    Word16 frac_gcode0,       /* i  : predicted CB gain (fraction), Q15  */    Word16 L_subfr,           /* i  : Subframe length                    */    Word16 cod_gain_frac,     /* i  : opt. codebook gain (fraction),Q15  */    Word16 cod_gain_exp,      /* i  : opt. codebook gain (exponent), Q0  */    Word16 gp_limit,          /* i  : pitch gain limit                   */    Word16 *gain_pit,         /* i/o: Pitch gain,                   Q14  */    Word16 *gain_cod,         /* o  : Code gain,                    Q1   */    Word16 *qua_ener_MR122,   /* o  : quantized energy error,       Q10  */    /*      (for MR122 MA predictor update)    */    Word16 *qua_ener,         /* o  : quantized energy error,       Q10  */    /*      (for other MA predictor update)    */    Word16 **anap,            /* o  : Index of quantization              */    /*      (first gain pitch, then code pitch)*/    CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of table ptrs   */    Flag   *pOverflow         /* o  : overflow indicator                */){    Word16 frac_en[4];    Word16 exp_en[4];    Word16 ltpg, alpha, gcode0;    Word16 g_pitch_cand[3];      /* pitch gain candidates   Q14 */    Word16 g_pitch_cind[3];      /* pitch gain indices      Q0  */    Word16 gain_pit_index;    Word16 gain_cod_index;    Word16 exp;    Word16 gain_cod_unq;         /* code gain (unq.) Q(10-exp_gcode0)  */    /* get list of candidate quantized pitch gain values     * and corresponding quantization indices     */    gain_pit_index = q_gain_pitch(MR795, gp_limit, gain_pit,                                  g_pitch_cand, g_pitch_cind, common_amr_tbls->qua_gain_pitch_ptr, pOverflow);    /*-------------------------------------------------------------------*     *  predicted codebook gain                                          *     *  ~~~~~~~~~~~~~~~~~~~~~~~                                          *     *  gc0     = 2^exp_gcode0 + 2^frac_gcode0                           *     *                                                                   *     *  gcode0 (Q14) = 2^14*2^frac_gcode0 = gc0 * 2^(14-exp_gcode0)      *     *-------------------------------------------------------------------*/    gcode0 = (Word16)(Pow2(14, frac_gcode0, pOverflow));           /* Q14 */    /* pre-quantization of codebook gain     * (using three pitch gain candidates);     * result: best guess of pitch gain and code gain     */    MR795_gain_code_quant3(        exp_gcode0, gcode0, g_pitch_cand, g_pitch_cind,        frac_coeff, exp_coeff,        gain_pit, &gain_pit_index, gain_cod, &gain_cod_index,        qua_ener_MR122, qua_ener, common_amr_tbls->qua_gain_code_ptr, pOverflow);    /* calculation of energy coefficients and LTP coding gain */    calc_unfilt_energies(res, exc, code, *gain_pit, L_subfr,                         frac_en, exp_en, &ltpg, pOverflow);    /* run gain adaptor, calculate alpha factor to balance LTP/CB gain     * (this includes the gain adaptor update)     * Note: ltpg = 0 if frac_en[0] == 0, so the update is OK in that case     */    gain_adapt(adapt_st, ltpg, *gain_cod, &alpha, pOverflow);    /* if this is a very low energy signal (threshold: see     * calc_unfilt_energies) or alpha <= 0 then don't run the modified quantizer     */    if (frac_en[0] != 0 && alpha > 0)    {        /* innovation energy <cod cod> was already computed in gc_pred() */        /* (this overwrites the LtpResEn which is no longer needed)      */        frac_en[3] = frac_code_en;        exp_en[3] = exp_code_en;        /* store optimum codebook gain in Q(10-exp_gcode0) */        exp = sub(cod_gain_exp, exp_gcode0, pOverflow) + 10;        gain_cod_unq = shl(cod_gain_frac, exp, pOverflow);        /* run quantization with modified criterion */        gain_cod_index = MR795_gain_code_quant_mod(                             *gain_pit, exp_gcode0, gcode0,                             frac_en, exp_en, alpha, gain_cod_unq,                             gain_cod, qua_ener_MR122, qua_ener, common_amr_tbls->qua_gain_code_ptr,                             pOverflow); /* function result */    }    *(*anap)++ = gain_pit_index;    *(*anap)++ = gain_cod_index;}
开发者ID:acassis,项目名称:emlinux-ssd1935,代码行数:100,


示例24: Cor_h_D

static void Cor_h_D(     Word16 *H,         /* (i) Q12 :Impulse response of filters */     Word16 *rr         /* (o)     :Correlations of H[]         */){  Word16 *rri0i0, *rri1i1, *rri2i2, *rri3i3, *rri4i4;  Word16 *rri0i1, *rri0i2, *rri0i3, *rri0i4;  Word16 *rri1i2, *rri1i3, *rri1i4;  Word16 *rri2i3, *rri2i4;  Word16 *p0, *p1, *p2, *p3, *p4;  Word16 *ptr_hd, *ptr_hf, *ptr_h1, *ptr_h2;  Word32 cor;  Word16 i, k, ldec, l_fin_sup, l_fin_inf;  Word16 h[L_SUBFR];  Word32 L_tmp;  Word16 lsym; /* Scaling h[] for maximum precision */  cor = 0;  for(i=0; i<L_SUBFR; i++)    cor = L_mac(cor, H[i], H[i]);  L_tmp = L_sub(extract_h(cor),32000);  if(L_tmp>0L )  {    for(i=0; i<L_SUBFR; i++) {      h[i] = shr(H[i], 1);}  }  else  {    k = norm_l(cor);    k = shr(k, 1);    for(i=0; i<L_SUBFR; i++) {      h[i] = shl(H[i], k); }  } /*-----------------------------------------------------------------*  * In case of G729 mode, nine cross correlations has to be         *  * calculated, namely the following:                               *  *                                                                 *  * rri0i1[],                                                       *  * rri0i2[],   rri1i2[],                                           *  * rri0i3[],   rri1i3[],  rri2i3[],                                *  * rri0i4[],   rri1i4[],  rri2i4[],                                *  *                                                                 *  * In case of G729 on 6.4 kbps mode, three of the above nine cross *//.........这里部分代码省略.........
开发者ID:SibghatullahSheikh,项目名称:codecs,代码行数:101,


示例25: sub

/* * Decompose CWallet transaction to model transaction records. */QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *wallet, const CWalletTx &wtx){    QList<TransactionRecord> parts;    int64_t nTime = wtx.GetTxTime();    CAmount nCredit = wtx.GetCredit(ISMINE_ALL);    CAmount nDebit = wtx.GetDebit(ISMINE_ALL);    CAmount nNet = nCredit - nDebit;    uint256 hash = wtx.GetHash();    std::map<std::string, std::string> mapValue = wtx.mapValue;    if (nNet > 0 || wtx.IsCoinBase())    {        //        // Credit        //        for(unsigned int i = 0; i < wtx.tx->vout.size(); i++)        {            const CTxOut& txout = wtx.tx->vout[i];            isminetype mine = wallet->IsMine(txout);            if(mine)            {                TransactionRecord sub(hash, nTime);                CTxDestination address;                sub.idx = i; // vout index                sub.credit = txout.nValue;                sub.involvesWatchAddress = mine & ISMINE_WATCH_ONLY;                if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*wallet, address))                {                    // Received by Bitcoin Address                    sub.type = TransactionRecord::RecvWithAddress;                    sub.address = CBitcoinAddress(address).ToString();                }                else                {                    // Received by IP connection (deprecated features), or a multisignature or other non-simple transaction                    sub.type = TransactionRecord::RecvFromOther;                    sub.address = mapValue["from"];                }                if (wtx.IsCoinBase())                {                    // Generated                    sub.type = TransactionRecord::Generated;                }                parts.append(sub);            }        }    }    else    {        bool involvesWatchAddress = false;        isminetype fAllFromMe = ISMINE_SPENDABLE;        for (const CTxIn& txin : wtx.tx->vin)        {            isminetype mine = wallet->IsMine(txin);            if(mine & ISMINE_WATCH_ONLY) involvesWatchAddress = true;            if(fAllFromMe > mine) fAllFromMe = mine;        }        isminetype fAllToMe = ISMINE_SPENDABLE;        for (const CTxOut& txout : wtx.tx->vout)        {            isminetype mine = wallet->IsMine(txout);            if(mine & ISMINE_WATCH_ONLY) involvesWatchAddress = true;            if(fAllToMe > mine) fAllToMe = mine;        }        if (fAllFromMe && fAllToMe)        {            // Payment to self            CAmount nChange = wtx.GetChange();            parts.append(TransactionRecord(hash, nTime, TransactionRecord::SendToSelf, "",                            -(nDebit - nChange), nCredit - nChange));            parts.last().involvesWatchAddress = involvesWatchAddress;   // maybe pass to TransactionRecord as constructor argument        }        else if (fAllFromMe)        {            //            // Debit            //            CAmount nTxFee = nDebit - wtx.tx->GetValueOut();            for (unsigned int nOut = 0; nOut < wtx.tx->vout.size(); nOut++)            {                const CTxOut& txout = wtx.tx->vout[nOut];                TransactionRecord sub(hash, nTime);                sub.idx = nOut;                sub.involvesWatchAddress = involvesWatchAddress;                if(wallet->IsMine(txout))                {                    // Ignore parts sent to self, as this is usually the change                    // from a transaction sent back to our own address.                    continue;                }//.........这里部分代码省略.........
开发者ID:bsjung,项目名称:bitcoin,代码行数:101,


示例26: ACELP_CodebookD

Word16  ACELP_CodebookD(  /* (o)     :index of pulses positions    */  Word16 x[],            /* (i)     :Target vector                */  Word16 h[],            /* (i) Q12 :Impulse response of filters  */  Word16 T0,             /* (i)     :Pitch lag                    */  Word16 pitch_sharp,    /* (i) Q14 :Last quantized pitch gain    */  Word16 i_subfr,        /* (i)     :Indicator of 1st subframe,   */  Word16 code[],         /* (o) Q13 :Innovative codebook          */  Word16 y[],            /* (o) Q12 :Filtered innovative codebook */  Word16 *sign           /* (o)     :Signs of 4 pulses            */){  Word16 i, index, sharp;  Word16 Dn[L_SUBFR];  Word16 rr[DIM_RR]; /*-----------------------------------------------------------------*  * Include fixed-gain pitch contribution into impulse resp. h[]    *  * Find correlations of h[] needed for the codebook search.        *  *-----------------------------------------------------------------*/  sharp = shl(pitch_sharp, 1);          /* From Q14 to Q15 */  if (sub(T0, L_SUBFR)<0)     for (i = T0; i < L_SUBFR; i++){    /* h[i] += pitch_sharp*h[i-T0] */       h[i] = add(h[i], mult(h[i-T0], sharp));     }  Cor_h_D(h, rr); /*-----------------------------------------------------------------*  * Compute correlation of target vector with impulse response.     *  *-----------------------------------------------------------------*/  Cor_h_X(h, x, Dn); /*-----------------------------------------------------------------*  * Find innovative codebook.                                       *  *-----------------------------------------------------------------*/  if (sub(CODEC_MODE, 2) == 0)      index = D4i40_17(Dn, rr, h, code, y, sign, i_subfr);  else if (sub(CODEC_MODE, 1) == 0)    index = D2i40_11(Dn, rr, h, code, y, sign);  else {    fprintf(stderr, "CODEC mode invalid/n");    exit(-1);  } /*-----------------------------------------------------------------*  * Compute innovation vector gain.                                 *  * Include fixed-gain pitch contribution into code[].              *//.........这里部分代码省略.........
开发者ID:SibghatullahSheikh,项目名称:codecs,代码行数:101,


示例27: divide

int divide(struct NUMBER *a,struct NUMBER *b,struct NUMBER *c,struct NUMBER *d){	int k,res = 0;	struct NUMBER tmp_a,n,m,l,abs_a,abs_b;	copyNumber(a,&tmp_a);//aが破
C++ subString函数代码示例
C++ styled函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。