Revision af3c8f82 libavcodec/adpcm.c
libavcodec/adpcm.c  

274  274 
static inline unsigned char adpcm_ima_qt_compress_sample(ADPCMChannelStatus *c, short sample) 
275  275 
{ 
276  276 
int delta = sample  c>prev_sample; 
277 
int mask, step = step_table[c>step_index]; 

278 
int diff = step >> 3; 

279 
int nibble = 0; 

277 
int diff, step = step_table[c>step_index]; 

278 
int nibble = 8*(delta < 0); 

280  279  
281 
if (delta < 0) { 

282 
nibble = 8; 

283 
delta = delta; 

284 
} 

280 
delta= abs(delta); 

281 
diff = delta + (step >> 3); 

285  282  
286 
for (mask = 4; mask;) { 

287 
if (delta >= step) { 

288 
nibble = mask; 

289 
delta = step; 

290 
diff += step; 

291 
} 

292 
step >>= 1; 

293 
mask >>= 1; 

283 
if (delta >= step) { 

284 
nibble = 4; 

285 
delta = step; 

286 
} 

287 
step >>= 1; 

288 
if (delta >= step) { 

289 
nibble = 2; 

290 
delta = step; 

291 
} 

292 
step >>= 1; 

293 
if (delta >= step) { 

294 
nibble = 1; 

295 
delta = step; 

294  296 
} 
297 
diff = delta; 

295  298  
296  299 
if (nibble & 8) 
297  300 
c>prev_sample = diff; 
Also available in: Unified diff