55 using namespace soundtouch;
58 #define min(a,b) ((a > b) ? b : a)
59 #define max(a,b) ((a < b) ? b : a)
71 #define MAX_SCAN_DELTA 124
75 { 124, 186, 248, 310, 372, 434, 496, 558, 620, 682, 744, 806,
76 868, 930, 992, 1054, 1116, 1178, 1240, 1302, 1364, 1426, 1488, 0},
77 {-100, -75, -50, -25, 25, 50, 75, 100, 0, 0, 0, 0,
78 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
79 { -20, -15, -10, -5, 5, 10, 15, 20, 0, 0, 0, 0,
80 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
81 { -4, -3, -2, -1, 1, 2, 3, 4, 0, 0, 0, 0,
82 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
102 setParameters(44100, DEFAULT_SEQUENCE_MS, DEFAULT_SEEKWINDOW_MS, DEFAULT_OVERLAP_MS);
125 return (
int)(log(value) / log(2.0) + 0.5);
140 uint aSeekWindowMS,
uint aOverlapMS)
367 uint scanCount, corrOffset, tempOffset;
383 for (scanCount = 0;scanCount < 4; scanCount ++)
388 tempOffset = corrOffset +
scanOffsets[scanCount][j];
399 bestOffs = tempOffset;
403 corrOffset = bestOffs;
463 uint scanCount, corrOffset, tempOffset;
479 for (scanCount = 0;scanCount < 4; scanCount ++)
484 tempOffset = corrOffset +
scanOffsets[scanCount][j];
495 bestOffs = tempOffset;
499 corrOffset = bestOffs;
530 for (tempOffset = 0; tempOffset <
seekLength; tempOffset ++)
532 compare = refPos + tempOffset;
542 bestOffs = tempOffset;
563 uint scanCount, corrOffset, tempOffset;
579 for (scanCount = 0;scanCount < 4; scanCount ++)
584 tempOffset = corrOffset +
scanOffsets[scanCount][j];
595 bestOffs = tempOffset;
599 corrOffset = bestOffs;
638 if (
channels == numChannels)
return;
640 assert(numChannels >= 1 && numChannels <= MULTICHANNEL);
642 assert(numChannels == 1 || numChannels == 2);
686 uint ovlSkip, offset;
791 void * TDStretch::operator
new(
size_t s)
807 if (uExtensions & MM_SSE3)
815 if (uExtensions & MM_SSE2)
835 #ifdef INTEGER_SAMPLES
854 *dest++ = (short)(temp2);
922 const short *ip = input;
980 corr += (mixingPos[i] * compare[i] +
1003 #endif // INTEGER_SAMPLES
1010 #ifdef FLOAT_SAMPLES
1044 temp2 = (float)(*src++ * temp);
1079 fi = (float)i * fScale;
1081 output[cnt2 + 0] = input[cnt2 + 0] * fi +
pMidBuffer[cnt2 + 0] * fTemp;
1082 output[cnt2 + 1] = input[cnt2 + 1] * fi +
pMidBuffer[cnt2 + 1] * fTemp;
1092 const float *ip = input;
1101 fi = (float)i * fScale;
1103 *op++ = (*ip++ * fi + *md++ * temp);
1114 if (newOvl < 16) newOvl = 16;
1117 newOvl -= newOvl % 8;
1132 corr += mixingPos[i] * compare[i];
1147 corr += mixingPos[i] * compare[i] +
1148 mixingPos[i + 1] * compare[i + 1];
1163 corr += mixingPos[i] * compare[i];
1170 #endif // FLOAT_SAMPLES