[x264-devel] Fix quantization factor allocation

Jason Garrett-Glaser git at videolan.org
Tue Jan 21 22:51:26 CET 2014


x264 | branch: master | Jason Garrett-Glaser <jason at x264.com> | Tue Jan 21 13:39:33 2014 -0800| [690bbe02fddda1321aaf3b2b6b15bb26c4a6ce41] | committer: Jason Garrett-Glaser

Fix quantization factor allocation

We don't need to wastefully allocate quant tables above QP_MAX_SPEC; they're
never used.

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

 common/common.h  |   16 ++++++++--------
 common/set.c     |    2 +-
 tools/checkasm.c |    2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/common/common.h b/common/common.h
index 6e63170..fa8fab3 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][52][16] */
-    int             (*unquant8_mf[4])[64];   /* [4][52][64] */
+    int             (*unquant4_mf[4])[16];   /* [4][QP_MAX_SPEC][16] */
+    int             (*unquant8_mf[4])[64];   /* [4][QP_MAX_SPEC][64] */
     /* quantization matrix for deadzone */
-    udctcoef        (*quant4_mf[4])[16];     /* [4][52][16] */
-    udctcoef        (*quant8_mf[4])[64];     /* [4][52][64] */
-    udctcoef        (*quant4_bias[4])[16];   /* [4][52][16] */
-    udctcoef        (*quant8_bias[4])[64];   /* [4][52][64] */
-    udctcoef        (*quant4_bias0[4])[16];  /* [4][52][16] */
-    udctcoef        (*quant8_bias0[4])[64];  /* [4][52][64] */
+    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        (*nr_offset_emergency)[4][64];
 
     /* mv/ref cost arrays. */
diff --git a/common/set.c b/common/set.c
index 53c61ca..ee865e8 100644
--- a/common/set.c
+++ b/common/set.c
@@ -159,7 +159,7 @@ int x264_cqm_init( x264_t *h )
                      quant8_mf[i_list][q][i] = DIV(def_quant8[q][i] * 16, h->pps->scaling_list[4+i_list][i]);
             }
     }
-    for( int q = 0; q < QP_MAX+1; q++ )
+    for( int q = 0; q <= QP_MAX_SPEC; q++ )
     {
         int j;
         for( int i_list = 0; i_list < 4; i_list++ )
diff --git a/tools/checkasm.c b/tools/checkasm.c
index f8f55e8..4f1f28f 100644
--- a/tools/checkasm.c
+++ b/tools/checkasm.c
@@ -1778,7 +1778,7 @@ static int check_quant( int cpu_ref, int cpu_new )
         }
 
         h->param.rc.i_qp_min = 0;
-        h->param.rc.i_qp_max = QP_MAX;
+        h->param.rc.i_qp_max = QP_MAX_SPEC;
         x264_cqm_init( h );
         x264_quant_init( h, 0, &qf_c );
         x264_quant_init( h, cpu_ref, &qf_ref );



More information about the x264-devel mailing list