From ee8d5e4b51da99e576b5aea3008e70d1c7ed2372 Mon Sep 17 00:00:00 2001 From: Anton Mitrofanov Date: Wed, 22 Jan 2014 12:54:49 +0400 Subject: [PATCH] Really fix quantization factor allocation Actually allocate less (instead of just initialize less) and fix comments. --- 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 ab14a632..e6a6fd00 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 ee865e85..bbfd921d 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) );\ }\ } -- 2.40.0