remove unused adaptive cabac_idc code
authorLoren Merritt <pengvado@videolan.org>
Sat, 29 Oct 2005 01:43:29 +0000 (01:43 +0000)
committerLoren Merritt <pengvado@videolan.org>
Sat, 29 Oct 2005 01:43:29 +0000 (01:43 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@343 df754926-b1dd-0310-bc7b-ec298dee348c

common/cabac.c
common/cabac.h
encoder/encoder.c

index 18945f6..1dc9831 100644 (file)
@@ -821,7 +821,6 @@ void x264_cabac_context_init( x264_cabac_t *cb, int i_slice_type, int i_qp, int
             cb->ctxstate[i].i_state = i_pre_state - 64;
             cb->ctxstate[i].i_mps = 1;
         }
             cb->ctxstate[i].i_state = i_pre_state - 64;
             cb->ctxstate[i].i_mps = 1;
         }
-        cb->ctxstate[i].i_count = 0;
     }
 }
 
     }
 }
 
@@ -902,66 +901,9 @@ int  x264_cabac_decode_terminal( x264_cabac_t *cb )
     return 0;
 }
 
     return 0;
 }
 
-
 /*****************************************************************************
  *
  *****************************************************************************/
 /*****************************************************************************
  *
  *****************************************************************************/
-void x264_cabac_model_init( x264_cabac_t *cb )
-{
-    int i;
-
-    for( i = 0; i < 3; i++ )
-    {
-        cb->slice[i].i_model = 0;
-        cb->slice[i].i_cost  = -1;
-    }
-}
-
-int  x264_cabac_model_get ( x264_cabac_t *cb, int i_slice_type )
-{
-    return cb->slice[i_slice_type].i_model;
-}
-
-void x264_cabac_model_update( x264_cabac_t *cb, int i_slice_type, int i_qp )
-{
-    int i;
-
-    if( i_slice_type == SLICE_TYPE_I )
-    {
-        return;
-    }
-    cb->slice[i_slice_type].i_cost = -1;
-
-    for( i = 0; i < 3; i++ )
-    {
-        int i_ctx;
-        int i_cost;
-
-        i_cost = 0; /* fix8 */
-
-        for( i_ctx = 0; i_ctx < 436; i_ctx++ )
-        {
-            int i_weight;
-            int i_model_state;
-            int i_ctx_state;
-
-            i_weight = X264_MIN( (1<<8), (cb->ctxstate[i_ctx].i_count<<8) / 32 );
-            i_model_state = x264_clip3( ((x264_cabac_context_init_PB[i][i_ctx][0] * i_qp)>>4) +
-                                          x264_cabac_context_init_PB[i][i_ctx][1], 0, 127 );
-            i_ctx_state   = cb->ctxstate[i_ctx].i_mps ? 64 + cb->ctxstate[i_ctx].i_state : 63 - cb->ctxstate[i_ctx].i_state;
-
-            i_cost += (i_weight * (( x264_cabac_probability[      i_ctx_state] * x264_cabac_entropy[      i_model_state] +
-                                     x264_cabac_probability[127 - i_ctx_state] * x264_cabac_entropy[127 - i_model_state] ) >> 8))>>8;
-        }
-
-        if( cb->slice[i_slice_type].i_cost == -1 || cb->slice[i_slice_type].i_cost > i_cost )
-        {
-            cb->slice[i_slice_type].i_model= i;
-            cb->slice[i_slice_type].i_cost = i_cost;
-        }
-    }
-}
-
 void x264_cabac_encode_init( x264_cabac_t *cb, bs_t *s )
 {
     cb->i_low   = 0;
 void x264_cabac_encode_init( x264_cabac_t *cb, bs_t *s )
 {
     cb->i_low   = 0;
@@ -1049,7 +991,6 @@ void x264_cabac_encode_decision( x264_cabac_t *cb, int i_ctx, int b )
     {
         cb->ctxstate[i_ctx].i_state = x264_transition_mps[i_state];
     }
     {
         cb->ctxstate[i_ctx].i_state = x264_transition_mps[i_state];
     }
-    cb->ctxstate[i_ctx].i_count++;
 
     x264_cabac_encode_renorm( cb );
 }
 
     x264_cabac_encode_renorm( cb );
 }
index 3bc0f94..eadaa2c 100644 (file)
@@ -39,7 +39,6 @@ typedef struct
     {
         int i_state;
         int i_mps;
     {
         int i_state;
         int i_mps;
-        int i_count;
     } ctxstate[436];
 
     /* state */
     } ctxstate[436];
 
     /* state */
