~ubuntu-branches/ubuntu/wily/x264/wily-proposed

« back to all changes in this revision

Viewing changes to encoder/cabac.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-01-19 07:28:39 UTC
  • mfrom: (12.1.11 experimental)
  • Revision ID: package-import@ubuntu.com-20120119072839-0vj6g40ky09d9nru
Tags: 2:0.120.2127+gitf33c8cb-2ubuntu1
* Merge from Debian, remaining changes:
  - build against libgpac-dev to enable .mp4 output

Show diffs side-by-side

added added

removed removed

Lines of Context:
167
167
 
168
168
    if( i_dqp != 0 )
169
169
    {
170
 
        int val = i_dqp <= 0 ? (-2*i_dqp) : (2*i_dqp - 1);
 
170
        /* Faster than (i_dqp <= 0 ? (-2*i_dqp) : (2*i_dqp-1)).
 
171
         * If you so much as sneeze on these lines, gcc will compile this suboptimally. */
 
172
        i_dqp *= 2;
 
173
        int val = 1 - i_dqp;
 
174
        if( val < 0 ) val = i_dqp;
 
175
        val--;
171
176
        /* dqp is interpreted modulo (QP_MAX_SPEC+1) */
172
177
        if( val >= QP_MAX_SPEC && val != QP_MAX_SPEC+1 )
173
178
            val = 2*QP_MAX_SPEC+1 - val;
952
957
                bs_write( &s, BIT_DEPTH, h->mb.pic.p_fenc[p][i] );
953
958
        if( chroma )
954
959
            for( int ch = 1; ch < 3; ch++ )
955
 
                for( int i = 0; i < 16>>h->mb.chroma_v_shift; i++ )
 
960
                for( int i = 0; i < 16>>CHROMA_V_SHIFT; i++ )
956
961
                    for( int j = 0; j < 8; j++ )
957
962
                        bs_write( &s, BIT_DEPTH, h->mb.pic.p_fenc[ch][i*FENC_STRIDE+j] );
958
963
 
1076
1081
 
1077
1082
            if( h->mb.i_cbp_chroma == 2 ) /* Chroma AC residual present */
1078
1083
            {
1079
 
                int step = 8 << h->mb.chroma_v_shift;
 
1084
                int step = 8 << CHROMA_V_SHIFT;
1080
1085
                for( int i = 16; i < 3*16; i += step )
1081
1086
                    for( int j = i; j < i+4; j++ )
1082
1087
                        x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, j, h->dct.luma4x4[j]+1, b_intra );
1231
1236
 
1232
1237
        if( h->mb.i_cbp_chroma == 2 )
1233
1238
        {
1234
 
            int step = 8 << h->mb.chroma_v_shift;
 
1239
            int step = 8 << CHROMA_V_SHIFT;
1235
1240
            for( int i = 16; i < 3*16; i += step )
1236
1241
                for( int j = i; j < i+4; j++ )
1237
1242
                    x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, j, h->dct.luma4x4[j]+1, 1 );