mirror of https://git.ffmpeg.org/ffmpeg.git
branchless renormalization (1% faster get_cabac) old branchless renormalization wasnt faster because gcc was scared of the shift variable (missusing bit variable now)
Originally committed as revision 6587 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
99ce10873d
commit
260ceb6322
|
@ -73,22 +73,22 @@ const uint8_t ff_h264_lps_state[64]= {
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t ff_h264_norm_shift[256]= {
|
const uint8_t ff_h264_norm_shift[256]= {
|
||||||
8,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,
|
9,8,7,7,6,6,6,6,5,5,5,5,5,5,5,5,
|
||||||
|
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
|
||||||
|
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
|
||||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
|
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
|
||||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
|
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
|
||||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
|
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
|
||||||
|
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
|
||||||
|
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
|
||||||
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||||
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||||
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||||
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -266,16 +266,16 @@ static void refill(CABACContext *c){
|
||||||
c->bytestream+= CABAC_BITS/8;
|
c->bytestream+= CABAC_BITS/8;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 /* all use commented */
|
#if 1 /* all use commented */
|
||||||
static void refill2(CABACContext *c){
|
static void refill2(CABACContext *c){
|
||||||
int i, x;
|
int i, x;
|
||||||
|
|
||||||
x= c->low ^ (c->low-1);
|
x= c->low ^ (c->low-1);
|
||||||
i= 8 - ff_h264_norm_shift[x>>(CABAC_BITS+1)];
|
i= 9 - ff_h264_norm_shift[x>>(CABAC_BITS+1)];
|
||||||
|
|
||||||
x= -CABAC_MASK;
|
x= -CABAC_MASK;
|
||||||
|
|
||||||
if(c->bytestream < c->bytestream_end)
|
if(c->bytestream <= c->bytestream_end)
|
||||||
#if CABAC_BITS == 16
|
#if CABAC_BITS == 16
|
||||||
x+= (c->bytestream[0]<<9) + (c->bytestream[1]<<1);
|
x+= (c->bytestream[0]<<9) + (c->bytestream[1]<<1);
|
||||||
#else
|
#else
|
||||||
|
@ -395,17 +395,18 @@ asm(
|
||||||
#endif
|
#endif
|
||||||
renorm_cabac_decoder_once(c);
|
renorm_cabac_decoder_once(c);
|
||||||
}else{
|
}else{
|
||||||
// int shift= ff_h264_norm_shift[RangeLPS>>17];
|
bit= ff_h264_norm_shift[RangeLPS>>17];
|
||||||
bit= (s&1)^1;
|
|
||||||
c->low -= c->range;
|
c->low -= c->range;
|
||||||
*state= c->lps_state[s];
|
*state= c->lps_state[s];
|
||||||
c->range = RangeLPS;
|
// c->range = RangeLPS;
|
||||||
renorm_cabac_decoder(c);
|
// renorm_cabac_decoder(c);
|
||||||
/* c->range = RangeLPS<<shift;
|
c->range = RangeLPS<<bit;
|
||||||
c->low <<= shift;
|
c->low <<= bit;
|
||||||
|
bit= (s&1)^1;
|
||||||
|
|
||||||
if(!(c->low & 0xFFFF)){
|
if(!(c->low & 0xFFFF)){
|
||||||
refill2(c);
|
refill2(c);
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
lps_mask= (c->range - c->low)>>31;
|
lps_mask= (c->range - c->low)>>31;
|
||||||
|
|
Loading…
Reference in New Issue