[vlc-devel] [PATCH] Support VOUT_ASPECT_CHANGE in deinterlace filter
Marian Ďurkovič
md at bts.sk
Sat Sep 13 08:18:05 CEST 2008
Hi again,
On Fri, Sep 12, 2008 at 11:10:35PM +0200, Laurent Aimar wrote:
> My bad, I missed an important part.
> p_vout->fmt_* should still be updated as in your patch.
> Then you have to call
> p_sys->p_vout = vout_Request( p_vout, p_sys->p_vout, &p_vout->fmt_out);
> (note that it is fmt_out).
I finally know why it all fails. Look at SpawnRealVout()
video_format_t fmt;
[snip]
fmt = p_vout->fmt_out;
[snip]
case DEINTERLACE_MEAN:
case DEINTERLACE_DISCARD:
fmt.i_height /= 2; fmt.i_visible_height /= 2; fmt.i_y_offset /= 2;
fmt.i_sar_den *= 2;
p_real_vout = vout_Create( p_vout, &fmt );
The above code makes a private copy of p_vout->fmt_out, reduces the
number of lines only in this copy and gives it to vout_Create.
But, p_vout->fmt_out is *not* modified.
Now, if I implement the same in ASPECT_CHANGE, it works - see attached
patch. I've also removed all other p_sys->p_vout manipulations, since they
don't seem to be needed anyway.
Now it works as expected with vout_Request.
Please advice if this is correct.
Thanks & kind regards,
M.
-------------- next part --------------
diff --git a/modules/video_filter/deinterlace.c b/modules/video_filter/deinterlace.c
index d6ffd99..4d35463 100644
--- a/modules/video_filter/deinterlace.c
+++ b/modules/video_filter/deinterlace.c
@@ -160,6 +160,7 @@ struct vout_sys_t
{
int i_mode; /* Deinterlace mode */
bool b_double_rate; /* Shall we double the framerate? */
+ bool b_half_height;
mtime_t last_date;
mtime_t next_date;
@@ -204,6 +205,7 @@ static int Create( vlc_object_t *p_this )
p_vout->p_sys->i_mode = DEINTERLACE_DISCARD;
p_vout->p_sys->b_double_rate = false;
+ p_vout->p_sys->b_half_height = false;
p_vout->p_sys->last_date = 0;
p_vout->p_sys->p_vout = 0;
vlc_mutex_init( &p_vout->p_sys->filter_lock );
@@ -390,6 +392,7 @@ static vout_thread_t *SpawnRealVout( vout_thread_t *p_vout )
fmt.i_height /= 2; fmt.i_visible_height /= 2; fmt.i_y_offset /= 2;
fmt.i_sar_den *= 2;
p_real_vout = vout_Create( p_vout, &fmt );
+ p_vout->p_sys->b_half_height = true;
break;
case DEINTERLACE_BOB:
@@ -397,6 +400,7 @@ static vout_thread_t *SpawnRealVout( vout_thread_t *p_vout )
case DEINTERLACE_LINEAR:
case DEINTERLACE_X:
p_real_vout = vout_Create( p_vout, &fmt );
+ p_vout->p_sys->b_half_height = false;
break;
}
break;
@@ -404,6 +408,7 @@ static vout_thread_t *SpawnRealVout( vout_thread_t *p_vout )
case VLC_FOURCC('I','4','2','2'):
fmt.i_chroma = VLC_FOURCC('I','4','2','0');
p_real_vout = vout_Create( p_vout, &fmt );
+ p_vout->p_sys->b_half_height = false;
break;
default:
@@ -460,22 +465,26 @@ static void Render ( vout_thread_t *p_vout, picture_t *p_pic )
vout_sys_t *p_sys = p_vout->p_sys;
picture_t *pp_outpic[2];
- p_vout->fmt_out.i_x_offset = p_sys->p_vout->fmt_in.i_x_offset =
- p_vout->fmt_in.i_x_offset;
- p_vout->fmt_out.i_y_offset = p_sys->p_vout->fmt_in.i_y_offset =
- p_vout->fmt_in.i_y_offset;
- p_vout->fmt_out.i_visible_width = p_sys->p_vout->fmt_in.i_visible_width =
- p_vout->fmt_in.i_visible_width;
- p_vout->fmt_out.i_visible_height = p_sys->p_vout->fmt_in.i_visible_height =
- p_vout->fmt_in.i_visible_height;
- if( p_vout->p_sys->i_mode == DEINTERLACE_MEAN ||
- p_vout->p_sys->i_mode == DEINTERLACE_DISCARD )
- {
- p_vout->fmt_out.i_y_offset /= 2; p_sys->p_vout->fmt_in.i_y_offset /= 2;
- p_vout->fmt_out.i_visible_height /= 2;
- p_sys->p_vout->fmt_in.i_visible_height /= 2;
- }
-
+ if( p_vout->i_changes & VOUT_ASPECT_CHANGE )
+ {
+ video_format_t fmt;
+
+ p_vout->i_changes &= ~VOUT_ASPECT_CHANGE;
+
+ p_vout->fmt_out.i_aspect = p_vout->fmt_in.i_aspect;
+ p_vout->fmt_out.i_sar_num = p_vout->fmt_in.i_sar_num;
+ p_vout->fmt_out.i_sar_den = p_vout->fmt_in.i_sar_den;
+
+ fmt = p_vout->fmt_out;
+
+ if( p_vout->p_sys->b_half_height )
+ {
+ fmt.i_height /= 2; fmt.i_visible_height /= 2; fmt.i_y_offset /= 2;
+ fmt.i_sar_den *= 2;
+ }
+ p_sys->p_vout = vout_Request( p_vout, p_sys->p_vout, &fmt );
+ }
+
pp_outpic[0] = pp_outpic[1] = NULL;
vlc_mutex_lock( &p_vout->p_sys->filter_lock );
More information about the vlc-devel
mailing list