From c90534d6c85664c7a161cbe70a7928cb65f19e18 Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Sun, 6 Mar 2005 05:12:25 +0000 Subject: [PATCH] Adaptive B skipped some POC numbers (slightly reducing b_direct efficiency). git-svn-id: svn://svn.videolan.org/x264/trunk@154 df754926-b1dd-0310-bc7b-ec298dee348c --- common/common.h | 2 +- encoder/encoder.c | 8 ++------ encoder/slicetype_decision.c | 4 ---- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/common/common.h b/common/common.h index 66657c0d..442b7b49 100644 --- a/common/common.h +++ b/common/common.h @@ -213,12 +213,12 @@ struct x264_t /* frame number/poc */ int i_frame; - int i_poc; int i_frame_offset; /* decoding only */ int i_frame_num; /* decoding only */ int i_poc_msb; /* decoding only */ int i_poc_lsb; /* decoding only */ + int i_poc; /* decoding only */ /* We use only one SPS and one PPS */ x264_sps_t sps_array[32]; diff --git a/encoder/encoder.c b/encoder/encoder.c index 7d97a028..a968e6c6 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -450,7 +450,6 @@ x264_t *x264_encoder_open ( x264_param_t *param ) h->i_frame = 0; h->i_frame_num = 0; - h->i_poc = 0; h->i_idr_pic_id = 0; h->sps = &h->sps_array[0]; @@ -1108,8 +1107,9 @@ do_encode: i_slice_type = SLICE_TYPE_B; } + h->fdec->i_poc = + h->fenc->i_poc = 2 * (h->fenc->i_frame - h->frames.i_last_idr); h->fdec->i_type = h->fenc->i_type; - h->fdec->i_poc = h->fenc->i_poc; h->fdec->i_frame = h->fenc->i_frame; h->fenc->b_kept_as_ref = h->fdec->b_kept_as_ref = i_nal_ref_idc != NAL_PRIORITY_DISPOSABLE; @@ -1258,16 +1258,12 @@ do_encode: x264_frame_t *tmp; /* Reset */ - h->i_poc = 0; h->i_frame_num = 0; /* Reinit field of fenc */ h->fenc->i_type = X264_TYPE_IDR; h->fenc->i_poc = 0; - /* Next Poc */ - h->i_poc += 2; - /* Put enqueued frames back in the pool */ while( (tmp = x264_frame_get( h->frames.current ) ) != NULL ) x264_frame_put( h->frames.next, tmp ); diff --git a/encoder/slicetype_decision.c b/encoder/slicetype_decision.c index 897cae55..61bf4053 100644 --- a/encoder/slicetype_decision.c +++ b/encoder/slicetype_decision.c @@ -385,7 +385,6 @@ void x264_slicetype_decide( x264_t *h ) } else { - h->i_poc = 0; h->i_frame_num = 0; } } @@ -400,9 +399,6 @@ void x264_slicetype_decide( x264_t *h ) frm->i_type = X264_TYPE_P; } - frm->i_poc = h->i_poc; - h->i_poc += 2; - if( frm->i_type != X264_TYPE_AUTO && frm->i_type != X264_TYPE_B && frm->i_type != X264_TYPE_BREF ) break; -- 2.40.0