changeset 7379:d3bd73e0f9a9 libavcodec

init_poc() vs. idr() cleanup
author michael
date Thu, 24 Jul 2008 22:04:29 +0000
parents eee233178dd6
children 9faeb82ba80b
files h264.c
diffstat 1 files changed, 3 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/h264.c	Thu Jul 24 17:13:37 2008 +0000
+++ b/h264.c	Thu Jul 24 22:04:29 2008 +0000
@@ -3304,6 +3304,9 @@
     }
     h->short_ref_count=0;
     h->prev_frame_num= 0;
+    h->prev_frame_num_offset= 0;
+    h->prev_poc_msb=
+    h->prev_poc_lsb= 0;
 }
 
 /* forget old pics after a seek */
@@ -3696,23 +3699,14 @@
     const int max_frame_num= 1<<h->sps.log2_max_frame_num;
     int field_poc[2];
 
-    if(h->nal_unit_type == NAL_IDR_SLICE){
-        h->frame_num_offset= 0;
-    }else{
         if(h->frame_num < h->prev_frame_num)
             h->frame_num_offset= h->prev_frame_num_offset + max_frame_num;
         else
             h->frame_num_offset= h->prev_frame_num_offset;
-    }
 
     if(h->sps.poc_type==0){
         const int max_poc_lsb= 1<<h->sps.log2_max_poc_lsb;
 
-        if(h->nal_unit_type == NAL_IDR_SLICE){
-             h->prev_poc_msb=
-             h->prev_poc_lsb= 0;
-        }
-
         if     (h->poc_lsb < h->prev_poc_lsb && h->prev_poc_lsb - h->poc_lsb >= max_poc_lsb/2)
             h->poc_msb = h->prev_poc_msb + max_poc_lsb;
         else if(h->poc_lsb > h->prev_poc_lsb && h->prev_poc_lsb - h->poc_lsb < -max_poc_lsb/2)
@@ -3760,12 +3754,8 @@
             field_poc[1] += h->delta_poc[1];
     }else{
         int poc;
-        if(h->nal_unit_type == NAL_IDR_SLICE){
-            poc= 0;
-        }else{
             if(h->nal_ref_idc) poc= 2*(h->frame_num_offset + h->frame_num);
             else               poc= 2*(h->frame_num_offset + h->frame_num) - 1;
-        }
         field_poc[0]= poc;
         field_poc[1]= poc;
     }