Mercurial > libavcodec.hg
comparison mpegaudiodec.c @ 5523:c2ab2ac31edb libavcodec
use av_clip_int16() where it makes sense
author | aurel |
---|---|
date | Sat, 11 Aug 2007 22:48:55 +0000 |
parents | d2ef80f5fd7e |
children | 85c4aca68be3 |
comparison
equal
deleted
inserted
replaced
5522:acaaff7b6fb8 | 5523:c2ab2ac31edb |
---|---|
820 for(j=0;j<32;j++) { | 820 for(j=0;j<32;j++) { |
821 v = tmp[j]; | 821 v = tmp[j]; |
822 #if FRAC_BITS <= 15 | 822 #if FRAC_BITS <= 15 |
823 /* NOTE: can cause a loss in precision if very high amplitude | 823 /* NOTE: can cause a loss in precision if very high amplitude |
824 sound */ | 824 sound */ |
825 if (v > 32767) | 825 v = av_clip_int16(v); |
826 v = 32767; | |
827 else if (v < -32768) | |
828 v = -32768; | |
829 #endif | 826 #endif |
830 synth_buf[j] = v; | 827 synth_buf[j] = v; |
831 } | 828 } |
832 /* copy to avoid wrap */ | 829 /* copy to avoid wrap */ |
833 memcpy(synth_buf + 512, synth_buf, 32 * sizeof(MPA_INT)); | 830 memcpy(synth_buf + 512, synth_buf, 32 * sizeof(MPA_INT)); |