]> git.sesse.net Git - x264/commitdiff
remove the distinction between itex and ptex
authorLoren Merritt <pengvado@akuvian.org>
Thu, 21 Aug 2008 02:56:56 +0000 (20:56 -0600)
committerLoren Merritt <pengvado@akuvian.org>
Sat, 30 Aug 2008 01:02:32 +0000 (19:02 -0600)
(changes 2pass statsfile format)

common/common.h
encoder/cabac.c
encoder/cavlc.c
encoder/encoder.c
encoder/ratecontrol.c

index ca555d1ef14ee4e6618afcaaad91b435820f616b..af5fb8719679ff4f6b2cd46829a1e34c7eb8bda0 100644 (file)
@@ -532,11 +532,10 @@ struct x264_t
         /* Current frame stats */
         struct
         {
-            /* Headers bits (MV+Ref+MB Block Type */
-            int i_hdr_bits;
-            /* Texture bits (Intra/Predicted) */
-            int i_itex_bits;
-            int i_ptex_bits;
+            /* MV bits (MV+Ref+Block Type) */
+            int i_mv_bits;
+            /* Texture bits (DCT coefs) */
+            int i_tex_bits;
             /* ? */
             int i_misc_bits;
             /* MB type counts */
index e1f4ffabbf45116478e27f6e45021af6f927d92b..8187438ccd4b72edee23f79aa88bbfb1d359c244 100644 (file)
@@ -790,7 +790,7 @@ void x264_macroblock_write_cabac( x264_t *h, x264_cabac_t *cb )
     if( i_mb_type == I_PCM )
     {
         i_mb_pos_tex = x264_cabac_pos( cb );
-        h->stat.frame.i_hdr_bits += i_mb_pos_tex - i_mb_pos_start;
+        h->stat.frame.i_mv_bits += i_mb_pos_tex - i_mb_pos_start;
 
         memcpy( cb->p, h->mb.pic.p_fenc[0], 256 );
         cb->p += 256;
@@ -811,7 +811,7 @@ void x264_macroblock_write_cabac( x264_t *h, x264_cabac_t *cb )
         h->mc.copy[PIXEL_8x8]  ( h->mb.pic.p_fdec[1], FDEC_STRIDE, h->mb.pic.p_fenc[1], FENC_STRIDE, 8 );
         h->mc.copy[PIXEL_8x8]  ( h->mb.pic.p_fdec[2], FDEC_STRIDE, h->mb.pic.p_fenc[2], FENC_STRIDE, 8 );
 
-        h->stat.frame.i_itex_bits += x264_cabac_pos( cb ) - i_mb_pos_tex;
+        h->stat.frame.i_tex_bits += x264_cabac_pos( cb ) - i_mb_pos_tex;
         return;
     }
 #endif
@@ -963,7 +963,7 @@ void x264_macroblock_write_cabac( x264_t *h, x264_cabac_t *cb )
 
 #ifndef RDO_SKIP_BS
     i_mb_pos_tex = x264_cabac_pos( cb );
-    h->stat.frame.i_hdr_bits += i_mb_pos_tex - i_mb_pos_start;
+    h->stat.frame.i_mv_bits += i_mb_pos_tex - i_mb_pos_start;
 #endif
 
     if( i_mb_type != I_16x16 )
@@ -1018,10 +1018,7 @@ void x264_macroblock_write_cabac( x264_t *h, x264_cabac_t *cb )
     }
 
 #ifndef RDO_SKIP_BS
-    if( IS_INTRA( i_mb_type ) )
-        h->stat.frame.i_itex_bits += x264_cabac_pos( cb ) - i_mb_pos_tex;
-    else
-        h->stat.frame.i_ptex_bits += x264_cabac_pos( cb ) - i_mb_pos_tex;
+    h->stat.frame.i_tex_bits += x264_cabac_pos( cb ) - i_mb_pos_tex;
 #endif
 }
 
