]> git.sesse.net Git - x264/commitdiff
Fix quantization factor allocation
authorFiona Glaser <fiona@x264.com>
Tue, 21 Jan 2014 21:39:33 +0000 (13:39 -0800)
committerFiona Glaser <fiona@x264.com>
Tue, 21 Jan 2014 21:40:12 +0000 (13:40 -0800)
We don't need to wastefully allocate quant tables above QP_MAX_SPEC; they're
never used.

common/common.h
common/set.c
tools/checkasm.c

index 6e63170f486c2f0adab17fb060cf194a9f2eb77f..fa8fab360b367bc7c8db87a064bcdd33a53816dd 100644 (file)
@@ -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. */
index 53c61ca1175560e4992754f466871ec1cf929b0b..ee865e85b84bf43655fdb062054b4e5bbeb6f2c8 100644 (file)
@@ -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++ )
index 4239605cadac19d97e28fbf8a192ba38eb7e623a..2f6f2860f0960572028587bfe8007d8930803046 100644 (file)
@@ -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 );