aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vp3.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2005-05-18 08:48:11 +0000
committerMichael Niedermayer <michaelni@gmx.at>2005-05-18 08:48:11 +0000
commitb5da363592aae26030a61c58c973504aef424c19 (patch)
tree545d038fa79b1f902a94b7ddd894df71ef22fa4e /libavcodec/vp3.c
parent8aeadb903a8b0dcf69f607134a9a5b807ea43458 (diff)
downloadffmpeg-b5da363592aae26030a61c58c973504aef424c19.tar.gz
optimizing rle decoding loops a little
Originally committed as revision 4269 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vp3.c')
-rw-r--r--libavcodec/vp3.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index e3a17817ab..4bcf107396 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -1180,12 +1180,12 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
* fetched the bit will be toggled again */
bit ^= 1;
while (current_superblock < s->superblock_count) {
- if (current_run == 0) {
+ if (current_run-- == 0) {
bit ^= 1;
#if 1
current_run = get_vlc2(gb,
- s->superblock_run_length_vlc.table, 6, 2) + 1;
- if (current_run == 34)
+ s->superblock_run_length_vlc.table, 6, 2);
+ if (current_run == 33)
current_run += get_bits(gb, 12);
#else
current_run = get_superblock_run_length(gb);
@@ -1206,9 +1206,7 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
decode_partial_blocks = 1;
}
}
- s->superblock_coding[current_superblock++] =
- (bit) ? SB_PARTIALLY_CODED : SB_NOT_CODED;
- current_run--;
+ s->superblock_coding[current_superblock++] = bit;
}
/* unpack the list of fully coded superblocks if any of the blocks were
@@ -1226,12 +1224,12 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
/* skip any superblocks already marked as partially coded */
if (s->superblock_coding[current_superblock] == SB_NOT_CODED) {
- if (current_run == 0) {
+ if (current_run-- == 0) {
bit ^= 1;
#if 1
current_run = get_vlc2(gb,
- s->superblock_run_length_vlc.table, 6, 2) + 1;
- if (current_run == 34)
+ s->superblock_run_length_vlc.table, 6, 2);
+ if (current_run == 33)
current_run += get_bits(gb, 12);
#else
current_run = get_superblock_run_length(gb);
@@ -1241,9 +1239,7 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
debug_block_coding(" setting superblock %d to %s\n",
current_superblock,
(bit) ? "fully coded" : "not coded");
- s->superblock_coding[current_superblock] =
- (bit) ? SB_FULLY_CODED : SB_NOT_CODED;
- current_run--;
+ s->superblock_coding[current_superblock] = 2*bit;
}
current_superblock++;
}
@@ -1291,11 +1287,11 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
/* fragment may or may not be coded; this is the case
* that cares about the fragment coding runs */
- if (current_run == 0) {
+ if (current_run-- == 0) {
bit ^= 1;
#if 1
current_run = get_vlc2(gb,
- s->fragment_run_length_vlc.table, 5, 2) + 1;
+ s->fragment_run_length_vlc.table, 5, 2);
#else
current_run = get_fragment_run_length(gb);
#endif
@@ -1328,8 +1324,6 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
i, current_fragment);
}
- current_run--;
-
} else {
/* fragments are fully coded in this superblock; actual