comparison vp56.h @ 12032:572c81b3be19 libavcodec

CMOV-ify vp56 arithcoder This incantation causes gcc 4.3 to generate cmov on x86, a vastly better option than a completely unpredictable branch. Hopefully this carries over to newer versions and other CPUs with conditionals. ~5 cycles saved per call on a Core i7.
author darkshikari
date Wed, 30 Jun 2010 23:18:47 +0000
parents 5578dcdf030c
children 5de2b84a1fc3
comparison
equal deleted inserted replaced
12031:5578dcdf030c 12032:572c81b3be19
197 unsigned int low = 1 + (((c->high - 1) * prob) >> 8); 197 unsigned int low = 1 + (((c->high - 1) * prob) >> 8);
198 unsigned int low_shift = low << 8; 198 unsigned int low_shift = low << 8;
199 int bit = c->code_word >= low_shift; 199 int bit = c->code_word >= low_shift;
200 int shift; 200 int shift;
201 201
202 if (bit) { 202 c->high = bit ? c->high - low : low;
203 c->high -= low; 203 c->code_word = bit ? c->code_word - low_shift : c->code_word;
204 c->code_word -= low_shift;
205 } else {
206 c->high = low;
207 }
208 204
209 /* normalize */ 205 /* normalize */
210 shift = ff_h264_norm_shift[c->high] - 1; 206 shift = ff_h264_norm_shift[c->high] - 1;
211 c->high <<= shift; 207 c->high <<= shift;
212 c->code_word <<= shift; 208 c->code_word <<= shift;