index e6d85c6b8c1f122b7f74b8b9758aea7ba2a3a3cf..345957f4839838a585b593e80c9a561f9528723f 100644 (file)
@@ -344,7 +344,7 @@ void x264_macroblock_write_cavlc( x264_t *h, bs_t *s )
     {
         bs_write_ue( s, i_mb_i_offset + 25 );
         i_mb_pos_tex = bs_pos( s );
-        h->stat.frame.i_hdr_bits += i_mb_pos_tex - i_mb_pos_start;
+        h->stat.frame.i_mv_bits += i_mb_pos_tex - i_mb_pos_start;
 
         bs_align_0( s );
 
@@ -362,7 +362,7 @@ void x264_macroblock_write_cavlc( x264_t *h, bs_t *s )
         h->mc.copy[PIXEL_8x8]  ( h->mb.pic.p_fdec[1], FDEC_STRIDE, h->mb.pic.p_fenc[1], FENC_STRIDE, 8 );
         h->mc.copy[PIXEL_8x8]  ( h->mb.pic.p_fdec[2], FDEC_STRIDE, h->mb.pic.p_fenc[2], FENC_STRIDE, 8 );
 
-        h->stat.frame.i_itex_bits += bs_pos(s) - i_mb_pos_tex;
+        h->stat.frame.i_tex_bits += bs_pos(s) - i_mb_pos_tex;
         return;
     }
 #endif
@@ -612,7 +612,7 @@ void x264_macroblock_write_cavlc( x264_t *h, bs_t *s )
 
 #ifndef RDO_SKIP_BS
     i_mb_pos_tex = bs_pos( s );
-    h->stat.frame.i_hdr_bits += i_mb_pos_tex - i_mb_pos_start;
+    h->stat.frame.i_mv_bits += i_mb_pos_tex - i_mb_pos_start;
 #endif
 
     /* Coded block patern */
@@ -666,10 +666,7 @@ void x264_macroblock_write_cavlc( x264_t *h, bs_t *s )
     }
 
 #ifndef RDO_SKIP_BS
-    if( IS_INTRA( i_mb_type ) )
-        h->stat.frame.i_itex_bits += bs_pos(s) - i_mb_pos_tex;
-    else
-        h->stat.frame.i_ptex_bits += bs_pos(s) - i_mb_pos_tex;
+    h->stat.frame.i_tex_bits += bs_pos(s) - i_mb_pos_tex;
 #endif
 }
 
index 1c114324d4d5c8d8583d9dd654713345179f58a4..d991a5e29c28551d4d9d079c29311a741c1d1a13 100644 (file)
@@ -1235,9 +1235,8 @@ static void x264_slice_write( x264_t *h )
     /* Compute misc bits */
     h->stat.frame.i_misc_bits = bs_pos( &h->out.bs )
                               + NALU_OVERHEAD * 8
-                              - h->stat.frame.i_itex_bits
-                              - h->stat.frame.i_ptex_bits
-                              - h->stat.frame.i_hdr_bits;
+                              - h->stat.frame.i_tex_bits
+                              - h->stat.frame.i_mv_bits;
 }
 
 static void x264_thread_sync_context( x264_t *dst, x264_t *src )
index cb8f5c5693bdb6d1f4b7b22e3b928ba0ed144c90..4c425e358d3a805bdd868126edded11dd8866d72 100644 (file)
@@ -40,8 +40,7 @@ typedef struct
     int kept_as_ref;
     float qscale;
     int mv_bits;
-    int i_tex_bits;
-    int p_tex_bits;
+    int tex_bits;
     int misc_bits;
     uint64_t expected_bits;
     double expected_vbv;
