diff options
author | Ganesh Ajjanagadde <gajjanagadde@gmail.com> | 2015-09-19 09:57:56 -0400 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-09-24 04:43:00 +0200 |
commit | 7179add427f38e14acf72368ec87a11c46848bd2 (patch) | |
tree | cbd907fb0c7bd098a7298dcfc317ef34bc8ed4a7 | |
parent | 07cd8d5676a72d80661e9bfde0a26d83aca4d029 (diff) | |
download | ffmpeg-7179add427f38e14acf72368ec87a11c46848bd2.tar.gz |
avcodec/ac3enc: use long long after switch to 64 bit bitrate
Commit 7404f3bdb switched bitrate to 64 bits.
This triggers -Wabsolute-value on clang, e.g
http://fate.ffmpeg.org/log.cgi?time=20150917122742&log=compile&slot=x86_64-darwin-clang-3.7-O3.
Therefore, usage of abs is changed to llabs, which is available on all of the platforms.
Unfortunately, LLONG_MAX is not always available, so INT64_MAX is used instead.
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/ac3enc.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 0d8a678f72..35e721a964 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -2153,8 +2153,9 @@ static av_cold int validate_options(AC3EncodeContext *s) /* validate bit rate */ if (s->eac3) { - int max_br, min_br, wpf, min_br_dist, min_br_code; + int max_br, min_br, wpf, min_br_code; int num_blks_code, num_blocks, frame_samples; + long long min_br_dist; /* calculate min/max bitrate */ /* TODO: More testing with 3 and 2 blocks. All E-AC-3 samples I've @@ -2184,9 +2185,9 @@ static av_cold int validate_options(AC3EncodeContext *s) this is needed for lookup tables for bandwidth and coupling parameter selection */ min_br_code = -1; - min_br_dist = INT_MAX; + min_br_dist = INT64_MAX; for (i = 0; i < 19; i++) { - int br_dist = abs(ff_ac3_bitrate_tab[i] * 1000 - avctx->bit_rate); + long long br_dist = llabs(ff_ac3_bitrate_tab[i] * 1000 - avctx->bit_rate); if (br_dist < min_br_dist) { min_br_dist = br_dist; min_br_code = i; @@ -2199,10 +2200,11 @@ static av_cold int validate_options(AC3EncodeContext *s) wpf--; s->frame_size_min = 2 * wpf; } else { - int best_br = 0, best_code = 0, best_diff = INT_MAX; + int best_br = 0, best_code = 0; + long long best_diff = INT64_MAX; for (i = 0; i < 19; i++) { int br = (ff_ac3_bitrate_tab[i] >> s->bit_alloc.sr_shift) * 1000; - int diff = abs(br - avctx->bit_rate); + long long diff = llabs(br - avctx->bit_rate); if (diff < best_diff) { best_br = br; best_code = i; |