[x264-devel] Really fix quantization factor allocation

Anton Mitrofanov git at videolan.org
Thu Mar 13 21:23:50 CET 2014


x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Wed Jan 22 12:54:49 2014 +0400| [08a1cbd21ebb2e2c6303d1b4fbef100f28c9023f] | committer: Jason Garrett-Glaser

Really fix quantization factor allocation

Actually allocate less (instead of just initialize less) and fix comments.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=08a1cbd21ebb2e2c6303d1b4fbef100f28c9023f
---

 common/common.h |   16 ++++++++--------
 common/set.c    |    8 ++++----
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/common/common.h b/common/common.h
index ab14a63..e6a6fd0 100644
--- a/common/common.h
+++ b/common/common.h
@@ -552,15 +552,15 @@ struct x264_t
     int             (*dequant4_mf[4])[16];   /* [4][6][16] */
     int             (*dequant8_mf[4])[64];   /* [4][6][64] */
     /* quantization matrix for trellis, [cqm][qp][coef] */
-    int             (*unquant4_mf[4])[16];   /* [4][QP_MAX_SPEC][16] */
-    int             (*unquant8_mf[4])[64];   /* [4][QP_MAX_SPEC][64] */
+    int             (*unquant4_mf[4])[16];   /* [4][QP_MAX_SPEC+1][16] */
+    int             (*unquant8_mf[4])[64];   /* [4][QP_MAX_SPEC+1][64] */
     /* quantization matrix for deadzone */
-    udctcoef        (*quant4_mf[4])[16];     /* [4][QP_MAX_SPEC][16] */
-    udctcoef        (*quant8_mf[4])[64];     /* [4][QP_MAX_SPEC][64] */
-    udctcoef        (*quant4_bias[4])[16];   /* [4][QP_MAX_SPEC][16] */
-    udctcoef        (*quant8_bias[4])[64];   /* [4][QP_MAX_SPEC][64] */
-    udctcoef        (*quant4_bias0[4])[16];  /* [4][QP_MAX_SPEC][16] */
-    udctcoef        (*quant8_bias0[4])[64];  /* [4][QP_MAX_SPEC][64] */
+    udctcoef        (*quant4_mf[4])[16];     /* [4][QP_MAX_SPEC+1][16] */
+    udctcoef        (*quant8_mf[4])[64];     /* [4][QP_MAX_SPEC+1][64] */
+    udctcoef        (*quant4_bias[4])[16];   /* [4][QP_MAX_SPEC+1][16] */
+    udctcoef        (*quant8_bias[4])[64];   /* [4][QP_MAX_SPEC+1][64] */
+    udctcoef        (*quant4_bias0[4])[16];  /* [4][QP_MAX_SPEC+1][16] */
+    udctcoef        (*quant8_bias0[4])[64];  /* [4][QP_MAX_SPEC+1][64] */
     udctcoef        (*nr_offset_emergency)[4][64];
 
     /* mv/ref cost arrays. */
diff --git a/common/set.c b/common/set.c
index ee865e8..bbfd921 100644
--- a/common/set.c
+++ b/common/set.c
@@ -105,9 +105,9 @@ int x264_cqm_init( x264_t *h )
         }\
         else\
         {\
-            CHECKED_MALLOC( h->  quant##w##_mf[i], (QP_MAX+1)*size*sizeof(udctcoef) );\
+            CHECKED_MALLOC( h->  quant##w##_mf[i], (QP_MAX_SPEC+1)*size*sizeof(udctcoef) );\
             CHECKED_MALLOC( h->dequant##w##_mf[i],  6*size*sizeof(int) );\
-            CHECKED_MALLOC( h->unquant##w##_mf[i], (QP_MAX+1)*size*sizeof(int) );\
+            CHECKED_MALLOC( h->unquant##w##_mf[i], (QP_MAX_SPEC+1)*size*sizeof(int) );\
         }\
         for( j = 0; j < i; j++ )\
             if( deadzone[j] == deadzone[i] &&\
@@ -120,8 +120,8 @@ int x264_cqm_init( x264_t *h )
         }\
         else\
         {\
-            CHECKED_MALLOC( h->quant##w##_bias[i], (QP_MAX+1)*size*sizeof(udctcoef) );\
-            CHECKED_MALLOC( h->quant##w##_bias0[i], (QP_MAX+1)*size*sizeof(udctcoef) );\
+            CHECKED_MALLOC( h->quant##w##_bias[i], (QP_MAX_SPEC+1)*size*sizeof(udctcoef) );\
+            CHECKED_MALLOC( h->quant##w##_bias0[i], (QP_MAX_SPEC+1)*size*sizeof(udctcoef) );\
         }\
     }
 



More information about the x264-devel mailing list