本文整理汇总了C++中MULT函数的典型用法代码示例。如果您正苦于以下问题:C++ MULT函数的具体用法?C++ MULT怎么用?C++ MULT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MULT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalcBandEnergyMS
void CalcBandEnergyMS(const float *mdctSpectrumLeft,
const float *mdctSpectrumRight,
const int *bandOffset,
const int numBands,
float *bandEnergyMid,
float *bandEnergyMidSum,
float *bandEnergySide,
float *bandEnergySideSum) {
int i, j;
COUNT_sub_start("CalcBandEnergyMS");
MOVE(3);
j = 0;
*bandEnergyMidSum = 0.0f;
*bandEnergySideSum = 0.0f;
PTR_INIT(5); /* pointers for bandEnergyMid[],
bandEnergySide[],
bandOffset[],
mdctSpectrumLeft[],
mdctSpectrumRight[]
*/
LOOP(1);
for(i=0; i<numBands; i++) {
MOVE(2);
bandEnergyMid[i] = 0.0f;
bandEnergySide[i] = 0.0f;
LOOP(1);
while (j < bandOffset[i+1]) {
float specm, specs;
ADD(2);
MULT(2);
specm = 0.5f * (mdctSpectrumLeft[j] + mdctSpectrumRight[j]);
specs = 0.5f * (mdctSpectrumLeft[j] - mdctSpectrumRight[j]);
MAC(2);
STORE(2);
bandEnergyMid[i] += specm * specm;
bandEnergySide[i] += specs * specs;
j++;
}
ADD(2);
STORE(2);
*bandEnergyMidSum += bandEnergyMid[i];
*bandEnergySideSum += bandEnergySide[i];
}
COUNT_sub_end();
}
示例2: atan
/*****************************************************************************
functionname: atan_approx
description: Calculates atan , val >=0
returns: approx of atan(val), error is less then 0.5 %
input:
output:
*****************************************************************************/
static float atan_approx(float val)
{
COUNT_sub_start("atan_approx");
ADD(1); BRANCH(1);
if(val < (float)1.0)
{
DIV(1); MULT(2); ADD(1); /* counting post-operations */
COUNT_sub_end();
return(val/((float)1.0f+(float)0.280872f*val*val));
}
else
{
DIV(1); MULT(1); ADD(2); /* counting post-operations */
COUNT_sub_end();
return((float)1.57079633f-val/((float)0.280872f +val*val));
}
}
示例3: AdvanceARFilter
static void
AdvanceARFilter( IIR_FILTER *iirFilter,
float input
)
{
int j;
float y;
int ptr = iirFilter->ptr;
int i = ptr + (BUFFER_SIZE-1);
COUNT_sub_start("AdvanceARFilter");
INDIRECT(1); MOVE(1); ADD(1); /* counting previous operations */
INDIRECT(2); MULT(1); ADD(1);
y = input + (iirFilter->coeffIIRb[1] * (-iirFilter->ring_buf_2[i & (BUFFER_SIZE-1)]));
PTR_INIT(4); /* iirFilter->noOffCoeffs
iirFilter->coeffIIRb[]
iirFilter->ring_buf_2[i]
iirFilter->ring_buf_2[ptr]
*/
LOOP(1);
for (j=2; j<iirFilter->noOffCoeffs; j++) {
i--;
MULT(1); MAC(1);
y += (iirFilter->coeffIIRb[j] * (-iirFilter->ring_buf_2[i & (BUFFER_SIZE-1)]));
}
MOVE(1);
iirFilter->ring_buf_2[ptr] = y;
/* pointer update */
iirFilter->ptr = (ptr+1) & (BUFFER_SIZE-1);
COUNT_sub_end();
}
示例4: inverseModulation
/*
*
* \brief Perform complex-valued inverse modulation of the subband
* samples stored in rSubband (real part) and iSubband (imaginary
* part) and stores the result in timeOut
*
*/
static void
inverseModulation (float *qmfReal,
float *qmfImag,
HANDLE_SBR_QMF_FILTER_BANK synQmf
)
{
int i, no_synthesis_channels, M;
float r1, i1, r2, i2;
COUNT_sub_start("inverseModulation");
INDIRECT(1); MOVE(1);
no_synthesis_channels = synQmf->no_channels;
MULT(1);
M = no_synthesis_channels / 2;
PTR_INIT(2); /* pointer for qmfReal[],
qmfImag[] */
INDIRECT(1); LOOP(1);
for (i = synQmf->usb; i < no_synthesis_channels; i++) {
MOVE(2);
qmfReal[i]=qmfImag[i]=0;
}
FUNC(2);
cosMod (qmfReal, synQmf);
FUNC(2);
sinMod (qmfImag, synQmf);
PTR_INIT(4); /* pointer for qmfReal[],
qmfImag[],
qmfImag[no_synthesis_channels - 1 - i],
qmfReal[no_synthesis_channels - i - 1] */
LOOP(1);
for (i = 0; i < M; i++) {
MOVE(4);
r1 = qmfReal[i];
i2 = qmfImag[no_synthesis_channels - 1 - i];
r2 = qmfReal[no_synthesis_channels - i - 1];
i1 = qmfImag[i];
ADD(4); STORE(4);
qmfReal[i] = (r1 - i1);
qmfImag[no_synthesis_channels - 1 - i] = -(r1 + i1);
qmfReal[no_synthesis_channels - i - 1] = (r2 - i2);
qmfImag[i] = -(r2 + i2);
}
COUNT_sub_end();
}
示例5: sbrForwardModulationLP
/*
*
* \brief Perform real-valued forward modulation of the time domain
* data of timeIn and stores the real part of the subband
* samples in rSubband
*
*/
static void
sbrForwardModulationLP (const float *timeIn,
float *rSubband,
HANDLE_SBR_QMF_FILTER_BANK qmfBank
)
{
int i, L, M;
COUNT_sub_start("sbrForwardModulationLP");
MOVE(1);
L = NO_ANALYSIS_CHANNELS;
MULT(1);
M = L/2;
PTR_INIT(1); /* pointers for rSubband[] */
MULT(1); MOVE(1);
rSubband[0] = timeIn[3 * M];
PTR_INIT(2); /* pointers for timeIn[3 * M - i],
timeIn[3 * M + i] */
LOOP(1);
for (i = 1; i < M; i++) {
ADD(1); STORE(1);
rSubband[i] = timeIn[3 * M - i] + timeIn[3 * M + i];
}
LOOP(1);
for (i = M; i < L; i++) {
ADD(1); STORE(1);
rSubband[i] = timeIn[3 * M - i] - timeIn[i - M];
}
FUNC(3);
dct3 (rSubband, L, qmfBank);
COUNT_sub_end();
}
示例6: main
int main(int argc, char *argv[]){
if (argc > 1 && atoi(argv[1]) > 10) limit = atoi(argv[1]);
clock_t start, end;
srand(clock());
M = rand() % limit/2 + limit/2;
N = rand() % limit/2 + limit/2;
O = (rand() % limit/8 + 1 + limit/16) * 4;
float* A = random_matrix(M, N, 10);
float* B = random_matrix(N, O, 10);
float* C = malloc(sizeof(float) * M * O);
float* D;
printf("Generadas dos matrices aleatorias de (%zu x %zu) y (%zu x %zu)\n", M, N, N, O);
if (print) {
print_matrix(A, M, N);
printf("\n");
print_matrix(B, N, O);
printf("\n");
}
start = clock();
D = MULT(A, B, M, N, O);
end = clock();
printf("RESULTADO FUERZA BRUTA: (%f)\n", ((double)(end - start))/CLOCKS_PER_SEC);
if (print) print_matrix(D, M, O);
start = clock();
SIMD_MULT(A, B, C, M, N, O);
end = clock();
printf("RESULTADO SIMD: (%f)\n", ((double)(end - start))/CLOCKS_PER_SEC);
if (print) print_matrix(C, M, O);
if (equal_mtrx(C, D, M*O)) printf("Son iguales!\n");
else printf("NO son iguales!\n");
free(A);
free(B);
free(C);
free(D);
}
示例7: BarcLineValue
/*****************************************************************************
functionname: BarcLineValue
description: Calculates barc value for one frequency line
returns: barc value of line
input: number of lines in transform, index of line to check, Fs
output:
*****************************************************************************/
static float BarcLineValue(int noOfLines, int fftLine, long samplingFreq) {
float center_freq, temp, bvalFFTLine;
COUNT_sub_start("BarcLineValue");
/*
center frequency of fft line
*/
MULT(2); DIV(1);
center_freq = (float) fftLine * ((float)samplingFreq * (float)0.5f)/(float)noOfLines;
MULT(1); FUNC(1);
temp = (float) atan_approx((float)1.3333333e-4f * center_freq);
MULT(4); ADD(1); FUNC(1);
bvalFFTLine = (float)13.3f * atan_approx((float)0.00076f * center_freq) + (float)3.5f * temp * temp;
COUNT_sub_end();
return(bvalFFTLine);
}
示例8: SpreadingMax
void SpreadingMax(const int pbCnt,
const float *maskLowFactor,
const float *maskHighFactor,
float *pbSpreadedEnergy)
{
int i;
COUNT_sub_start("SpreadingMax");
/* slope to higher frequencies */
PTR_INIT(2); /* pointers for pbSpreadedEnergy[],
maskHighFactor[]
*/
LOOP(1);
for (i=1; i<pbCnt; i++) {
MULT(1); ADD(1); BRANCH(1); MOVE(1);
pbSpreadedEnergy[i] = max(pbSpreadedEnergy[i],
maskHighFactor[i] * pbSpreadedEnergy[i-1]);
}
/* slope to lower frequencies */
PTR_INIT(2); /* pointers for pbSpreadedEnergy[],
maskLowFactor[]
*/
LOOP(1);
for (i=pbCnt-2; i>=0; i--) {
MULT(1); ADD(1); BRANCH(1); MOVE(1);
pbSpreadedEnergy[i] = max(pbSpreadedEnergy[i],
maskLowFactor[i] * pbSpreadedEnergy[i+1]);
}
COUNT_sub_end();
}
示例9: apply_window
static void apply_window(const float *buf, const float *win1,
const float *win2, float *sum1, float *sum2, int len)
{
const vector float *win1a = (const vector float *) win1;
const vector float *win2a = (const vector float *) win2;
const vector float *bufa = (const vector float *) buf;
vector float *sum1a = (vector float *) sum1;
vector float *sum2a = (vector float *) sum2;
vector float av_uninit(v0), av_uninit(v4);
vector float v1, v2, v3;
len = len >> 2;
#define MULT(a, b) \
{ \
v1 = vec_ld(a, win1a); \
v2 = vec_ld(b, win2a); \
v3 = vec_ld(a, bufa); \
v0 = vec_madd(v3, v1, v0); \
v4 = vec_madd(v2, v3, v4); \
}
while (len--)
{
v0 = vec_xor(v0, v0);
v4 = vec_xor(v4, v4);
MULT( 0, 0);
MULT( 256, 64);
MULT( 512, 128);
MULT( 768, 192);
MULT(1024, 256);
MULT(1280, 320);
MULT(1536, 384);
MULT(1792, 448);
vec_st(v0, 0, sum1a);
vec_st(v4, 0, sum2a);
sum1a++;
sum2a++;
win1a++;
win2a++;
bufa++;
}
}
示例10: IIR32GetResamplerFeed
int
IIR32GetResamplerFeed( int blockSizeOut)
{
int size;
COUNT_sub_start("IIR32GetResamplerFeed");
MULT(1);
size = blockSizeOut * 3;
DIV(1);
size /= 2;
COUNT_sub_end();
return size;
}
示例11: getCrc
/*
\brief crc
*/
static int
getCrc (HANDLE_BIT_BUFFER hBitBuf, unsigned long NrBits)
{
int i;
int CrcStep = NrBits / MAXCRCSTEP;
int CrcNrBitsRest = (NrBits - CrcStep * MAXCRCSTEP);
unsigned long bValue;
CRC_BUFFER CrcBuf;
FLC_sub_start("getCrc");
DIV(1); MULT(1); ADD(1); /* counting previous operations */
MOVE(3);
CrcBuf.crcState = SBR_CRC_START;
CrcBuf.crcPoly = SBR_CRC_POLY;
CrcBuf.crcMask = SBR_CRC_MASK;
LOOP(1);
for (i = 0; i < CrcStep; i++) {
FUNC(2);
bValue = getbits (hBitBuf, MAXCRCSTEP);
PTR_INIT(1); FUNC(3);
calcCRC (&CrcBuf, bValue, MAXCRCSTEP);
}
FUNC(2);
bValue = getbits (hBitBuf, CrcNrBitsRest);
PTR_INIT(1); FUNC(3);
calcCRC (&CrcBuf, bValue, CrcNrBitsRest);
LOGIC(1); /* counting post operation */
FLC_sub_end();
return (CrcBuf.crcState & SBR_CRC_RANGE);
}
示例12: calcBitSave
static float calcBitSave(float fillLevel,
const float clipLow,
const float clipHigh,
const float minBitSave,
const float maxBitSave)
{
float bitsave;
COUNT_sub_start("calcBitSave");
ADD(2); BRANCH(2); MOVE(2);
fillLevel = max(fillLevel, clipLow);
fillLevel = min(fillLevel, clipHigh);
ADD(4); DIV(1); MULT(1);
bitsave = maxBitSave - ((maxBitSave-minBitSave) / (clipHigh-clipLow)) *
(fillLevel-clipLow);
COUNT_sub_end();
return (bitsave);
}
示例13: calcBitSpend
static float calcBitSpend(float fillLevel,
const float clipLow,
const float clipHigh,
const float minBitSpend,
const float maxBitSpend)
{
float bitspend;
COUNT_sub_start("calcBitSpend");
ADD(2); BRANCH(2); MOVE(2);
fillLevel = max(fillLevel, clipLow);
fillLevel = min(fillLevel, clipHigh);
ADD(4); DIV(1); MULT(1);
bitspend = minBitSpend + ((maxBitSpend-minBitSpend) / (clipHigh-clipLow)) *
(fillLevel-clipLow);
COUNT_sub_end();
return (bitspend);
}
示例14: AdvanceIIRFilter
static float
AdvanceIIRFilter(IIR_FILTER *iirFilter,
float input
)
{
float y = 0.0f;
int j = 0;
int i;
COUNT_sub_start("AdvanceIIRFilter");
MOVE(2); /* counting previous operations */
INDIRECT(1); MOVE(1);
iirFilter->ring_buf_1[iirFilter->ptr] = input;
PTR_INIT(4); /* pointer for iirFilter->ring_buf_1,
iirFilter->ring_buf_2,
iirFilter->coeffIIRa,
iirFilter->coeffIIRb
*/
ADD(1); LOOP(1);
for (i = iirFilter->ptr; i > iirFilter->ptr - iirFilter->noOffCoeffs; i--, j++) {
MULT(2); ADD(1);
y += iirFilter->coeffIIRa[j] * iirFilter->ring_buf_1[i & (BUFFER_SIZE - 1)] - iirFilter->coeffIIRb[j] * iirFilter->ring_buf_2[i & (BUFFER_SIZE - 1)];
}
MOVE(1);
iirFilter->ring_buf_2[(iirFilter->ptr) & (BUFFER_SIZE - 1)] = y;
iirFilter->ptr = (iirFilter->ptr+1) & (BUFFER_SIZE - 1);
COUNT_sub_end();
return y;
}
示例15: ImportRow
static WEBP_INLINE void ImportRow(const uint8_t* const src,
WebPRescaler* const wrk) {
int x_in = 0;
int x_out;
int accum = 0;
if (!wrk->x_expand) {
int sum = 0;
for (x_out = 0; x_out < wrk->dst_width; ++x_out) {
accum += wrk->x_add;
for (; accum > 0; accum -= wrk->x_sub) {
sum += src[x_in++];
}
{ // Emit next horizontal pixel.
const int32_t base = src[x_in++];
const int32_t frac = base * (-accum);
wrk->frow[x_out] = (sum + base) * wrk->x_sub - frac;
// fresh fractional start for next pixel
sum = MULT(frac, wrk->fx_scale);
}
}
} else { // simple bilinear interpolation
int left = src[0], right = src[0];
for (x_out = 0; x_out < wrk->dst_width; ++x_out) {
if (accum < 0) {
left = right;
right = src[++x_in];
accum += wrk->x_add;
}
wrk->frow[x_out] = right * wrk->x_add + (left - right) * accum;
accum -= wrk->x_sub;
}
}
// Accumulate the new row's contribution
for (x_out = 0; x_out < wrk->dst_width; ++x_out) {
wrk->irow[x_out] += wrk->frow[x_out];
}
}