comparison mjpeg.c @ 3239:d92263225a77 libavcodec

avoid hard to predict branch (idea by arpi)
author michael
date Fri, 31 Mar 2006 16:50:43 +0000
parents b9f906a0b0f8
children 5fab2409bf8d
comparison
equal deleted inserted replaced
3238:21ba2e68ce03 3239:d92263225a77
1286 } else { 1286 } else {
1287 i += ((unsigned)code) >> 4; 1287 i += ((unsigned)code) >> 4;
1288 code &= 0xf; 1288 code &= 0xf;
1289 1289
1290 UPDATE_CACHE(re, &s->gb) 1290 UPDATE_CACHE(re, &s->gb)
1291 1291 {
1292 if ((int32_t)GET_CACHE(re,&s->gb)<0) { //MSB=1 1292 int cache=GET_CACHE(re,gb);
1293 level = NEG_USR32( GET_CACHE(re,&s->gb),code); 1293 int sign=(~cache)>>31;
1294 } else { 1294 level = (NEG_USR32(sign ^ cache,code) ^ sign) + (sign&1) ;
1295 level = - NEG_USR32(~GET_CACHE(re,&s->gb),code);
1296 } 1295 }
1297 1296
1298 LAST_SKIP_BITS(re, &s->gb, code) 1297 LAST_SKIP_BITS(re, &s->gb, code)
1299 1298
1300 if (i >= 63) { 1299 if (i >= 63) {