1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-21 16:37:12 +01:00

Update libsndfile to 1.0.29pre2+git

This pulls in MANY (over 890) changes compared to our
from our current 1.0.24 version.
This commit is contained in:
Leland Lucius
2020-03-16 22:41:09 -05:00
parent 4ac45bb5f8
commit b749a16943
370 changed files with 39029 additions and 81333 deletions

View File

@@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -24,6 +24,8 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#else
#include "sf_unistd.h"
#endif
#include <sndfile.h>
@@ -203,21 +205,21 @@ unsigned char ulaw_encode (int sample)
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
} ;
int sign, exponent, mantissa ;
unsigned char ulawbyte ;
int sign, exponent, mantissa ;
unsigned char ulawbyte ;
/* Get the sample into sign-magnitude. */
sign = (sample >> 8) & 0x80 ; /* set aside the sign */
if ( sign != 0 )
/* Get the sample into sign-magnitude. */
sign = (sample >> 8) & 0x80 ; /* set aside the sign */
if (sign != 0)
sample = -sample ; /* get magnitude */
if ( sample > uCLIP )
if (sample > uCLIP)
sample = uCLIP ; /* clip the magnitude */
/* Convert from 16 bit linear to ulaw. */
sample = sample + uBIAS ;
exponent = exp_lut [( sample >> 7 ) & 0xFF] ;
mantissa = (sample >> ( exponent + 3 ) ) & 0x0F ;
ulawbyte = ~ (sign | ( exponent << 4 ) | mantissa) ;
/* Convert from 16 bit linear to ulaw. */
sample = sample + uBIAS ;
exponent = exp_lut [(sample >> 7) & 0xFF] ;
mantissa = (sample >> (exponent + 3)) & 0x0F ;
ulawbyte = ~ (sign | (exponent << 4) | mantissa) ;
return ulawbyte ;
} /* ulaw_encode */
@@ -242,16 +244,16 @@ unsigned char ulaw_encode (int sample)
static
int ulaw_decode (unsigned int ulawbyte)
{ static int exp_lut [8] = { 0, 132, 396, 924, 1980, 4092, 8316, 16764 } ;
int sign, exponent, mantissa, sample ;
int sign, exponent, mantissa, sample ;
ulawbyte = ~ ulawbyte ;
sign = (ulawbyte & 0x80) ;
exponent = (ulawbyte >> 4) & 0x07 ;
mantissa = ulawbyte & 0x0F ;
sample = exp_lut [exponent] + (mantissa << (exponent + 3)) ;
if (sign != 0)
ulawbyte = ~ ulawbyte ;
sign = (ulawbyte & 0x80) ;
exponent = (ulawbyte >> 4) & 0x07 ;
mantissa = ulawbyte & 0x0F ;
sample = exp_lut [exponent] + (mantissa << (exponent + 3)) ;
if (sign != 0)
sample = -sample ;
return sample ;
return sample ;
} /* ulaw_decode */