@@ -167,7 +166,7 @@ static inline double qscale2bits(ratecontrol_entry_t *rce, double qscale)
 {
     if(qscale<0.1)
         qscale = 0.1;
-    return (rce->i_tex_bits + rce->p_tex_bits + .1) * pow( rce->qscale / qscale, 1.1 )
+    return (rce->tex_bits + .1) * pow( rce->qscale / qscale, 1.1 )
            + rce->mv_bits * pow( X264_MAX(rce->qscale, 1) / X264_MAX(qscale, 1), 0.5 )
            + rce->misc_bits;
 }
@@ -496,8 +495,8 @@ int x264_ratecontrol_new( x264_t *h )
             rce = &rc->entry[frame_number];
             rce->direct_mode = 0;
 
-            e += sscanf(p, " in:%*d out:%*d type:%c q:%f itex:%d ptex:%d mv:%d misc:%d imb:%d pmb:%d smb:%d d:%c",
-                   &pict_type, &qp, &rce->i_tex_bits, &rce->p_tex_bits,
+            e += sscanf(p, " in:%*d out:%*d type:%c q:%f tex:%d mv:%d misc:%d imb:%d pmb:%d smb:%d d:%c",
+                   &pict_type, &qp, &rce->tex_bits,
                    &rce->mv_bits, &rce->misc_bits, &rce->i_count, &rce->p_count,
                    &rce->s_count, &rce->direct_mode);
 
@@ -1071,11 +1070,12 @@ void x264_ratecontrol_end( x264_t *h, int bits )
                           dir_avg>0 ? 's' : dir_avg<0 ? 't' : '-' )
                         : '-';
         fprintf( rc->p_stat_file_out,
-                 "in:%d out:%d type:%c q:%.2f itex:%d ptex:%d mv:%d misc:%d imb:%d pmb:%d smb:%d d:%c;\n",
+                 "in:%d out:%d type:%c q:%.2f tex:%d mv:%d misc:%d imb:%d pmb:%d smb:%d d:%c;\n",
                  h->fenc->i_frame, h->i_frame,
                  c_type, rc->qpa_rc,
-                 h->stat.frame.i_itex_bits, h->stat.frame.i_ptex_bits,
-                 h->stat.frame.i_hdr_bits, h->stat.frame.i_misc_bits,
+                 h->stat.frame.i_tex_bits,
+                 h->stat.frame.i_mv_bits,
+                 h->stat.frame.i_misc_bits,
                  h->stat.frame.i_mb_count_i,
                  h->stat.frame.i_mb_count_p,
                  h->stat.frame.i_mb_count_skip,
@@ -1138,7 +1138,7 @@ static double get_qscale(x264_t *h, ratecontrol_entry_t *rce, double rate_factor
     q = pow( rce->blurred_complexity, 1 - h->param.rc.f_qcompress );
 
     // avoid NaN's in the rc_eq
-    if(!isfinite(q) || rce->i_tex_bits + rce->p_tex_bits + rce->mv_bits == 0)
+    if(!isfinite(q) || rce->tex_bits + rce->mv_bits == 0)
         q = rcc->last_qscale;
     else
     {
@@ -1190,7 +1190,7 @@ static double get_diff_limited_q(x264_t *h, ratecontrol_entry_t *rce, double q)
     }
     else if( pict_type == SLICE_TYPE_P
              && rcc->last_non_b_pict_type == SLICE_TYPE_P
-             && rce->i_tex_bits + rce->p_tex_bits == 0 )
+             && rce->tex_bits == 0 )
     {
         q = last_p_q;
     }
@@ -1471,9 +1471,8 @@ static float rate_estimate_qscale( x264_t *h )
             rcc->short_term_cplxsum += rcc->last_satd;
             rcc->short_term_cplxcount ++;
 
-            rce.p_tex_bits = rcc->last_satd;
+            rce.tex_bits = rcc->last_satd;
             rce.blurred_complexity = rcc->short_term_cplxsum / rcc->short_term_cplxcount;
-            rce.i_tex_bits = 0;
             rce.mv_bits = 0;
             rce.p_count = rcc->nmb;
             rce.i_count = 0;