changeset 1891:f403b3e286b3 libavcodec

use pan_scan to remove some weight, proper pan_scan offset reading
author iive
date Tue, 16 Mar 2004 15:38:40 +0000
parents a07406ac4725
children 5ac49e7a1b8f
files mpeg12.c
diffstat 1 files changed, 19 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mpeg12.c	Mon Mar 15 16:41:15 2004 +0000
+++ b/mpeg12.c	Tue Mar 16 15:38:40 2004 +0000
@@ -1750,8 +1750,6 @@
     MpegEncContext mpeg_enc_ctx;
     int mpeg_enc_ctx_allocated; /* true if decoding context allocated */
     int repeat_field; /* true if we must repeat the field */
-    int display_weight;
-    int display_height;
     AVPanScan pan_scan; /** some temporary storage for the panscan */
     int slice_count;
     int swap_uv;//indicate VCR2
@@ -1838,7 +1836,7 @@
                 1<<30);
         //mpeg2 aspect
             if(s->aspect_ratio_info > 1){
-                if( (s1->display_weight == 0 )||(s1->display_height == 0) ){
+                if( (s1->pan_scan.width == 0 )||(s1->pan_scan.height == 0) ){
                     s->avctx->sample_aspect_ratio= 
                         av_div_q(
                          mpeg2_aspect[s->aspect_ratio_info], 
@@ -1848,7 +1846,7 @@
                     s->avctx->sample_aspect_ratio= 
                         av_div_q(
                          mpeg2_aspect[s->aspect_ratio_info], 
-                         (AVRational){s1->display_weight, s1->display_height}
+                         (AVRational){s1->pan_scan.width, s1->pan_scan.height}
                         );
         	}
             }else{
@@ -2018,11 +2016,7 @@
     
     s1->pan_scan.width= 16*w;
     s1->pan_scan.height=16*h;
-    
-    s1->display_weight = w;
-    s1->display_height = h;
-
-    
+        
     if(s->avctx->debug & FF_DEBUG_PICT_INFO)
         av_log(s->avctx, AV_LOG_DEBUG, "sde w:%d, h:%d\n", w, h);
 }
@@ -2030,9 +2024,23 @@
 static void mpeg_decode_picture_display_extension(Mpeg1Context *s1)
 {
     MpegEncContext *s= &s1->mpeg_enc_ctx;
-    int i;
+    int i,nofco;
 
-    for(i=0; i<1; i++){ //FIXME count
+    nofco = 1;
+    if(s->progressive_sequence){
+        if(s->repeat_first_field){
+	    nofco++;
+	    if(s->top_field_first)
+	        nofco++;	
+	}
+    }else{
+        if(s->picture_structure == PICT_FRAME){
+            nofco++;
+	    if(s->repeat_first_field)
+	        nofco++;
+	}
+    }
+    for(i=0; i<nofco; i++){
         s1->pan_scan.position[i][0]= get_sbits(&s->gb, 16);
         skip_bits(&s->gb, 1); //marker
         s1->pan_scan.position[i][1]= get_sbits(&s->gb, 16);