[vlc-devel] [PATCH 6/7] codec/schroedinger: update to inform vlc about clean area

davidf+nntp at woaf.net davidf+nntp at woaf.net
Thu Nov 27 12:58:51 CET 2008


From: David Flynn <davidf at rd.bbc.co.uk>

This should allow the removal of black bars from the sides of SD
pictures.  i_aspect is set to the aspect ratio of the whole frame
which may be greater than that of the clean area.  VLC should then
calculate the SAR, and eventually display a clean area sized picture
that is of the correct aspect ratio.

Signed-off-by: David Flynn <davidf at rd.bbc.co.uk>
---
 modules/codec/schroedinger.c |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/modules/codec/schroedinger.c b/modules/codec/schroedinger.c
index 4bb392a..8c0acc7 100644
--- a/modules/codec/schroedinger.c
+++ b/modules/codec/schroedinger.c
@@ -161,7 +161,6 @@ static int OpenDecoder( vlc_object_t *p_this )
 static void SetVideoFormat( decoder_t *p_dec )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
-    double f_aspect;
 
     p_sys->p_format = schro_decoder_get_video_format(p_sys->p_schro);
     if( p_sys->p_format == NULL ) return;
@@ -180,18 +179,27 @@ static void SetVideoFormat( decoder_t *p_dec )
         break;
     }
 
-    p_dec->fmt_out.video.i_visible_width =
+    p_dec->fmt_out.video.i_visible_width = p_sys->p_format->clean_width;
+    p_dec->fmt_out.video.i_x_offset = p_sys->p_format->left_offset;
     p_dec->fmt_out.video.i_width = p_sys->p_format->width;
 
-    p_dec->fmt_out.video.i_visible_height =
+    p_dec->fmt_out.video.i_visible_height = p_sys->p_format->clean_height;
+    p_dec->fmt_out.video.i_y_offset = p_sys->p_format->top_offset;
     p_dec->fmt_out.video.i_height = p_sys->p_format->height;
 
-    /* aspect_ratio_[numerator|denominator] describes the pixel aspect ratio */
-    f_aspect = (double)
+    /* aspect_ratio_[numerator|denominator] describes the pixel aspect ratio
+     * the picture aspect ratio is related to the clean width and height */
+    /* i_aspect is the aspect ratio of the entire frame, vlc will calculate
+     * the SAR later, and hopefully just display the clean area: Eg.
+     *  625 line video shuold be 702 active samples which is rounded to 704.
+     *  This is often transmited as 720 samples, with 8|9 black pels on either
+     *  side (ie clean area is ~704).  For wide screen, the SAR makes the
+     *  704x576 raster be 16:9; however the physical aspect ratio for using
+     *  720 samples would be >16:9.  The same applies to 4:3.
+     */
+    p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR *
         ( p_sys->p_format->aspect_ratio_numerator * p_sys->p_format->width ) /
-        ( p_sys->p_format->aspect_ratio_denominator * p_sys->p_format->height);
-
-    p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * f_aspect;
+        ( p_sys->p_format->aspect_ratio_denominator * p_sys->p_format->height );
 
     p_dec->fmt_out.video.i_frame_rate =
         p_sys->p_format->frame_rate_numerator;
-- 
1.5.6.5




More information about the vlc-devel mailing list