summaryrefslogtreecommitdiff
path: root/apps/codecs/libatrac/atrac3.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libatrac/atrac3.c')
-rw-r--r--apps/codecs/libatrac/atrac3.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/apps/codecs/libatrac/atrac3.c b/apps/codecs/libatrac/atrac3.c
index 467f42f161..5ff3a8587b 100644
--- a/apps/codecs/libatrac/atrac3.c
+++ b/apps/codecs/libatrac/atrac3.c
@@ -628,8 +628,21 @@ static int addTonalComponents (int32_t *pSpectrum, int numComponents, tonal_comp
628 return lastPos; 628 return lastPos;
629} 629}
630 630
631 631/**
632#define INTERPOLATE(old,new,nsample) ((old*ONE_16) + fixmul16(((nsample*ONE_16)>>3), (((new) - (old))*ONE_16))) 632 * Linear equidistant interpolation between two points x and y. 7 interpolation
633 * points can be calculated. Result is scaled by <<16.
634 * Result for s=0 is x*ONE_16
635 * Result for s=8 is y*ONE_16
636 *
637 * @param x first input point
638 * @param y second input point
639 * @param s index of interpolation point (0..7)
640 */
641
642/*
643#define INTERPOLATE(x, y, s) ((x*ONE_16) + fixmul16(((s*ONE_16)>>3), (((x) - (y))*ONE_16)))
644*/
645#define INTERPOLATE(x, y, s) ((((x)<<3) + s*((y)-(x)))<<13)
633 646
634static void reverseMatrixing(int32_t *su1, int32_t *su2, int *pPrevCode, int *pCurrCode) 647static void reverseMatrixing(int32_t *su1, int32_t *su2, int *pPrevCode, int *pCurrCode)
635{ 648{
@@ -695,14 +708,14 @@ static void reverseMatrixing(int32_t *su1, int32_t *su2, int *pPrevCode, int *pC
695} 708}
696 709
697static void getChannelWeights (int indx, int flag, int32_t ch[2]){ 710static void getChannelWeights (int indx, int flag, int32_t ch[2]){
698 if (indx == 7) { 711 /* Read channel weights from table */
699 ch[0] = ONE_16; 712 if (flag) {
700 ch[1] = ONE_16; 713 /* Swap channel weights */
714 ch[1] = channelWeights0[indx&7];
715 ch[0] = channelWeights1[indx&7];
701 } else { 716 } else {
702 ch[0] = fixdiv16(((indx & 7)*ONE_16), 7*ONE_16); 717 ch[0] = channelWeights0[indx&7];
703 ch[1] = fastSqrt((ONE_16 << 1) - fixmul16(ch[0], ch[0])); 718 ch[1] = channelWeights1[indx&7];
704 if(flag)
705 FFSWAP(int32_t, ch[0], ch[1]);
706 } 719 }
707} 720}
708 721