Adaptive B skipped some POC numbers (slightly reducing b_direct efficiency).
authorLoren Merritt <pengvado@videolan.org>
Sun, 6 Mar 2005 05:12:25 +0000 (05:12 +0000)
committerLoren Merritt <pengvado@videolan.org>
Sun, 6 Mar 2005 05:12:25 +0000 (05:12 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@154 df754926-b1dd-0310-bc7b-ec298dee348c

common/common.h
encoder/encoder.c
encoder/slicetype_decision.c

index 66657c0..442b7b4 100644 (file)
@@ -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];
index 7d97a02..a968e6c 100644 (file)
@@ -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 );
index 897cae5..61bf405 100644 (file)
@@ -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;