Mercurial > libavcodec.hg
comparison mjpeg.c @ 3226:e3ddc57c2d6e libavcodec
minor optimization of decode_block()
author | michael |
---|---|
date | Wed, 29 Mar 2006 08:41:53 +0000 |
parents | a0d2d5053c9d |
children | ea0ca798d389 |
comparison
equal
deleted
inserted
replaced
3225:a0d2d5053c9d | 3226:e3ddc57c2d6e |
---|---|
1266 OPEN_READER(re, &s->gb) | 1266 OPEN_READER(re, &s->gb) |
1267 for(;;) { | 1267 for(;;) { |
1268 UPDATE_CACHE(re, &s->gb); | 1268 UPDATE_CACHE(re, &s->gb); |
1269 GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2) | 1269 GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2) |
1270 | 1270 |
1271 if (code < 0) { | |
1272 dprintf("error ac\n"); | |
1273 return -1; | |
1274 } | |
1275 /* EOB */ | 1271 /* EOB */ |
1276 if (code == 0) | 1272 if (code == 0) |
1277 break; | 1273 break; |
1278 if (code == 0xf0) { | 1274 if (code == 0xf0) { |
1279 i += 16; | 1275 i += 16; |
1280 } else { | 1276 } else { |
1281 i += code >> 4; | 1277 i += ((unsigned)code) >> 4; |
1282 code &= 0xf; | 1278 code &= 0xf; |
1283 | 1279 |
1284 UPDATE_CACHE(re, &s->gb) | 1280 UPDATE_CACHE(re, &s->gb) |
1285 | 1281 |
1286 if ((int32_t)GET_CACHE(re,&s->gb)<0) { //MSB=1 | 1282 if ((int32_t)GET_CACHE(re,&s->gb)<0) { //MSB=1 |
1287 level = NEG_USR32( GET_CACHE(re,&s->gb),code); | 1283 level = NEG_USR32( GET_CACHE(re,&s->gb),code); |
1288 } else { | 1284 } else { |
1289 level = - NEG_USR32(~GET_CACHE(re,&s->gb),code); | 1285 level = - NEG_USR32(~GET_CACHE(re,&s->gb),code); |
1290 } | 1286 } |
1291 | 1287 |
1292 SKIP_BITS(re, &s->gb, code) | 1288 LAST_SKIP_BITS(re, &s->gb, code) |
1293 | 1289 |
1294 if (i >= 64) { | 1290 if (i >= 64) { |
1295 dprintf("error count: %d\n", i); | 1291 dprintf("error count: %d\n", i); |
1296 return -1; | 1292 return -1; |
1297 } | 1293 } |