summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2014-12-07 09:43:10 +1100
committerErik de Castro Lopo <erikd@mega-nerd.com>2014-12-07 16:45:12 +1100
commit249e526a0f3313af960a2709531446110079d145 (patch)
treec48d5abbc8455bddd73d80c9599efc42bcc7cc53
parent9f1fbafb56c5b985bce9589ad81c5f7b4a1a3418 (diff)
src/ALAC/ : Code improvements.
* Make internal APIs const correct. * Use mNumSamples field from encoder/decoder state struct instead of passing to encode/decode functions.
-rw-r--r--src/ALAC/alac_codec.h7
-rw-r--r--src/ALAC/alac_decoder.c7
-rw-r--r--src/ALAC/alac_encoder.c23
-rw-r--r--src/ALAC/dp_dec.c6
-rw-r--r--src/ALAC/dp_enc.c9
-rw-r--r--src/ALAC/dplib.h4
-rw-r--r--src/ALAC/matrix_dec.c27
-rw-r--r--src/ALAC/matrix_enc.c13
-rw-r--r--src/ALAC/matrixlib.h30
-rw-r--r--src/alac.c6
10 files changed, 77 insertions, 55 deletions
diff --git a/src/ALAC/alac_codec.h b/src/ALAC/alac_codec.h
index 98de3ff..c73347d 100644
--- a/src/ALAC/alac_codec.h
+++ b/src/ALAC/alac_codec.h
@@ -49,6 +49,7 @@ typedef struct alac_decoder_s
int32_t mPredictor [ALAC_FRAME_LENGTH] ;
uint16_t mShiftBuffer [ALAC_FRAME_LENGTH] ;
} ;
+ uint32_t mNumChannels ;
} ALAC_DECODER ;
typedef struct alac_encoder_s
@@ -88,10 +89,10 @@ int32_t alac_decoder_init (ALAC_DECODER *p, void * inMagicCookie, uint32_t inMag
int32_t alac_encoder_init (ALAC_ENCODER *p, uint32_t samplerate, uint32_t channels, uint32_t format_flags, uint32_t frameSize) ;
int32_t alac_decode (ALAC_DECODER *, struct BitBuffer * bits, int32_t * sampleBuffer,
- uint32_t numSamples, uint32_t numChannels, uint32_t * outNumSamples) ;
+ uint32_t numSamples, uint32_t * outNumSamples) ;
-int32_t alac_encode (ALAC_ENCODER *p, uint32_t numChannels, uint32_t numSamples,
- int32_t * theReadBuffer, unsigned char * theWriteBuffer,
+int32_t alac_encode (ALAC_ENCODER *p, uint32_t numSamples,
+ const int32_t * theReadBuffer, unsigned char * theWriteBuffer,
uint32_t * ioNumBytes) ;
void alac_set_fastmode (ALAC_ENCODER * p, int32_t fast) ;
diff --git a/src/ALAC/alac_decoder.c b/src/ALAC/alac_decoder.c
index afc89e4..ea36e3f 100644
--- a/src/ALAC/alac_decoder.c
+++ b/src/ALAC/alac_decoder.c
@@ -23,6 +23,7 @@
File: ALACDecoder.cpp
*/
+#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
@@ -105,6 +106,7 @@ alac_decoder_init (ALAC_DECODER *p, void * inMagicCookie, uint32_t inMagicCookie
theConfig.sampleRate = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, sampleRate)) ;
p->mConfig = theConfig ;
+ p->mNumChannels = theConfig.numChannels ;
RequireAction (p->mConfig.compatibleVersion <= kALACVersion, return kALAC_ParamError ;) ;
@@ -132,7 +134,7 @@ Exit:
the bitstream
*/
int32_t
-alac_decode (ALAC_DECODER *p, struct BitBuffer * bits, int32_t * sampleBuffer, uint32_t numSamples, uint32_t numChannels, uint32_t * outNumSamples)
+alac_decode (ALAC_DECODER *p, struct BitBuffer * bits, int32_t * sampleBuffer, uint32_t numSamples, uint32_t * outNumSamples)
{
BitBuffer shiftBits ;
uint32_t bits1, bits2 ;
@@ -161,9 +163,10 @@ alac_decode (ALAC_DECODER *p, struct BitBuffer * bits, int32_t * sampleBuffer, u
int32_t val ;
uint32_t i, j ;
int32_t status ;
+ uint32_t numChannels = p->mNumChannels ;
RequireAction ((bits != NULL) && (sampleBuffer != NULL) && (outNumSamples != NULL), return kALAC_ParamError ;) ;
- RequireAction (numChannels > 0, return kALAC_ParamError ;) ;
+ RequireAction (p->mNumChannels > 0, return kALAC_ParamError ;) ;
p->mActiveElements = 0 ;
channelIndex = 0 ;
diff --git a/src/ALAC/alac_encoder.c b/src/ALAC/alac_encoder.c
index f145a13..611d9bb 100644
--- a/src/ALAC/alac_encoder.c
+++ b/src/ALAC/alac_encoder.c
@@ -52,10 +52,10 @@ typedef enum
static void GetConfig (ALAC_ENCODER *p, ALACSpecificConfig * config) ;
-static int32_t EncodeStereo (ALAC_ENCODER *p, struct BitBuffer * bitstream, int32_t * input, uint32_t stride, uint32_t channelIndex, uint32_t numSamples) ;
-static int32_t EncodeStereoFast (ALAC_ENCODER *p, struct BitBuffer * bitstream, int32_t * input, uint32_t stride, uint32_t channelIndex, uint32_t numSamples) ;
-static int32_t EncodeStereoEscape (ALAC_ENCODER *p, struct BitBuffer * bitstream, int32_t * input, uint32_t stride, uint32_t numSamples) ;
-static int32_t EncodeMono (ALAC_ENCODER *p, struct BitBuffer * bitstream, int32_t * input, uint32_t stride, uint32_t channelIndex, uint32_t numSamples) ;
+static int32_t EncodeStereo (ALAC_ENCODER *p, struct BitBuffer * bitstream, const int32_t * input, uint32_t stride, uint32_t channelIndex, uint32_t numSamples) ;
+static int32_t EncodeStereoFast (ALAC_ENCODER *p, struct BitBuffer * bitstream, const int32_t * input, uint32_t stride, uint32_t channelIndex, uint32_t numSamples) ;
+static int32_t EncodeStereoEscape (ALAC_ENCODER *p, struct BitBuffer * bitstream, const int32_t * input, uint32_t stride, uint32_t numSamples) ;
+static int32_t EncodeMono (ALAC_ENCODER *p, struct BitBuffer * bitstream, const int32_t * input, uint32_t stride, uint32_t channelIndex, uint32_t numSamples) ;
@@ -225,7 +225,7 @@ alac_set_fastmode (ALAC_ENCODER * p, int32_t fast)
- encode a channel pair
*/
static int32_t
-EncodeStereo (ALAC_ENCODER *p, struct BitBuffer * bitstream, int32_t * inputBuffer, uint32_t stride, uint32_t channelIndex, uint32_t numSamples)
+EncodeStereo (ALAC_ENCODER *p, struct BitBuffer * bitstream, const int32_t * inputBuffer, uint32_t stride, uint32_t channelIndex, uint32_t numSamples)
{
BitBuffer workBits ;
BitBuffer startBits = *bitstream ; // squirrel away copy of current state in case we need to go back and do an escape packet
@@ -507,7 +507,7 @@ Exit:
- encode a channel pair without the search loop for maximum possible speed
*/
static int32_t
-EncodeStereoFast (ALAC_ENCODER *p, struct BitBuffer * bitstream, int32_t * inputBuffer, uint32_t stride, uint32_t channelIndex, uint32_t numSamples)
+EncodeStereoFast (ALAC_ENCODER *p, struct BitBuffer * bitstream, const int32_t * inputBuffer, uint32_t stride, uint32_t channelIndex, uint32_t numSamples)
{
BitBuffer startBits = *bitstream ; // squirrel away current bit position in case we decide to use escape hatch
AGParamRec agParams ;
@@ -689,7 +689,7 @@ Exit:
- encode stereo escape frame
*/
static int32_t
-EncodeStereoEscape (ALAC_ENCODER *p, struct BitBuffer * bitstream, int32_t * inputBuffer, uint32_t stride, uint32_t numSamples)
+EncodeStereoEscape (ALAC_ENCODER *p, struct BitBuffer * bitstream, const int32_t * inputBuffer, uint32_t stride, uint32_t numSamples)
{
uint8_t partialFrame ;
uint32_t indx ;
@@ -746,7 +746,7 @@ EncodeStereoEscape (ALAC_ENCODER *p, struct BitBuffer * bitstream, int32_t * inp
- encode a mono input buffer
*/
static int32_t
-EncodeMono (ALAC_ENCODER *p, struct BitBuffer * bitstream, int32_t * inputBuffer, uint32_t stride, uint32_t channelIndex, uint32_t numSamples)
+EncodeMono (ALAC_ENCODER *p, struct BitBuffer * bitstream, const int32_t * inputBuffer, uint32_t stride, uint32_t channelIndex, uint32_t numSamples)
{
BitBuffer startBits = *bitstream ; // squirrel away copy of current state in case we need to go back and do an escape packet
AGParamRec agParams ;
@@ -964,12 +964,13 @@ Exit:
- encode the next block of samples
*/
int32_t
-alac_encode (ALAC_ENCODER *p, uint32_t numChannels, uint32_t numSamples,
- int32_t * theReadBuffer, unsigned char * theWriteBuffer, uint32_t * ioNumBytes)
+alac_encode (ALAC_ENCODER *p, uint32_t numSamples,
+ const int32_t * theReadBuffer, unsigned char * theWriteBuffer, uint32_t * ioNumBytes)
{
uint32_t outputSize ;
BitBuffer bitstream ;
int32_t status ;
+ uint32_t numChannels = p->mNumChannels ;
// create a bit buffer structure pointing to our output buffer
BitBufferInit (&bitstream, theWriteBuffer, p->mMaxOutputBytes) ;
@@ -999,7 +1000,7 @@ alac_encode (ALAC_ENCODER *p, uint32_t numChannels, uint32_t numSamples,
}
else
{
- int32_t * inputBuffer ;
+ const int32_t * inputBuffer ;
uint32_t tag ;
uint32_t channelIndex ;
uint32_t inputIncrement ;
diff --git a/src/ALAC/dp_dec.c b/src/ALAC/dp_dec.c
index cea6aa2..4f5bc1d 100644
--- a/src/ALAC/dp_dec.c
+++ b/src/ALAC/dp_dec.c
@@ -40,7 +40,8 @@
#define LOOP_ALIGN
-static inline int32_t ALWAYS_INLINE sign_of_int (int32_t i)
+static inline int32_t ALWAYS_INLINE
+sign_of_int (int32_t i)
{
int32_t negishift ;
@@ -48,7 +49,8 @@ static inline int32_t ALWAYS_INLINE sign_of_int (int32_t i)
return negishift | (i >> 31) ;
}
-void unpc_block (int32_t * pc1, int32_t * out, int32_t num, int16_t * coefs, int32_t numactive, uint32_t chanbits, uint32_t denshift)
+void
+unpc_block (const int32_t * pc1, int32_t * out, int32_t num, int16_t * coefs, int32_t numactive, uint32_t chanbits, uint32_t denshift)
{
register int16_t a0, a1, a2, a3 ;
register int32_t b0, b1, b2, b3 ;
diff --git a/src/ALAC/dp_enc.c b/src/ALAC/dp_enc.c
index 291f39f..ad098a4 100644
--- a/src/ALAC/dp_enc.c
+++ b/src/ALAC/dp_enc.c
@@ -39,7 +39,8 @@
#define LOOP_ALIGN
-void init_coefs (int16_t * coefs, uint32_t denshift, int32_t numPairs)
+void
+init_coefs (int16_t * coefs, uint32_t denshift, int32_t numPairs)
{
int32_t k ;
int32_t den = 1 << denshift ;
@@ -51,7 +52,8 @@ void init_coefs (int16_t * coefs, uint32_t denshift, int32_t numPairs)
coefs [k] = 0 ;
}
-void copy_coefs (int16_t * srcCoefs, int16_t * dstCoefs, int32_t numPairs)
+void
+copy_coefs (const int16_t * srcCoefs, int16_t * dstCoefs, int32_t numPairs)
{
int32_t k ;
@@ -67,7 +69,8 @@ static inline int32_t ALWAYS_INLINE sign_of_int (int32_t i)
return negishift | (i >> 31) ;
}
-void pc_block (int32_t * in, int32_t * pc1, int32_t num, int16_t * coefs, int32_t numactive, uint32_t chanbits, uint32_t denshift)
+void
+pc_block (int32_t * in, int32_t * pc1, int32_t num, int16_t * coefs, int32_t numactive, uint32_t chanbits, uint32_t denshift)
{
register int16_t a0, a1, a2, a3 ;
register int32_t b0, b1, b2, b3 ;
diff --git a/src/ALAC/dplib.h b/src/ALAC/dplib.h
index 569503c..43ae721 100644
--- a/src/ALAC/dplib.h
+++ b/src/ALAC/dplib.h
@@ -47,12 +47,12 @@ extern "C" {
// prototypes
void init_coefs (int16_t * coefs, uint32_t denshift, int32_t numPairs) ;
-void copy_coefs (int16_t * srcCoefs, int16_t * dstCoefs, int32_t numPairs) ;
+void copy_coefs (const int16_t * srcCoefs, int16_t * dstCoefs, int32_t numPairs) ;
// NOTE: these routines read at least "numactive" samples so the i/o buffers must be at least that big
void pc_block (int32_t * in, int32_t * pc, int32_t num, int16_t * coefs, int32_t numactive, uint32_t chanbits, uint32_t denshift) ;
-void unpc_block (int32_t * pc, int32_t * out, int32_t num, int16_t * coefs, int32_t numactive, uint32_t chanbits, uint32_t denshift) ;
+void unpc_block (const int32_t * pc, int32_t * out, int32_t num, int16_t * coefs, int32_t numactive, uint32_t chanbits, uint32_t denshift) ;
#ifdef __cplusplus
}
diff --git a/src/ALAC/matrix_dec.c b/src/ALAC/matrix_dec.c
index 68b696d..6d0b401 100644
--- a/src/ALAC/matrix_dec.c
+++ b/src/ALAC/matrix_dec.c
@@ -59,7 +59,8 @@
// 16-bit routines
-void unmix16 (int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t numSamples, int32_t mixbits, int32_t mixres)
+void
+unmix16 (const int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t numSamples, int32_t mixbits, int32_t mixres)
{
int32_t j ;
@@ -93,7 +94,8 @@ void unmix16 (int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t
// 20-bit routines
// - the 20 bits of data are left-justified in 3 bytes of storage but right-aligned for input/output predictor buffers
-void unmix20 (int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t numSamples, int32_t mixbits, int32_t mixres)
+void
+unmix20 (const int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t numSamples, int32_t mixbits, int32_t mixres)
{
int32_t j ;
@@ -127,7 +129,8 @@ void unmix20 (int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t
// 24-bit routines
// - the 24 bits of data are right-justified in the input/output predictor buffers
-void unmix24 (int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t numSamples,
+void
+unmix24 (const int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t numSamples,
int32_t mixbits, int32_t mixres, uint16_t * shiftUV, int32_t bytesShifted)
{
int32_t shift = bytesShifted * 8 ;
@@ -200,7 +203,8 @@ void unmix24 (int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t
// - otherwise, the calculations might overflow into the 33rd bit and be lost
// - therefore, these routines deal with the specified "unused lower" bytes in the "shift" buffers
-void unmix32 (int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t numSamples,
+void
+unmix32 (const int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t numSamples,
int32_t mixbits, int32_t mixres, uint16_t * shiftUV, int32_t bytesShifted)
{
int32_t shift = bytesShifted * 8 ;
@@ -254,7 +258,8 @@ void unmix32 (int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t
// 20/24-bit <-> 32-bit helper routines (not really matrixing but convenient to put here)
-void copyPredictorTo24 (int32_t * in, int32_t * out, uint32_t stride, int32_t numSamples)
+void
+copyPredictorTo24 (const int32_t * in, int32_t * out, uint32_t stride, int32_t numSamples)
{
int32_t j ;
@@ -265,7 +270,8 @@ void copyPredictorTo24 (int32_t * in, int32_t * out, uint32_t stride, int32_t nu
}
}
-void copyPredictorTo24Shift (int32_t * in, uint16_t * shift, int32_t * out, uint32_t stride, int32_t numSamples, int32_t bytesShifted)
+void
+copyPredictorTo24Shift (const int32_t * in, uint16_t * shift, int32_t * out, uint32_t stride, int32_t numSamples, int32_t bytesShifted)
{
int32_t shiftVal = bytesShifted * 8 ;
int32_t j ;
@@ -282,7 +288,8 @@ void copyPredictorTo24Shift (int32_t * in, uint16_t * shift, int32_t * out, uint
}
}
-void copyPredictorTo20 (int32_t * in, int32_t * out, uint32_t stride, int32_t numSamples)
+void
+copyPredictorTo20 (const int32_t * in, int32_t * out, uint32_t stride, int32_t numSamples)
{
int32_t j ;
@@ -295,7 +302,8 @@ void copyPredictorTo20 (int32_t * in, int32_t * out, uint32_t stride, int32_t nu
}
}
-void copyPredictorTo32 (int32_t * in, int32_t * out, uint32_t stride, int32_t numSamples)
+void
+copyPredictorTo32 (const int32_t * in, int32_t * out, uint32_t stride, int32_t numSamples)
{
int32_t i, j ;
@@ -304,7 +312,8 @@ void copyPredictorTo32 (int32_t * in, int32_t * out, uint32_t stride, int32_t nu
out [j] = arith_shift_left (in [i], 8) ;
}
-void copyPredictorTo32Shift (int32_t * in, uint16_t * shift, int32_t * out, uint32_t stride, int32_t numSamples, int32_t bytesShifted)
+void
+copyPredictorTo32Shift (const int32_t * in, uint16_t * shift, int32_t * out, uint32_t stride, int32_t numSamples, int32_t bytesShifted)
{
int32_t * op = out ;
uint32_t shiftVal = bytesShifted * 8 ;
diff --git a/src/ALAC/matrix_enc.c b/src/ALAC/matrix_enc.c
index b6a9dc2..b50f83b 100644
--- a/src/ALAC/matrix_enc.c
+++ b/src/ALAC/matrix_enc.c
@@ -47,7 +47,8 @@
// 16-bit routines
-void mix16 (int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples, int32_t mixbits, int32_t mixres)
+void
+mix16 (const int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples, int32_t mixbits, int32_t mixres)
{
int32_t j ;
@@ -84,7 +85,8 @@ void mix16 (int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t num
// 20-bit routines
// - the 20 bits of data are left-justified in 3 bytes of storage but right-aligned for input/output predictor buffers
-void mix20 (int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples, int32_t mixbits, int32_t mixres)
+void
+mix20 (const int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples, int32_t mixbits, int32_t mixres)
{
int32_t l, r ;
int32_t j ;
@@ -120,7 +122,8 @@ void mix20 (int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t num
// 24-bit routines
// - the 24 bits of data are right-justified in the input/output predictor buffers
-void mix24 (int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples,
+void
+mix24 (const int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples,
int32_t mixbits, int32_t mixres, uint16_t * shiftUV, int32_t bytesShifted)
{
int32_t l, r ;
@@ -203,7 +206,8 @@ void mix24 (int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t num
// - otherwise, the calculations might overflow into the 33rd bit and be lost
// - therefore, these routines deal with the specified "unused lower" bytes in the "shift" buffers
-void mix32 (int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples,
+void
+mix32 (const int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples,
int32_t mixbits, int32_t mixres, uint16_t * shiftUV, int32_t bytesShifted)
{
int32_t shift = bytesShifted * 8 ;
@@ -269,4 +273,3 @@ void mix32 (int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t num
}
}
}
-
diff --git a/src/ALAC/matrixlib.h b/src/ALAC/matrixlib.h
index 251b792..d9be5fe 100644
--- a/src/ALAC/matrixlib.h
+++ b/src/ALAC/matrixlib.h
@@ -39,40 +39,40 @@ extern "C" {
#endif
// 16-bit routines
-void mix16 (int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples, int32_t mixbits, int32_t mixres) ;
-void unmix16 (int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t numSamples, int32_t mixbits, int32_t mixres) ;
+void mix16 (const int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples, int32_t mixbits, int32_t mixres) ;
+void unmix16 (const int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t numSamples, int32_t mixbits, int32_t mixres) ;
// 20-bit routines
-void mix20 (int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples, int32_t mixbits, int32_t mixres) ;
-void unmix20 (int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t numSamples, int32_t mixbits, int32_t mixres) ;
+void mix20 (const int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples, int32_t mixbits, int32_t mixres) ;
+void unmix20 (const int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t numSamples, int32_t mixbits, int32_t mixres) ;
// 24-bit routines
// - 24-bit data sometimes compresses better by shifting off the bottom byte so these routines deal with
// the specified "unused lower bytes" in the combined "shift" buffer
-void mix24 (int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples,
+void mix24 (const int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples,
int32_t mixbits, int32_t mixres, uint16_t * shiftUV, int32_t bytesShifted) ;
-void unmix24 (int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t numSamples,
+void unmix24 (const int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t numSamples,
int32_t mixbits, int32_t mixres, uint16_t * shiftUV, int32_t bytesShifted) ;
// 32-bit routines
// - note that these really expect the internal data width to be < 32-bit but the arrays are 32-bit
// - otherwise, the calculations might overflow into the 33rd bit and be lost
// - therefore, these routines deal with the specified "unused lower" bytes in the combined "shift" buffer
-void mix32 (int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples,
+void mix32 (const int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples,
int32_t mixbits, int32_t mixres, uint16_t * shiftUV, int32_t bytesShifted) ;
-void unmix32 (int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t numSamples,
+void unmix32 (const int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t numSamples,
int32_t mixbits, int32_t mixres, uint16_t * shiftUV, int32_t bytesShifted) ;
// 20/24/32-bit <-> 32-bit helper routines (not really matrixing but convenient to put here)
-void copy20ToPredictor (int32_t * in, uint32_t stride, int32_t * out, int32_t numSamples) ;
-void copy24ToPredictor (int32_t * in, uint32_t stride, int32_t * out, int32_t numSamples) ;
+void copy20ToPredictor (const int32_t * in, uint32_t stride, int32_t * out, int32_t numSamples) ;
+void copy24ToPredictor (const int32_t * in, uint32_t stride, int32_t * out, int32_t numSamples) ;
-void copyPredictorTo24 (int32_t * in, int32_t * out, uint32_t stride, int32_t numSamples) ;
-void copyPredictorTo24Shift (int32_t * in, uint16_t * shift, int32_t * out, uint32_t stride, int32_t numSamples, int32_t bytesShifted) ;
-void copyPredictorTo20 (int32_t * in, int32_t * out, uint32_t stride, int32_t numSamples) ;
+void copyPredictorTo24 (const int32_t * in, int32_t * out, uint32_t stride, int32_t numSamples) ;
+void copyPredictorTo24Shift (const int32_t * in, uint16_t * shift, int32_t * out, uint32_t stride, int32_t numSamples, int32_t bytesShifted) ;
+void copyPredictorTo20 (const int32_t * in, int32_t * out, uint32_t stride, int32_t numSamples) ;
-void copyPredictorTo32 (int32_t * in, int32_t * out, uint32_t stride, int32_t numSamples) ;
-void copyPredictorTo32Shift (int32_t * in, uint16_t * shift, int32_t * out, uint32_t stride, int32_t numSamples, int32_t bytesShifted) ;
+void copyPredictorTo32 (const int32_t * in, int32_t * out, uint32_t stride, int32_t numSamples) ;
+void copyPredictorTo32Shift (const int32_t * in, uint16_t * shift, int32_t * out, uint32_t stride, int32_t numSamples, int32_t bytesShifted) ;
#ifdef __cplusplus
}
diff --git a/src/alac.c b/src/alac.c
index fbc1472..57f8be8 100644
--- a/src/alac.c
+++ b/src/alac.c
@@ -1,5 +1,5 @@
/*
-** Copyright (C) 2011-2013 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2011-2014 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 Lesser General Public License as published by
@@ -410,7 +410,7 @@ alac_decode_block (SF_PRIVATE *psf, ALAC_PRIVATE *plac)
plac->input_data_pos += packet_size ;
plac->frames_this_block = 0 ;
- alac_decode (pdec, &bit_buffer, plac->buffer, plac->frames_per_block, psf->sf.channels, &plac->frames_this_block) ;
+ alac_decode (pdec, &bit_buffer, plac->buffer, plac->frames_per_block, &plac->frames_this_block) ;
plac->partial_block_frames = 0 ;
@@ -424,7 +424,7 @@ alac_encode_block (SF_PRIVATE * psf, ALAC_PRIVATE *plac)
uint8_t byte_buffer [psf->sf.channels * ALAC_BYTE_BUFFER_SIZE] ;
uint32_t num_bytes = 0 ;
- alac_encode (penc, plac->channels, plac->partial_block_frames, plac->buffer, byte_buffer, &num_bytes) ;
+ alac_encode (penc, plac->partial_block_frames, plac->buffer, byte_buffer, &num_bytes) ;
if (fwrite (byte_buffer, 1, num_bytes, plac->enctmp) != num_bytes)
return 0 ;