[FFmpeg-cvslog] avcodec/lagarithrac: increase LUT from 256 to 1024 bytes

Michael Niedermayer git at videolan.org
Wed Jun 4 02:29:58 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue May 27 01:33:59 2014 +0200| [d8ae0dfd999db6721892a1242e0baaa34af5135d] | committer: Michael Niedermayer

avcodec/lagarithrac: increase LUT from 256 to 1024 bytes

about 2 cycles (~1%) faster lag_get_rac()

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d8ae0dfd999db6721892a1242e0baaa34af5135d
---

 libavcodec/lagarithrac.c |    4 ++--
 libavcodec/lagarithrac.h |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/lagarithrac.c b/libavcodec/lagarithrac.c
index 895acb0..c240646 100644
--- a/libavcodec/lagarithrac.c
+++ b/libavcodec/lagarithrac.c
@@ -45,9 +45,9 @@ void ff_lag_rac_init(lag_rac *l, GetBitContext *gb, int length)
 
     l->range        = 0x80;
     l->low          = *l->bytestream >> 1;
-    l->hash_shift   = FFMAX((int)l->scale - 8, 0);
+    l->hash_shift   = FFMAX((int)l->scale - 10, 0);
 
-    for (i = j = 0; i < 256; i++) {
+    for (i = j = 0; i < 1024; i++) {
         unsigned r = i << l->hash_shift;
         while (l->prob[j + 1] <= r)
             j++;
diff --git a/libavcodec/lagarithrac.h b/libavcodec/lagarithrac.h
index ebc6bef..7d60d56 100644
--- a/libavcodec/lagarithrac.h
+++ b/libavcodec/lagarithrac.h
@@ -48,7 +48,7 @@ typedef struct lag_rac {
     const uint8_t *bytestream_end;    /**< End position of input bytestream. */
 
     uint32_t prob[258];         /**< Table of cumulative probability for each symbol. */
-    uint8_t  range_hash[256];   /**< Hash table mapping upper byte to approximate symbol. */
+    uint8_t  range_hash[1024];   /**< Hash table mapping upper byte to approximate symbol. */
 } lag_rac;
 
 void ff_lag_rac_init(lag_rac *l, GetBitContext *gb, int length);



More information about the ffmpeg-cvslog mailing list