On recent hardware and compiler using a plain division is faster.
---

Some numbers using gcc-4.8 in -Og mode.

avconv
1399640 decicycles in vorbis, 2048 runs, 0 skips
avconv-div
1385903 decicycles in vorbis, 2048 runs, 0 skips
avconv
1422062 decicycles in vorbis, 2048 runs, 0 skips
avconv-div
1393888 decicycles in vorbis, 2048 runs, 0 skips
avconv
1420744 decicycles in vorbis, 2048 runs, 0 skips
avconv-div
1389816 decicycles in vorbis, 2048 runs, 0 skips
avconv
1398754 decicycles in vorbis, 2048 runs, 0 skips
avconv-div
1384642 decicycles in vorbis, 2048 runs, 0 skips
avconv
1408228 decicycles in vorbis, 2048 runs, 0 skips
avconv-div
1402553 decicycles in vorbis, 2048 runs, 0 skips
avconv
1404719 decicycles in vorbis, 2048 runs, 0 skips
avconv-div
1400232 decicycles in vorbis, 2048 runs, 0 skips


 libavcodec/vorbisdec.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index 03c80b4..35e2242 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -42,9 +42,6 @@
 #define V_MAX_VLCS (1 << 16)
 #define V_MAX_PARTITIONS (1 << 20)

-#undef NDEBUG
-#include <assert.h>
-
 typedef struct {
     uint8_t      dimensions;
     uint8_t      lookup_type;
@@ -1345,7 +1342,6 @@ 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,
@@ -1353,11 +1349,9 @@ static av_always_inline int 
vorbis_residue_decode_internal(vorbis_context *vc,

                         av_dlog(NULL, "Classword: %u\n", temp);

-                        assert(vr->classifications > 1 && temp <= 65536); 
//needed for inverse[]
                         for (i = 0; i < c_p_c; ++i) {
-                            unsigned temp2;
+                            unsigned temp2 = temp / vr->classifications;

-                            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;
--
1.8.2.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to