From: Loren Merritt Date: Thu, 22 Jul 2010 06:40:12 +0000 (+0000) Subject: Eradicate all mention of SI/SP-frames X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=757f5c15b9c742e3076b44b073fae222522c7a5e;p=x264.git Eradicate all mention of SI/SP-frames --- diff --git a/common/common.h b/common/common.h index 6af92ead..69e7152f 100644 --- a/common/common.h +++ b/common/common.h @@ -288,11 +288,9 @@ enum slice_type_e SLICE_TYPE_P = 0, SLICE_TYPE_B = 1, SLICE_TYPE_I = 2, - SLICE_TYPE_SP = 3, - SLICE_TYPE_SI = 4 }; -static const char slice_type_to_char[] = { 'P', 'B', 'I', 'S', 'S' }; +static const char slice_type_to_char[] = { 'P', 'B', 'I' }; enum sei_payload_type_e { diff --git a/encoder/encoder.c b/encoder/encoder.c index 701a5909..d72c9f8e 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -216,7 +216,7 @@ static void x264_slice_header_write( bs_t *s, x264_slice_header_t *sh, int i_nal if( sh->i_type == SLICE_TYPE_B ) bs_write1( s, sh->b_direct_spatial_mv_pred ); - if( sh->i_type == SLICE_TYPE_P || sh->i_type == SLICE_TYPE_SP || sh->i_type == SLICE_TYPE_B ) + if( sh->i_type == SLICE_TYPE_P || sh->i_type == SLICE_TYPE_B ) { bs_write1( s, sh->b_num_ref_idx_override ); if( sh->b_num_ref_idx_override ) @@ -255,7 +255,7 @@ static void x264_slice_header_write( bs_t *s, x264_slice_header_t *sh, int i_nal } } - if( sh->pps->b_weighted_pred && ( sh->i_type == SLICE_TYPE_P || sh->i_type == SLICE_TYPE_SP ) ) + if( sh->pps->b_weighted_pred && sh->i_type == SLICE_TYPE_P ) { /* pred_weight_table() */ bs_write_ue( s, sh->weight[0][0].i_denom ); @@ -2941,10 +2941,9 @@ void x264_encoder_close ( x264_t *h ) h->i_frame++; /* Slices used and PSNR */ - for( int i = 0; i < 5; i++ ) + for( int i = 0; i < 3; i++ ) { - static const uint8_t slice_order[] = { SLICE_TYPE_I, SLICE_TYPE_SI, SLICE_TYPE_P, SLICE_TYPE_SP, SLICE_TYPE_B }; - static const char * const slice_name[] = { "P", "B", "I", "SP", "SI" }; + static const uint8_t slice_order[] = { SLICE_TYPE_I, SLICE_TYPE_P, SLICE_TYPE_B }; int i_slice = slice_order[i]; if( h->stat.i_frame_count[i_slice] > 0 ) @@ -2953,8 +2952,8 @@ void x264_encoder_close ( x264_t *h ) if( h->param.analyse.b_psnr ) { x264_log( h, X264_LOG_INFO, - "frame %s:%-5d Avg QP:%5.2f size:%6.0f PSNR Mean Y:%5.2f U:%5.2f V:%5.2f Avg:%5.2f Global:%5.2f\n", - slice_name[i_slice], + "frame %c:%-5d Avg QP:%5.2f size:%6.0f PSNR Mean Y:%5.2f U:%5.2f V:%5.2f Avg:%5.2f Global:%5.2f\n", + slice_type_to_char[i_slice], i_count, h->stat.f_frame_qp[i_slice] / i_count, (double)h->stat.i_frame_size[i_slice] / i_count, @@ -2965,8 +2964,8 @@ void x264_encoder_close ( x264_t *h ) else { x264_log( h, X264_LOG_INFO, - "frame %s:%-5d Avg QP:%5.2f size:%6.0f\n", - slice_name[i_slice], + "frame %c:%-5d Avg QP:%5.2f size:%6.0f\n", + slice_type_to_char[i_slice], i_count, h->stat.f_frame_qp[i_slice] / i_count, (double)h->stat.i_frame_size[i_slice] / i_count ); diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c index ef197c44..b48b70a3 100644 --- a/encoder/ratecontrol.c +++ b/encoder/ratecontrol.c @@ -78,7 +78,7 @@ struct x264_ratecontrol_t double rate_tolerance; double qcompress; int nmb; /* number of macroblocks in a frame */ - int qp_constant[5]; + int qp_constant[3]; /* current frame */ ratecontrol_entry_t *rce; @@ -123,13 +123,13 @@ struct x264_ratecontrol_t int num_entries; /* number of ratecontrol_entry_ts */ ratecontrol_entry_t *entry; /* FIXME: copy needed data and free this once init is done */ double last_qscale; - double last_qscale_for[5]; /* last qscale for a specific pict type, used for max_diff & ipb factor stuff */ + double last_qscale_for[3]; /* last qscale for a specific pict type, used for max_diff & ipb factor stuff */ int last_non_b_pict_type; double accum_p_qp; /* for determining I-frame quant */ double accum_p_norm; double last_accum_p_norm; - double lmin[5]; /* min qscale by frame type */ - double lmax[5]; + double lmin[3]; /* min qscale by frame type */ + double lmax[3]; double lstep; /* max change (multiply) in qscale per frame */ uint16_t *qp_buffer[2]; /* Global buffers for converting MB-tree quantizer data. */ int qpbuf_pos; /* In order to handle pyramid reordering, QP buffer acts as a stack. @@ -143,7 +143,7 @@ struct x264_ratecontrol_t double slice_size_planned; double max_frame_error; predictor_t (*row_pred)[2]; - predictor_t row_preds[5][2]; + predictor_t row_preds[3][2]; predictor_t *pred_b_from_p; /* predict B-frame size from P-frame satd */ int bframes; /* # consecutive B-frames before this P-frame */ int bframe_bits; /* total cost of those frames */ @@ -639,7 +639,7 @@ int x264_ratecontrol_new( x264_t *h ) int num_preds = h->param.b_sliced_threads * h->param.i_threads + 1; CHECKED_MALLOC( rc->pred, 5 * sizeof(predictor_t) * num_preds ); CHECKED_MALLOC( rc->pred_b_from_p, sizeof(predictor_t) ); - for( int i = 0; i < 5; i++ ) + for( int i = 0; i < 3; i++ ) { rc->last_qscale_for[i] = qp2qscale( ABR_INIT_QP ); rc->lmin[i] = qp2qscale( h->param.rc.i_qp_min );