aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/alac.c
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2009-03-03 01:53:54 +0000
committerMåns Rullgård <mans@mansr.com>2009-03-03 01:53:54 +0000
commit8858990f0731ed8826902fbb0aeb2d89c6690f79 (patch)
tree39f4bb9ece739525aa0693ad60e90be617067323 /libavcodec/alac.c
parent101dfa7d0a15de14c599a9c5db9945419fd12fb9 (diff)
downloadffmpeg-8858990f0731ed8826902fbb0aeb2d89c6690f79.tar.gz
ALAC: use sign_extend() from mathops.h
Originally committed as revision 17739 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/alac.c')
-rw-r--r--libavcodec/alac.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index 095876e13f..3a7b0809f9 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -56,6 +56,7 @@
#include "bitstream.h"
#include "bytestream.h"
#include "unary.h"
+#include "mathops.h"
#define ALAC_EXTRADATA_SIZE 36
#define MAX_CHANNELS 2
@@ -229,11 +230,6 @@ static void bastardized_rice_decompress(ALACContext *alac,
}
}
-static inline int32_t extend_sign32(int32_t val, int bits)
-{
- return (val << (32 - bits)) >> (32 - bits);
-}
-
static inline int sign_only(int v)
{
return v ? FFSIGN(v) : 0;
@@ -273,7 +269,7 @@ static void predictor_decompress_fir_adapt(int32_t *error_buffer,
prev_value = buffer_out[i];
error_value = error_buffer[i+1];
buffer_out[i+1] =
- extend_sign32((prev_value + error_value), readsamplesize);
+ sign_extend((prev_value + error_value), readsamplesize);
}
return;
}
@@ -284,7 +280,7 @@ static void predictor_decompress_fir_adapt(int32_t *error_buffer,
int32_t val;
val = buffer_out[i] + error_buffer[i+1];
- val = extend_sign32(val, readsamplesize);
+ val = sign_extend(val, readsamplesize);
buffer_out[i+1] = val;
}
@@ -319,7 +315,7 @@ static void predictor_decompress_fir_adapt(int32_t *error_buffer,
outval = (1 << (predictor_quantitization-1)) + sum;
outval = outval >> predictor_quantitization;
outval = outval + buffer_out[0] + error_val;
- outval = extend_sign32(outval, readsamplesize);
+ outval = sign_extend(outval, readsamplesize);
buffer_out[predictor_coef_num+1] = outval;
@@ -545,7 +541,7 @@ static int alac_decode_frame(AVCodecContext *avctx,
int32_t audiobits;
audiobits = get_bits_long(&alac->gb, alac->setinfo_sample_size);
- audiobits = extend_sign32(audiobits, alac->setinfo_sample_size);
+ audiobits = sign_extend(audiobits, alac->setinfo_sample_size);
alac->outputsamples_buffer[chan][i] = audiobits;
}