summaryrefslogtreecommitdiffstats
path: root/embdrv
diff options
context:
space:
mode:
authorMatthew Xie <mattx@google.com>2012-09-18 16:14:30 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-09-18 16:14:30 -0700
commitad2d45b15aae80ba254277c3d1fa036207d8b926 (patch)
tree27ebefd16a44995abb1b16e5c279a1bd169cf0f5 /embdrv
parentcc914cffd521b2e6e1be804c82aea2388b843ebf (diff)
downloadexternal_bluetooth_bluedroid-ad2d45b15aae80ba254277c3d1fa036207d8b926.zip
external_bluetooth_bluedroid-ad2d45b15aae80ba254277c3d1fa036207d8b926.tar.gz
external_bluetooth_bluedroid-ad2d45b15aae80ba254277c3d1fa036207d8b926.tar.bz2
Revert "Header file and whitespace cleanups"
This reverts commit cc914cffd521b2e6e1be804c82aea2388b843ebf More changes in the original CL after my cherry-pick. Change-Id: Ic144dba96aeb8a60611baac7565c9f628ab8f9eb
Diffstat (limited to 'embdrv')
-rw-r--r--embdrv/sbc/encoder/include/sbc_encoder.h12
-rw-r--r--embdrv/sbc/encoder/include/sbc_if.h2
-rw-r--r--embdrv/sbc/encoder/srce/sbc_analysis.c38
-rw-r--r--embdrv/sbc/encoder/srce/sbc_dct.c112
-rw-r--r--embdrv/sbc/encoder/srce/sbc_dct_coeffs.c4
-rw-r--r--embdrv/sbc/encoder/srce/sbc_enc_bit_alloc_mono.c32
-rw-r--r--embdrv/sbc/encoder/srce/sbc_enc_bit_alloc_ste.c10
-rw-r--r--embdrv/sbc/encoder/srce/sbc_enc_coeffs.c8
-rw-r--r--embdrv/sbc/encoder/srce/sbc_encoder.c100
-rw-r--r--embdrv/sbc/encoder/srce/sbc_packing.c36
10 files changed, 177 insertions, 177 deletions
diff --git a/embdrv/sbc/encoder/include/sbc_encoder.h b/embdrv/sbc/encoder/include/sbc_encoder.h
index e7415ca..b348de8 100644
--- a/embdrv/sbc/encoder/include/sbc_encoder.h
+++ b/embdrv/sbc/encoder/include/sbc_encoder.h
@@ -15,8 +15,8 @@
#define SBC_ENCODER_H
#define ENCODER_VERSION "0025"
-
-#ifdef BUILDCFG
+
+#ifdef BUILDCFG
#include "bt_target.h"
#endif
@@ -60,7 +60,7 @@
#define SBC_MAX_NUM_FRAME 1
#endif
-#ifndef SBC_DSP_OPT
+#ifndef SBC_DSP_OPT
#define SBC_DSP_OPT FALSE
#endif
@@ -101,7 +101,7 @@
/* -> more MIPS required for a better audio quality. comparasion with the SIG utilities shows a division by 10 of the RMS */
/* CAUTION: It only apply in the if SBC_FAST_DCT is set to TRUE */
#ifndef SBC_IS_64_MULT_IN_IDCT
-#define SBC_IS_64_MULT_IN_IDCT FALSE
+#define SBC_IS_64_MULT_IN_IDCT FALSE
#endif /*SBC_IS_64_MULT_IN_IDCT */
/* set SBC_IS_64_MULT_IN_QUANTIZER to TRUE to use 64 bits multiplication in the quantizer */
@@ -126,7 +126,7 @@
#endif
#define MINIMUM_ENC_VX_BUFFER_SIZE (8*10*2)
-#ifndef ENC_VX_BUFFER_SIZE
+#ifndef ENC_VX_BUFFER_SIZE
#define ENC_VX_BUFFER_SIZE (MINIMUM_ENC_VX_BUFFER_SIZE + 64)
/*#define ENC_VX_BUFFER_SIZE MINIMUM_ENC_VX_BUFFER_SIZE + 1024*/
#endif
@@ -148,7 +148,7 @@ typedef struct SBC_ENC_PARAMS_TAG
SINT16 s16NumOfChannels;
SINT16 s16NumOfBlocks; /* 4, 8, 12 or 16*/
SINT16 s16AllocationMethod; /* loudness or SNR*/
- SINT16 s16BitPool; /* 16*numOfSb for mono & dual;
+ SINT16 s16BitPool; /* 16*numOfSb for mono & dual;
32*numOfSb for stereo & joint stereo */
UINT16 u16BitRate;
UINT8 u8NumPacketToEncode; /* number of sbc frame to encode. Default is 1 */
diff --git a/embdrv/sbc/encoder/include/sbc_if.h b/embdrv/sbc/encoder/include/sbc_if.h
index 59d47f3..7e4c2c5 100644
--- a/embdrv/sbc/encoder/include/sbc_if.h
+++ b/embdrv/sbc/encoder/include/sbc_if.h
@@ -24,5 +24,5 @@ int SBC_init(int pcm_sample_freq, int channels, int bits_per_sample);
return - number of bytes written to sbc_out
*/
-int SBC_write(unsigned char *pcm_in, int length, unsigned char *sbc_out);
+int SBC_write(unsigned char *pcm_in, int length, unsigned char *sbc_out);
#endif
diff --git a/embdrv/sbc/encoder/srce/sbc_analysis.c b/embdrv/sbc/encoder/srce/sbc_analysis.c
index 9e8ba7e..77f4dbe 100644
--- a/embdrv/sbc/encoder/srce/sbc_analysis.c
+++ b/embdrv/sbc/encoder/srce/sbc_analysis.c
@@ -2,7 +2,7 @@
**
** File Name: $RCSfile: sbc_analysis.c,v $
**
-** Description: This file contains the code that performs Analysis of the input
+** Description: This file contains the code that performs Analysis of the input
** audio stream.
**
** Revision : $Id: sbc_analysis.c,v 1.29 2006/04/13 17:00:37 mjougit Exp $
@@ -64,7 +64,7 @@
#define WIND_8_SUBBANDS_5_1 (SINT32)0x0209291F /* 21 et 59 = 0x0209291F */
#define WIND_8_SUBBANDS_5_2 (SINT32)0x110ECEF0 /* 37 et 43 = 0x110ECEF0 */
#define WIND_8_SUBBANDS_5_3 (SINT32)0xFF5EEB73 /* 27 et 53 = 0xFF5EEB73 */
-#define WIND_8_SUBBANDS_5_4 (SINT32)0x0034F8B6 /* 11 et 69 = 0x0034F8B6 */
+#define WIND_8_SUBBANDS_5_4 (SINT32)0x0034F8B6 /* 11 et 69 = 0x0034F8B6 */
#define WIND_8_SUBBANDS_6_0 (SINT32)0x003060F4 /* 6 et 74 = 0x003060F4 */
#define WIND_8_SUBBANDS_6_1 (SINT32)0x02138653 /* 22 et 58 = 0x02138653 */
#define WIND_8_SUBBANDS_6_2 (SINT32)0x120435FA /* 38 et 42 = 0x120435FA */
@@ -72,7 +72,7 @@
#define WIND_8_SUBBANDS_6_4 (SINT32)0x00415B75 /* 10 et 70 = 0x00415B75 */
#define WIND_8_SUBBANDS_7_0 (SINT32)0x003A72E7 /* 7 et 73 = 0x003A72E7 */
#define WIND_8_SUBBANDS_7_1 (SINT32)0x01F5F424 /* 23 et 57 = 0x01F5F424 */
-#define WIND_8_SUBBANDS_7_2 (SINT32)0x129C226F /* 39 et 41 = 0x129C226F */
+#define WIND_8_SUBBANDS_7_2 (SINT32)0x129C226F /* 39 et 41 = 0x129C226F */
#define WIND_8_SUBBANDS_7_3 (SINT32)0x01223EBA /* 25 et 55 = 0x01223EBA */
#define WIND_8_SUBBANDS_7_4 (SINT32)0x0044EF48 /* 9 et 71 = 0x0044EF48 */
#define WIND_8_SUBBANDS_8_0 (SINT32)0x0041EC6A /* 8 et 72 = 0x0041EC6A */
@@ -126,7 +126,7 @@
#define WIND_8_SUBBANDS_5_1 (SINT16)0x0209 /* 21 et 59 = 0x0209291F */
#define WIND_8_SUBBANDS_5_2 (SINT16)0x110F /* 37 et 43 = 0x110ECEF0 */
#define WIND_8_SUBBANDS_5_3 (SINT16)0xFF5F /* 27 et 53 = 0xFF5EEB73 */
-#define WIND_8_SUBBANDS_5_4 (SINT16)0x0035 /* 11 et 69 = 0x0034F8B6 */
+#define WIND_8_SUBBANDS_5_4 (SINT16)0x0035 /* 11 et 69 = 0x0034F8B6 */
#define WIND_8_SUBBANDS_6_0 (SINT16)0x0030 /* 6 et 74 = 0x003060F4 */
#define WIND_8_SUBBANDS_6_1 (SINT16)0x0214 /* 22 et 58 = 0x02138653 */
#define WIND_8_SUBBANDS_6_2 (SINT16)0x1204 /* 38 et 42 = 0x120435FA */
@@ -134,7 +134,7 @@
#define WIND_8_SUBBANDS_6_4 (SINT16)0x0041 /* 10 et 70 = 0x00415B75 */
#define WIND_8_SUBBANDS_7_0 (SINT16)0x003A /* 7 et 73 = 0x003A72E7 */
#define WIND_8_SUBBANDS_7_1 (SINT16)0x01F6 /* 23 et 57 = 0x01F5F424 */
-#define WIND_8_SUBBANDS_7_2 (SINT16)0x129C /* 39 et 41 = 0x129C226F */
+#define WIND_8_SUBBANDS_7_2 (SINT16)0x129C /* 39 et 41 = 0x129C226F */
#define WIND_8_SUBBANDS_7_3 (SINT16)0x0122 /* 25 et 55 = 0x01223EBA */
#define WIND_8_SUBBANDS_7_4 (SINT16)0x0045 /* 9 et 71 = 0x0044EF48 */
#define WIND_8_SUBBANDS_8_0 (SINT16)0x0042 /* 8 et 72 = 0x0041EC6A */
@@ -147,7 +147,7 @@
#endif
static SINT32 s32DCTY[16] = {0};
static SINT32 s32X[ENC_VX_BUFFER_SIZE/2];
-static SINT16 *s16X=(SINT16*) s32X; /* s16X must be 32 bits aligned cf SHIFTUP_X8_2*/
+static SINT16 *s16X=(SINT16*) s32X; /* s16X must be 32 bits aligned cf SHIFTUP_X8_2*/
#if (SBC_USE_ARM_PRAGMA==TRUE)
#pragma arm section zidata
#endif
@@ -951,17 +951,17 @@ void SbcAnalysisFilter4(SBC_ENC_PARAMS *pstrEncParams)
for (s32Ch=0;s32Ch<s32NumOfChannels;s32Ch++)
{
ChOffset=s32Ch*Offset2+Offset;
-
- WINDOW_PARTIAL_4
-
+
+ WINDOW_PARTIAL_4
+
SBC_FastIDCT4(s32DCTY, ps32SbBuf);
-
+
ps32SbBuf +=SUB_BANDS_4;
}
if (s32NumOfChannels==1)
{
if (ShiftCounter>=EncMaxShiftCounter)
- {
+ {
SHIFTUP_X4;
ShiftCounter=0;
}
@@ -973,7 +973,7 @@ void SbcAnalysisFilter4(SBC_ENC_PARAMS *pstrEncParams)
else
{
if (ShiftCounter>=EncMaxShiftCounter)
- {
+ {
SHIFTUP_X4_2;
ShiftCounter=0;
}
@@ -1055,17 +1055,17 @@ void SbcAnalysisFilter8 (SBC_ENC_PARAMS *pstrEncParams)
for (s32Ch=0;s32Ch<s32NumOfChannels;s32Ch++)
{
ChOffset=s32Ch*Offset2+Offset;
-
- WINDOW_PARTIAL_8
-
+
+ WINDOW_PARTIAL_8
+
SBC_FastIDCT8 (s32DCTY, ps32SbBuf);
-
+
ps32SbBuf +=SUB_BANDS_8;
}
if (s32NumOfChannels==1)
{
if (ShiftCounter>=EncMaxShiftCounter)
- {
+ {
SHIFTUP_X8;
ShiftCounter=0;
}
@@ -1077,7 +1077,7 @@ void SbcAnalysisFilter8 (SBC_ENC_PARAMS *pstrEncParams)
else
{
if (ShiftCounter>=EncMaxShiftCounter)
- {
+ {
SHIFTUP_X8_2;
ShiftCounter=0;
}
@@ -1086,7 +1086,7 @@ void SbcAnalysisFilter8 (SBC_ENC_PARAMS *pstrEncParams)
ShiftCounter+=SUB_BANDS_8;
}
}
- }
+ }
}
void SbcAnalysisInit (void)
diff --git a/embdrv/sbc/encoder/srce/sbc_dct.c b/embdrv/sbc/encoder/srce/sbc_dct.c
index ca23c70..0ff7f1f 100644
--- a/embdrv/sbc/encoder/srce/sbc_dct.c
+++ b/embdrv/sbc/encoder/srce/sbc_dct.c
@@ -22,10 +22,10 @@
** Function SBC_FastIDCT8
**
** Description implementation of fast DCT algorithm by Feig and Winograd
-**
+**
**
** Returns y = dct(pInVect)
-**
+**
**
*******************************************************************************/
@@ -86,66 +86,66 @@ void SBC_FastIDCT8(SINT32 *pInVect, SINT32 *pOutVect)
x5 = (pInVect[9] - pInVect[15]) >>1;
x6 = (pInVect[10] - pInVect[14])>>1;
x7 = (pInVect[11] - pInVect[13])>>1;
-
- /* 2-point IDCT of x0 and x4 as in (11) */
- temp = x0 ;
+
+ /* 2-point IDCT of x0 and x4 as in (11) */
+ temp = x0 ;
SBC_IDCT_MULT(SBC_COS_PI_SUR_4, ( x0 + x4 ), x0); /*x0 = ( x0 + x4 ) * cos(1*pi/4) ; */
SBC_IDCT_MULT(SBC_COS_PI_SUR_4, ( temp - x4 ), x4); /*x4 = ( temp - x4 ) * cos(1*pi/4) ; */
-
- /* rearrangement of x2 and x6 as in (15) */
+
+ /* rearrangement of x2 and x6 as in (15) */
x2 -=x6;
- x6 <<= 1 ;
-
- /* 2-point IDCT of x2 and x6 and post-multiplication as in (15) */
+ x6 <<= 1 ;
+
+ /* 2-point IDCT of x2 and x6 and post-multiplication as in (15) */
SBC_IDCT_MULT(SBC_COS_PI_SUR_4,x6, x6); /*x6 = x6 * cos(1*pi/4) ; */
- temp = x2 ;
+ temp = x2 ;
SBC_IDCT_MULT(SBC_COS_PI_SUR_8,( x2 + x6 ), x2); /*x2 = ( x2 + x6 ) * cos(1*pi/8) ; */
- SBC_IDCT_MULT(SBC_COS_3PI_SUR_8,( temp - x6 ), x6); /*x6 = ( temp - x6 ) * cos(3*pi/8) ;*/
-
- /* 4-point IDCT of x0,x2,x4 and x6 as in (11) */
- res_even[ 0 ] = x0 + x2 ;
- res_even[ 1 ] = x4 + x6 ;
- res_even[ 2 ] = x4 - x6 ;
- res_even[ 3 ] = x0 - x2 ;
-
-
- /* rearrangement of x1,x3,x5,x7 as in (15) */
- x7 <<= 1 ;
- x5 = ( x5 <<1 ) - x7 ;
- x3 = ( x3 <<1 ) - x5 ;
+ SBC_IDCT_MULT(SBC_COS_3PI_SUR_8,( temp - x6 ), x6); /*x6 = ( temp - x6 ) * cos(3*pi/8) ;*/
+
+ /* 4-point IDCT of x0,x2,x4 and x6 as in (11) */
+ res_even[ 0 ] = x0 + x2 ;
+ res_even[ 1 ] = x4 + x6 ;
+ res_even[ 2 ] = x4 - x6 ;
+ res_even[ 3 ] = x0 - x2 ;
+
+
+ /* rearrangement of x1,x3,x5,x7 as in (15) */
+ x7 <<= 1 ;
+ x5 = ( x5 <<1 ) - x7 ;
+ x3 = ( x3 <<1 ) - x5 ;
x1 -= x3 >>1 ;
-
- /* two-dimensional IDCT of x1 and x5 */
+
+ /* two-dimensional IDCT of x1 and x5 */
SBC_IDCT_MULT(SBC_COS_PI_SUR_4, x5, x5); /*x5 = x5 * cos(1*pi/4) ; */
- temp = x1 ;
- x1 = x1 + x5 ;
- x5 = temp - x5 ;
-
- /* rearrangement of x3 and x7 as in (15) */
+ temp = x1 ;
+ x1 = x1 + x5 ;
+ x5 = temp - x5 ;
+
+ /* rearrangement of x3 and x7 as in (15) */
x3 -= x7;
- x7 <<= 1 ;
+ x7 <<= 1 ;
SBC_IDCT_MULT(SBC_COS_PI_SUR_4, x7, x7); /*x7 = x7 * cos(1*pi/4) ; */
-
- /* 2-point IDCT of x3 and x7 and post-multiplication as in (15) */
- temp = x3 ;
+
+ /* 2-point IDCT of x3 and x7 and post-multiplication as in (15) */
+ temp = x3 ;
SBC_IDCT_MULT( SBC_COS_PI_SUR_8,( x3 + x7 ), x3); /*x3 = ( x3 + x7 ) * cos(1*pi/8) ; */
- SBC_IDCT_MULT( SBC_COS_3PI_SUR_8,( temp - x7 ), x7); /*x7 = ( temp - x7 ) * cos(3*pi/8) ;*/
-
- /* 4-point IDCT of x1,x3,x5 and x7 and post multiplication by diagonal matrix as in (14) */
+ SBC_IDCT_MULT( SBC_COS_3PI_SUR_8,( temp - x7 ), x7); /*x7 = ( temp - x7 ) * cos(3*pi/8) ;*/
+
+ /* 4-point IDCT of x1,x3,x5 and x7 and post multiplication by diagonal matrix as in (14) */
SBC_IDCT_MULT((SBC_COS_PI_SUR_16), ( x1 + x3 ) , res_odd[0]); /*res_odd[ 0 ] = ( x1 + x3 ) * cos(1*pi/16) ; */
SBC_IDCT_MULT((SBC_COS_3PI_SUR_16), ( x5 + x7 ) , res_odd[1]); /*res_odd[ 1 ] = ( x5 + x7 ) * cos(3*pi/16) ; */
SBC_IDCT_MULT((SBC_COS_5PI_SUR_16), ( x5 - x7 ) , res_odd[2]); /*res_odd[ 2 ] = ( x5 - x7 ) * cos(5*pi/16) ; */
SBC_IDCT_MULT((SBC_COS_7PI_SUR_16), ( x1 - x3 ) , res_odd[3]); /*res_odd[ 3 ] = ( x1 - x3 ) * cos(7*pi/16) ; */
-
- /* additions and subtractions as in (9) */
- pOutVect[0] = (res_even[ 0 ] + res_odd[ 0 ]) ;
- pOutVect[1] = (res_even[ 1 ] + res_odd[ 1 ]) ;
- pOutVect[2] = (res_even[ 2 ] + res_odd[ 2 ]) ;
- pOutVect[3] = (res_even[ 3 ] + res_odd[ 3 ]) ;
- pOutVect[7] = (res_even[ 0 ] - res_odd[ 0 ]) ;
- pOutVect[6] = (res_even[ 1 ] - res_odd[ 1 ]) ;
- pOutVect[5] = (res_even[ 2 ] - res_odd[ 2 ]) ;
- pOutVect[4] = (res_even[ 3 ] - res_odd[ 3 ]) ;
+
+ /* additions and subtractions as in (9) */
+ pOutVect[0] = (res_even[ 0 ] + res_odd[ 0 ]) ;
+ pOutVect[1] = (res_even[ 1 ] + res_odd[ 1 ]) ;
+ pOutVect[2] = (res_even[ 2 ] + res_odd[ 2 ]) ;
+ pOutVect[3] = (res_even[ 3 ] + res_odd[ 3 ]) ;
+ pOutVect[7] = (res_even[ 0 ] - res_odd[ 0 ]) ;
+ pOutVect[6] = (res_even[ 1 ] - res_odd[ 1 ]) ;
+ pOutVect[5] = (res_even[ 2 ] - res_odd[ 2 ]) ;
+ pOutVect[4] = (res_even[ 3 ] - res_odd[ 3 ]) ;
#else
UINT8 Index, k;
SINT32 temp;
@@ -171,16 +171,16 @@ void SBC_FastIDCT8(SINT32 *pInVect, SINT32 *pOutVect)
** Function SBC_FastIDCT4
**
** Description implementation of fast DCT algorithm by Feig and Winograd
-**
+**
**
** Returns y = dct(x0)
-**
+**
**
*******************************************************************************/
void SBC_FastIDCT4(SINT32 *pInVect, SINT32 *pOutVect)
{
#if (SBC_FAST_DCT == TRUE)
-#if (SBC_ARM_ASM_OPT==TRUE)
+#if (SBC_ARM_ASM_OPT==TRUE)
#else
#if (SBC_IPAQ_OPT==TRUE)
#if (SBC_IS_64_MULT_IN_IDCT == TRUE)
@@ -211,10 +211,10 @@ void SBC_FastIDCT4(SINT32 *pInVect, SINT32 *pOutVect)
SBC_IDCT_MULT((SBC_COS_PI_SUR_8>>1), temp , tmp[4]);
tmp[6]=tmp[2]+tmp[5];
tmp[7]=tmp[3]-tmp[4];
- pOutVect[0] = (tmp[0]+tmp[6]);
- pOutVect[1] = (tmp[1]+tmp[7]);
- pOutVect[2] = (tmp[1]-tmp[7]);
- pOutVect[3] = (tmp[0]-tmp[6]);
+ pOutVect[0] = (tmp[0]+tmp[6]);
+ pOutVect[1] = (tmp[1]+tmp[7]);
+ pOutVect[2] = (tmp[1]-tmp[7]);
+ pOutVect[3] = (tmp[0]-tmp[6]);
#else
UINT8 Index, k;
SINT32 temp;
@@ -229,6 +229,6 @@ void SBC_FastIDCT4(SINT32 *pInVect, SINT32 *pOutVect)
temp += ((gas16AnalDCTcoeff4[(Index*4*2)+k] * (pInVect[k] & 0xFFFF)) >> 16);
}
pOutVect[Index] = temp;
- }
+ }
#endif
}
diff --git a/embdrv/sbc/encoder/srce/sbc_dct_coeffs.c b/embdrv/sbc/encoder/srce/sbc_dct_coeffs.c
index 3711519..03f632f 100644
--- a/embdrv/sbc/encoder/srce/sbc_dct_coeffs.c
+++ b/embdrv/sbc/encoder/srce/sbc_dct_coeffs.c
@@ -15,7 +15,7 @@
#include "sbc_encoder.h"
/*DCT coeff for 4 sub-band case.*/
#if (SBC_FAST_DCT == FALSE)
-const SINT16 gas16AnalDCTcoeff4[] =
+const SINT16 gas16AnalDCTcoeff4[] =
{
(SINT16)(0.7071*32768),
(SINT16)(0.9239*32768),
@@ -55,7 +55,7 @@ const SINT16 gas16AnalDCTcoeff4[] =
};
/*DCT coeff for 8 sub-band case.*/
-const SINT16 gas16AnalDCTcoeff8[] =
+const SINT16 gas16AnalDCTcoeff8[] =
{
(SINT16)(0.7071*32768),
(SINT16)(0.8315*32768),
diff --git a/embdrv/sbc/encoder/srce/sbc_enc_bit_alloc_mono.c b/embdrv/sbc/encoder/srce/sbc_enc_bit_alloc_mono.c
index 497f014..c8b13a9 100644
--- a/embdrv/sbc/encoder/srce/sbc_enc_bit_alloc_mono.c
+++ b/embdrv/sbc/encoder/srce/sbc_enc_bit_alloc_mono.c
@@ -2,7 +2,7 @@
**
** File Name: $RCSfile: sbc_enc_bit_alloc_mono.c,v $
**
-** Description: This file contains the code for bit allocation algorithm.
+** Description: This file contains the code for bit allocation algorithm.
** It calculates the number of bits required for the encoded stream of data.
**
** Revision : $Id: sbc_enc_bit_alloc_mono.c,v 1.9 2006/03/31 17:16:35 mjougit Exp $
@@ -17,16 +17,16 @@
#include "sbc_enc_func_declare.h"
/*global arrays*/
-const SINT16 sbc_enc_as16Offset4[4][4] = { {-1, 0, 0, 0}, {-2, 0, 0, 1},
+const SINT16 sbc_enc_as16Offset4[4][4] = { {-1, 0, 0, 0}, {-2, 0, 0, 1},
{-2, 0, 0, 1}, {-2, 0, 0, 1} };
-const SINT16 sbc_enc_as16Offset8[4][8] = { {-2, 0, 0, 0, 0, 0, 0, 1},
+const SINT16 sbc_enc_as16Offset8[4][8] = { {-2, 0, 0, 0, 0, 0, 0, 1},
{-3, 0, 0, 0, 0, 0, 1, 2},
- {-4, 0, 0, 0, 0, 0, 1, 2},
+ {-4, 0, 0, 0, 0, 0, 1, 2},
{-4, 0, 0, 0, 0, 0, 1, 2} };
/****************************************************************************
* BitAlloc - Calculates the required number of bits for the given scale factor
-* and the number of subbands.
+* and the number of subbands.
*
* RETURNS : N/A
*/
@@ -78,8 +78,8 @@ void sbc_enc_bit_alloc_mono(SBC_ENC_PARAMS *pstrCodecParams)
*(ps16GenBufPtr) = -5;
else
{
- s32Loudness =
- (SINT32)(pstrCodecParams->as16ScaleFactor[s32Ch*s32NumOfSubBands+s32Sb]
+ s32Loudness =
+ (SINT32)(pstrCodecParams->as16ScaleFactor[s32Ch*s32NumOfSubBands+s32Sb]
- *ps16GenTabPtr);
if(s32Loudness > 0)
*(ps16GenBufPtr) = (SINT16)(s32Loudness >>1);
@@ -89,7 +89,7 @@ void sbc_enc_bit_alloc_mono(SBC_ENC_PARAMS *pstrCodecParams)
ps16GenBufPtr++;
ps16GenTabPtr++;
}
-
+
}
/* max bitneed index is searched*/
@@ -112,7 +112,7 @@ void sbc_enc_bit_alloc_mono(SBC_ENC_PARAMS *pstrCodecParams)
s32BitSlice --;
s32BitCount -= s32SliceCount;
s32SliceCount = 0;
-
+
for(s32Sb=0; s32Sb<s32NumOfSubBands; s32Sb++)
{
if( (((*ps16GenBufPtr-s32BitSlice)< 16) && (*ps16GenBufPtr-s32BitSlice) >= 1))
@@ -123,17 +123,17 @@ void sbc_enc_bit_alloc_mono(SBC_ENC_PARAMS *pstrCodecParams)
s32SliceCount++;
}
ps16GenBufPtr++;
-
+
}/*end of for*/
ps16GenBufPtr = ps16BitNeed + s32Ch*s32NumOfSubBands;
}while(s32BitCount-s32SliceCount>0);
-
+
if(s32BitCount == 0)
{
s32BitCount -= s32SliceCount;
s32BitSlice --;
}
-
+
/*Bits are distributed until the last bitslice is reached*/
ps16GenArrPtr = pstrCodecParams->as16Bits+s32Ch*s32NumOfSubBands;
ps16GenBufPtr = ps16BitNeed + s32Ch*s32NumOfSubBands;
@@ -142,7 +142,7 @@ void sbc_enc_bit_alloc_mono(SBC_ENC_PARAMS *pstrCodecParams)
if(*(ps16GenBufPtr) < s32BitSlice+2)
*(ps16GenArrPtr) = 0;
else
- *(ps16GenArrPtr) = ((*(ps16GenBufPtr)-s32BitSlice)<16) ?
+ *(ps16GenArrPtr) = ((*(ps16GenBufPtr)-s32BitSlice)<16) ?
(SINT16)(*(ps16GenBufPtr)-s32BitSlice) : 16;
ps16GenBufPtr++;
@@ -159,7 +159,7 @@ void sbc_enc_bit_alloc_mono(SBC_ENC_PARAMS *pstrCodecParams)
(*(ps16GenArrPtr))++;
s32BitCount--;
}
- else if( (*(ps16GenBufPtr) == s32BitSlice+1) &&
+ else if( (*(ps16GenBufPtr) == s32BitSlice+1) &&
(s32BitCount > 1) )
{
*(ps16GenArrPtr) = 2;
@@ -170,8 +170,8 @@ void sbc_enc_bit_alloc_mono(SBC_ENC_PARAMS *pstrCodecParams)
ps16GenBufPtr++;
}
ps16GenArrPtr = pstrCodecParams->as16Bits+s32Ch*s32NumOfSubBands;
-
-
+
+
s32Sb=0;
while( (s32BitCount > 0) && (s32Sb < s32NumOfSubBands) )
{
diff --git a/embdrv/sbc/encoder/srce/sbc_enc_bit_alloc_ste.c b/embdrv/sbc/encoder/srce/sbc_enc_bit_alloc_ste.c
index cb7819b..cbcb809 100644
--- a/embdrv/sbc/encoder/srce/sbc_enc_bit_alloc_ste.c
+++ b/embdrv/sbc/encoder/srce/sbc_enc_bit_alloc_ste.c
@@ -2,7 +2,7 @@
**
** File Name: $RCSfile: sbc_enc_bit_alloc_ste.c,v $
**
-** Description: This file contains the code for bit allocation algorithm.
+** Description: This file contains the code for bit allocation algorithm.
** It calculates the number of bits required for the encoded stream of data.
**
** Revision : $Id: sbc_enc_bit_alloc_ste.c,v 1.9 2006/03/31 17:17:07 mjougit Exp $
@@ -22,7 +22,7 @@ extern const SINT16 sbc_enc_as16Offset8[4][8];
/****************************************************************************
* BitAlloc - Calculates the required number of bits for the given scale factor
-* and the number of subbands.
+* and the number of subbands.
*
* RETURNS : N/A
*/
@@ -101,7 +101,7 @@ void sbc_enc_bit_alloc_ste(SBC_ENC_PARAMS *pstrCodecParams)
s32BitCount -= s32SliceCount;
s32SliceCount = 0;
ps16GenBufPtr = ps16BitNeed;
-
+
for (s32Sb = 0; s32Sb < 2*s32NumOfSubBands; s32Sb++)
{
if ( (*ps16GenBufPtr >= s32BitSlice + 1) && (*ps16GenBufPtr < s32BitSlice + 16) )
@@ -131,7 +131,7 @@ void sbc_enc_bit_alloc_ste(SBC_ENC_PARAMS *pstrCodecParams)
if (*ps16GenBufPtr < s32BitSlice+2)
*ps16GenArrPtr = 0;
else
- *ps16GenArrPtr = ((*(ps16GenBufPtr)-s32BitSlice) < 16) ?
+ *ps16GenArrPtr = ((*(ps16GenBufPtr)-s32BitSlice) < 16) ?
(SINT16)(*(ps16GenBufPtr)-s32BitSlice):16;
ps16GenBufPtr++;
ps16GenArrPtr++;
@@ -162,7 +162,7 @@ void sbc_enc_bit_alloc_ste(SBC_ENC_PARAMS *pstrCodecParams)
s32Sb++;
ps16GenBufPtr = ps16BitNeed+s32Sb;
ps16GenArrPtr = pstrCodecParams->as16Bits+s32Sb;
-
+
}
else
{
diff --git a/embdrv/sbc/encoder/srce/sbc_enc_coeffs.c b/embdrv/sbc/encoder/srce/sbc_enc_coeffs.c
index 840e329..48cc22f 100644
--- a/embdrv/sbc/encoder/srce/sbc_enc_coeffs.c
+++ b/embdrv/sbc/encoder/srce/sbc_enc_coeffs.c
@@ -16,7 +16,7 @@
#if (SBC_ARM_ASM_OPT==FALSE && SBC_IPAQ_OPT==FALSE)
#if (SBC_IS_64_MULT_IN_WINDOW_ACCU == FALSE)
/*Window coeff for 4 sub band case*/
-const SINT16 gas32CoeffFor4SBs[] =
+const SINT16 gas32CoeffFor4SBs[] =
{
(SINT16)((SINT32)0x00000000 >> 16), (SINT16)0x00000000,
(SINT16)((SINT32)0x001194E6 >> 16), (SINT16)0x001194E6,
@@ -65,7 +65,7 @@ const SINT16 gas32CoeffFor4SBs[] =
};
/*Window coeff for 8 sub band case*/
-const SINT16 gas32CoeffFor8SBs[] =
+const SINT16 gas32CoeffFor8SBs[] =
{
(SINT16)((SINT32)0x00000000 >>16), (SINT16)0x00000000,
(SINT16)((SINT32)0x00052173 >>16), (SINT16)0x00052173,
@@ -161,7 +161,7 @@ const SINT16 gas32CoeffFor8SBs[] =
#else
/*Window coeff for 4 sub band case*/
-const SINT32 gas32CoeffFor4SBs[] =
+const SINT32 gas32CoeffFor4SBs[] =
{
(SINT32)0x00000000,
(SINT32)0x001194E6,
@@ -210,7 +210,7 @@ const SINT32 gas32CoeffFor4SBs[] =
};
/*Window coeff for 8 sub band case*/
-const SINT32 gas32CoeffFor8SBs[] =
+const SINT32 gas32CoeffFor8SBs[] =
{
(SINT32)0x00000000,
(SINT32)0x00052173,
diff --git a/embdrv/sbc/encoder/srce/sbc_encoder.c b/embdrv/sbc/encoder/srce/sbc_encoder.c
index f950f80..ce7dbb9 100644
--- a/embdrv/sbc/encoder/srce/sbc_encoder.c
+++ b/embdrv/sbc/encoder/srce/sbc_encoder.c
@@ -47,7 +47,7 @@ SINT16 EncMaxShiftCounter;
*
* if(index > 0)
* {
- * p = &u8frame[base_index];
+ * p = &u8frame[base_index];
* if((index&1)&&(u16PacketLength > (base_index+index*2)))
* {
* // odd index: swap 2 bytes
@@ -108,7 +108,7 @@ void SBC_Encoder(SBC_ENC_PARAMS *pstrEncParams)
SINT32 s32Sb; /* counter for sub-band*/
UINT32 u32Count, maxBit = 0; /* loop count*/
SINT32 s32MaxValue; /* temp variable to store max value */
-
+
SINT16 *ps16ScfL;
SINT32 *SbBuffer;
SINT32 s32Blk; /* counter for block*/
@@ -122,7 +122,7 @@ void SBC_Encoder(SBC_ENC_PARAMS *pstrEncParams)
tSBC_FR_CB *p_cur, *p_last;
UINT32 idx, tmp, tmp2;
register SINT32 s32NumOfSubBands = pstrEncParams->s16NumOfSubBands;
-
+
pstrEncParams->pu8NextPacket = pstrEncParams->pu8Packet;
#if (SBC_NO_PCM_CPY_OPTION == TRUE)
@@ -131,19 +131,19 @@ void SBC_Encoder(SBC_ENC_PARAMS *pstrEncParams)
pstrEncParams->ps16NextPcmBuffer = pstrEncParams->as16PcmBuffer;
#endif
do
- {
+ {
/* SBC ananlysis filter*/
if (s32NumOfSubBands == 4)
SbcAnalysisFilter4(pstrEncParams);
else
SbcAnalysisFilter8(pstrEncParams);
-
+
/* compute the scale factor, and save the max */
ps16ScfL = pstrEncParams->as16ScaleFactor;
s32Ch=pstrEncParams->s16NumOfChannels*s32NumOfSubBands;
pstrEncParams->ps16NextPcmBuffer+=s32Ch*s32NumOfBlocks; /* in case of multible sbc frame to encode update the pcm pointer */
-
+
for (s32Sb=0; s32Sb<s32Ch; s32Sb++)
{
SbBuffer=pstrEncParams->s32SbBuffer+s32Sb;
@@ -154,16 +154,16 @@ void SBC_Encoder(SBC_ENC_PARAMS *pstrEncParams)
s32MaxValue=abs32(*SbBuffer);
SbBuffer+=s32Ch;
}
-
+
u32Count = (s32MaxValue > 0x800000) ? 9 : 0;
-
+
for ( ; u32Count < 15; u32Count++)
{
if (s32MaxValue <= (SINT32)(0x8000 << u32Count))
break;
}
*ps16ScfL++ = (SINT16)u32Count;
-
+
if (u32Count > maxBit)
maxBit = u32Count;
}
@@ -209,30 +209,30 @@ void SBC_Encoder(SBC_ENC_PARAMS *pstrEncParams)
u32CountDiff=u32Count;
if ( (*ps16ScfL + *(ps16ScfL+s32NumOfSubBands)) > (SINT16)(u32CountSum + u32CountDiff) )
{
-
+
if (u32CountSum > maxBit)
maxBit = u32CountSum;
-
+
if (u32CountDiff > maxBit)
maxBit = u32CountDiff;
-
+
*ps16ScfL = (SINT16)u32CountSum;
*(ps16ScfL+s32NumOfSubBands) = (SINT16)u32CountDiff;
-
+
SbBuffer=pstrEncParams->s32SbBuffer+s32Sb;
pSum = s32LRSum;
pDiff = s32LRDiff;
-
+
for (s32Blk = 0; s32Blk < s32NumOfBlocks; s32Blk++)
{
- *SbBuffer = *pSum;
+ *SbBuffer = *pSum;
*(SbBuffer+s32NumOfSubBands) = *pDiff;
-
- SbBuffer += s32NumOfSubBands<<1;
+
+ SbBuffer += s32NumOfSubBands<<1;
pSum++;
pDiff++;
}
-
+
pstrEncParams->as16Join[s32Sb] = 1;
}
else
@@ -241,18 +241,18 @@ void SBC_Encoder(SBC_ENC_PARAMS *pstrEncParams)
}
ps16ScfL++;
}
- pstrEncParams->as16Join[s32Sb] = 0;
+ pstrEncParams->as16Join[s32Sb] = 0;
}
#endif
-
+
pstrEncParams->s16MaxBitNeed = (SINT16)maxBit;
-
+
/* bit allocation */
if ((pstrEncParams->s16ChannelMode == SBC_STEREO) || (pstrEncParams->s16ChannelMode == SBC_JOINT_STEREO))
sbc_enc_bit_alloc_ste(pstrEncParams);
else
sbc_enc_bit_alloc_mono(pstrEncParams);
-
+
/* save the beginning of the frame. pu8NextPacket is modified in EncPacking() */
pu8 = pstrEncParams->pu8NextPacket;
/* Quantize the encoded audio */
@@ -270,9 +270,9 @@ void SBC_Encoder(SBC_ENC_PARAMS *pstrEncParams)
SBC_PRTC_SCRMB((&pu8[sbc_prtc_cb.base]));
}
while(--(pstrEncParams->u8NumPacketToEncode));
-
+
pstrEncParams->u8NumPacketToEncode = 1; /* default is one for retrocompatibility purpose */
-
+
}
/****************************************************************************
@@ -295,7 +295,7 @@ void SBC_Encoder_Init(SBC_ENC_PARAMS *pstrEncParams)
pstrEncParams->s16NumOfChannels = 1;
else
pstrEncParams->s16NumOfChannels = 2;
-
+
/* Bit pool calculation */
if (pstrEncParams->s16SamplingFreq == SBC_sf16000)
s16SamplingFreq = 16000;
@@ -305,31 +305,31 @@ void SBC_Encoder_Init(SBC_ENC_PARAMS *pstrEncParams)
s16SamplingFreq = 44100;
else
s16SamplingFreq = 48000;
-
+
if ( (pstrEncParams->s16ChannelMode == SBC_JOINT_STEREO)
|| (pstrEncParams->s16ChannelMode == SBC_STEREO) )
{
- s16Bitpool = (SINT16)( (pstrEncParams->u16BitRate *
+ s16Bitpool = (SINT16)( (pstrEncParams->u16BitRate *
pstrEncParams->s16NumOfSubBands * 1000 / s16SamplingFreq)
- -( (32 + (4 * pstrEncParams->s16NumOfSubBands *
+ -( (32 + (4 * pstrEncParams->s16NumOfSubBands *
pstrEncParams->s16NumOfChannels)
- + ( (pstrEncParams->s16ChannelMode - 2) *
+ + ( (pstrEncParams->s16ChannelMode - 2) *
pstrEncParams->s16NumOfSubBands ) )
/ pstrEncParams->s16NumOfBlocks) );
-
+
s16FrameLen = 4 + (4*pstrEncParams->s16NumOfSubBands*
pstrEncParams->s16NumOfChannels)/8
- + ( ((pstrEncParams->s16ChannelMode - 2) *
- pstrEncParams->s16NumOfSubBands)
+ + ( ((pstrEncParams->s16ChannelMode - 2) *
+ pstrEncParams->s16NumOfSubBands)
+ (pstrEncParams->s16NumOfBlocks * s16Bitpool) ) / 8;
-
- s16BitRate = (8 * s16FrameLen * s16SamplingFreq)
- / (pstrEncParams->s16NumOfSubBands *
+
+ s16BitRate = (8 * s16FrameLen * s16SamplingFreq)
+ / (pstrEncParams->s16NumOfSubBands *
pstrEncParams->s16NumOfBlocks * 1000);
-
+
if (s16BitRate > pstrEncParams->u16BitRate)
s16Bitpool--;
-
+
if(pstrEncParams->s16NumOfSubBands == 8)
pstrEncParams->s16BitPool = (s16Bitpool > 255) ? 255 : s16Bitpool;
else
@@ -337,34 +337,34 @@ void SBC_Encoder_Init(SBC_ENC_PARAMS *pstrEncParams)
}
else
{
- s16Bitpool = (SINT16)( ((pstrEncParams->s16NumOfSubBands *
+ s16Bitpool = (SINT16)( ((pstrEncParams->s16NumOfSubBands *
pstrEncParams->u16BitRate * 1000)
/ (s16SamplingFreq * pstrEncParams->s16NumOfChannels))
- -( ( (32 / pstrEncParams->s16NumOfChannels) +
+ -( ( (32 / pstrEncParams->s16NumOfChannels) +
(4 * pstrEncParams->s16NumOfSubBands) )
/ pstrEncParams->s16NumOfBlocks ) );
-
- pstrEncParams->s16BitPool = (s16Bitpool >
+
+ pstrEncParams->s16BitPool = (s16Bitpool >
(16 * pstrEncParams->s16NumOfSubBands))
? (16*pstrEncParams->s16NumOfSubBands) : s16Bitpool;
}
-
+
if (pstrEncParams->s16BitPool < 0)
pstrEncParams->s16BitPool = 0;
/* sampling freq */
- HeaderParams = ((pstrEncParams->s16SamplingFreq & 3)<< 6);
-
+ HeaderParams = ((pstrEncParams->s16SamplingFreq & 3)<< 6);
+
/* number of blocks*/
HeaderParams |= (((pstrEncParams->s16NumOfBlocks -4) & 12) << 2);
-
+
/* channel mode: mono, dual...*/
- HeaderParams |= ((pstrEncParams->s16ChannelMode & 3)<< 2);
-
+ HeaderParams |= ((pstrEncParams->s16ChannelMode & 3)<< 2);
+
/* Loudness or SNR */
HeaderParams |= ((pstrEncParams->s16AllocationMethod & 1)<< 1);
HeaderParams |= ((pstrEncParams->s16NumOfSubBands >> 3) & 1); /*4 or 8*/
pstrEncParams->FrameHeader=HeaderParams;
-
+
if (pstrEncParams->s16NumOfSubBands==4)
{
if (pstrEncParams->s16NumOfChannels==1)
@@ -379,8 +379,8 @@ void SBC_Encoder_Init(SBC_ENC_PARAMS *pstrEncParams)
else
EncMaxShiftCounter=((ENC_VX_BUFFER_SIZE-8*10*2)>>4)<<3;
}
-
- APPL_TRACE_EVENT2("SBC_Encoder_Init : bitrate %d, bitpool %d",
+
+ APPL_TRACE_EVENT2("SBC_Encoder_Init : bitrate %d, bitpool %d",
pstrEncParams->u16BitRate, pstrEncParams->s16BitPool);
SbcAnalysisInit();
diff --git a/embdrv/sbc/encoder/srce/sbc_packing.c b/embdrv/sbc/encoder/srce/sbc_packing.c
index faa8750..55edb9b 100644
--- a/embdrv/sbc/encoder/srce/sbc_packing.c
+++ b/embdrv/sbc/encoder/srce/sbc_packing.c
@@ -2,7 +2,7 @@
**
** File Name: $RCSfile: sbc_packing.c,v $
**
-** Description: This file contains code for packing the Encoded data into bit
+** Description: This file contains code for packing the Encoded data into bit
** streams.
**
** Revision : $Id: sbc_packing.c,v 1.17 2006/04/11 17:07:03 mjougit Exp $
@@ -22,7 +22,7 @@
{ \
MUL s32OutLow,s32In1,s32In2; \
} \
-}
+}
#define Mult64(s32In1, s32In2, s32OutLow, s32OutHi) \
{ \
__asm \
@@ -74,7 +74,7 @@ void EncPacking(SBC_ENC_PARAMS *pstrEncParams)
pu8PacketPtr = pstrEncParams->pu8NextPacket; /*Initialize the ptr*/
*pu8PacketPtr++ = (UINT8)0x9C; /*Sync word*/
*pu8PacketPtr++=(UINT8)(pstrEncParams->FrameHeader);
-
+
*pu8PacketPtr = (UINT8)(pstrEncParams->s16BitPool & 0x00FF);
pu8PacketPtr += 2; /*skip for CRC*/
@@ -103,7 +103,7 @@ void EncPacking(SBC_ENC_PARAMS *pstrEncParams)
}
}
#endif
-
+
/* Pack Scale factor */
ps16GenPtr = pstrEncParams->as16ScaleFactor;
s32Sb=s32NumOfChannels*s32NumOfSubBands;
@@ -112,10 +112,10 @@ void EncPacking(SBC_ENC_PARAMS *pstrEncParams)
{
Temp<<= 4;
Temp |= *ps16GenPtr++;
-
+
if(s32PresentBit == 4)
{
- s32PresentBit = 8;
+ s32PresentBit = 8;
*(pu8PacketPtr++)=Temp;
Temp = 0;
}
@@ -124,7 +124,7 @@ void EncPacking(SBC_ENC_PARAMS *pstrEncParams)
s32PresentBit = 4;
}
}
-
+
/* Pack samples */
ps32SbPtr = pstrEncParams->s32SbBuffer;
/*Temp=*pu8PacketPtr;*/
@@ -165,10 +165,10 @@ void EncPacking(SBC_ENC_PARAMS *pstrEncParams)
s32Low>>= (*ps16ScfPtr+1);
u32QuantizedSbValue0 = (UINT16)s32Low;
#endif
- /*store the number of bits required and the quantized s32Sb
+ /*store the number of bits required and the quantized s32Sb
sample to ease the coding*/
u32QuantizedSbValue = u32QuantizedSbValue0;
-
+
if(s32PresentBit >= s32LoopCount)
{
Temp <<= s32LoopCount;
@@ -181,33 +181,33 @@ void EncPacking(SBC_ENC_PARAMS *pstrEncParams)
{
s32LoopCount -= s32PresentBit;
u32QuantizedSbValue >>= s32LoopCount;
-
+
/*remove the unwanted msbs*/
/*u32QuantizedSbValue <<= 16 - s32PresentBit;
u32QuantizedSbValue >>= 16 - s32PresentBit;*/
-
+
Temp <<= s32PresentBit;
-
+
Temp |= u32QuantizedSbValue ;
/*restore the original*/
u32QuantizedSbValue=u32QuantizedSbValue0;
-
+
*(pu8PacketPtr++)=Temp;
Temp = 0;
s32PresentBit = 8;
}
Temp <<= s32LoopCount;
-
+
/* remove the unwanted msbs */
/*u32QuantizedSbValue <<= 16 - s32LoopCount;
u32QuantizedSbValue >>= 16 - s32LoopCount;*/
-
+
Temp |= u32QuantizedSbValue;
-
+
s32PresentBit -= s32LoopCount;
}
}
- ps16ScfPtr++;
+ ps16ScfPtr++;
ps32SbPtr++;
}
}
@@ -221,7 +221,7 @@ void EncPacking(SBC_ENC_PARAMS *pstrEncParams)
s32LoopCount = s32Sb >> 1;
/*
- The loops is run from the start of the packet till the scale factor
+ The loops is run from the start of the packet till the scale factor
parameters. In case of JS, 'join' parameter is included in the packet
so that many more bytes are included in CRC calculation.
*/