@@ -63,10 +62,6 @@ int  x264_cabac_decode_decision( x264_cabac_t *cb, int i_ctx_idx );
 int  x264_cabac_decode_bypass  ( x264_cabac_t *cb );
 int  x264_cabac_decode_terminal( x264_cabac_t *cb );
 
 int  x264_cabac_decode_bypass  ( x264_cabac_t *cb );
 int  x264_cabac_decode_terminal( x264_cabac_t *cb );
 
-/* encoder only: adaptive model init */
-void x264_cabac_model_init( x264_cabac_t *cb );
-int  x264_cabac_model_get ( x264_cabac_t *cb, int i_slice_type );
-void x264_cabac_model_update( x264_cabac_t *cb, int i_slice_type, int i_qp );
 /* encoder only: */
 void x264_cabac_encode_init ( x264_cabac_t *cb, bs_t *s );
 void x264_cabac_encode_decision( x264_cabac_t *cb, int i_ctx_idx, int b );
 /* encoder only: */
 void x264_cabac_encode_init ( x264_cabac_t *cb, bs_t *s );
 void x264_cabac_encode_decision( x264_cabac_t *cb, int i_ctx_idx, int b );
index 6f83aa5..623bcd3 100644 (file)
@@ -387,10 +387,7 @@ static int x264_validate_parameters( x264_t *h )
     h->param.i_deblocking_filter_alphac0 = x264_clip3( h->param.i_deblocking_filter_alphac0, -6, 6 );
     h->param.i_deblocking_filter_beta    = x264_clip3( h->param.i_deblocking_filter_beta, -6, 6 );
 
     h->param.i_deblocking_filter_alphac0 = x264_clip3( h->param.i_deblocking_filter_alphac0, -6, 6 );
     h->param.i_deblocking_filter_beta    = x264_clip3( h->param.i_deblocking_filter_beta, -6, 6 );
 
-    h->param.i_cabac_init_idc = x264_clip3( h->param.i_cabac_init_idc, -1, 2 );
-    /* don't yet support merging of cabac stats */
-    if( h->param.i_threads > 1 && h->param.i_cabac_init_idc == -1 )
-        h->param.i_cabac_init_idc = 0;
+    h->param.i_cabac_init_idc = x264_clip3( h->param.i_cabac_init_idc, 0, 2 );
 
     if( h->param.i_cqm_preset < X264_CQM_FLAT || h->param.i_cqm_preset > X264_CQM_CUSTOM )
         h->param.i_cqm_preset = X264_CQM_FLAT;
 
     if( h->param.i_cqm_preset < X264_CQM_FLAT || h->param.i_cqm_preset > X264_CQM_CUSTOM )
         h->param.i_cqm_preset = X264_CQM_FLAT;
@@ -552,9 +549,6 @@ x264_t *x264_encoder_open   ( x264_param_t *param )
     /* init mb cache */
     x264_macroblock_cache_init( h );
 
     /* init mb cache */
     x264_macroblock_cache_init( h );
 
-    /* init cabac adaptive model */
-    x264_cabac_model_init( &h->cabac );
-
     /* init CPU functions */
     x264_predict_16x16_init( h->param.cpu, h->predict_16x16 );
     x264_predict_8x8c_init( h->param.cpu, h->predict_8x8c );
     /* init CPU functions */
     x264_predict_16x16_init( h->param.cpu, h->predict_16x16 );
     x264_predict_8x8c_init( h->param.cpu, h->predict_8x8c );
@@ -889,15 +883,6 @@ static inline void x264_slice_init( x264_t *h, int i_nal_type, int i_slice_type,
         /* Nothing to do ? */
     }
 
         /* Nothing to do ? */
     }
 
-    /* get adapative cabac model if needed */
-    if( h->param.b_cabac )
-    {
-        if( h->param.i_cabac_init_idc == -1 )
-        {
-            h->sh.i_cabac_init_idc = x264_cabac_model_get( &h->cabac, i_slice_type );
-        }
-    }
-
     x264_macroblock_slice_init( h );
 }
 
     x264_macroblock_slice_init( h );
 }
 
@@ -1472,11 +1457,6 @@ do_encode:
     }
 
     /* ---------------------- Update encoder state ------------------------- */
     }
 
     /* ---------------------- Update encoder state ------------------------- */
-    /* update cabac */
-    if( h->param.b_cabac && h->param.i_cabac_init_idc == -1 )
-    {
-        x264_cabac_model_update( &h->cabac, i_slice_type, h->sh.i_qp );
-    }
 
     /* handle references */
     if( i_nal_ref_idc != NAL_PRIORITY_DISPOSABLE )
 
     /* handle references */
     if( i_nal_ref_idc != NAL_PRIORITY_DISPOSABLE )