diff options
author | Mike Melanson <mike@multimedia.cx> | 2009-09-21 01:37:50 +0000 |
---|---|---|
committer | Mike Melanson <mike@multimedia.cx> | 2009-09-21 01:37:50 +0000 |
commit | ee3d7f585215458246c2dd971c2afdd2642a5ca8 (patch) | |
tree | e8969f77a8bb3a95b5bc512c43d65b1c0e688d0c /libavcodec/vp3.c | |
parent | 40461e54cef6e678848005acfcd697a0f53958d0 (diff) | |
download | ffmpeg-ee3d7f585215458246c2dd971c2afdd2642a5ca8.tar.gz |
Modify unpack_vlcs() so that there are fewer dereferences through the
main (heavily iterated) loop.
Originally committed as revision 19934 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vp3.c')
-rw-r--r-- | libavcodec/vp3.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index 2cbafa7165..0f4f6dafb3 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -1035,9 +1035,15 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb, int zero_run = 0; DCTELEM coeff = 0; Vp3Fragment *fragment; - uint8_t *perm= s->scantable.permutated; int bits_to_get; + /* local references to structure members to avoid repeated deferences */ + uint8_t *perm= s->scantable.permutated; + int *coded_fragment_list = s->coded_fragment_list; + Vp3Fragment *all_fragments = s->all_fragments; + uint8_t *coeff_counts = s->coeff_counts; + VLC_TYPE (*vlc_table)[2] = table->table; + if ((first_fragment >= s->fragment_count) || (last_fragment >= s->fragment_count)) { @@ -1047,15 +1053,15 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb, } for (i = first_fragment; i <= last_fragment; i++) { - int fragment_num = s->coded_fragment_list[i]; + int fragment_num = coded_fragment_list[i]; - if (s->coeff_counts[fragment_num] > coeff_index) + if (coeff_counts[fragment_num] > coeff_index) continue; - fragment = &s->all_fragments[fragment_num]; + fragment = &all_fragments[fragment_num]; if (!eob_run) { /* decode a VLC into a token */ - token = get_vlc2(gb, table->table, 5, 3); + token = get_vlc2(gb, vlc_table, 5, 3); /* use the token to get a zero run, a coefficient, and an eob run */ if (token <= 6) { eob_run = eob_run_base[token]; @@ -1076,16 +1082,16 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb, } if (!eob_run) { - s->coeff_counts[fragment_num] += zero_run; - if (s->coeff_counts[fragment_num] < 64){ + coeff_counts[fragment_num] += zero_run; + if (coeff_counts[fragment_num] < 64){ fragment->next_coeff->coeff= coeff; - fragment->next_coeff->index= perm[s->coeff_counts[fragment_num]++]; //FIXME perm here already? + fragment->next_coeff->index= perm[coeff_counts[fragment_num]++]; //FIXME perm here already? fragment->next_coeff->next= s->next_coeff; s->next_coeff->next=NULL; fragment->next_coeff= s->next_coeff++; } } else { - s->coeff_counts[fragment_num] |= 128; + coeff_counts[fragment_num] |= 128; eob_run--; } } |