diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-05-20 10:58:43 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-05-20 10:58:43 +0200 |
commit | fbba76e89d852c4f86ec3c498669afe037f9575a (patch) | |
tree | 5799ca3b4c9d7f19fd1b1536c5873fa0544c3861 | |
parent | faac955d9b7abf1c17dd76df6a8f2f3644ef5099 (diff) | |
parent | 98186578a2a21af5bfe6dd71d222dc270f763c7d (diff) | |
download | ffmpeg-fbba76e89d852c4f86ec3c498669afe037f9575a.tar.gz |
Merge commit '98186578a2a21af5bfe6dd71d222dc270f763c7d'
* commit '98186578a2a21af5bfe6dd71d222dc270f763c7d':
vorbis: refactor vorbis_residue_decode_internal
Conflicts:
libavcodec/vorbisdec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/vorbisdec.c | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index ba5b1a3f94..b7e676f1a0 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -1313,6 +1313,37 @@ static int vorbis_floor1_decode(vorbis_context *vc, return 0; } +static av_always_inline int setup_classifs(vorbis_context *vc, + vorbis_residue *vr, + uint8_t *do_not_decode, + unsigned ch_used, + unsigned partition_count) +{ + int p, j, i; + unsigned c_p_c = vc->codebooks[vr->classbook].dimensions; + unsigned inverse_class = ff_inverse[vr->classifications]; + unsigned temp, temp2; + for (p = 0, j = 0; j < ch_used; ++j) { + if (!do_not_decode[j]) { + temp = get_vlc2(&vc->gb, vc->codebooks[vr->classbook].vlc.table, + vc->codebooks[vr->classbook].nb_bits, 3); + + av_dlog(NULL, "Classword: %u\n", temp); + + av_assert0(vr->classifications > 1 && temp <= 65536); //needed for inverse[] + + for (i = 0; i < c_p_c; ++i) { + temp2 = (((uint64_t)temp) * inverse_class) >> 32; + if (partition_count + c_p_c - 1 - i < vr->ptns_to_read) + vr->classifs[p + partition_count + c_p_c - 1 - i] = + temp - temp2 * vr->classifications; + temp = temp2; + } + } + p += vr->ptns_to_read; + } + return 0; +} // Read and decode residue static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, @@ -1356,26 +1387,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, voffset = vr->begin; for (partition_count = 0; partition_count < ptns_to_read;) { // SPEC error if (!pass) { - unsigned inverse_class = ff_inverse[vr->classifications]; - for (j_times_ptns_to_read = 0, j = 0; j < ch_used; ++j) { - if (!do_not_decode[j]) { - unsigned temp = get_vlc2(gb, vc->codebooks[vr->classbook].vlc.table, - vc->codebooks[vr->classbook].nb_bits, 3); - - av_dlog(NULL, "Classword: %u\n", temp); - - av_assert0(vr->classifications > 1 && temp <= 65536); //needed for inverse[] - for (i = 0; i < c_p_c; ++i) { - unsigned temp2; - - temp2 = (((uint64_t)temp) * inverse_class) >> 32; - if (partition_count + c_p_c - 1 - i < ptns_to_read) - classifs[j_times_ptns_to_read + partition_count + c_p_c - 1 - i] = temp - temp2 * vr->classifications; - temp = temp2; - } - } - j_times_ptns_to_read += ptns_to_read; - } + setup_classifs(vc, vr, do_not_decode, ch_used, partition_count); } for (i = 0; (i < c_p_c) && (partition_count < ptns_to_read); ++i) { for (j_times_ptns_to_read = 0, j = 0; j < ch_used; ++j) { |