]> git.videolan.org Git - x264.git/commitdiff
Fix possible issues with out-of-spec QP values
authorAnton Mitrofanov <BugMaster@narod.ru>
Thu, 8 Nov 2012 22:31:10 +0000 (02:31 +0400)
committerJason Garrett-Glaser <jason@x264.com>
Thu, 8 Nov 2012 22:42:01 +0000 (14:42 -0800)
Fixes a possible regression in r2228.

common/set.c
encoder/analyse.c
encoder/encoder.c

index 56da025f920ef18dd3fd3186db6d544d8da5502e..da25bcb443a2e422ff7e41534f6001766fdf9e95 100644 (file)
@@ -241,7 +241,7 @@ int x264_cqm_init( x264_t *h )
 
     if( !h->mb.b_lossless )
     {
-        while( h->chroma_qp_table[h->param.rc.i_qp_min] <= max_chroma_qp_err )
+        while( h->chroma_qp_table[SPEC_QP(h->param.rc.i_qp_min)] <= max_chroma_qp_err )
             h->param.rc.i_qp_min++;
         if( min_qp_err <= h->param.rc.i_qp_max )
             h->param.rc.i_qp_max = min_qp_err-1;
index 0577b7af7973ce7c92e79a7cd04607ef3431b098..52f19400eda438090835203b48a9a14af2b7e586 100644 (file)
@@ -2922,7 +2922,7 @@ static inline void x264_mb_analyse_qp_rd( x264_t *h, x264_mb_analysis_t *a )
         {
             if( !origcbp )
             {
-                h->mb.i_qp = X264_MAX( h->mb.i_qp - threshold - 1, h->param.rc.i_qp_min );
+                h->mb.i_qp = X264_MAX( h->mb.i_qp - threshold - 1, SPEC_QP( h->param.rc.i_qp_min ) );
                 h->mb.i_chroma_qp = h->chroma_qp_table[h->mb.i_qp];
                 already_checked_cost = x264_rd_cost_mb( h, a->i_lambda2 );
                 if( !h->mb.cbp[h->mb.i_mb_xy] )
index 8ec9260b33ace1d548b903c84bcd26a40078ec17..c8460d2675af88fda2e7513795a51191c36c4632 100644 (file)
@@ -2239,6 +2239,7 @@ static int x264_slice_write( x264_t *h )
     /* Set the QP equal to the first QP in the slice for more accurate CABAC initialization. */
     h->mb.i_mb_xy = h->sh.i_first_mb;
     h->sh.i_qp = x264_ratecontrol_mb_qp( h );
+    h->sh.i_qp = SPEC_QP( h->sh.i_qp );
     h->sh.i_qp_delta = h->sh.i_qp - h->pps->i_pic_init_qp;
 
     x264_slice_header_write( &h->out.bs, &h->sh, h->i_nal_ref_idc );