mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-11 17:55:21 +00:00
Replace two #define's by inline functions
Originally committed as revision 10264 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
14da6549a7
commit
321c313836
@ -269,12 +269,15 @@ static void bastardized_rice_decompress(ALACContext *alac,
|
||||
}
|
||||
}
|
||||
|
||||
#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_adapt(int32_t *error_buffer,
|
||||
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_adapt(int32_t *error_buffer,
|
||||
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_adapt(int32_t *error_buffer,
|
||||
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_adapt(int32_t *error_buffer,
|
||||
|
||||
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_adapt(int32_t *error_buffer,
|
||||
|
||||
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(AVCodecContext *avctx,
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user