[x264-devel] commit: remove the distinction between itex and ptex (Loren Merritt )
git version control
git at videolan.org
Sat Aug 30 02:59:52 CEST 2008
x264 | branch: master | Loren Merritt <pengvado at akuvian.org> | Wed Aug 20 20:56:56 2008 -0600| [3727f2b46abd4821c4deea415eeafa42da898eb0] | committer: Loren Merritt
remove the distinction between itex and ptex
(changes 2pass statsfile format)
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=3727f2b46abd4821c4deea415eeafa42da898eb0
---
common/common.h | 9 ++++-----
encoder/cabac.c | 11 ++++-------
encoder/cavlc.c | 11 ++++-------
encoder/encoder.c | 5 ++---
encoder/ratecontrol.c | 23 +++++++++++------------
5 files changed, 25 insertions(+), 34 deletions(-)
diff --git a/common/common.h b/common/common.h
index ca555d1..af5fb87 100644
--- a/common/common.h
+++ b/common/common.h
@@ -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 */
diff --git a/encoder/cabac.c b/encoder/cabac.c
index e1f4ffa..8187438 100644
--- a/encoder/cabac.c
+++ b/encoder/cabac.c
@@ -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
}
diff --git a/encoder/cavlc.c b/encoder/cavlc.c
index e6d85c6..345957f 100644
--- a/encoder/cavlc.c
+++ b/encoder/cavlc.c
@@ -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
}
diff --git a/encoder/encoder.c b/encoder/encoder.c
index 1c11432..d991a5e 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -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 )
diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index f7b68db..28ca1be 100644
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -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;
More information about the x264-devel
mailing list