1 /*****************************************************************************
2 * panoramix.c : Wall panoramic video with edge blending plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
5 * $Id: panoramix.c 2006-08-29 16:20:15Z ced $
7 * Authors: Cedric Cocquebert <cedric.cocquebert@supelec.fr>
8 * based on Samuel Hocevar <sam@zoy.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
28 #include <stdlib.h> /* malloc(), free() */
34 #include "filter_common.h"
36 // add by cedric.cocquebert@supelec.fr
40 // OS CODE DEPENDANT to get display dimensions
47 // #define PACKED_YUV 1
48 #define F2(a) ((a)*(a))
49 #define F4(a,b,x) ((a)*(F2(x))+((b)*(x)))
51 #define RATIO_MAX 2500
52 #define CLIP_01(a) (a < 0.0 ? 0.0 : (a > 1.0 ? 1.0 : a))
53 // #define CLIP_0A(a) (a < 0.0 ? 0.0 : (a > ACCURACY ? ACCURACY : a))
56 /*****************************************************************************
58 *****************************************************************************/
59 static int Create ( vlc_object_t * );
60 static void Destroy ( vlc_object_t * );
62 static int Init ( vout_thread_t * );
63 static void End ( vout_thread_t * );
65 static void RenderPackedYUV ( vout_thread_t *, picture_t * );
67 static void RenderPlanarYUV ( vout_thread_t *, picture_t * );
68 static void RenderPackedRGB ( vout_thread_t *, picture_t * );
70 static void RemoveAllVout ( vout_thread_t *p_vout );
72 static int SendEvents( vlc_object_t *, char const *,
73 vlc_value_t, vlc_value_t, void * );
75 /*****************************************************************************
77 *****************************************************************************/
78 #define COLS_TEXT N_("Number of columns")
79 #define COLS_LONGTEXT N_("Select the number of horizontal video windows in " \
80 "which to split the video")
82 #define ROWS_TEXT N_("Number of rows")
83 #define ROWS_LONGTEXT N_("Select the number of vertical video windows in " \
84 "which to split the video")
86 #define ACTIVE_TEXT N_("Active windows")
87 #define ACTIVE_LONGTEXT N_("Comma separated list of active windows, " \
91 set_description( N_("Panoramix: wall with overlap video filter") );
92 set_shortname( _("Panoramix" ));
93 set_capability( "video filter", 0 );
94 set_category( CAT_VIDEO );
95 set_subcategory( SUBCAT_VIDEO_VFILTER );
97 add_integer( "panoramix-cols", -1, NULL, COLS_TEXT, COLS_LONGTEXT, VLC_TRUE );
98 add_integer( "panoramix-rows", -1, NULL, ROWS_TEXT, ROWS_LONGTEXT, VLC_TRUE );
101 #define OFFSET_X_TEXT N_("Offset X offset (automatic compensation)")
102 #define OFFSET_X_LONGTEXT N_("Select if you want an automatic offset in horizontal (in case of misalignment due to autoratio control)")
103 add_bool( "offset-x", 1, NULL, OFFSET_X_TEXT, OFFSET_X_LONGTEXT, VLC_TRUE );
105 #define LENGTH_TEXT N_("length of the overlapping area (in %)")
106 #define LENGTH_LONGTEXT N_("Select in percent the length of the blended zone")
107 add_integer_with_range( "bz-length", 100, 0, 100, NULL, LENGTH_TEXT, LENGTH_LONGTEXT, VLC_TRUE );
109 #define HEIGHT_TEXT N_("height of the overlapping area (in %)")
110 #define HEIGHT_LONGTEXT N_("Select in percent the height of the blended zone (case of 2x2 wall)")
111 add_integer_with_range( "bz-height", 100, 0, 100, NULL, HEIGHT_TEXT, HEIGHT_LONGTEXT, VLC_TRUE );
113 #define ATTENUATION_TEXT N_("Attenuation")
114 #define ATTENUATION_LONGTEXT N_("Check this option if you want attenuate blended zone by this plug-in (if option is unchecked, attenuate is made by opengl)")
115 add_bool( "panoramix-attenuate", 1, NULL, ATTENUATION_TEXT, ATTENUATION_LONGTEXT, VLC_FALSE );
117 #define BEGIN_TEXT N_("Attenuation, begin (in %)")
118 #define BEGIN_LONGTEXT N_("Select in percent the Lagrange coeff of the beginning blended zone")
119 add_integer_with_range( "bz-begin", 0, 0, 100, NULL, BEGIN_TEXT, BEGIN_LONGTEXT, VLC_TRUE );
121 #define MIDDLE_TEXT N_("Attenuation, middle (in %)")
122 #define MIDDLE_LONGTEXT N_("Select in percent the Lagrange coeff of the middle of blended zone")
123 add_integer_with_range( "bz-middle", 50, 0, 100, NULL, MIDDLE_TEXT, MIDDLE_LONGTEXT, VLC_FALSE );
125 #define END_TEXT N_("Attenuation, end (in %)")
126 #define END_LONGTEXT N_("Select in percent the Lagrange coeff of the end of blended zone")
127 add_integer_with_range( "bz-end", 100, 0, 100, NULL, END_TEXT, END_LONGTEXT, VLC_TRUE );
129 #define MIDDLE_POS_TEXT N_("middle position (in %)")
130 #define MIDDLE_POS_LONGTEXT N_("Select in percent (50 is center) the position of the middle point (Lagrange) of blended zone")
131 add_integer_with_range( "bz-middle-pos", 50, 1, 99, NULL, MIDDLE_POS_TEXT, MIDDLE_POS_LONGTEXT, VLC_FALSE );
133 #define RGAMMA_TEXT N_("Gamma (Red) correction")
134 #define RGAMMA_LONGTEXT N_("Select the gamma for the correction of blended zone (Red or Y component)")
135 add_float_with_range( "bz-gamma-red", 1, 0, 5, NULL, RGAMMA_TEXT, RGAMMA_LONGTEXT, VLC_TRUE );
137 #define GGAMMA_TEXT N_("Gamma (Green) correction")
138 #define GGAMMA_LONGTEXT N_("Select the gamma for the correction of blended zone (Green or U component)")
139 add_float_with_range( "bz-gamma-green", 1, 0, 5, NULL, GGAMMA_TEXT, GGAMMA_LONGTEXT, VLC_TRUE );
141 #define BGAMMA_TEXT N_("Gamma (Blue) correction")
142 #define BGAMMA_LONGTEXT N_("Select the gamma for the correction of blended zone (Blue or V component)")
143 add_float_with_range( "bz-gamma-blue", 1, 0, 5, NULL, BGAMMA_TEXT, BGAMMA_LONGTEXT, VLC_TRUE );
145 #define RGAMMA_BC_TEXT N_("Black Crush for Red")
146 #define RGAMMA_BC_LONGTEXT N_("Select the Black Crush of blended zone (Red or Y component)")
147 #define GGAMMA_BC_TEXT N_("Black Crush for Green")
148 #define GGAMMA_BC_LONGTEXT N_("Select the Black Crush of blended zone (Green or U component)")
149 #define BGAMMA_BC_TEXT N_("Black Crush for Blue")
150 #define BGAMMA_BC_LONGTEXT N_("Select the Black Crush of blended zone (Blue or V component)")
152 #define RGAMMA_WC_TEXT N_("White Crush for Red")
153 #define RGAMMA_WC_LONGTEXT N_("Select the White Crush of blended zone (Red or Y component)")
154 #define GGAMMA_WC_TEXT N_("White Crush for Green")
155 #define GGAMMA_WC_LONGTEXT N_("Select the White Crush of blended zone (Green or U component)")
156 #define BGAMMA_WC_TEXT N_("White Crush for Blue")
157 #define BGAMMA_WC_LONGTEXT N_("Select the White Crush of blended zone (Blue or V component)")
159 #define RGAMMA_BL_TEXT N_("Black Level for Red")
160 #define RGAMMA_BL_LONGTEXT N_("Select the Black Level of blended zone (Red or Y component)")
161 #define GGAMMA_BL_TEXT N_("Black Level for Green")
162 #define GGAMMA_BL_LONGTEXT N_("Select the Black Level of blended zone (Green or U component)")
163 #define BGAMMA_BL_TEXT N_("Black Level for Blue")
164 #define BGAMMA_BL_LONGTEXT N_("Select the Black Level of blended zone (Blue or V component)")
166 #define RGAMMA_WL_TEXT N_("White Level for Red")
167 #define RGAMMA_WL_LONGTEXT N_("Select the White Level of blended zone (Red or Y component)")
168 #define GGAMMA_WL_TEXT N_("White Level for Green")
169 #define GGAMMA_WL_LONGTEXT N_("Select the White Level of blended zone (Green or U component)")
170 #define BGAMMA_WL_TEXT N_("White Level for Blue")
171 #define BGAMMA_WL_LONGTEXT N_("Select the White Level of blended zone (Blue or V component)")
172 add_integer_with_range( "bz-blackcrush-red", 140, 0, 255, NULL, RGAMMA_BC_TEXT, RGAMMA_BC_LONGTEXT, VLC_TRUE );
173 add_integer_with_range( "bz-blackcrush-green", 140, 0, 255, NULL, GGAMMA_BC_TEXT, GGAMMA_BC_LONGTEXT, VLC_TRUE );
174 add_integer_with_range( "bz-blackcrush-blue", 140, 0, 255, NULL, BGAMMA_BC_TEXT, BGAMMA_BC_LONGTEXT, VLC_TRUE );
175 add_integer_with_range( "bz-whitecrush-red", 200, 0, 255, NULL, RGAMMA_WC_TEXT, RGAMMA_WC_LONGTEXT, VLC_TRUE );
176 add_integer_with_range( "bz-whitecrush-green", 200, 0, 255, NULL, GGAMMA_WC_TEXT, GGAMMA_WC_LONGTEXT, VLC_TRUE );
177 add_integer_with_range( "bz-whitecrush-blue", 200, 0, 255, NULL, BGAMMA_WC_TEXT, BGAMMA_WC_LONGTEXT, VLC_TRUE );
178 add_integer_with_range( "bz-blacklevel-red", 150, 0, 255, NULL, RGAMMA_BL_TEXT, RGAMMA_BL_LONGTEXT, VLC_TRUE );
179 add_integer_with_range( "bz-blacklevel-green", 150, 0, 255, NULL, GGAMMA_BL_TEXT, GGAMMA_BL_LONGTEXT, VLC_TRUE );
180 add_integer_with_range( "bz-blacklevel-blue", 150, 0, 255, NULL, BGAMMA_BL_TEXT, BGAMMA_BL_LONGTEXT, VLC_TRUE );
181 add_integer_with_range( "bz-whitelevel-red", 0, 0, 255, NULL, RGAMMA_WL_TEXT, RGAMMA_WL_LONGTEXT, VLC_TRUE );
182 add_integer_with_range( "bz-whitelevel-green", 0, 0, 255, NULL, GGAMMA_WL_TEXT, GGAMMA_WL_LONGTEXT, VLC_TRUE );
183 add_integer_with_range( "bz-whitelevel-blue", 0, 0, 255, NULL, BGAMMA_WL_TEXT, BGAMMA_WL_LONGTEXT, VLC_TRUE );
185 #define XINERAMA_TEXT N_("Xinerama option")
186 #define XINERAMA_LONGTEXT N_("Uncheck if you have not used xinerama")
187 add_bool( "xinerama", 1, NULL, XINERAMA_TEXT, XINERAMA_LONGTEXT, VLC_TRUE );
191 add_string( "wall-active", NULL, NULL, ACTIVE_TEXT, ACTIVE_LONGTEXT, VLC_TRUE );
193 add_shortcut( "panoramix" );
194 set_callbacks( Create, Destroy );
197 /*****************************************************************************
198 * vout_sys_t: Wall video output method descriptor
199 *****************************************************************************
200 * This structure is part of the video output thread descriptor.
201 * It describes the Wall specific properties of an output thread.
202 *****************************************************************************/
206 vlc_bool_t b_autocrop;
207 vlc_bool_t b_attenuate;
208 unsigned int bz_length, bz_height, bz_begin, bz_middle, bz_end, bz_middle_pos;
209 unsigned int i_ratio_max;
210 unsigned int i_ratio;
211 unsigned int a_0, a_1, a_2;
212 vlc_bool_t b_has_changed;
213 int lambda[2][VOUT_MAX_PLANES][500];
214 int cstYUV[2][VOUT_MAX_PLANES][500];
215 int lambda2[2][VOUT_MAX_PLANES][500];
216 int cstYUV2[2][VOUT_MAX_PLANES][500];
217 unsigned int i_halfLength;
218 unsigned int i_halfHeight;
222 float f_gamma_red, f_gamma_green, f_gamma_blue;
223 float f_gamma[VOUT_MAX_PLANES];
224 uint8_t LUT[VOUT_MAX_PLANES][ACCURACY + 1][256];
226 uint8_t LUT2[VOUT_MAX_PLANES][256][500];
230 vlc_bool_t b_xinerama;
241 vout_thread_t *p_vout;
247 /*****************************************************************************
248 * Control: control facility for the vout (forwards to child vout)
249 *****************************************************************************/
250 static int Control( vout_thread_t *p_vout, int i_query, va_list args )
252 int i_row, i_col, i_vout = 0;
254 for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
256 for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
258 vout_vaControl( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
266 /*****************************************************************************
267 * Create: allocates Wall video thread output method
268 *****************************************************************************
269 * This function allocates and initializes a Wall vout method.
270 *****************************************************************************/
271 static int Create( vlc_object_t *p_this )
273 vout_thread_t *p_vout = (vout_thread_t *)p_this;
274 char *psz_method, *psz_tmp, *psz_method_tmp;
277 /* Allocate structure */
278 p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
279 if( p_vout->p_sys == NULL )
281 msg_Err( p_vout, "out of memory" );
285 p_vout->pf_init = Init;
286 p_vout->pf_end = End;
287 p_vout->pf_manage = NULL;
288 /* Color Format not supported
289 // Planar Y, packed UV
290 case VLC_FOURCC('Y','M','G','A'):
291 // Packed YUV 4:2:2, U:Y:V:Y, interlaced
292 case VLC_FOURCC('I','U','Y','V'): // packed by 2
293 // Packed YUV 2:1:1, Y:U:Y:V
294 case VLC_FOURCC('Y','2','1','1'): // packed by 4
295 // Packed YUV Reverted
296 case VLC_FOURCC('c','y','u','v'): // packed by 2
298 switch (p_vout->render.i_chroma)
301 case VLC_FOURCC('I','4','4','4'):
302 case VLC_FOURCC('I','4','2','2'):
303 case VLC_FOURCC('I','4','2','0'):
304 case VLC_FOURCC('Y','V','1','2'):
305 case VLC_FOURCC('I','Y','U','V'):
306 case VLC_FOURCC('I','4','1','1'):
307 case VLC_FOURCC('I','4','1','0'):
308 case VLC_FOURCC('Y','V','U','9'):
309 case VLC_FOURCC('Y','U','V','A'):
310 p_vout->pf_render = RenderPlanarYUV;
313 case VLC_FOURCC('R','G','B','2'): // packed by 1
314 case VLC_FOURCC('R','V','1','5'): // packed by 2
315 case VLC_FOURCC('R','V','1','6'): // packed by 2
316 case VLC_FOURCC('R','V','2','4'): // packed by 3
317 case VLC_FOURCC('R','V','3','2'): // packed by 4
318 p_vout->pf_render = RenderPackedRGB;
322 case VLC_FOURCC('Y','U','Y','2'): // packed by 2
323 case VLC_FOURCC('Y','U','N','V'): // packed by 2
324 case VLC_FOURCC('U','Y','V','Y'): // packed by 2
325 case VLC_FOURCC('U','Y','N','V'): // packed by 2
326 case VLC_FOURCC('Y','4','2','2'): // packed by 2
327 p_vout->pf_render = RenderPackedYUV;
331 msg_Err( p_vout, "colorspace not supported by plug-in !!!");
332 free( p_vout->p_sys );
335 p_vout->pf_display = NULL;
336 p_vout->pf_control = Control;
338 /* Look what method was requested */
339 p_vout->p_sys->i_col = var_CreateGetInteger( p_vout, "panoramix-cols" );
340 p_vout->p_sys->i_row = var_CreateGetInteger( p_vout, "panoramix-rows" );
342 // OS dependant code : Autodetect number of displays in wall
344 if ((p_vout->p_sys->i_col < 0) || (p_vout->p_sys->i_row < 0) )
346 int nbMonitors = GetSystemMetrics(SM_CMONITORS);
349 nbMonitors = 5; // 1 display => 5x1 simulation
350 p_vout->p_sys->i_col = nbMonitors;
351 p_vout->p_sys->i_row = 1;
355 p_vout->p_sys->i_col = GetSystemMetrics( SM_CXVIRTUALSCREEN ) / GetSystemMetrics( SM_CXSCREEN );
356 p_vout->p_sys->i_row = GetSystemMetrics( SM_CYVIRTUALSCREEN ) / GetSystemMetrics( SM_CYSCREEN );
357 if (p_vout->p_sys->i_col * p_vout->p_sys->i_row != nbMonitors)
359 p_vout->p_sys->i_col = nbMonitors;
360 p_vout->p_sys->i_row = 1;
363 var_SetInteger( p_vout, "panoramix-cols", p_vout->p_sys->i_col);
364 var_SetInteger( p_vout, "panoramix-rows", p_vout->p_sys->i_row);
369 p_vout->p_sys->i_offset_x = var_CreateGetInteger( p_vout, "offset-x" );
370 if (p_vout->p_sys->i_col > 2) p_vout->p_sys->i_offset_x = 0; // offset-x is used in case of 2x1 wall & autocrop
371 p_vout->p_sys->b_autocrop = !(var_CreateGetInteger( p_vout, "crop-ratio" ) == 0);
372 if (!p_vout->p_sys->b_autocrop) p_vout->p_sys->b_autocrop = var_CreateGetInteger( p_vout, "autocrop" );
373 p_vout->p_sys->b_attenuate = var_CreateGetInteger( p_vout, "panoramix-attenuate");
374 p_vout->p_sys->bz_length = var_CreateGetInteger( p_vout, "bz-length" );
375 if (p_vout->p_sys->i_row > 1)
376 p_vout->p_sys->bz_height = var_CreateGetInteger( p_vout, "bz-height" );
378 p_vout->p_sys->bz_height = 100;
379 p_vout->p_sys->bz_begin = var_CreateGetInteger( p_vout, "bz-begin" );
380 p_vout->p_sys->bz_middle = var_CreateGetInteger( p_vout, "bz-middle" );
381 p_vout->p_sys->bz_end = var_CreateGetInteger( p_vout, "bz-end" );
382 p_vout->p_sys->bz_middle_pos = var_CreateGetInteger( p_vout, "bz-middle-pos" );
383 double d_p = 100.0 / p_vout->p_sys->bz_middle_pos;
384 p_vout->p_sys->i_ratio_max = var_CreateGetInteger( p_vout, "autocrop-ratio-max" ); // in crop module with autocrop ...
385 p_vout->p_sys->i_ratio = var_CreateGetInteger( p_vout, "crop-ratio" ); // in crop module with manual ratio ...
387 p_vout->p_sys->a_2 = d_p * p_vout->p_sys->bz_begin - (double)(d_p * d_p / (d_p - 1)) * p_vout->p_sys->bz_middle + (double)(d_p / (d_p - 1)) * p_vout->p_sys->bz_end;
388 p_vout->p_sys->a_1 = -(d_p + 1) * p_vout->p_sys->bz_begin + (double)(d_p * d_p / (d_p - 1)) * p_vout->p_sys->bz_middle - (double)(1 / (d_p - 1)) * p_vout->p_sys->bz_end;
389 p_vout->p_sys->a_0 = p_vout->p_sys->bz_begin;
392 p_vout->p_sys->f_gamma_red = var_CreateGetFloat( p_vout, "bz-gamma-red" );
393 p_vout->p_sys->f_gamma_green = var_CreateGetFloat( p_vout, "bz-gamma-green" );
394 p_vout->p_sys->f_gamma_blue = var_CreateGetFloat( p_vout, "bz-gamma-blue" );
397 p_vout->p_sys->b_xinerama= var_CreateGetInteger( p_vout, "xinerama" );
400 p_vout->p_sys->i_col = __MAX( 1, __MIN( 15, p_vout->p_sys->i_col ) );
401 p_vout->p_sys->i_row = __MAX( 1, __MIN( 15, p_vout->p_sys->i_row ) );
404 msg_Dbg( p_vout, "opening a %i x %i wall",
405 p_vout->p_sys->i_col, p_vout->p_sys->i_row );
407 p_vout->p_sys->pp_vout = malloc( p_vout->p_sys->i_row *
408 p_vout->p_sys->i_col *
409 sizeof(struct vout_list_t) );
410 if( p_vout->p_sys->pp_vout == NULL )
412 msg_Err( p_vout, "out of memory" );
413 free( p_vout->p_sys );
417 psz_method_tmp = psz_method = config_GetPsz( p_vout, "wall-active" );
419 /* If no trailing vout are specified, take them all */
420 if( psz_method == NULL )
422 for( i_vout = p_vout->p_sys->i_row * p_vout->p_sys->i_col;
425 p_vout->p_sys->pp_vout[i_vout].b_active = 1;
428 /* If trailing vout are specified, activate only the requested ones */
431 for( i_vout = p_vout->p_sys->i_row * p_vout->p_sys->i_col;
434 p_vout->p_sys->pp_vout[i_vout].b_active = 0;
439 psz_tmp = psz_method;
440 while( *psz_tmp && *psz_tmp != ',' )
448 i_vout = atoi( psz_method );
449 psz_method = psz_tmp + 1;
453 i_vout = atoi( psz_method );
454 psz_method = psz_tmp;
458 i_vout < p_vout->p_sys->i_row * p_vout->p_sys->i_col )
460 p_vout->p_sys->pp_vout[i_vout].b_active = 1;
465 free( psz_method_tmp );
472 /*****************************************************************************
473 * CLIP_0A: clip between 0 and ACCURACY
474 *****************************************************************************/
475 inline static int CLIP_0A( int a )
477 return (a > ACCURACY) ? ACCURACY : (a < 0) ? 0 : a;
481 /*****************************************************************************
482 * Gamma: Gamma correction
483 *****************************************************************************/
484 static double Gamma_Correction(int i_plane, float f_component, float f_BlackCrush[VOUT_MAX_PLANES], float f_WhiteCrush[VOUT_MAX_PLANES], float f_BlackLevel[VOUT_MAX_PLANES], float f_WhiteLevel[VOUT_MAX_PLANES], float f_Gamma[VOUT_MAX_PLANES])
488 f_Input = (f_component * f_BlackLevel[i_plane]) / (f_BlackCrush[i_plane]) + (1.0 - f_BlackLevel[i_plane]);
489 if (f_component <= f_BlackCrush[i_plane])
490 return pow(f_Input, 1.0 / f_Gamma[i_plane]);
491 else if (f_component >= f_WhiteCrush[i_plane])
493 f_Input = (f_component * (1.0 - (f_WhiteLevel[i_plane] + 1.0)) + (f_WhiteLevel[i_plane] + 1.0) * f_WhiteCrush[i_plane] - 1.0) / (f_WhiteCrush[i_plane] - 1.0);
494 return pow(f_Input, 1.0 / f_Gamma[i_plane]);
502 /*****************************************************************************
503 * F: Function to calculate Gamma correction
504 *****************************************************************************/
505 static uint8_t F(uint8_t i, float gamma)
507 double input = (double) i / 255.0;
509 // return clip(255 * pow(input, 1.0 / gamma));
512 return clip_uint8((255 * pow(2 * input, gamma)) / 2);
514 return clip_uint8(255 * (1 - pow(2 * (1 - input), gamma) / 2));
520 /*****************************************************************************
521 * AdjustHeight: ajust p_sys->i_height to have same BZ width for any ratio
522 *****************************************************************************/
523 static int AdjustHeight( vout_thread_t *p_vout )
525 vlc_bool_t b_fullscreen = var_CreateGetInteger( p_vout, "fullscreen" );
526 int i_window_width = p_vout->i_window_width;
527 int i_window_height = p_vout->i_window_height;
528 double d_halfLength = 0;
529 double d_halfLength_crop;
530 double d_halfLength_calculated;
533 // OS DEPENDANT CODE to get display dimensions
537 i_window_width = GetSystemMetrics(SM_CXSCREEN);
538 i_window_height = GetSystemMetrics(SM_CYSCREEN);
540 Display *p_display = XOpenDisplay( "" );
541 if (p_vout->p_sys->b_xinerama)
543 i_window_width = DisplayWidth(p_display, 0) / p_vout->p_sys->i_col;
544 i_window_height = DisplayHeight(p_display, 0) / p_vout->p_sys->i_row;
548 i_window_width = DisplayWidth(p_display, 0);
549 i_window_height = DisplayHeight(p_display, 0);
551 XCloseDisplay( p_display );
554 var_SetInteger( p_vout, "width", i_window_width);
555 var_SetInteger( p_vout, "height", i_window_height);
556 p_vout->i_window_width = i_window_width;
557 p_vout->i_window_height = i_window_height;
560 if (p_vout->p_sys->bz_length)
561 if ((!p_vout->p_sys->b_autocrop) && (!p_vout->p_sys->i_ratio))
563 if ((p_vout->p_sys->i_row > 1) || (p_vout->p_sys->i_col > 1))
565 while ((d_halfLength <= 0) || (d_halfLength > p_vout->render.i_width / (2 * p_vout->p_sys->i_col)))
567 if (p_vout->p_sys->bz_length >= 50)
568 d_halfLength = i_window_width * p_vout->render.i_height / (2 * i_window_height * p_vout->p_sys->i_row) - p_vout->render.i_width / (2 * p_vout->p_sys->i_col);
571 d_halfLength = (p_vout->render.i_width * p_vout->p_sys->bz_length) / (100.0 * p_vout->p_sys->i_col);
572 d_halfLength = __MAX(i_window_width * p_vout->render.i_height / (2 * i_window_height * p_vout->p_sys->i_row) - p_vout->render.i_width / (2 * p_vout->p_sys->i_col), d_halfLength);
574 if ((d_halfLength <= 0) || (d_halfLength > p_vout->render.i_width / (2 * p_vout->p_sys->i_col))) p_vout->p_sys->i_row--;
575 if (p_vout->p_sys->i_row < 1 )
577 p_vout->p_sys->i_row = 1;
581 p_vout->p_sys->i_halfLength = (d_halfLength + 0.5);
582 p_vout->p_sys->bz_length = (p_vout->p_sys->i_halfLength * 100.0 * p_vout->p_sys->i_col) / p_vout->render.i_width;
583 var_SetInteger( p_vout, "bz-length", p_vout->p_sys->bz_length);
584 var_SetInteger( p_vout, "panoramix-rows", p_vout->p_sys->i_row);
589 d_halfLength = ((2 * (double)i_window_width - (double)(p_vout->p_sys->i_ratio_max * i_window_height) / 1000.0 ) * (double)p_vout->p_sys->bz_length) / 200.0;
590 d_halfLength_crop = d_halfLength * VOUT_ASPECT_FACTOR * (double)p_vout->output.i_width
591 / (double)i_window_height / (double)p_vout->render.i_aspect;
592 p_vout->p_sys->i_halfLength = (d_halfLength_crop + 0.5);
593 d_halfLength_calculated = p_vout->p_sys->i_halfLength * (double)i_window_height *
594 (double)p_vout->render.i_aspect / VOUT_ASPECT_FACTOR / (double)p_vout->output.i_width;
596 if (!p_vout->p_sys->b_attenuate)
598 double d_bz_length = (p_vout->p_sys->i_halfLength * p_vout->p_sys->i_col * 100.0) / p_vout->render.i_width;
599 // F(2x) != 2F(x) in opengl module
600 if (p_vout->p_sys->i_col == 2) d_bz_length = (100.0 * d_bz_length) / (100.0 - d_bz_length) ;
601 var_SetInteger( p_vout, "bz-length", (int)(d_bz_length + 0.5));
603 i_offset = (int)d_halfLength - (int)
604 (p_vout->p_sys->i_halfLength * (double)i_window_height *
605 (double)p_vout->render.i_aspect / VOUT_ASPECT_FACTOR / (double)p_vout->output.i_width);
615 /*****************************************************************************
616 * Init: initialize Wall video thread output method
617 *****************************************************************************/
618 static int Init( vout_thread_t *p_vout )
620 int i_index, i_row, i_col, i_width, i_height;
623 I_OUTPUTPICTURES = 0;
625 /* Initialize the output structure */
626 p_vout->output.i_chroma = p_vout->render.i_chroma;
627 p_vout->output.i_width = p_vout->render.i_width;
628 p_vout->output.i_height = p_vout->render.i_height;
629 p_vout->output.i_aspect = p_vout->render.i_aspect;
631 p_vout->p_sys->b_has_changed = p_vout->p_sys->b_attenuate;
632 int i_video_x = var_GetInteger( p_vout, "video-x");
633 int i_video_y = var_GetInteger( p_vout, "video-y");
635 if (p_vout->p_sys->b_attenuate)
637 int i_index2, i_plane;
638 int constantYUV[3] = {0,128,128};
639 float f_BlackCrush[VOUT_MAX_PLANES];
640 float f_BlackLevel[VOUT_MAX_PLANES];
641 float f_WhiteCrush[VOUT_MAX_PLANES];
642 float f_WhiteLevel[VOUT_MAX_PLANES];
643 p_vout->p_sys->f_gamma[0] = var_CreateGetFloat( p_vout, "bz-gamma-red" );
644 p_vout->p_sys->f_gamma[1] = var_CreateGetFloat( p_vout, "bz-gamma-green" );
645 p_vout->p_sys->f_gamma[2] = var_CreateGetFloat( p_vout, "bz-gamma-blue" );
646 f_BlackCrush[0] = var_CreateGetInteger( p_vout, "bz-blackcrush-red" ) / 255.0;
647 f_BlackCrush[1] = var_CreateGetInteger( p_vout, "bz-blackcrush-green" ) / 255.0;
648 f_BlackCrush[2] = var_CreateGetInteger( p_vout, "bz-blackcrush-blue" ) / 255.0;
649 f_WhiteCrush[0] = var_CreateGetInteger( p_vout, "bz-whitecrush-red" ) / 255.0;
650 f_WhiteCrush[1] = var_CreateGetInteger( p_vout, "bz-whitecrush-green" ) / 255.0;
651 f_WhiteCrush[2] = var_CreateGetInteger( p_vout, "bz-whitecrush-blue" ) / 255.0;
652 f_BlackLevel[0] = var_CreateGetInteger( p_vout, "bz-blacklevel-red" ) / 255.0;
653 f_BlackLevel[1] = var_CreateGetInteger( p_vout, "bz-blacklevel-green" ) / 255.0;
654 f_BlackLevel[2] = var_CreateGetInteger( p_vout, "bz-blacklevel-blue" ) / 255.0;
655 f_WhiteLevel[0] = var_CreateGetInteger( p_vout, "bz-whitelevel-red" ) / 255.0;
656 f_WhiteLevel[1] = var_CreateGetInteger( p_vout, "bz-whitelevel-green" ) / 255.0;
657 f_WhiteLevel[2] = var_CreateGetInteger( p_vout, "bz-whitelevel-blue" ) / 255.0;
658 switch (p_vout->render.i_chroma)
661 case VLC_FOURCC('Y','V','1','2'):
662 case VLC_FOURCC('Y','V','U','9'):
664 case VLC_FOURCC('U','Y','V','Y'): // packed by 2
665 case VLC_FOURCC('U','Y','N','V'): // packed by 2
666 case VLC_FOURCC('Y','4','2','2'): // packed by 2
667 // case VLC_FOURCC('c','y','u','v'): // packed by 2
668 p_vout->p_sys->f_gamma[2] = var_CreateGetFloat( p_vout, "bz-gamma-green" );
669 p_vout->p_sys->f_gamma[1] = var_CreateGetFloat( p_vout, "bz-gamma-blue" );
670 f_BlackCrush[2] = var_CreateGetInteger( p_vout, "bz-blackcrush-green" ) / 255.0;
671 f_BlackCrush[1] = var_CreateGetInteger( p_vout, "bz-blackcrush-blue" ) / 255.0;
672 f_WhiteCrush[2] = var_CreateGetInteger( p_vout, "bz-whitecrush-green" ) / 255.0;
673 f_WhiteCrush[1] = var_CreateGetInteger( p_vout, "bz-whitecrush-blue" ) / 255.0;
674 f_BlackLevel[2] = var_CreateGetInteger( p_vout, "bz-blacklevel-green" ) / 255.0;
675 f_BlackLevel[1] = var_CreateGetInteger( p_vout, "bz-blacklevel-blue" ) / 255.0;
676 f_WhiteLevel[2] = var_CreateGetInteger( p_vout, "bz-whitelevel-green" ) / 255.0;
677 f_WhiteLevel[1] = var_CreateGetInteger( p_vout, "bz-whitelevel-blue" ) / 255.0;
679 case VLC_FOURCC('I','4','4','4'):
680 case VLC_FOURCC('I','4','2','2'):
681 case VLC_FOURCC('I','4','2','0'):
682 case VLC_FOURCC('I','4','1','1'):
683 case VLC_FOURCC('I','4','1','0'):
684 case VLC_FOURCC('I','Y','U','V'):
685 case VLC_FOURCC('Y','U','V','A'):
687 case VLC_FOURCC('Y','U','Y','2'): // packed by 2
688 case VLC_FOURCC('Y','U','N','V'): // packed by 2
689 for (i_index = 0; i_index < 256; i_index++)
690 for (i_index2 = 0; i_index2 <= ACCURACY; i_index2++)
691 for (i_plane = 0; i_plane < VOUT_MAX_PLANES; i_plane++)
693 float f_lut = CLIP_01(1.0 -
694 ((ACCURACY - (float)i_index2)
695 * Gamma_Correction(i_plane, (float)i_index / 255.0, f_BlackCrush, f_WhiteCrush, f_BlackLevel, f_WhiteLevel, p_vout->p_sys->f_gamma)
697 p_vout->p_sys->LUT[i_plane][i_index2][i_index] = f_lut * i_index + (int)((1.0 - f_lut) * (float)constantYUV[i_plane]);
701 case VLC_FOURCC('R','G','B','2'): // packed by 1
702 case VLC_FOURCC('R','V','1','5'): // packed by 2
703 case VLC_FOURCC('R','V','1','6'): // packed by 2
704 case VLC_FOURCC('R','V','2','4'): // packed by 3
705 case VLC_FOURCC('R','V','3','2'): // packed by 4
706 for (i_index = 0; i_index < 256; i_index++)
707 for (i_index2 = 0; i_index2 <= ACCURACY; i_index2++)
708 for (i_plane = 0; i_plane < VOUT_MAX_PLANES; i_plane++)
710 float f_lut = CLIP_01(1.0 -
711 ((ACCURACY - (float)i_index2)
712 * Gamma_Correction(i_plane, (float)i_index / 255.0, f_BlackCrush, f_WhiteCrush, f_BlackLevel, f_WhiteLevel, p_vout->p_sys->f_gamma)
714 p_vout->p_sys->LUT[i_plane][i_index2][i_index] = f_lut * i_index;
718 msg_Err( p_vout, "colorspace not supported by plug-in !!!");
719 free( p_vout->p_sys );
724 if (p_vout->p_sys->i_offset_x)
725 p_vout->p_sys->i_offset_x = AdjustHeight(p_vout);
727 AdjustHeight(p_vout);
730 /* Try to open the real video output */
731 msg_Dbg( p_vout, "spawning the real video outputs" );
733 p_vout->p_sys->i_vout = 0;
735 /* FIXME: use bresenham instead of those ugly divisions */
736 for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
738 for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
742 memset( &fmt, 0, sizeof(video_format_t) );
744 if( i_col + 1 < p_vout->p_sys->i_col )
746 i_width = ( p_vout->render.i_width
747 / p_vout->p_sys->i_col ) & ~0x1;
751 i_width = p_vout->render.i_width
752 - ( ( p_vout->render.i_width
753 / p_vout->p_sys->i_col ) & ~0x1 ) * i_col;
757 i_width += p_vout->p_sys->i_halfLength;
758 if (p_vout->p_sys->i_col > 2 ) i_width += p_vout->p_sys->i_halfLength;
759 i_width -= i_width % 2;
761 if( i_row + 1 < p_vout->p_sys->i_row )
763 i_height = ( p_vout->render.i_height
764 / p_vout->p_sys->i_row ) & ~0x3;
768 i_height = p_vout->render.i_height
769 - ( ( p_vout->render.i_height
770 / p_vout->p_sys->i_row ) & ~0x3 ) * i_row;
774 if (p_vout->p_sys->i_row >= 2)
776 p_vout->p_sys->i_halfHeight = (p_vout->p_sys->i_halfLength * p_vout->p_sys->bz_height) / 100;
777 p_vout->p_sys->i_halfHeight -= (p_vout->p_sys->i_halfHeight % 2);
778 i_height += p_vout->p_sys->i_halfHeight;
779 if (p_vout->p_sys->i_row > 2) i_height += p_vout->p_sys->i_halfHeight;
781 i_height -= i_height % 2;
783 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].i_width = i_width;
784 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].i_height = i_height;
786 if( !p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].b_active )
788 p_vout->p_sys->i_vout++;
792 fmt.i_width = fmt.i_visible_width = p_vout->render.i_width;
793 fmt.i_height = fmt.i_visible_height = p_vout->render.i_height;
794 fmt.i_x_offset = fmt.i_y_offset = 0;
795 fmt.i_chroma = p_vout->render.i_chroma;
796 fmt.i_aspect = p_vout->render.i_aspect;
797 fmt.i_sar_num = p_vout->render.i_aspect * fmt.i_height / fmt.i_width;
798 fmt.i_sar_den = VOUT_ASPECT_FACTOR;
799 fmt.i_width = fmt.i_visible_width = i_width;
800 fmt.i_height = fmt.i_visible_height = i_height;
801 fmt.i_aspect = p_vout->render.i_aspect
802 * p_vout->render.i_height / i_height
803 * i_width / p_vout->render.i_width;
805 if (p_vout->p_sys->i_offset_x < 0)
807 var_SetInteger(p_vout, "video-x", -p_vout->p_sys->i_offset_x);
808 p_vout->p_sys->i_offset_x = 0;
811 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout =
812 vout_Create( p_vout, &fmt);
814 if( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout == NULL )
816 msg_Err( p_vout, "failed to get %ix%i vout threads",
817 p_vout->p_sys->i_col, p_vout->p_sys->i_row );
818 RemoveAllVout( p_vout );
822 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout,
825 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout->i_alignment = 0;
826 if (i_col == 0) p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout->i_alignment |= VOUT_ALIGN_RIGHT;
827 else if (i_col == p_vout->p_sys->i_col -1) p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout->i_alignment |= VOUT_ALIGN_LEFT;
828 if (p_vout->p_sys->i_row > 1)
830 if (i_row == 0) p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout->i_alignment |= VOUT_ALIGN_BOTTOM;
831 else if (i_row == p_vout->p_sys->i_row -1) p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout->i_alignment |= VOUT_ALIGN_TOP;
833 // i_n : number of active pp_vout
834 int i_index, i_n = p_vout->p_sys->i_vout;
835 for (i_index = p_vout->p_sys->i_vout; i_index >= 0; i_index--) if (!p_vout->p_sys->pp_vout[i_index].b_active) i_n -= 1;
836 var_SetInteger( p_vout, "align", p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout->i_alignment );
837 var_SetInteger( p_vout, "video-x",i_video_x + p_vout->p_sys->i_offset_x + ((i_n + 1) % p_vout->p_sys->i_col) * p_vout->i_window_width);
838 var_SetInteger( p_vout, "video-y",i_video_y + ((i_n + 1) / p_vout->p_sys->i_col) * p_vout->i_window_height);
840 p_vout->p_sys->i_vout++;
844 ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
846 ADD_PARENT_CALLBACKS( SendEventsToChild );
851 /*****************************************************************************
852 * End: terminate Wall video thread output method
853 *****************************************************************************/
854 static void End( vout_thread_t *p_vout )
859 var_SetInteger( p_vout, "bz-length", p_vout->p_sys->bz_length);
861 /* Free the fake output buffers we allocated */
862 for( i_index = I_OUTPUTPICTURES ; i_index ; )
865 free( PP_OUTPUTPICTURE[ i_index ]->p_data_orig );
869 /*****************************************************************************
870 * Destroy: destroy Wall video thread output method
871 *****************************************************************************
872 * Terminate an output method created by WallCreateOutputMethod
873 *****************************************************************************/
874 static void Destroy( vlc_object_t *p_this )
876 vout_thread_t *p_vout = (vout_thread_t *)p_this;
879 DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents);
880 vlc_object_detach( p_vout->p_sys->p_vout );
881 vout_Destroy( p_vout->p_sys->p_vout );
882 DEL_PARENT_CALLBACKS( SendEventsToChild);
885 RemoveAllVout( p_vout );
886 DEL_PARENT_CALLBACKS( SendEventsToChild );
888 free( p_vout->p_sys->pp_vout );
889 free( p_vout->p_sys );
893 /*****************************************************************************
894 * RenderPlanarYUV: displays previously rendered output
895 *****************************************************************************
896 * This function send the currently rendered image to Wall image, waits
897 * until it is displayed and switch the two rendering buffers, preparing next
899 *****************************************************************************/
900 static void RenderPlanarYUV( vout_thread_t *p_vout, picture_t *p_pic )
902 picture_t *p_outpic = NULL;
903 int i_col, i_row, i_vout, i_plane;
904 int pi_left_skip[VOUT_MAX_PLANES], pi_top_skip[VOUT_MAX_PLANES];
906 int LeftOffset, TopOffset;
907 int constantYUV[3] = {0,128,128};
912 int i_index, i_index2;
918 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
920 pi_top_skip[i_plane] = 0;
923 for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
925 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
927 pi_left_skip[i_plane] = 0;
930 for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
932 if( !p_vout->p_sys->pp_vout[ i_vout ].b_active )
934 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
936 pi_left_skip[i_plane] +=
937 p_vout->p_sys->pp_vout[ i_vout ].i_width
938 * p_pic->p[i_plane].i_pitch / p_vout->output.i_width;
945 vout_CreatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
949 if( p_vout->b_die || p_vout->b_error )
952 p_vout->p_sys->pp_vout[ i_vout ].p_vout, p_outpic );
956 msleep( VOUT_OUTMEM_SLEEP );
959 vout_DatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
960 p_outpic, p_pic->date );
961 vout_LinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
964 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
966 uint8_t *p_in, *p_in_end, *p_out;
967 int i_in_pitch = p_pic->p[i_plane].i_pitch;
968 int i_out_pitch = p_outpic->p[i_plane].i_pitch;
969 int i_copy_pitch = p_outpic->p[i_plane].i_visible_pitch;
970 int i_lines = p_outpic->p[i_plane].i_visible_lines;
972 if (i_col) pi_left_skip[i_plane] -= (2 * p_vout->p_sys->i_halfLength ) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
973 if ((i_row) && (!i_col)) pi_top_skip[i_plane] -= (2 * p_vout->p_sys->i_halfHeight * p_pic->p[i_plane].i_pitch) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
974 if ((p_vout->p_sys->i_row > 2) && (i_row == 1) && (!i_col)) pi_top_skip[i_plane] -= (2 * p_vout->p_sys->i_halfHeight * p_pic->p[i_plane].i_pitch) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
975 if ((!p_vout->p_sys->pp_vout[p_vout->p_sys->i_col].b_active))
976 pi_top_skip[i_plane] -= (2 * p_vout->p_sys->i_halfHeight * i_row * p_pic->p[i_plane].i_pitch) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
977 // i_n : previous inactive pp_vout
979 while ((!p_vout->p_sys->pp_vout[i_row * p_vout->p_sys->i_col + i_col - 1 - i_n].b_active) && (i_col - i_n > 1)) i_n++;
980 if ((i_col > 1) && i_n)
981 pi_left_skip[i_plane] -= i_n*(2 * p_vout->p_sys->i_halfLength ) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
983 p_in = p_pic->p[i_plane].p_pixels
984 /* Wall proprities */
985 + pi_top_skip[i_plane] + pi_left_skip[i_plane];
987 if ((p_vout->p_sys->i_row > 2) &&
988 ((!i_row) || (i_row + 1 == p_vout->p_sys->i_row)))
989 i_lines -= (2 * p_vout->p_sys->i_halfHeight) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
991 // 1088 lines bug in a mpeg2 stream of 1080 lines
992 if ((p_vout->p_sys->i_row - 1 == i_row) &&
993 (p_pic->p[i_plane].i_lines == 1088))
994 i_lines -= 8 / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
996 p_in_end = p_in + i_lines * p_pic->p[i_plane].i_pitch;
998 p_in = p_pic->p[i_plane].p_pixels
999 + pi_top_skip[i_plane] + pi_left_skip[i_plane];
1001 p_in_end = p_in + i_lines * p_pic->p[i_plane].i_pitch;
1003 p_out = p_outpic->p[i_plane].p_pixels;
1005 if ((p_vout->p_sys->i_row > 2) && (!i_row))
1006 p_out += (p_outpic->p[i_plane].i_pitch * (2 * p_vout->p_sys->i_halfHeight) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch));
1010 length = 2 * p_vout->p_sys->i_halfLength / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1012 if (p_vout->p_sys->b_has_changed)
1015 a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
1016 a_1 = p_vout->p_sys->a_1 * length * (ACCURACY / 100);
1017 a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
1018 for(i_col_mod = 0; i_col_mod < 2; i_col_mod++)
1019 for (i_index = 0; i_index < length; i_index++)
1021 p_vout->p_sys->lambda[i_col_mod][i_plane][i_index] = CLIP_0A(!i_col_mod ? ACCURACY - (F4(a_2, a_1, i_index) + a_0) / Denom : ACCURACY - (F4(a_2, a_1,length - i_index) + a_0) / Denom);
1022 p_vout->p_sys->cstYUV[i_col_mod][i_plane][i_index] = ((ACCURACY - p_vout->p_sys->lambda[i_col_mod][i_plane][i_index]) * constantYUV[i_plane]) / ACCURACY;
1026 while( p_in < p_in_end )
1029 p_vout->p_libvlc->pf_memcpy( p_out , p_in, i_copy_pitch);
1031 if (p_vout->p_sys->i_col > 2)
1035 p_vout->p_libvlc->pf_memcpy( p_out + length , p_in, i_copy_pitch - length);
1036 else if (i_col + 1 == p_vout->p_sys->i_col)
1037 p_vout->p_libvlc->pf_memcpy( p_out, p_in - length, i_copy_pitch - length);
1039 p_vout->p_libvlc->pf_memcpy( p_out, p_in - length, i_copy_pitch);
1045 p_out += LeftOffset;
1046 memset(p_out, constantYUV[i_plane], length);
1047 p_out -= LeftOffset;
1049 else if ((i_col + 1 == p_vout->p_sys->i_col ))
1052 LeftOffset = i_copy_pitch - length;
1053 p_out += LeftOffset;
1054 memset(p_out, constantYUV[i_plane], length);
1055 p_out -= LeftOffset;
1060 p_vout->p_libvlc->pf_memcpy( p_out , p_in, i_copy_pitch);
1062 if (p_vout->p_sys->b_attenuate)
1065 // first blended zone
1069 p_out += LeftOffset;
1070 for (i_index = 0; i_index < length; i_index++)
1073 *(p_out + i_index) = (p_vout->p_sys->lambda[1][i_plane][i_index] *
1074 (*(p_out + i_index))) / ACCURACY +
1075 p_vout->p_sys->cstYUV[1][i_plane][i_index];
1077 *(p_out + i_index) = p_vout->p_sys->LUT[i_plane][p_vout->p_sys->lambda[1][i_plane][i_index]][*(p_out + i_index)];
1080 p_out -= LeftOffset;
1082 // second blended zone
1083 if (i_col + 1 < p_vout->p_sys->i_col)
1085 LeftOffset = i_copy_pitch - length;
1086 p_out += LeftOffset;
1087 for (i_index = 0; i_index < length; i_index++)
1090 *(p_out + i_index) = (p_vout->p_sys->lambda[0][i_plane][i_index] *
1091 (*(p_out + i_index))) / ACCURACY +
1092 p_vout->p_sys->cstYUV[0][i_plane][i_index];
1095 *(p_out + i_index) = p_vout->p_sys->LUT[i_plane][p_vout->p_sys->lambda[0][i_plane][i_index]][*(p_out + i_index)];
1098 p_out -= LeftOffset;
1104 p_out += i_out_pitch;
1108 if (!p_vout->p_sys->b_attenuate)
1110 if ((i_row == 0) && (p_vout->p_sys->i_row > 2))
1113 int height = 2 * p_vout->p_sys->i_halfHeight / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1114 TopOffset = i_lines + (2 * p_vout->p_sys->i_halfHeight) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1115 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1116 for (i_index = 0; i_index < height; i_index++)
1117 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1118 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = constantYUV[i_plane];
1119 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1121 else if ((i_row + 1 == p_vout->p_sys->i_row) && (p_vout->p_sys->i_row > 2))
1124 int height = 2 * p_vout->p_sys->i_halfHeight / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1125 TopOffset = height - (2 * p_vout->p_sys->i_halfHeight) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1126 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1127 for (i_index = 0; i_index < height; i_index++)
1128 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1129 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = constantYUV[i_plane];
1130 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1135 if (p_vout->p_sys->i_row >= 2)
1137 length = 2 * p_vout->p_sys->i_halfHeight / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1138 if (p_vout->p_sys->b_has_changed)
1141 a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
1142 a_1 = p_vout->p_sys->a_1 * length * (ACCURACY / 100);
1143 a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
1144 for(i_col_mod = 0; i_col_mod < 2; i_col_mod++)
1145 for (i_index = 0; i_index < length; i_index++)
1147 p_vout->p_sys->lambda2[i_col_mod][i_plane][i_index] = CLIP_0A(!i_col_mod ? ACCURACY - (F4(a_2, a_1, i_index) + a_0) / Denom : ACCURACY - (F4(a_2, a_1,length - i_index) + a_0) / Denom);
1148 p_vout->p_sys->cstYUV2[i_col_mod][i_plane][i_index] = ((ACCURACY - p_vout->p_sys->lambda2[i_col_mod][i_plane][i_index]) * constantYUV[i_plane]) / ACCURACY;
1151 // first blended zone
1155 TopOffset = i_lines;
1156 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1157 for (i_index = 0; i_index < length; i_index++)
1158 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1160 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = (p_vout->p_sys->lambda2[1][i_plane][i_index] *
1161 (*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2))) / ACCURACY +
1162 p_vout->p_sys->cstYUV2[1][i_plane][i_index];
1165 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = p_vout->p_sys->LUT[i_plane][p_vout->p_sys->lambda2[1][i_plane][i_index]][*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2)];
1167 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1169 else if (p_vout->p_sys->i_row > 2)
1172 TopOffset = i_lines + (2 * p_vout->p_sys->i_halfHeight) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1173 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1174 for (i_index = 0; i_index < length; i_index++)
1175 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1176 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = constantYUV[i_plane];
1177 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1180 // second blended zone
1182 if (i_row + 1 < p_vout->p_sys->i_row)
1185 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1186 for (i_index = 0; i_index < length; i_index++)
1187 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1189 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = (p_vout->p_sys->lambda2[0][i_plane][i_index] *
1190 (*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2))) / ACCURACY +
1191 p_vout->p_sys->cstYUV2[0][i_plane][i_index];
1194 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = p_vout->p_sys->LUT[i_plane][p_vout->p_sys->lambda2[0][i_plane][i_index]][*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2)];
1197 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1199 else if (p_vout->p_sys->i_row > 2)
1202 TopOffset = length - (2 * p_vout->p_sys->i_halfHeight) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1203 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1204 for (i_index = 0; i_index < length; i_index++)
1205 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1206 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = constantYUV[i_plane];
1207 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1213 // bug for wall filter : fix by CC
1214 // pi_left_skip[i_plane] += i_out_pitch;
1215 pi_left_skip[i_plane] += i_copy_pitch;
1218 vout_UnlinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1220 vout_DisplayPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1225 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1227 pi_top_skip[i_plane] += p_vout->p_sys->pp_vout[ i_vout ].i_height
1228 * p_pic->p[i_plane].i_lines
1229 / p_vout->output.i_height
1230 * p_pic->p[i_plane].i_pitch;
1235 if (p_vout->p_sys->b_has_changed) p_vout->p_sys->b_has_changed = VLC_FALSE;
1240 /*****************************************************************************
1241 * RenderPackedRGB: displays previously rendered output
1242 *****************************************************************************
1243 * This function send the currently rendered image to Wall image, waits
1244 * until it is displayed and switch the two rendering buffers, preparing next
1246 *****************************************************************************/
1247 static void RenderPackedRGB( vout_thread_t *p_vout, picture_t *p_pic )
1249 picture_t *p_outpic = NULL;
1250 int i_col, i_row, i_vout, i_plane;
1251 int pi_left_skip[VOUT_MAX_PLANES], pi_top_skip[VOUT_MAX_PLANES];
1253 int LeftOffset, TopOffset;
1258 int i_index, i_index2;
1263 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1265 pi_top_skip[i_plane] = 0;
1268 for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
1270 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1272 pi_left_skip[i_plane] = 0;
1275 for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
1277 if( !p_vout->p_sys->pp_vout[ i_vout ].b_active )
1279 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1281 pi_left_skip[i_plane] +=
1282 p_vout->p_sys->pp_vout[ i_vout ].i_width * p_pic->p->i_pixel_pitch;
1289 vout_CreatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1293 if( p_vout->b_die || p_vout->b_error )
1295 vout_DestroyPicture(
1296 p_vout->p_sys->pp_vout[ i_vout ].p_vout, p_outpic );
1300 msleep( VOUT_OUTMEM_SLEEP );
1303 vout_DatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1304 p_outpic, p_pic->date );
1305 vout_LinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1308 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1310 uint8_t *p_in, *p_in_end, *p_out;
1311 int i_in_pitch = p_pic->p[i_plane].i_pitch;
1312 int i_out_pitch = p_outpic->p[i_plane].i_pitch;
1313 int i_copy_pitch = p_outpic->p[i_plane].i_visible_pitch;
1316 if (i_col) pi_left_skip[i_plane] -= (2 * p_vout->p_sys->i_halfLength) * p_pic->p->i_pixel_pitch;
1317 if ((i_row) && (!i_col)) pi_top_skip[i_plane] -= (2 * p_vout->p_sys->i_halfHeight * p_pic->p[i_plane].i_pitch);
1318 if ((!p_vout->p_sys->pp_vout[p_vout->p_sys->i_col].b_active))
1319 pi_top_skip[i_plane] -= (2 * p_vout->p_sys->i_halfHeight * i_row * p_pic->p[i_plane].i_pitch);
1320 // i_n : previous inactive pp_vout
1322 while ((!p_vout->p_sys->pp_vout[i_row * p_vout->p_sys->i_col + i_col - 1 - i_n].b_active) && (i_col - i_n > 1)) i_n++;
1323 if ((i_col > 1) && i_n)
1324 pi_left_skip[i_plane] -= i_n*(2 * p_vout->p_sys->i_halfLength ) * p_pic->p->i_pixel_pitch;
1326 p_in = p_pic->p[i_plane].p_pixels
1327 /* Wall proprities */
1328 + pi_top_skip[i_plane] + pi_left_skip[i_plane];
1330 int i_lines = p_outpic->p[i_plane].i_visible_lines;
1331 // 1088 lines bug in a mpeg2 stream of 1080 lines
1332 if ((p_vout->p_sys->i_row - 1 == i_row) &&
1333 (p_pic->p[i_plane].i_lines == 1088))
1336 p_in_end = p_in + i_lines * p_pic->p[i_plane].i_pitch;
1338 p_in = p_pic->p[i_plane].p_pixels
1339 + pi_top_skip[i_plane] + pi_left_skip[i_plane];
1341 p_in_end = p_in + p_outpic->p[i_plane].i_visible_lines
1342 * p_pic->p[i_plane].i_pitch;
1345 p_out = p_outpic->p[i_plane].p_pixels;
1349 if ((p_vout->p_sys->i_row > 2) && (!i_row))
1350 p_out += (p_outpic->p[i_plane].i_pitch * (2 * p_vout->p_sys->i_halfHeight) * p_pic->p->i_pixel_pitch);
1353 length = 2 * p_vout->p_sys->i_halfLength * p_pic->p->i_pixel_pitch;
1355 if (p_vout->p_sys->b_has_changed)
1359 Denom = F2(length / p_pic->p->i_pixel_pitch);
1360 a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
1361 a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfLength * (ACCURACY / 100);
1362 a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
1363 for(i_col_mod = 0; i_col_mod < 2; i_col_mod++)
1364 for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index++)
1365 for (i_plane_ = 0; i_plane_ < p_pic->p->i_pixel_pitch; i_plane_++)
1366 p_vout->p_sys->lambda[i_col_mod][i_plane_][i_index] = CLIP_0A(!i_col_mod ? ACCURACY - (F4(a_2, a_1, i_index) + a_0) / Denom : ACCURACY - (F4(a_2, a_1,(length / p_pic->p->i_pixel_pitch) - i_index) + a_0) / Denom);
1369 while( p_in < p_in_end )
1372 p_vout->p_libvlc->pf_memcpy( p_out, p_in, i_copy_pitch);
1374 if (p_vout->p_sys->i_col > 2)
1379 p_vout->p_libvlc->pf_memcpy( p_out + length, p_in, i_copy_pitch - length);
1380 else if (i_col + 1 == p_vout->p_sys->i_col)
1381 p_vout->p_libvlc->pf_memcpy( p_out, p_in - length, i_copy_pitch - length);
1383 p_vout->p_libvlc->pf_memcpy( p_out, p_in - length, i_copy_pitch);
1389 p_out += LeftOffset;
1391 for (i_index = 0; i_index < length; i_index++)
1392 *(p_out + i_index) = 0;
1393 p_out -= LeftOffset;
1396 else if ((i_col + 1 == p_vout->p_sys->i_col ))
1399 LeftOffset = i_copy_pitch - length;
1400 p_out += LeftOffset;
1402 for (i_index = 0; i_index < length; i_index++)
1403 *(p_out + i_index) = 0;
1404 p_out -= LeftOffset;
1410 p_vout->p_libvlc->pf_memcpy( p_out, p_in, i_copy_pitch);
1413 // first blended zone
1417 p_out += LeftOffset;
1418 for (i_index = 0; i_index < length; i_index++)
1420 *(p_out + i_index) = (p_vout->p_sys->lambda[1][i_index % p_pic->p->i_pixel_pitch][i_index / p_pic->p->i_pixel_pitch] *
1421 (*(p_out + i_index))) / ACCURACY;
1423 *(p_out + i_index) = p_vout->p_sys->LUT[i_index % p_pic->p->i_pixel_pitch][p_vout->p_sys->lambda[1][i_index % p_pic->p->i_pixel_pitch][i_index / p_pic->p->i_pixel_pitch]][*(p_out + i_index)];
1425 p_out -= LeftOffset;
1427 // second blended zone
1428 if (i_col + 1 < p_vout->p_sys->i_col)
1430 LeftOffset = i_copy_pitch - length;
1431 p_out += LeftOffset;
1432 for (i_index = 0; i_index < length; i_index++)
1434 *(p_out + i_index) = (p_vout->p_sys->lambda[0][i_index % p_pic->p->i_pixel_pitch][i_index / p_pic->p->i_pixel_pitch] *
1435 (*(p_out + i_index))) / ACCURACY;
1437 *(p_out + i_index) = p_vout->p_sys->LUT[i_index % p_pic->p->i_pixel_pitch][p_vout->p_sys->lambda[0][i_index % p_pic->p->i_pixel_pitch][i_index / p_pic->p->i_pixel_pitch]][*(p_out + i_index)];
1439 p_out -= LeftOffset;
1444 p_out += i_out_pitch;
1448 if (!p_vout->p_sys->b_attenuate)
1450 if ((i_row == 0) && (p_vout->p_sys->i_row > 2))
1453 TopOffset = i_lines + (2 * p_vout->p_sys->i_halfHeight);
1454 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1455 for (i_index = 0; i_index < length; i_index++)
1456 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1457 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = 0;
1458 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1460 else if ((i_row + 1 == p_vout->p_sys->i_row) && (p_vout->p_sys->i_row > 2))
1463 TopOffset = length - (2 * p_vout->p_sys->i_halfHeight);
1464 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1465 for (i_index = 0; i_index < length; i_index++)
1466 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1467 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = 0;
1468 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1473 if (p_vout->p_sys->i_row >= 2)
1475 length = 2 * p_vout->p_sys->i_halfHeight;
1476 if (p_vout->p_sys->b_has_changed)
1481 a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
1482 a_1 = p_vout->p_sys->a_1 * length * (ACCURACY / 100);
1483 a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
1484 for(i_row_mod = 0; i_row_mod < 2; i_row_mod++)
1485 for (i_index = 0; i_index < length; i_index++)
1486 for (i_plane_ = 0; i_plane_ < p_pic->p->i_pixel_pitch; i_plane_++)
1487 p_vout->p_sys->lambda2[i_row_mod][i_plane_][i_index] = CLIP_0A(!i_row_mod ? ACCURACY - (F4(a_2, a_1, i_index) + a_0) / Denom : ACCURACY - (F4(a_2, a_1,(length) - i_index) + a_0) / Denom);
1489 // first blended zone
1493 TopOffset = i_lines;
1494 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1495 for (i_index = 0; i_index < length; i_index++)
1496 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1498 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = (p_vout->p_sys->lambda2[1][i_index2 % p_pic->p->i_pixel_pitch][i_index] *
1499 (*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2))) / ACCURACY;
1501 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = p_vout->p_sys->LUT[i_index2 % p_pic->p->i_pixel_pitch][p_vout->p_sys->lambda2[1][i_index2 % p_pic->p->i_pixel_pitch][i_index]][*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2)];
1503 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1505 else if (p_vout->p_sys->i_row > 2)
1508 TopOffset = i_lines + (2 * p_vout->p_sys->i_halfHeight);
1509 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1510 for (i_index = 0; i_index < length; i_index++)
1511 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1512 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = 0;
1513 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1516 // second blended zone
1518 if (i_row + 1 < p_vout->p_sys->i_row)
1521 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1522 for (i_index = 0; i_index < length; i_index++)
1523 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1525 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = (p_vout->p_sys->lambda2[0][i_index2 % p_pic->p->i_pixel_pitch][i_index] *
1526 (*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2))) / ACCURACY;
1528 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = p_vout->p_sys->LUT[i_index2 % p_pic->p->i_pixel_pitch][p_vout->p_sys->lambda2[0][i_index2 % p_pic->p->i_pixel_pitch][i_index]][*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2)];
1531 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1533 else if (p_vout->p_sys->i_row > 2)
1536 TopOffset = length - (2 * p_vout->p_sys->i_halfHeight);
1537 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1538 for (i_index = 0; i_index < length; i_index++)
1539 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1540 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = 0;
1541 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1547 // bug for wall filter : fix by CC
1548 // pi_left_skip[i_plane] += i_out_pitch;
1549 pi_left_skip[i_plane] += i_copy_pitch;
1552 vout_UnlinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1554 vout_DisplayPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1559 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1561 pi_top_skip[i_plane] += p_vout->p_sys->pp_vout[ i_vout ].i_height
1562 * p_pic->p[i_plane].i_lines
1563 / p_vout->output.i_height
1564 * p_pic->p[i_plane].i_pitch;
1568 if (p_vout->p_sys->b_has_changed) p_vout->p_sys->b_has_changed = VLC_FALSE;
1574 // WARNING : NO DEBUGGED
1575 /*****************************************************************************
1576 * RenderPackedYUV: displays previously rendered output
1577 *****************************************************************************
1578 * This function send the currently rendered image to Wall image, waits
1579 * until it is displayed and switch the two rendering buffers, preparing next
1581 *****************************************************************************/
1582 static void RenderPackedYUV( vout_thread_t *p_vout, picture_t *p_pic )
1584 picture_t *p_outpic = NULL;
1585 int i_col, i_row, i_vout, i_plane;
1586 int pi_left_skip[VOUT_MAX_PLANES], pi_top_skip[VOUT_MAX_PLANES];
1588 int LeftOffset, TopOffset;
1589 int constantYUV[3] = {0,128,128};
1594 int i_index, i_index2;
1600 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1602 pi_top_skip[i_plane] = 0;
1605 for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
1607 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1609 pi_left_skip[i_plane] = 0;
1612 for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
1614 if( !p_vout->p_sys->pp_vout[ i_vout ].b_active )
1616 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1618 pi_left_skip[i_plane] +=
1619 p_vout->p_sys->pp_vout[ i_vout ].i_width
1620 * p_pic->p[i_plane].i_pitch / p_vout->output.i_width;
1627 vout_CreatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1631 if( p_vout->b_die || p_vout->b_error )
1633 vout_DestroyPicture(
1634 p_vout->p_sys->pp_vout[ i_vout ].p_vout, p_outpic );
1638 msleep( VOUT_OUTMEM_SLEEP );
1641 vout_DatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1642 p_outpic, p_pic->date );
1643 vout_LinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1646 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1648 uint8_t *p_in, *p_in_end, *p_out;
1649 int i_in_pitch = p_pic->p[i_plane].i_pitch;
1650 int i_out_pitch = p_outpic->p[i_plane].i_pitch;
1651 int i_copy_pitch = p_outpic->p[i_plane].i_visible_pitch;
1654 if (i_col) pi_left_skip[i_plane] -= (2 * p_vout->p_sys->i_halfLength ) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1655 if ((i_row) && (!i_col)) pi_top_skip[i_plane] -= (2 * p_vout->p_sys->i_halfHeight * p_pic->p[i_plane].i_pitch) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1656 if ((p_vout->p_sys->i_row > 2) && (i_row == 1) && (!i_col)) pi_top_skip[i_plane] -= (2 * p_vout->p_sys->i_halfHeight * p_pic->p[i_plane].i_pitch) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1657 if ((!p_vout->p_sys->pp_vout[p_vout->p_sys->i_col].b_active))
1658 pi_top_skip[i_plane] -= (2 * p_vout->p_sys->i_halfHeight * i_row * p_pic->p[i_plane].i_pitch) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1659 // i_n : previous inactive pp_vout
1661 while ((!p_vout->p_sys->pp_vout[i_row * p_vout->p_sys->i_col + i_col - 1 - i_n].b_active) && (i_col - i_n > 1)) i_n++;
1662 if ((i_col > 1) && i_n)
1663 pi_left_skip[i_plane] -= i_n*(2 * p_vout->p_sys->i_halfLength ) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1665 p_in = p_pic->p[i_plane].p_pixels
1666 /* Wall proprities */
1667 + pi_top_skip[i_plane] + pi_left_skip[i_plane];
1669 int i_lines = p_outpic->p[i_plane].i_visible_lines;
1670 // 1088 lines bug in a mpeg2 stream of 1080 lines
1671 if ((p_vout->p_sys->i_row - 1 == i_row) &&
1672 (p_pic->p[i_plane].i_lines == 1088))
1675 p_in_end = p_in + i_lines * p_pic->p[i_plane].i_pitch;
1677 p_in = p_pic->p[i_plane].p_pixels
1678 + pi_top_skip[i_plane] + pi_left_skip[i_plane];
1680 p_in_end = p_in + p_outpic->p[i_plane].i_visible_lines
1681 * p_pic->p[i_plane].i_pitch;
1683 p_out = p_outpic->p[i_plane].p_pixels;
1686 length = 2 * p_vout->p_sys->i_halfLength * p_pic->p->i_pixel_pitch;
1687 LeftOffset = (i_col ? 0 : i_copy_pitch - length);
1688 if (p_vout->p_sys->b_has_changed)
1692 for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index++)
1693 for (i_plane_ = 0; i_plane_ < p_pic->p->i_pixel_pitch; i_plane_++)
1694 for (i_index2 = 0; i_index2 < 256; i_index2++)
1695 p_vout->p_sys->LUT[i_plane_][i_index2][i_index] = F(i_index2, (length / p_pic->p->i_pixel_pitch, i_index, p_vout->p_sys->f_gamma[i_plane_]));
1697 switch (p_vout->output.i_chroma)
1699 case VLC_FOURCC('Y','U','Y','2'): // packed by 2
1700 case VLC_FOURCC('Y','U','N','V'): // packed by 2
1701 Denom = F2(length / p_pic->p->i_pixel_pitch);
1702 a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
1703 a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfLength * (ACCURACY / 100);
1704 a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
1705 for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index+=p_pic->p->i_pixel_pitch)
1706 // for each macropixel
1708 // first image pixel
1709 p_vout->p_sys->lambda[i_col][0][i_index] = CLIP_0A(!i_col ? ACCURACY - (F4(a_2, a_1, i_index) + a_0) / Denom : ACCURACY - (F4(a_2, a_1,(length / p_pic->p->i_pixel_pitch) - i_index) + a_0) / Denom);
1710 p_vout->p_sys->cstYUV[i_col][0][i_index] = ((ACCURACY - p_vout->p_sys->lambda[i_col][0][i_index]) * constantYUV[0]) / ACCURACY;
1711 p_vout->p_sys->lambda[i_col][1][i_index] = CLIP_0A(!i_col ? ACCURACY - (F4(a_2, a_1, i_index) + a_0) / Denom : ACCURACY - (F4(a_2, a_1,(length / p_pic->p->i_pixel_pitch) - i_index) + a_0) / Denom);
1712 p_vout->p_sys->cstYUV[i_col][1][i_index] = ((ACCURACY - p_vout->p_sys->lambda[i_col][1][i_index]) * constantYUV[1]) / ACCURACY;
1713 // second image pixel
1714 p_vout->p_sys->lambda[i_col][0][i_index + 1] = CLIP_0A(!i_col ? ACCURACY - (F4(a_2, a_1, i_index + 1) + a_0) / Denom : ACCURACY - (F4(a_2, a_1,(length / p_pic->p->i_pixel_pitch) - (i_index + 1)) + a_0) / Denom);
1715 p_vout->p_sys->cstYUV[i_col][0][i_index + 1] = ((ACCURACY - p_vout->p_sys->lambda[i_col][0][i_index]) * constantYUV[0]) / ACCURACY;
1716 p_vout->p_sys->lambda[i_col][1][i_index + 1] = p_vout->p_sys->lambda[i_col][1][i_index];
1717 p_vout->p_sys->cstYUV[i_col][1][i_index + 1] = p_vout->p_sys->cstYUV[i_col][1][i_index];
1720 case VLC_FOURCC('U','Y','V','Y'): // packed by 2
1721 case VLC_FOURCC('U','Y','N','V'): // packed by 2
1722 case VLC_FOURCC('Y','4','2','2'): // packed by 2
1723 Denom = F2(length / p_pic->p->i_pixel_pitch);
1724 a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
1725 a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfLength * (ACCURACY / 100);
1726 a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
1727 for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index+=p_pic->p->i_pixel_pitch)
1728 // for each macropixel
1730 // first image pixel
1731 p_vout->p_sys->lambda[i_col][0][i_index] = CLIP_0A(!i_col ? ACCURACY - (F4(a_2, a_1, i_index) + a_0) / Denom : ACCURACY - (F4(a_2, a_1,(length / p_pic->p->i_pixel_pitch) - i_index) + a_0) / Denom);
1732 p_vout->p_sys->cstYUV[i_col][0][i_index] = ((ACCURACY - p_vout->p_sys->lambda[i_col][0][i_index]) * constantYUV[1]) / ACCURACY;
1733 p_vout->p_sys->lambda[i_col][1][i_index] = CLIP_0A(!i_col ? ACCURACY - (F4(a_2, a_1, i_index) + a_0) / Denom : ACCURACY - (F4(a_2, a_1,(length / p_pic->p->i_pixel_pitch) - i_index) + a_0) / Denom);
1734 p_vout->p_sys->cstYUV[i_col][1][i_index] = ((ACCURACY - p_vout->p_sys->lambda[i_col][1][i_index]) * constantYUV[0]) / ACCURACY;
1735 // second image pixel
1736 p_vout->p_sys->lambda[i_col][0][i_index + 1] = CLIP_0A(!i_col ? ACCURACY - (F4(a_2, a_1, i_index + 1) + a_0) / Denom : ACCURACY - (F4(a_2, a_1,(length / p_pic->p->i_pixel_pitch) - (i_index + 1)) + a_0) / Denom);
1737 p_vout->p_sys->cstYUV[i_col][0][i_index + 1] = ((ACCURACY - p_vout->p_sys->lambda[i_col][0][i_index]) * constantYUV[1]) / ACCURACY;
1738 p_vout->p_sys->lambda[i_col][1][i_index + 1] = p_vout->p_sys->lambda[i_col][1][i_index];
1739 p_vout->p_sys->cstYUV[i_col][1][i_index + 1] = p_vout->p_sys->cstYUV[i_col][1][i_index];
1747 while( p_in < p_in_end )
1750 p_vout->p_libvlc->pf_memcpy( p_out, p_in, i_copy_pitch);
1752 p_vout->p_libvlc->pf_memcpy( p_out + i_col * length, p_in + i_col * length, i_copy_pitch - length);
1753 p_out += LeftOffset;
1756 for (i_index = 0; i_index < length; i_index++)
1757 *(p_out + i_index) = (p_vout->p_sys->lambda[i_col][i_index % p_pic->p->i_pixel_pitch][i_index / p_pic->p->i_pixel_pitch] *
1758 (*(p_in + i_index))) / ACCURACY +
1759 p_vout->p_sys->cstYUV[i_col][i_index % p_pic->p->i_pixel_pitch][i_index / p_pic->p->i_pixel_pitch];
1761 for (i_index = 0; i_index < length; i_index++)
1762 *(p_out + i_index) = p_vout->p_sys->LUT[i_index % p_pic->p->i_pixel_pitch][(p_vout->p_sys->lambda[i_col][i_index % p_pic->p->i_pixel_pitch][i_index / p_pic->p->i_pixel_pitch] *
1763 (*(p_in + i_index))) / ACCURACY +
1764 p_vout->p_sys->cstYUV[i_col][i_index % p_pic->p->i_pixel_pitch][i_index / p_pic->p->i_pixel_pitch]][i_index / p_pic->p->i_pixel_pitch];
1766 p_out -= LeftOffset;
1770 p_out += i_out_pitch;
1773 if (p_vout->p_sys->i_row == 2)
1775 length = 2 * p_vout->p_sys->i_halfHeight * p_pic->p->i_pixel_pitch;
1776 TopOffset = (i_row ? i_lines : length / p_pic->p->i_pixel_pitch);
1777 if (p_vout->p_sys->b_has_changed)
1781 for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index++)
1782 for (i_plane_ = 0; i_plane_ < p_pic->p->i_pixel_pitch; i_plane_++)
1783 for (i_index2 = 0; i_index2 < 256; i_index2++)
1784 p_vout->p_sys->LUT2[i_plane_][i_index2][i_index] = F(i_index2, (length / p_pic->p->i_pixel_pitch, i_index, p_vout->p_sys->f_gamma[i_plane_]));
1786 switch (p_vout->output.i_chroma)
1788 case VLC_FOURCC('Y','U','Y','2'): // packed by 2
1789 case VLC_FOURCC('Y','U','N','V'): // packed by 2
1790 Denom = F2(length / p_pic->p->i_pixel_pitch);
1791 a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
1792 a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfHeight * (ACCURACY / 100);
1793 a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
1794 for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index+=p_pic->p->i_pixel_pitch)
1795 // for each macropixel
1797 // first image pixel
1798 p_vout->p_sys->lambda2[i_row][0][i_index] = CLIP_0A(!i_row ? ACCURACY - (F4(a_2, a_1, i_index) + a_0) / Denom : ACCURACY - (F4(a_2, a_1,(length / p_pic->p->i_pixel_pitch) - i_index) + a_0) / Denom);
1799 p_vout->p_sys->cstYUV2[i_row][0][i_index] = ((ACCURACY - p_vout->p_sys->lambda2[i_row][0][i_index]) * constantYUV[0]) / ACCURACY;
1800 p_vout->p_sys->lambda2[i_row][1][i_index] = CLIP_0A(!i_row ? ACCURACY - (F4(a_2, a_1, i_index) + a_0) / Denom : ACCURACY - (F4(a_2, a_1,(length / p_pic->p->i_pixel_pitch) - i_index) + a_0) / Denom);
1801 p_vout->p_sys->cstYUV2[i_row][1][i_index] = ((ACCURACY - p_vout->p_sys->lambda2[i_row][1][i_index]) * constantYUV[1]) / ACCURACY;
1802 // second image pixel
1803 p_vout->p_sys->lambda2[i_row][0][i_index + 1] = CLIP_0A(!i_row ? ACCURACY - (F4(a_2, a_1, i_index + 1) + a_0) / Denom : ACCURACY - (F4(a_2, a_1,(length / p_pic->p->i_pixel_pitch) - (i_index + 1)) + a_0) / Denom);
1804 p_vout->p_sys->cstYUV2[i_row][0][i_index + 1] = ((ACCURACY - p_vout->p_sys->lambda2[i_row][0][i_index]) * constantYUV[0]) / ACCURACY;
1805 p_vout->p_sys->lambda2[i_row][1][i_index + 1] = p_vout->p_sys->lambda2[i_row][1][i_index];
1806 p_vout->p_sys->cstYUV2[i_row][1][i_index + 1] = p_vout->p_sys->cstYUV2[i_row][1][i_index];
1809 case VLC_FOURCC('U','Y','V','Y'): // packed by 2
1810 case VLC_FOURCC('U','Y','N','V'): // packed by 2
1811 case VLC_FOURCC('Y','4','2','2'): // packed by 2
1812 Denom = F2(length / p_pic->p->i_pixel_pitch);
1813 a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
1814 a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfHeight * (ACCURACY / 100);
1815 a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
1816 for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index+=p_pic->p->i_pixel_pitch)
1817 // for each macropixel
1819 // first image pixel
1820 p_vout->p_sys->lambda2[i_row][0][i_index] = CLIP_0A(!i_row ? ACCURACY - (F4(a_2, a_1, i_index) + a_0) / Denom : ACCURACY - (F4(a_2, a_1,(length / p_pic->p->i_pixel_pitch) - i_index) + a_0) / Denom);
1821 p_vout->p_sys->cstYUV2[i_row][0][i_index] = ((ACCURACY - p_vout->p_sys->lambda2[i_col][0][i_index]) * constantYUV[1]) / ACCURACY;
1822 p_vout->p_sys->lambda2[i_row][1][i_index] = CLIP_0A(!i_row ? ACCURACY - (F4(a_2, a_1, i_index) + a_0) / Denom : ACCURACY - (F4(a_2, a_1,(length / p_pic->p->i_pixel_pitch) - i_index) + a_0) / Denom);
1823 p_vout->p_sys->cstYUV2[i_row][1][i_index] = ((ACCURACY - p_vout->p_sys->lambda2[i_row][1][i_index]) * constantYUV[0]) / ACCURACY;
1824 // second image pixel
1825 p_vout->p_sys->lambda2[i_row][0][i_index + 1] = CLIP_0A(!i_row ? ACCURACY - (F4(a_2, a_1, i_index + 1) + a_0) / Denom : ACCURACY - (F4(a_2, a_1,(length / p_pic->p->i_pixel_pitch) - (i_index + 1)) + a_0) / Denom);
1826 p_vout->p_sys->cstYUV2[i_row][0][i_index + 1] = ((ACCURACY - p_vout->p_sys->lambda2[i_row][0][i_index]) * constantYUV[1]) / ACCURACY;
1827 p_vout->p_sys->lambda2[i_row][1][i_index + 1] = p_vout->p_sys->lambda2[i_row][1][i_index];
1828 p_vout->p_sys->cstYUV2[i_row][1][i_index + 1] = p_vout->p_sys->cstYUV2[i_row][1][i_index];
1835 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1837 for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index++)
1838 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1839 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = (p_vout->p_sys->lambda2[i_row][i_index2 % p_pic->p->i_pixel_pitch][i_index] *
1840 (*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2))) / ACCURACY +
1841 p_vout->p_sys->cstYUV2[i_row][i_index2 % p_pic->p->i_pixel_pitch][i_index];
1843 for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index++)
1844 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1845 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = p_vout->p_sys->LUT[i_index % p_pic->p->i_pixel_pitch][(p_vout->p_sys->lambda2[i_row][i_index2 % p_pic->p->i_pixel_pitch][i_index] *
1846 (*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2))) / ACCURACY +
1847 p_vout->p_sys->cstYUV2[i_row][i_index2 % p_pic->p->i_pixel_pitch][i_index]][i_index / p_pic->p->i_pixel_pitch];
1850 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1853 // bug for wall filter : fix by CC
1854 // pi_left_skip[i_plane] += i_out_pitch;
1855 pi_left_skip[i_plane] += i_copy_pitch;
1858 vout_UnlinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1860 vout_DisplayPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1865 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1867 pi_top_skip[i_plane] += p_vout->p_sys->pp_vout[ i_vout ].i_height
1868 * p_pic->p[i_plane].i_lines
1869 / p_vout->output.i_height
1870 * p_pic->p[i_plane].i_pitch;
1874 if (p_vout->p_sys->b_has_changed) p_vout->p_sys->b_has_changed = VLC_FALSE;
1880 /*****************************************************************************
1881 * RemoveAllVout: destroy all the child video output threads
1882 *****************************************************************************/
1883 static void RemoveAllVout( vout_thread_t *p_vout )
1885 while( p_vout->p_sys->i_vout )
1887 --p_vout->p_sys->i_vout;
1888 if( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].b_active )
1891 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout,
1894 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout );
1896 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout );
1901 /*****************************************************************************
1902 * SendEvents: forward mouse and keyboard events to the parent p_vout
1903 *****************************************************************************/
1904 static int SendEvents( vlc_object_t *p_this, char const *psz_var,
1905 vlc_value_t oldval, vlc_value_t newval, void *_p_vout )
1907 vout_thread_t *p_vout = (vout_thread_t *)_p_vout;
1909 vlc_value_t sentval = newval;
1911 /* Find the video output index */
1912 for( i_vout = 0; i_vout < p_vout->p_sys->i_vout; i_vout++ )
1914 if( p_this == (vlc_object_t *)p_vout->p_sys->pp_vout[ i_vout ].p_vout )
1920 if( i_vout == p_vout->p_sys->i_vout )
1922 return VLC_EGENERIC;
1925 /* Translate the mouse coordinates */
1926 if( !strcmp( psz_var, "mouse-x" ) )
1929 int i_overlap = ((p_vout->p_sys->i_col > 2) ? 0 : 2 * p_vout->p_sys->i_halfLength);
1930 sentval.i_int += (p_vout->output.i_width - i_overlap)
1932 sentval.i_int += p_vout->output.i_width
1934 * (i_vout % p_vout->p_sys->i_col)
1935 / p_vout->p_sys->i_col;
1937 else if( !strcmp( psz_var, "mouse-y" ) )
1940 int i_overlap = ((p_vout->p_sys->i_row > 2) ? 0 : 2 * p_vout->p_sys->i_halfHeight);
1941 sentval.i_int += (p_vout->output.i_height - i_overlap)
1943 sentval.i_int += p_vout->output.i_height
1945 //bug fix in Wall plug-in
1946 // * (i_vout / p_vout->p_sys->i_row)
1947 * (i_vout / p_vout->p_sys->i_col)
1948 / p_vout->p_sys->i_row;
1951 var_Set( p_vout, psz_var, sentval );
1956 /*****************************************************************************
1957 * SendEventsToChild: forward events to the child/children vout
1958 *****************************************************************************/
1959 static int SendEventsToChild( vlc_object_t *p_this, char const *psz_var,
1960 vlc_value_t oldval, vlc_value_t newval, void *p_data )
1963 vout_thread_t *p_vout = (vout_thread_t *)p_this;
1964 int i_row, i_col, i_vout = 0;
1966 for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
1968 for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
1970 var_Set( p_vout->p_sys->pp_vout[ i_vout ].p_vout, psz_var, newval);
1971 if( !strcmp( psz_var, "fullscreen" ) ) break;