[vlc-devel] [patch] Fixed source aspect ratio calculation
Marian Durkovic
md at bts.sk
Mon Oct 17 10:49:06 CEST 2005
Hi all,
attached is the patch which fixes source aspect ratio calculation.
SAR needs to be calculated from visible image size, not from encoded size.
With this patch, HDTV streams have proper SAR of 1:1 (square pixels) as
per HDTV definition.
With kind regards,
M.
--------------------------------------------------------------------------
---- ----
---- Marian Durkovic network manager ----
---- ----
---- Slovak Technical University Tel: +421 2 524 51 301 ----
---- Computer Centre, Nam. Slobody 17 Fax: +421 2 524 94 351 ----
---- 812 43 Bratislava, Slovak Republic E-mail/sip: md at bts.sk ----
---- ----
--------------------------------------------------------------------------
-------------- next part --------------
--- src/input/decoder.c.12805 Mon Oct 17 10:15:48 2005
+++ src/input/decoder.c Mon Oct 17 10:18:42 2005
@@ -917,29 +917,35 @@
return NULL;
}
+ if( !p_dec->fmt_out.video.i_visible_width ||
+ !p_dec->fmt_out.video.i_visible_height )
+ {
+ p_dec->fmt_out.video.i_visible_width =
+ p_dec->fmt_out.video.i_width;
+ p_dec->fmt_out.video.i_visible_height =
+ p_dec->fmt_out.video.i_height;
+ }
+
+ if( p_dec->fmt_out.video.i_visible_height == 1088 )
+ {
+ p_dec->fmt_out.video.i_visible_height = 1080;
+ msg_Warn( p_dec, "Incorrect HDTV stream - reducing height to 1080");
+ }
+
if( !p_dec->fmt_out.video.i_sar_num ||
!p_dec->fmt_out.video.i_sar_den )
{
p_dec->fmt_out.video.i_sar_num =
- p_dec->fmt_out.video.i_aspect * p_dec->fmt_out.video.i_height;
+ p_dec->fmt_out.video.i_aspect * p_dec->fmt_out.video.i_visible_height;
p_dec->fmt_out.video.i_sar_den = VOUT_ASPECT_FACTOR *
- p_dec->fmt_out.video.i_width;
+ p_dec->fmt_out.video.i_visible_width;
}
vlc_ureduce( &p_dec->fmt_out.video.i_sar_num,
&p_dec->fmt_out.video.i_sar_den,
p_dec->fmt_out.video.i_sar_num,
p_dec->fmt_out.video.i_sar_den, 0 );
-
- if( !p_dec->fmt_out.video.i_visible_width ||
- !p_dec->fmt_out.video.i_visible_height )
- {
- p_dec->fmt_out.video.i_visible_width =
- p_dec->fmt_out.video.i_width;
- p_dec->fmt_out.video.i_visible_height =
- p_dec->fmt_out.video.i_height;
- }
p_dec->fmt_out.video.i_chroma = p_dec->fmt_out.i_codec;
p_sys->video = p_dec->fmt_out.video;
More information about the vlc-devel
mailing list