[FFmpeg-cvslog] r10264 - trunk/libavcodec/alac.c
vitor
subversion
Thu Aug 30 18:04:01 CEST 2007
Author: vitor
Date: Thu Aug 30 18:04:00 2007
New Revision: 10264
Log:
Replace two #define's by inline functions
Modified:
trunk/libavcodec/alac.c
Modified: trunk/libavcodec/alac.c
==============================================================================
--- trunk/libavcodec/alac.c (original)
+++ trunk/libavcodec/alac.c Thu Aug 30 18:04:00 2007
@@ -269,12 +269,15 @@ static void bastardized_rice_decompress(
}
}
-#define SIGN_EXTENDED32(val, bits) ((val << (32 - bits)) >> (32 - bits))
+static inline int32_t sign_extended32(int32_t val, int bits)
+{
+ return (val << (32 - bits)) >> (32 - bits);
+}
-#define SIGN_ONLY(v) \
- ((v < 0) ? (-1) : \
- ((v > 0) ? (1) : \
- (0)))
+static inline int sign_only(int v)
+{
+ return v ? FFSIGN(v) : 0;
+}
static void predictor_decompress_fir_adapt(int32_t *error_buffer,
int32_t *buffer_out,
@@ -310,7 +313,7 @@ static void predictor_decompress_fir_ada
prev_value = buffer_out[i];
error_value = error_buffer[i+1];
buffer_out[i+1] =
- SIGN_EXTENDED32((prev_value + error_value), readsamplesize);
+ sign_extended32((prev_value + error_value), readsamplesize);
}
return;
}
@@ -321,7 +324,7 @@ static void predictor_decompress_fir_ada
int32_t val;
val = buffer_out[i] + error_buffer[i+1];
- val = SIGN_EXTENDED32(val, readsamplesize);
+ val = sign_extended32(val, readsamplesize);
buffer_out[i+1] = val;
}
@@ -356,7 +359,7 @@ static void predictor_decompress_fir_ada
outval = (1 << (predictor_quantitization-1)) + sum;
outval = outval >> predictor_quantitization;
outval = outval + buffer_out[0] + error_val;
- outval = SIGN_EXTENDED32(outval, readsamplesize);
+ outval = sign_extended32(outval, readsamplesize);
buffer_out[predictor_coef_num+1] = outval;
@@ -365,7 +368,7 @@ static void predictor_decompress_fir_ada
while (predictor_num >= 0 && error_val > 0) {
int val = buffer_out[0] - buffer_out[predictor_coef_num - predictor_num];
- int sign = SIGN_ONLY(val);
+ int sign = sign_only(val);
predictor_coef_table[predictor_num] -= sign;
@@ -381,7 +384,7 @@ static void predictor_decompress_fir_ada
while (predictor_num >= 0 && error_val < 0) {
int val = buffer_out[0] - buffer_out[predictor_coef_num - predictor_num];
- int sign = - SIGN_ONLY(val);
+ int sign = - sign_only(val);
predictor_coef_table[predictor_num] -= sign;
@@ -570,7 +573,7 @@ static int alac_decode_frame(AVCodecCont
int32_t audiobits;
audiobits = get_bits(&alac->gb, alac->setinfo_sample_size);
- audiobits = SIGN_EXTENDED32(audiobits, readsamplesize);
+ audiobits = sign_extended32(audiobits, readsamplesize);
alac->outputsamples_buffer[chan][i] = audiobits;
}
More information about the ffmpeg-cvslog
mailing list