mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
avcodec/vc1_block: Optimize vc1_decode_ac_coeff()
Avoid branches in sign handling Move local variables to where they are used Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
ccad34e3ca
commit
ec908ce427
@ -487,17 +487,16 @@ static void vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip,
|
||||
int *value, int codingset)
|
||||
{
|
||||
GetBitContext *gb = &v->s.gb;
|
||||
int index, escape, run = 0, level = 0, lst = 0;
|
||||
int index, run, level, lst, sign;
|
||||
|
||||
index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset].table, AC_VLC_BITS, 3);
|
||||
if (index != ff_vc1_ac_sizes[codingset] - 1) {
|
||||
run = vc1_index_decode_table[codingset][index][0];
|
||||
level = vc1_index_decode_table[codingset][index][1];
|
||||
lst = index >= vc1_last_decode_table[codingset] || get_bits_left(gb) < 0;
|
||||
if (get_bits1(gb))
|
||||
level = -level;
|
||||
sign = get_bits1(gb);
|
||||
} else {
|
||||
escape = decode210(gb);
|
||||
int escape = decode210(gb);
|
||||
if (escape != 2) {
|
||||
index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset].table, AC_VLC_BITS, 3);
|
||||
run = vc1_index_decode_table[codingset][index][0];
|
||||
@ -514,10 +513,8 @@ static void vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip,
|
||||
else
|
||||
run += vc1_delta_run_table[codingset][level] + 1;
|
||||
}
|
||||
if (get_bits1(gb))
|
||||
level = -level;
|
||||
sign = get_bits1(gb);
|
||||
} else {
|
||||
int sign;
|
||||
lst = get_bits1(gb);
|
||||
if (v->s.esc3_level_length == 0) {
|
||||
if (v->pq < 8 || v->dquantfrm) { // table 59
|
||||
@ -532,14 +529,12 @@ static void vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip,
|
||||
run = get_bits(gb, v->s.esc3_run_length);
|
||||
sign = get_bits1(gb);
|
||||
level = get_bits(gb, v->s.esc3_level_length);
|
||||
if (sign)
|
||||
level = -level;
|
||||
}
|
||||
}
|
||||
|
||||
*last = lst;
|
||||
*skip = run;
|
||||
*value = level;
|
||||
*value = (level ^ -sign) + sign;
|
||||
}
|
||||
|
||||
/** Decode intra block in intra frames - should be faster than decode_intra_block
|
||||
|
Loading…
Reference in New Issue
Block a user