summaryrefslogtreecommitdiffstats
path: root/embdrv/sbc/encoder/srce/sbc_packing.c
diff options
context:
space:
mode:
Diffstat (limited to 'embdrv/sbc/encoder/srce/sbc_packing.c')
-rw-r--r--embdrv/sbc/encoder/srce/sbc_packing.c68
1 files changed, 39 insertions, 29 deletions
diff --git a/embdrv/sbc/encoder/srce/sbc_packing.c b/embdrv/sbc/encoder/srce/sbc_packing.c
index 55edb9b..bdbefea 100644
--- a/embdrv/sbc/encoder/srce/sbc_packing.c
+++ b/embdrv/sbc/encoder/srce/sbc_packing.c
@@ -1,16 +1,26 @@
/******************************************************************************
-**
-** File Name: $RCSfile: sbc_packing.c,v $
-**
-** 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 $
-**
-** Copyright (c) 1999-2002, Widcomm Inc., All Rights Reserved.
-** Widcomm Bluetooth Core. Proprietary and confidential.
-**
-******************************************************************************/
+ *
+ * Copyright (C) 1999-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains code for packing the Encoded data into bit streams.
+ *
+ ******************************************************************************/
#include "sbc_encoder.h"
#include "sbc_enc_func_declare.h"
@@ -22,7 +32,7 @@
{ \
MUL s32OutLow,s32In1,s32In2; \
} \
-}
+}
#define Mult64(s32In1, s32In2, s32OutLow, s32OutHi) \
{ \
__asm \
@@ -74,7 +84,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 +113,7 @@ void EncPacking(SBC_ENC_PARAMS *pstrEncParams)
}
}
#endif
-
+
/* Pack Scale factor */
ps16GenPtr = pstrEncParams->as16ScaleFactor;
s32Sb=s32NumOfChannels*s32NumOfSubBands;
@@ -112,10 +122,10 @@ void EncPacking(SBC_ENC_PARAMS *pstrEncParams)
{
Temp<<= 4;
Temp |= *ps16GenPtr++;
-
+
if(s32PresentBit == 4)
{
- s32PresentBit = 8;
+ s32PresentBit = 8;
*(pu8PacketPtr++)=Temp;
Temp = 0;
}
@@ -124,7 +134,7 @@ void EncPacking(SBC_ENC_PARAMS *pstrEncParams)
s32PresentBit = 4;
}
}
-
+
/* Pack samples */
ps32SbPtr = pstrEncParams->s32SbBuffer;
/*Temp=*pu8PacketPtr;*/
@@ -165,10 +175,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 +191,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 +231,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.
*/