summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2007-08-11 23:23:20 +0000
committerAurelien Jacobs <aurel@gnuage.org>2007-08-11 23:23:20 +0000
commite4a50e6d2e4798f7dec9f9224605dd09b55c18d7 (patch)
tree7ef94e19ac3684370b321e1601199a4fa89f828e /libavcodec
parent295f37379269e2df0e8983fbe89787ef1f49dc93 (diff)
one more simplification
Originally committed as revision 10081 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/adpcm.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 0a1059e351..53341fd17f 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -692,7 +692,6 @@ static inline short adpcm_ms_expand_nibble(ADPCMChannelStatus *c, char nibble)
static inline short adpcm_ct_expand_nibble(ADPCMChannelStatus *c, char nibble)
{
- int predictor;
int sign, delta, diff;
int new_step;
@@ -702,12 +701,9 @@ static inline short adpcm_ct_expand_nibble(ADPCMChannelStatus *c, char nibble)
* the reference ADPCM implementation since modern CPUs can do the mults
* quickly enough */
diff = ((2 * delta + 1) * c->step) >> 3;
- predictor = c->predictor;
/* predictor update is not so trivial: predictor is multiplied on 254/256 before updating */
- if(sign)
- predictor = ((predictor * 254) >> 8) - diff;
- else
- predictor = ((predictor * 254) >> 8) + diff;
+ c->predictor = ((c->predictor * 254) >> 8) + (sign ? -diff : diff);
+ c->predictor = av_clip_int16(c->predictor);
/* calculate new step and clamp it to range 511..32767 */
new_step = (ct_adpcm_table[nibble & 7] * c->step) >> 8;
c->step = new_step;
@@ -716,7 +712,6 @@ static inline short adpcm_ct_expand_nibble(ADPCMChannelStatus *c, char nibble)
if(c->step > 32767)
c->step = 32767;
- c->predictor = av_clip_int16(predictor);
return (short)c->predictor;
}