1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-10 16:43:33 +02:00

Update twolame to 0.3.13.

This commit is contained in:
lllucius
2013-10-24 04:32:13 +00:00
parent 99acb56af6
commit 3effa9693f
124 changed files with 44671 additions and 44430 deletions

View File

@@ -18,7 +18,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: crc.c,v 1.3 2008-02-01 19:44:31 richardash1981 Exp $
* $Id$
*
*/
@@ -36,16 +36,16 @@
static unsigned int crc_update(unsigned int value, unsigned int crc, unsigned int nbBit)
{
int i;
value <<= 8;
for (i = 0; i < nbBit; i++) {
value <<= 1;
crc <<= 1;
if (((crc ^ value) & 0x10000))
crc ^= CRC16_POLYNOMIAL;
}
return crc;
int i;
value <<= 8;
for (i = 0; i < nbBit; i++) {
value <<= 1;
crc <<= 1;
if (((crc ^ value) & 0x10000))
crc ^= CRC16_POLYNOMIAL;
}
return crc;
}
@@ -54,32 +54,29 @@ static unsigned int crc_update(unsigned int value, unsigned int crc, unsigned in
* The CRC is based on the second two bytes of the MPEG audio header
* and then the bits up and until the scale-factor bits.
*/
void crc_writeheader( unsigned char *bitstream, int bit_count )
void crc_writeheader(unsigned char *bitstream, int bit_count)
{
unsigned int crc = 0xffff; /* (jo) init crc16 for error_protection */
int whole_bytes = (bit_count>>3);
int byte;
// Calculate the CRC on the second two bytes of the header
crc = crc_update(bitstream[2], crc, 8);
crc = crc_update(bitstream[3], crc, 8);
// Calculate CRC on whole bytes after CRC
for(byte=6; byte<(whole_bytes+6); byte++)
{
crc = crc_update(bitstream[byte], crc, 8);
}
// Calculate CRC on remaining bits
if(bit_count & 7)
{
crc = crc_update(bitstream[byte], crc, bit_count&7);
}
// Insert the CRC into the 16-bits after the header
bitstream[4] = crc >> 8;
bitstream[5] = crc & 0xFF;
unsigned int crc = 0xffff; /* (jo) init crc16 for error_protection */
int whole_bytes = (bit_count >> 3);
int byte;
// Calculate the CRC on the second two bytes of the header
crc = crc_update(bitstream[2], crc, 8);
crc = crc_update(bitstream[3], crc, 8);
// Calculate CRC on whole bytes after CRC
for (byte = 6; byte < (whole_bytes + 6); byte++) {
crc = crc_update(bitstream[byte], crc, 8);
}
// Calculate CRC on remaining bits
if (bit_count & 7) {
crc = crc_update(bitstream[byte], crc, bit_count & 7);
}
// Insert the CRC into the 16-bits after the header
bitstream[4] = crc >> 8;
bitstream[5] = crc & 0xFF;
}