[FFmpeg-soc] [soc]: r3934 - in dirac/libavcodec: dirac_arith.c dirac_arith.h diracdec.c

conrad subversion at mplayerhq.hu
Thu Jan 1 21:32:23 CET 2009


Author: conrad
Date: Thu Jan  1 21:32:23 2009
New Revision: 3934

Log:
Move contexts so that the initial context for coeffs can be calculated
without a lookup table
1% faster decode

Modified:
   dirac/libavcodec/dirac_arith.c
   dirac/libavcodec/dirac_arith.h
   dirac/libavcodec/diracdec.c

Modified: dirac/libavcodec/dirac_arith.c
==============================================================================
--- dirac/libavcodec/dirac_arith.c	Thu Jan  1 21:32:21 2009	(r3933)
+++ dirac/libavcodec/dirac_arith.c	Thu Jan  1 21:32:23 2009	(r3934)
@@ -63,18 +63,15 @@ static uint16_t arith_lookup[256] = {
 };
 
 static uint8_t next_ctx[ARITH_CONTEXT_COUNT] = {
-    0,
-    0,
-    0,
     ARITH_CONTEXT_ZP_F2,    // ZPZN_F1
     ARITH_CONTEXT_ZP_F2,    // ZPNN_F1
+    ARITH_CONTEXT_NP_F2,    // NPZN_F1
+    ARITH_CONTEXT_NP_F2,    // NPNN_F1
     ARITH_CONTEXT_ZP_F3,    // ZP_F2
     ARITH_CONTEXT_ZP_F4,    // ZP_F3
     ARITH_CONTEXT_ZP_F5,    // ZP_F4
     ARITH_CONTEXT_ZP_F6,    // ZP_F5
     ARITH_CONTEXT_ZP_F6,    // ZP_F6
-    ARITH_CONTEXT_NP_F2,    // NPZN_F1
-    ARITH_CONTEXT_NP_F2,    // NPNN_F1
     ARITH_CONTEXT_NP_F3,    // NP_F2
     ARITH_CONTEXT_NP_F4,    // NP_F3
     ARITH_CONTEXT_NP_F5,    // NP_F4
@@ -82,6 +79,9 @@ static uint8_t next_ctx[ARITH_CONTEXT_CO
     ARITH_CONTEXT_NP_F6,    // NP_F6
     0,
     0,
+    0,
+    0,
+    0,
     ARITH_CONTEXT_Q_OFFSET_FOLLOW,
     0,
     0,

Modified: dirac/libavcodec/dirac_arith.h
==============================================================================
--- dirac/libavcodec/dirac_arith.h	Thu Jan  1 21:32:21 2009	(r3933)
+++ dirac/libavcodec/dirac_arith.h	Thu Jan  1 21:32:23 2009	(r3934)
@@ -31,23 +31,23 @@
 #include "bitstream.h"
 
 enum arith_context_indices {
-    ARITH_CONTEXT_SIGN_ZERO,
-    ARITH_CONTEXT_SIGN_POS,
-    ARITH_CONTEXT_SIGN_NEG,
     ARITH_CONTEXT_ZPZN_F1,
     ARITH_CONTEXT_ZPNN_F1,
+    ARITH_CONTEXT_NPZN_F1,
+    ARITH_CONTEXT_NPNN_F1,
     ARITH_CONTEXT_ZP_F2,
     ARITH_CONTEXT_ZP_F3,
     ARITH_CONTEXT_ZP_F4,
     ARITH_CONTEXT_ZP_F5,
     ARITH_CONTEXT_ZP_F6,
-    ARITH_CONTEXT_NPZN_F1,
-    ARITH_CONTEXT_NPNN_F1,
     ARITH_CONTEXT_NP_F2,
     ARITH_CONTEXT_NP_F3,
     ARITH_CONTEXT_NP_F4,
     ARITH_CONTEXT_NP_F5,
     ARITH_CONTEXT_NP_F6,
+    ARITH_CONTEXT_SIGN_ZERO,
+    ARITH_CONTEXT_SIGN_POS,
+    ARITH_CONTEXT_SIGN_NEG,
     ARITH_CONTEXT_COEFF_DATA,
     ARITH_CONTEXT_ZERO_BLOCK,
     ARITH_CONTEXT_Q_OFFSET_FOLLOW,

Modified: dirac/libavcodec/diracdec.c
==============================================================================
--- dirac/libavcodec/diracdec.c	Thu Jan  1 21:32:21 2009	(r3933)
+++ dirac/libavcodec/diracdec.c	Thu Jan  1 21:32:23 2009	(r3934)
@@ -142,9 +142,6 @@ static inline void coeff_unpack_arith(Di
     int coeff;
     int read_sign;
     int sign_ctx;
-    static const uint8_t follow_ctxs[4] = {
-        ARITH_CONTEXT_ZPZN_F1, ARITH_CONTEXT_ZPNN_F1,
-        ARITH_CONTEXT_NPZN_F1, ARITH_CONTEXT_NPNN_F1 };
 
     /* The value of the pixel belonging to the lower level. */
     if (b->parent)
@@ -155,7 +152,7 @@ static inline void coeff_unpack_arith(Di
 
     sign_ctx = sign_predict(coeffp, b->orientation, x, y, b->stride);
 
-    coeff = dirac_get_arith_uint(&s->arith, follow_ctxs[(parent<<1) | nhood],
+    coeff = dirac_get_arith_uint(&s->arith, (parent<<1) | nhood,
                                  ARITH_CONTEXT_COEFF_DATA);
 
     read_sign = coeff;



More information about the FFmpeg-soc mailing list