libmpeg2: Fix aspect ratio calculation according to MPEG standard.
authorMarian Ďurkovič <md@bts.sk>
Tue, 20 Oct 2009 08:11:24 +0000 (10:11 +0200)
committerMarian Ďurkovič <md@bts.sk>
Tue, 20 Oct 2009 08:11:24 +0000 (10:11 +0200)
The library delivers us pixel width/height relative to display size
so we must compute it accordingly, otherwise we have conflicting data
in i_sar_num/i_sar_den and i_aspect.

modules/codec/libmpeg2.c

index e0dcd84..b0239e7 100644 (file)
@@ -732,10 +732,10 @@ static void GetAR( decoder_t *p_dec )
         if( p_sys->p_info->sequence->pixel_height > 0 )
         {
             p_sys->i_aspect =
-                ((uint64_t)p_sys->p_info->sequence->picture_width) *
+                ((uint64_t)p_sys->p_info->sequence->display_width) *
                 p_sys->p_info->sequence->pixel_width *
                 VOUT_ASPECT_FACTOR /
-                p_sys->p_info->sequence->picture_height /
+                p_sys->p_info->sequence->display_height /
                 p_sys->p_info->sequence->pixel_height;
             p_sys->i_sar_num = p_sys->p_info->sequence->pixel_width;
             p_sys->i_sar_den = p_sys->p_info->sequence->pixel_height;