1 /*****************************************************************************
2 * panoramix.c : Wall panoramic video with edge blending plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
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 *****************************************************************************/
36 #include "filter_common.h"
38 // add by cedric.cocquebert@supelec.fr
42 // OS CODE DEPENDANT to get display dimensions
49 // #define PACKED_YUV 1
50 #define F2(a) ((a)*(a))
51 #define F4(a,b,x) ((a)*(F2(x))+((b)*(x)))
53 #define RATIO_MAX 2500
54 #define CLIP_01(a) (a < 0.0 ? 0.0 : (a > 1.0 ? 1.0 : a))
55 // #define CLIP_0A(a) (a < 0.0 ? 0.0 : (a > ACCURACY ? ACCURACY : a))
58 /*****************************************************************************
60 *****************************************************************************/
61 static int Create ( vlc_object_t * );
62 static void Destroy ( vlc_object_t * );
64 static int Init ( vout_thread_t * );
65 static void End ( vout_thread_t * );
67 static void RenderPackedYUV ( vout_thread_t *, picture_t * );
69 static void RenderPlanarYUV ( vout_thread_t *, picture_t * );
70 static void RenderPackedRGB ( vout_thread_t *, picture_t * );
72 static void RemoveAllVout ( vout_thread_t *p_vout );
74 static int SendEvents( vlc_object_t *, char const *,
75 vlc_value_t, vlc_value_t, void * );
77 /*****************************************************************************
79 *****************************************************************************/
80 #define COLS_TEXT N_("Number of columns")
81 #define COLS_LONGTEXT N_("Select the number of horizontal video windows in " \
82 "which to split the video")
84 #define ROWS_TEXT N_("Number of rows")
85 #define ROWS_LONGTEXT N_("Select the number of vertical video windows in " \
86 "which to split the video")
88 #define ACTIVE_TEXT N_("Active windows")
89 #define ACTIVE_LONGTEXT N_("Comma separated list of active windows, " \
92 #define CFG_PREFIX "panoramix-"
95 set_description( N_("Panoramix: wall with overlap video filter") );
96 set_shortname( _("Panoramix" ));
97 set_capability( "video filter", 0 );
98 set_category( CAT_VIDEO );
99 set_subcategory( SUBCAT_VIDEO_VFILTER );
101 add_integer( CFG_PREFIX "cols", -1, NULL,
102 COLS_TEXT, COLS_LONGTEXT, true );
103 add_integer( CFG_PREFIX "rows", -1, NULL,
104 ROWS_TEXT, ROWS_LONGTEXT, true );
107 #define OFFSET_X_TEXT N_("Offset X offset (automatic compensation)")
108 #define OFFSET_X_LONGTEXT N_("Select if you want an automatic offset in horizontal (in case of misalignment due to autoratio control)")
109 add_bool( CFG_PREFIX "offset-x", 1, NULL, OFFSET_X_TEXT, OFFSET_X_LONGTEXT, true );
111 #define LENGTH_TEXT N_("length of the overlapping area (in %)")
112 #define LENGTH_LONGTEXT N_("Select in percent the length of the blended zone")
113 add_integer_with_range( CFG_PREFIX "bz-length", 100, 0, 100, NULL, LENGTH_TEXT, LENGTH_LONGTEXT, true );
115 #define HEIGHT_TEXT N_("height of the overlapping area (in %)")
116 #define HEIGHT_LONGTEXT N_("Select in percent the height of the blended zone (case of 2x2 wall)")
117 add_integer_with_range( CFG_PREFIX "bz-height", 100, 0, 100, NULL, HEIGHT_TEXT, HEIGHT_LONGTEXT, true );
119 #define ATTENUATION_TEXT N_("Attenuation")
120 #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)")
121 add_bool( CFG_PREFIX "attenuate", 1, NULL, ATTENUATION_TEXT, ATTENUATION_LONGTEXT, false );
123 #define BEGIN_TEXT N_("Attenuation, begin (in %)")
124 #define BEGIN_LONGTEXT N_("Select in percent the Lagrange coeff of the beginning blended zone")
125 add_integer_with_range( CFG_PREFIX "bz-begin", 0, 0, 100, NULL, BEGIN_TEXT, BEGIN_LONGTEXT, true );
127 #define MIDDLE_TEXT N_("Attenuation, middle (in %)")
128 #define MIDDLE_LONGTEXT N_("Select in percent the Lagrange coeff of the middle of blended zone")
129 add_integer_with_range( CFG_PREFIX "bz-middle", 50, 0, 100, NULL, MIDDLE_TEXT, MIDDLE_LONGTEXT, false );
131 #define END_TEXT N_("Attenuation, end (in %)")
132 #define END_LONGTEXT N_("Select in percent the Lagrange coeff of the end of blended zone")
133 add_integer_with_range( CFG_PREFIX "bz-end", 100, 0, 100, NULL, END_TEXT, END_LONGTEXT, true );
135 #define MIDDLE_POS_TEXT N_("middle position (in %)")
136 #define MIDDLE_POS_LONGTEXT N_("Select in percent (50 is center) the position of the middle point (Lagrange) of blended zone")
137 add_integer_with_range( CFG_PREFIX "bz-middle-pos", 50, 1, 99, NULL, MIDDLE_POS_TEXT, MIDDLE_POS_LONGTEXT, false );
139 #define RGAMMA_TEXT N_("Gamma (Red) correction")
140 #define RGAMMA_LONGTEXT N_("Select the gamma for the correction of blended zone (Red or Y component)")
141 add_float_with_range( CFG_PREFIX "bz-gamma-red", 1, 0, 5, NULL, RGAMMA_TEXT, RGAMMA_LONGTEXT, true );
143 #define GGAMMA_TEXT N_("Gamma (Green) correction")
144 #define GGAMMA_LONGTEXT N_("Select the gamma for the correction of blended zone (Green or U component)")
145 add_float_with_range( CFG_PREFIX "bz-gamma-green", 1, 0, 5, NULL, GGAMMA_TEXT, GGAMMA_LONGTEXT, true );
147 #define BGAMMA_TEXT N_("Gamma (Blue) correction")
148 #define BGAMMA_LONGTEXT N_("Select the gamma for the correction of blended zone (Blue or V component)")
149 add_float_with_range( CFG_PREFIX "bz-gamma-blue", 1, 0, 5, NULL, BGAMMA_TEXT, BGAMMA_LONGTEXT, true );
151 #define RGAMMA_BC_TEXT N_("Black Crush for Red")
152 #define RGAMMA_BC_LONGTEXT N_("Select the Black Crush of blended zone (Red or Y component)")
153 #define GGAMMA_BC_TEXT N_("Black Crush for Green")
154 #define GGAMMA_BC_LONGTEXT N_("Select the Black Crush of blended zone (Green or U component)")
155 #define BGAMMA_BC_TEXT N_("Black Crush for Blue")
156 #define BGAMMA_BC_LONGTEXT N_("Select the Black Crush of blended zone (Blue or V component)")
158 #define RGAMMA_WC_TEXT N_("White Crush for Red")
159 #define RGAMMA_WC_LONGTEXT N_("Select the White Crush of blended zone (Red or Y component)")
160 #define GGAMMA_WC_TEXT N_("White Crush for Green")
161 #define GGAMMA_WC_LONGTEXT N_("Select the White Crush of blended zone (Green or U component)")
162 #define BGAMMA_WC_TEXT N_("White Crush for Blue")
163 #define BGAMMA_WC_LONGTEXT N_("Select the White Crush of blended zone (Blue or V component)")
165 #define RGAMMA_BL_TEXT N_("Black Level for Red")
166 #define RGAMMA_BL_LONGTEXT N_("Select the Black Level of blended zone (Red or Y component)")
167 #define GGAMMA_BL_TEXT N_("Black Level for Green")
168 #define GGAMMA_BL_LONGTEXT N_("Select the Black Level of blended zone (Green or U component)")
169 #define BGAMMA_BL_TEXT N_("Black Level for Blue")
170 #define BGAMMA_BL_LONGTEXT N_("Select the Black Level of blended zone (Blue or V component)")
172 #define RGAMMA_WL_TEXT N_("White Level for Red")
173 #define RGAMMA_WL_LONGTEXT N_("Select the White Level of blended zone (Red or Y component)")
174 #define GGAMMA_WL_TEXT N_("White Level for Green")
175 #define GGAMMA_WL_LONGTEXT N_("Select the White Level of blended zone (Green or U component)")
176 #define BGAMMA_WL_TEXT N_("White Level for Blue")
177 #define BGAMMA_WL_LONGTEXT N_("Select the White Level of blended zone (Blue or V component)")
178 add_integer_with_range( CFG_PREFIX "bz-blackcrush-red", 140, 0, 255, NULL, RGAMMA_BC_TEXT, RGAMMA_BC_LONGTEXT, true );
179 add_integer_with_range( CFG_PREFIX "bz-blackcrush-green", 140, 0, 255, NULL, GGAMMA_BC_TEXT, GGAMMA_BC_LONGTEXT, true );
180 add_integer_with_range( CFG_PREFIX "bz-blackcrush-blue", 140, 0, 255, NULL, BGAMMA_BC_TEXT, BGAMMA_BC_LONGTEXT, true );
181 add_integer_with_range( CFG_PREFIX "bz-whitecrush-red", 200, 0, 255, NULL, RGAMMA_WC_TEXT, RGAMMA_WC_LONGTEXT, true );
182 add_integer_with_range( CFG_PREFIX "bz-whitecrush-green", 200, 0, 255, NULL, GGAMMA_WC_TEXT, GGAMMA_WC_LONGTEXT, true );
183 add_integer_with_range( CFG_PREFIX "bz-whitecrush-blue", 200, 0, 255, NULL, BGAMMA_WC_TEXT, BGAMMA_WC_LONGTEXT, true );
184 add_integer_with_range( CFG_PREFIX "bz-blacklevel-red", 150, 0, 255, NULL, RGAMMA_BL_TEXT, RGAMMA_BL_LONGTEXT, true );
185 add_integer_with_range( CFG_PREFIX "bz-blacklevel-green", 150, 0, 255, NULL, GGAMMA_BL_TEXT, GGAMMA_BL_LONGTEXT, true );
186 add_integer_with_range( CFG_PREFIX "bz-blacklevel-blue", 150, 0, 255, NULL, BGAMMA_BL_TEXT, BGAMMA_BL_LONGTEXT, true );
187 add_integer_with_range( CFG_PREFIX "bz-whitelevel-red", 0, 0, 255, NULL, RGAMMA_WL_TEXT, RGAMMA_WL_LONGTEXT, true );
188 add_integer_with_range( CFG_PREFIX "bz-whitelevel-green", 0, 0, 255, NULL, GGAMMA_WL_TEXT, GGAMMA_WL_LONGTEXT, true );
189 add_integer_with_range( CFG_PREFIX "bz-whitelevel-blue", 0, 0, 255, NULL, BGAMMA_WL_TEXT, BGAMMA_WL_LONGTEXT, true );
191 #define XINERAMA_TEXT N_("Xinerama option")
192 #define XINERAMA_LONGTEXT N_("Uncheck if you have not used xinerama")
193 add_bool( CFG_PREFIX "xinerama", 1, NULL, XINERAMA_TEXT, XINERAMA_LONGTEXT, true );
197 add_string( CFG_PREFIX "active", NULL, NULL, ACTIVE_TEXT, ACTIVE_LONGTEXT, true );
199 add_shortcut( "panoramix" );
200 set_callbacks( Create, Destroy );
203 static const char *ppsz_filter_options[] = {
204 "cols", "rows", "offset-x", "bz-length", "bz-height", "attenuate",
205 "bz-begin", "bz-middle", "bz-end", "bz-middle-pos", "bz-gamma-red",
206 "bz-gamma-green", "bz-gamma-blue", "bz-blackcrush-red",
207 "bz-blackcrush-green", "bz-blackcrush-blue", "bz-whitecrush-red",
208 "bz-whitecrush-green", "bz-whitecrush-blue", "bz-blacklevel-red",
209 "bz-blacklevel-green", "bz-blacklevel-blue", "bz-whitelevel-red",
210 "bz-whitelevel-green", "bz-whitelevel-blue", "xinerama", "active",
214 /*****************************************************************************
215 * vout_sys_t: Wall video output method descriptor
216 *****************************************************************************
217 * This structure is part of the video output thread descriptor.
218 * It describes the Wall specific properties of an output thread.
219 *****************************************************************************/
225 unsigned int bz_length, bz_height, bz_begin, bz_middle, bz_end, bz_middle_pos;
226 unsigned int i_ratio_max;
227 unsigned int i_ratio;
228 unsigned int a_0, a_1, a_2;
230 int lambda[2][VOUT_MAX_PLANES][500];
231 int cstYUV[2][VOUT_MAX_PLANES][500];
232 int lambda2[2][VOUT_MAX_PLANES][500];
233 int cstYUV2[2][VOUT_MAX_PLANES][500];
234 unsigned int i_halfLength;
235 unsigned int i_halfHeight;
239 float f_gamma_red, f_gamma_green, f_gamma_blue;
240 float f_gamma[VOUT_MAX_PLANES];
241 uint8_t LUT[VOUT_MAX_PLANES][ACCURACY + 1][256];
243 uint8_t LUT2[VOUT_MAX_PLANES][256][500];
258 vout_thread_t *p_vout;
264 /*****************************************************************************
265 * Control: control facility for the vout (forwards to child vout)
266 *****************************************************************************/
267 static int Control( vout_thread_t *p_vout, int i_query, va_list args )
269 int i_row, i_col, i_vout = 0;
271 for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
273 for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
275 vout_vaControl( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
283 /*****************************************************************************
284 * Create: allocates Wall video thread output method
285 *****************************************************************************
286 * This function allocates and initializes a Wall vout method.
287 *****************************************************************************/
288 static int Create( vlc_object_t *p_this )
290 vout_thread_t *p_vout = (vout_thread_t *)p_this;
291 char *psz_method, *psz_tmp, *psz_method_tmp;
294 /* Allocate structure */
295 p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
296 if( p_vout->p_sys == NULL )
298 msg_Err( p_vout, "out of memory" );
302 p_vout->pf_init = Init;
303 p_vout->pf_end = End;
304 p_vout->pf_manage = NULL;
305 /* Color Format not supported
306 // Planar Y, packed UV
307 case VLC_FOURCC('Y','M','G','A'):
308 // Packed YUV 4:2:2, U:Y:V:Y, interlaced
309 case VLC_FOURCC('I','U','Y','V'): // packed by 2
310 // Packed YUV 2:1:1, Y:U:Y:V
311 case VLC_FOURCC('Y','2','1','1'): // packed by 4
312 // Packed YUV Reverted
313 case VLC_FOURCC('c','y','u','v'): // packed by 2
315 switch (p_vout->render.i_chroma)
318 case VLC_FOURCC('I','4','4','4'):
319 case VLC_FOURCC('I','4','2','2'):
320 case VLC_FOURCC('I','4','2','0'):
321 case VLC_FOURCC('Y','V','1','2'):
322 case VLC_FOURCC('I','Y','U','V'):
323 case VLC_FOURCC('I','4','1','1'):
324 case VLC_FOURCC('I','4','1','0'):
325 case VLC_FOURCC('Y','V','U','9'):
326 case VLC_FOURCC('Y','U','V','A'):
327 p_vout->pf_render = RenderPlanarYUV;
330 case VLC_FOURCC('R','G','B','2'): // packed by 1
331 case VLC_FOURCC('R','V','1','5'): // packed by 2
332 case VLC_FOURCC('R','V','1','6'): // packed by 2
333 case VLC_FOURCC('R','V','2','4'): // packed by 3
334 case VLC_FOURCC('R','V','3','2'): // packed by 4
335 p_vout->pf_render = RenderPackedRGB;
339 case VLC_FOURCC('Y','U','Y','2'): // packed by 2
340 case VLC_FOURCC('Y','U','N','V'): // packed by 2
341 case VLC_FOURCC('U','Y','V','Y'): // packed by 2
342 case VLC_FOURCC('U','Y','N','V'): // packed by 2
343 case VLC_FOURCC('Y','4','2','2'): // packed by 2
344 p_vout->pf_render = RenderPackedYUV;
348 msg_Err( p_vout, "colorspace not supported by plug-in !!!");
349 free( p_vout->p_sys );
352 p_vout->pf_display = NULL;
353 p_vout->pf_control = Control;
355 config_ChainParse( p_vout, CFG_PREFIX, ppsz_filter_options,
358 /* Look what method was requested */
359 p_vout->p_sys->i_col = var_CreateGetInteger( p_vout, CFG_PREFIX "cols" );
360 p_vout->p_sys->i_row = var_CreateGetInteger( p_vout, CFG_PREFIX "rows" );
362 // OS dependant code : Autodetect number of displays in wall
364 if ((p_vout->p_sys->i_col < 0) || (p_vout->p_sys->i_row < 0) )
366 int nbMonitors = GetSystemMetrics(SM_CMONITORS);
369 nbMonitors = 5; // 1 display => 5x1 simulation
370 p_vout->p_sys->i_col = nbMonitors;
371 p_vout->p_sys->i_row = 1;
375 p_vout->p_sys->i_col = GetSystemMetrics( SM_CXVIRTUALSCREEN ) / GetSystemMetrics( SM_CXSCREEN );
376 p_vout->p_sys->i_row = GetSystemMetrics( SM_CYVIRTUALSCREEN ) / GetSystemMetrics( SM_CYSCREEN );
377 if (p_vout->p_sys->i_col * p_vout->p_sys->i_row != nbMonitors)
379 p_vout->p_sys->i_col = nbMonitors;
380 p_vout->p_sys->i_row = 1;
383 var_SetInteger( p_vout, CFG_PREFIX "cols", p_vout->p_sys->i_col);
384 var_SetInteger( p_vout, CFG_PREFIX "rows", p_vout->p_sys->i_row);
389 p_vout->p_sys->i_offset_x = var_CreateGetInteger( p_vout, CFG_PREFIX "offset-x" );
390 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
391 p_vout->p_sys->b_autocrop = !(var_CreateGetInteger( p_vout, "crop-ratio" ) == 0);
392 if (!p_vout->p_sys->b_autocrop) p_vout->p_sys->b_autocrop = var_CreateGetInteger( p_vout, "autocrop" );
393 p_vout->p_sys->b_attenuate = var_CreateGetInteger( p_vout, CFG_PREFIX "attenuate");
394 p_vout->p_sys->bz_length = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-length" );
395 if (p_vout->p_sys->i_row > 1)
396 p_vout->p_sys->bz_height = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-height" );
398 p_vout->p_sys->bz_height = 100;
399 p_vout->p_sys->bz_begin = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-begin" );
400 p_vout->p_sys->bz_middle = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-middle" );
401 p_vout->p_sys->bz_end = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-end" );
402 p_vout->p_sys->bz_middle_pos = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-middle-pos" );
403 double d_p = 100.0 / p_vout->p_sys->bz_middle_pos;
404 p_vout->p_sys->i_ratio_max = var_CreateGetInteger( p_vout, "autocrop-ratio-max" ); // in crop module with autocrop ...
405 p_vout->p_sys->i_ratio = var_CreateGetInteger( p_vout, "crop-ratio" ); // in crop module with manual ratio ...
407 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;
408 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;
409 p_vout->p_sys->a_0 = p_vout->p_sys->bz_begin;
412 p_vout->p_sys->f_gamma_red = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-red" );
413 p_vout->p_sys->f_gamma_green = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-green" );
414 p_vout->p_sys->f_gamma_blue = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-blue" );
417 p_vout->p_sys->b_xinerama= var_CreateGetInteger( p_vout, CFG_PREFIX "xinerama" );
420 p_vout->p_sys->i_col = __MAX( 1, __MIN( 15, p_vout->p_sys->i_col ) );
421 p_vout->p_sys->i_row = __MAX( 1, __MIN( 15, p_vout->p_sys->i_row ) );
424 msg_Dbg( p_vout, "opening a %i x %i wall",
425 p_vout->p_sys->i_col, p_vout->p_sys->i_row );
427 p_vout->p_sys->pp_vout = malloc( p_vout->p_sys->i_row *
428 p_vout->p_sys->i_col *
429 sizeof(struct vout_list_t) );
430 if( p_vout->p_sys->pp_vout == NULL )
432 msg_Err( p_vout, "out of memory" );
433 free( p_vout->p_sys );
438 psz_method = var_CreateGetNonEmptyString( p_vout, CFG_PREFIX "active" );
440 /* If no trailing vout are specified, take them all */
441 if( psz_method == NULL )
443 for( i_vout = p_vout->p_sys->i_row * p_vout->p_sys->i_col;
446 p_vout->p_sys->pp_vout[i_vout].b_active = 1;
449 /* If trailing vout are specified, activate only the requested ones */
452 for( i_vout = p_vout->p_sys->i_row * p_vout->p_sys->i_col;
455 p_vout->p_sys->pp_vout[i_vout].b_active = 0;
460 psz_tmp = psz_method;
461 while( *psz_tmp && *psz_tmp != ',' )
469 i_vout = atoi( psz_method );
470 psz_method = psz_tmp + 1;
474 i_vout = atoi( psz_method );
475 psz_method = psz_tmp;
479 i_vout < p_vout->p_sys->i_row * p_vout->p_sys->i_col )
481 p_vout->p_sys->pp_vout[i_vout].b_active = 1;
486 free( psz_method_tmp );
493 /*****************************************************************************
494 * CLIP_0A: clip between 0 and ACCURACY
495 *****************************************************************************/
496 inline static int CLIP_0A( int a )
498 return (a > ACCURACY) ? ACCURACY : (a < 0) ? 0 : a;
502 /*****************************************************************************
503 * Gamma: Gamma correction
504 *****************************************************************************/
505 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])
509 f_Input = (f_component * f_BlackLevel[i_plane]) / (f_BlackCrush[i_plane]) + (1.0 - f_BlackLevel[i_plane]);
510 if (f_component <= f_BlackCrush[i_plane])
511 return pow(f_Input, 1.0 / f_Gamma[i_plane]);
512 else if (f_component >= f_WhiteCrush[i_plane])
514 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);
515 return pow(f_Input, 1.0 / f_Gamma[i_plane]);
523 /*****************************************************************************
524 * F: Function to calculate Gamma correction
525 *****************************************************************************/
526 static uint8_t F(uint8_t i, float gamma)
528 double input = (double) i / 255.0;
530 // return clip(255 * pow(input, 1.0 / gamma));
533 return clip_uint8((255 * pow(2 * input, gamma)) / 2);
535 return clip_uint8(255 * (1 - pow(2 * (1 - input), gamma) / 2));
541 /*****************************************************************************
542 * AdjustHeight: ajust p_sys->i_height to have same BZ width for any ratio
543 *****************************************************************************/
544 static int AdjustHeight( vout_thread_t *p_vout )
546 bool b_fullscreen = var_CreateGetInteger( p_vout, "fullscreen" );
547 int i_window_width = p_vout->i_window_width;
548 int i_window_height = p_vout->i_window_height;
549 double d_halfLength = 0;
550 double d_halfLength_crop;
551 double d_halfLength_calculated;
554 // OS DEPENDANT CODE to get display dimensions
558 i_window_width = GetSystemMetrics(SM_CXSCREEN);
559 i_window_height = GetSystemMetrics(SM_CYSCREEN);
561 Display *p_display = XOpenDisplay( "" );
562 if (p_vout->p_sys->b_xinerama)
564 i_window_width = DisplayWidth(p_display, 0) / p_vout->p_sys->i_col;
565 i_window_height = DisplayHeight(p_display, 0) / p_vout->p_sys->i_row;
569 i_window_width = DisplayWidth(p_display, 0);
570 i_window_height = DisplayHeight(p_display, 0);
572 XCloseDisplay( p_display );
575 var_SetInteger( p_vout, "width", i_window_width);
576 var_SetInteger( p_vout, "height", i_window_height);
577 p_vout->i_window_width = i_window_width;
578 p_vout->i_window_height = i_window_height;
581 if (p_vout->p_sys->bz_length)
582 if ((!p_vout->p_sys->b_autocrop) && (!p_vout->p_sys->i_ratio))
584 if ((p_vout->p_sys->i_row > 1) || (p_vout->p_sys->i_col > 1))
586 while ((d_halfLength <= 0) || (d_halfLength > p_vout->render.i_width / (2 * p_vout->p_sys->i_col)))
588 if (p_vout->p_sys->bz_length >= 50)
589 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);
592 d_halfLength = (p_vout->render.i_width * p_vout->p_sys->bz_length) / (100.0 * p_vout->p_sys->i_col);
593 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);
595 if ((d_halfLength <= 0) || (d_halfLength > p_vout->render.i_width / (2 * p_vout->p_sys->i_col))) p_vout->p_sys->i_row--;
596 if (p_vout->p_sys->i_row < 1 )
598 p_vout->p_sys->i_row = 1;
602 p_vout->p_sys->i_halfLength = (d_halfLength + 0.5);
603 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;
604 var_SetInteger( p_vout, "bz-length", p_vout->p_sys->bz_length);
605 var_SetInteger( p_vout, "panoramix-rows", p_vout->p_sys->i_row);
610 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;
611 d_halfLength_crop = d_halfLength * VOUT_ASPECT_FACTOR * (double)p_vout->output.i_width
612 / (double)i_window_height / (double)p_vout->render.i_aspect;
613 p_vout->p_sys->i_halfLength = (d_halfLength_crop + 0.5);
614 d_halfLength_calculated = p_vout->p_sys->i_halfLength * (double)i_window_height *
615 (double)p_vout->render.i_aspect / VOUT_ASPECT_FACTOR / (double)p_vout->output.i_width;
617 if (!p_vout->p_sys->b_attenuate)
619 double d_bz_length = (p_vout->p_sys->i_halfLength * p_vout->p_sys->i_col * 100.0) / p_vout->render.i_width;
620 // F(2x) != 2F(x) in opengl module
621 if (p_vout->p_sys->i_col == 2) d_bz_length = (100.0 * d_bz_length) / (100.0 - d_bz_length) ;
622 var_SetInteger( p_vout, "bz-length", (int)(d_bz_length + 0.5));
624 i_offset = (int)d_halfLength - (int)
625 (p_vout->p_sys->i_halfLength * (double)i_window_height *
626 (double)p_vout->render.i_aspect / VOUT_ASPECT_FACTOR / (double)p_vout->output.i_width);
636 /*****************************************************************************
637 * Init: initialize Wall video thread output method
638 *****************************************************************************/
639 static int Init( vout_thread_t *p_vout )
641 int i_index, i_row, i_col, i_width, i_height;
644 I_OUTPUTPICTURES = 0;
646 /* Initialize the output structure */
647 p_vout->output.i_chroma = p_vout->render.i_chroma;
648 p_vout->output.i_width = p_vout->render.i_width;
649 p_vout->output.i_height = p_vout->render.i_height;
650 p_vout->output.i_aspect = p_vout->render.i_aspect;
652 p_vout->p_sys->b_has_changed = p_vout->p_sys->b_attenuate;
653 int i_video_x = var_GetInteger( p_vout, "video-x");
654 int i_video_y = var_GetInteger( p_vout, "video-y");
656 if (p_vout->p_sys->b_attenuate)
658 int i_index2, i_plane;
659 int constantYUV[3] = {0,128,128};
660 float f_BlackCrush[VOUT_MAX_PLANES];
661 float f_BlackLevel[VOUT_MAX_PLANES];
662 float f_WhiteCrush[VOUT_MAX_PLANES];
663 float f_WhiteLevel[VOUT_MAX_PLANES];
664 p_vout->p_sys->f_gamma[0] = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-red" );
665 p_vout->p_sys->f_gamma[1] = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-green" );
666 p_vout->p_sys->f_gamma[2] = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-blue" );
667 f_BlackCrush[0] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blackcrush-red" ) / 255.0;
668 f_BlackCrush[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blackcrush-green" ) / 255.0;
669 f_BlackCrush[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blackcrush-blue" ) / 255.0;
670 f_WhiteCrush[0] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitecrush-red" ) / 255.0;
671 f_WhiteCrush[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitecrush-green" ) / 255.0;
672 f_WhiteCrush[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitecrush-blue" ) / 255.0;
673 f_BlackLevel[0] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blacklevel-red" ) / 255.0;
674 f_BlackLevel[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blacklevel-green" ) / 255.0;
675 f_BlackLevel[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blacklevel-blue" ) / 255.0;
676 f_WhiteLevel[0] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitelevel-red" ) / 255.0;
677 f_WhiteLevel[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitelevel-green" ) / 255.0;
678 f_WhiteLevel[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitelevel-blue" ) / 255.0;
679 switch (p_vout->render.i_chroma)
682 case VLC_FOURCC('Y','V','1','2'):
683 case VLC_FOURCC('Y','V','U','9'):
685 case VLC_FOURCC('U','Y','V','Y'): // packed by 2
686 case VLC_FOURCC('U','Y','N','V'): // packed by 2
687 case VLC_FOURCC('Y','4','2','2'): // packed by 2
688 // case VLC_FOURCC('c','y','u','v'): // packed by 2
689 p_vout->p_sys->f_gamma[2] = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-green" );
690 p_vout->p_sys->f_gamma[1] = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-blue" );
691 f_BlackCrush[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blackcrush-green" ) / 255.0;
692 f_BlackCrush[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blackcrush-blue" ) / 255.0;
693 f_WhiteCrush[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitecrush-green" ) / 255.0;
694 f_WhiteCrush[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitecrush-blue" ) / 255.0;
695 f_BlackLevel[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blacklevel-green" ) / 255.0;
696 f_BlackLevel[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blacklevel-blue" ) / 255.0;
697 f_WhiteLevel[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitelevel-green" ) / 255.0;
698 f_WhiteLevel[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitelevel-blue" ) / 255.0;
700 case VLC_FOURCC('I','4','4','4'):
701 case VLC_FOURCC('I','4','2','2'):
702 case VLC_FOURCC('I','4','2','0'):
703 case VLC_FOURCC('I','4','1','1'):
704 case VLC_FOURCC('I','4','1','0'):
705 case VLC_FOURCC('I','Y','U','V'):
706 case VLC_FOURCC('Y','U','V','A'):
708 case VLC_FOURCC('Y','U','Y','2'): // packed by 2
709 case VLC_FOURCC('Y','U','N','V'): // packed by 2
710 for (i_index = 0; i_index < 256; i_index++)
711 for (i_index2 = 0; i_index2 <= ACCURACY; i_index2++)
712 for (i_plane = 0; i_plane < VOUT_MAX_PLANES; i_plane++)
714 float f_lut = CLIP_01(1.0 -
715 ((ACCURACY - (float)i_index2)
716 * Gamma_Correction(i_plane, (float)i_index / 255.0, f_BlackCrush, f_WhiteCrush, f_BlackLevel, f_WhiteLevel, p_vout->p_sys->f_gamma)
718 p_vout->p_sys->LUT[i_plane][i_index2][i_index] = f_lut * i_index + (int)((1.0 - f_lut) * (float)constantYUV[i_plane]);
722 case VLC_FOURCC('R','G','B','2'): // packed by 1
723 case VLC_FOURCC('R','V','1','5'): // packed by 2
724 case VLC_FOURCC('R','V','1','6'): // packed by 2
725 case VLC_FOURCC('R','V','2','4'): // packed by 3
726 case VLC_FOURCC('R','V','3','2'): // packed by 4
727 for (i_index = 0; i_index < 256; i_index++)
728 for (i_index2 = 0; i_index2 <= ACCURACY; i_index2++)
729 for (i_plane = 0; i_plane < VOUT_MAX_PLANES; i_plane++)
731 float f_lut = CLIP_01(1.0 -
732 ((ACCURACY - (float)i_index2)
733 * Gamma_Correction(i_plane, (float)i_index / 255.0, f_BlackCrush, f_WhiteCrush, f_BlackLevel, f_WhiteLevel, p_vout->p_sys->f_gamma)
735 p_vout->p_sys->LUT[i_plane][i_index2][i_index] = f_lut * i_index;
739 msg_Err( p_vout, "colorspace not supported by plug-in !!!");
740 free( p_vout->p_sys );
745 if (p_vout->p_sys->i_offset_x)
746 p_vout->p_sys->i_offset_x = AdjustHeight(p_vout);
748 AdjustHeight(p_vout);
751 /* Try to open the real video output */
752 msg_Dbg( p_vout, "spawning the real video outputs" );
754 p_vout->p_sys->i_vout = 0;
756 /* FIXME: use bresenham instead of those ugly divisions */
757 for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
759 for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
763 memset( &fmt, 0, sizeof(video_format_t) );
765 if( i_col + 1 < p_vout->p_sys->i_col )
767 i_width = ( p_vout->render.i_width
768 / p_vout->p_sys->i_col ) & ~0x1;
772 i_width = p_vout->render.i_width
773 - ( ( p_vout->render.i_width
774 / p_vout->p_sys->i_col ) & ~0x1 ) * i_col;
778 i_width += p_vout->p_sys->i_halfLength;
779 if (p_vout->p_sys->i_col > 2 ) i_width += p_vout->p_sys->i_halfLength;
780 i_width -= i_width % 2;
782 if( i_row + 1 < p_vout->p_sys->i_row )
784 i_height = ( p_vout->render.i_height
785 / p_vout->p_sys->i_row ) & ~0x3;
789 i_height = p_vout->render.i_height
790 - ( ( p_vout->render.i_height
791 / p_vout->p_sys->i_row ) & ~0x3 ) * i_row;
795 if (p_vout->p_sys->i_row >= 2)
797 p_vout->p_sys->i_halfHeight = (p_vout->p_sys->i_halfLength * p_vout->p_sys->bz_height) / 100;
798 p_vout->p_sys->i_halfHeight -= (p_vout->p_sys->i_halfHeight % 2);
799 i_height += p_vout->p_sys->i_halfHeight;
800 if (p_vout->p_sys->i_row > 2) i_height += p_vout->p_sys->i_halfHeight;
802 i_height -= i_height % 2;
804 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].i_width = i_width;
805 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].i_height = i_height;
807 if( !p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].b_active )
809 p_vout->p_sys->i_vout++;
813 fmt.i_width = fmt.i_visible_width = p_vout->render.i_width;
814 fmt.i_height = fmt.i_visible_height = p_vout->render.i_height;
815 fmt.i_x_offset = fmt.i_y_offset = 0;
816 fmt.i_chroma = p_vout->render.i_chroma;
817 fmt.i_aspect = p_vout->render.i_aspect;
818 fmt.i_sar_num = p_vout->render.i_aspect * fmt.i_height / fmt.i_width;
819 fmt.i_sar_den = VOUT_ASPECT_FACTOR;
820 fmt.i_width = fmt.i_visible_width = i_width;
821 fmt.i_height = fmt.i_visible_height = i_height;
822 fmt.i_aspect = p_vout->render.i_aspect
823 * p_vout->render.i_height / i_height
824 * i_width / p_vout->render.i_width;
826 if (p_vout->p_sys->i_offset_x < 0)
828 var_SetInteger(p_vout, "video-x", -p_vout->p_sys->i_offset_x);
829 p_vout->p_sys->i_offset_x = 0;
832 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout =
833 vout_Create( p_vout, &fmt);
835 if( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout == NULL )
837 msg_Err( p_vout, "failed to get %ix%i vout threads",
838 p_vout->p_sys->i_col, p_vout->p_sys->i_row );
839 RemoveAllVout( p_vout );
843 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout,
846 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout->i_alignment = 0;
847 if (i_col == 0) p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout->i_alignment |= VOUT_ALIGN_RIGHT;
848 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;
849 if (p_vout->p_sys->i_row > 1)
851 if (i_row == 0) p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout->i_alignment |= VOUT_ALIGN_BOTTOM;
852 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;
854 // i_n : number of active pp_vout
855 int i_index, i_n = p_vout->p_sys->i_vout;
856 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;
857 var_SetInteger( p_vout, "align", p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout->i_alignment );
858 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);
859 var_SetInteger( p_vout, "video-y",i_video_y + ((i_n + 1) / p_vout->p_sys->i_col) * p_vout->i_window_height);
861 p_vout->p_sys->i_vout++;
865 ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
867 ADD_PARENT_CALLBACKS( SendEventsToChild );
872 /*****************************************************************************
873 * End: terminate Wall video thread output method
874 *****************************************************************************/
875 static void End( vout_thread_t *p_vout )
880 var_SetInteger( p_vout, "bz-length", p_vout->p_sys->bz_length);
882 /* Free the fake output buffers we allocated */
883 for( i_index = I_OUTPUTPICTURES ; i_index ; )
886 free( PP_OUTPUTPICTURE[ i_index ]->p_data_orig );
890 /*****************************************************************************
891 * Destroy: destroy Wall video thread output method
892 *****************************************************************************
893 * Terminate an output method created by WallCreateOutputMethod
894 *****************************************************************************/
895 static void Destroy( vlc_object_t *p_this )
897 vout_thread_t *p_vout = (vout_thread_t *)p_this;
900 DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents);
901 vlc_object_detach( p_vout->p_sys->p_vout );
902 vout_Destroy( p_vout->p_sys->p_vout );
903 DEL_PARENT_CALLBACKS( SendEventsToChild);
906 RemoveAllVout( p_vout );
907 DEL_PARENT_CALLBACKS( SendEventsToChild );
909 free( p_vout->p_sys->pp_vout );
910 free( p_vout->p_sys );
914 /*****************************************************************************
915 * RenderPlanarYUV: displays previously rendered output
916 *****************************************************************************
917 * This function send the currently rendered image to Wall image, waits
918 * until it is displayed and switch the two rendering buffers, preparing next
920 *****************************************************************************/
921 static void RenderPlanarYUV( vout_thread_t *p_vout, picture_t *p_pic )
923 picture_t *p_outpic = NULL;
924 int i_col, i_row, i_vout, i_plane;
925 int pi_left_skip[VOUT_MAX_PLANES], pi_top_skip[VOUT_MAX_PLANES];
927 int LeftOffset, TopOffset;
928 int constantYUV[3] = {0,128,128};
933 int i_index, i_index2;
939 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
941 pi_top_skip[i_plane] = 0;
944 for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
946 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
948 pi_left_skip[i_plane] = 0;
951 for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
953 if( !p_vout->p_sys->pp_vout[ i_vout ].b_active )
955 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
957 pi_left_skip[i_plane] +=
958 p_vout->p_sys->pp_vout[ i_vout ].i_width
959 * p_pic->p[i_plane].i_pitch / p_vout->output.i_width;
966 vout_CreatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
970 if( p_vout->b_die || p_vout->b_error )
973 p_vout->p_sys->pp_vout[ i_vout ].p_vout, p_outpic );
977 msleep( VOUT_OUTMEM_SLEEP );
980 vout_DatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
981 p_outpic, p_pic->date );
982 vout_LinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
985 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
987 uint8_t *p_in, *p_in_end, *p_out;
988 int i_in_pitch = p_pic->p[i_plane].i_pitch;
989 int i_out_pitch = p_outpic->p[i_plane].i_pitch;
990 int i_copy_pitch = p_outpic->p[i_plane].i_visible_pitch;
991 int i_lines = p_outpic->p[i_plane].i_visible_lines;
993 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);
994 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);
995 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);
996 if ((!p_vout->p_sys->pp_vout[p_vout->p_sys->i_col].b_active))
997 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);
998 // i_n : previous inactive pp_vout
1000 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++;
1001 if ((i_col > 1) && i_n)
1002 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);
1004 p_in = p_pic->p[i_plane].p_pixels
1005 /* Wall proprities */
1006 + pi_top_skip[i_plane] + pi_left_skip[i_plane];
1008 if ((p_vout->p_sys->i_row > 2) &&
1009 ((!i_row) || (i_row + 1 == p_vout->p_sys->i_row)))
1010 i_lines -= (2 * p_vout->p_sys->i_halfHeight) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1012 // 1088 lines bug in a mpeg2 stream of 1080 lines
1013 if ((p_vout->p_sys->i_row - 1 == i_row) &&
1014 (p_pic->p[i_plane].i_lines == 1088))
1015 i_lines -= 8 / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1017 p_in_end = p_in + i_lines * p_pic->p[i_plane].i_pitch;
1019 p_in = p_pic->p[i_plane].p_pixels
1020 + pi_top_skip[i_plane] + pi_left_skip[i_plane];
1022 p_in_end = p_in + i_lines * p_pic->p[i_plane].i_pitch;
1024 p_out = p_outpic->p[i_plane].p_pixels;
1026 if ((p_vout->p_sys->i_row > 2) && (!i_row))
1027 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));
1031 length = 2 * p_vout->p_sys->i_halfLength / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1033 if (p_vout->p_sys->b_has_changed)
1036 a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
1037 a_1 = p_vout->p_sys->a_1 * length * (ACCURACY / 100);
1038 a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
1039 for(i_col_mod = 0; i_col_mod < 2; i_col_mod++)
1040 for (i_index = 0; i_index < length; i_index++)
1042 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);
1043 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;
1047 while( p_in < p_in_end )
1050 p_vout->p_libvlc->pf_memcpy( p_out , p_in, i_copy_pitch);
1052 if (p_vout->p_sys->i_col > 2)
1056 p_vout->p_libvlc->pf_memcpy( p_out + length , p_in, i_copy_pitch - length);
1057 else if (i_col + 1 == p_vout->p_sys->i_col)
1058 p_vout->p_libvlc->pf_memcpy( p_out, p_in - length, i_copy_pitch - length);
1060 p_vout->p_libvlc->pf_memcpy( p_out, p_in - length, i_copy_pitch);
1066 p_out += LeftOffset;
1067 memset(p_out, constantYUV[i_plane], length);
1068 p_out -= LeftOffset;
1070 else if ((i_col + 1 == p_vout->p_sys->i_col ))
1073 LeftOffset = i_copy_pitch - length;
1074 p_out += LeftOffset;
1075 memset(p_out, constantYUV[i_plane], length);
1076 p_out -= LeftOffset;
1081 p_vout->p_libvlc->pf_memcpy( p_out , p_in, i_copy_pitch);
1083 if (p_vout->p_sys->b_attenuate)
1086 // first blended zone
1090 p_out += LeftOffset;
1091 for (i_index = 0; i_index < length; i_index++)
1094 *(p_out + i_index) = (p_vout->p_sys->lambda[1][i_plane][i_index] *
1095 (*(p_out + i_index))) / ACCURACY +
1096 p_vout->p_sys->cstYUV[1][i_plane][i_index];
1098 *(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)];
1101 p_out -= LeftOffset;
1103 // second blended zone
1104 if (i_col + 1 < p_vout->p_sys->i_col)
1106 LeftOffset = i_copy_pitch - length;
1107 p_out += LeftOffset;
1108 for (i_index = 0; i_index < length; i_index++)
1111 *(p_out + i_index) = (p_vout->p_sys->lambda[0][i_plane][i_index] *
1112 (*(p_out + i_index))) / ACCURACY +
1113 p_vout->p_sys->cstYUV[0][i_plane][i_index];
1116 *(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)];
1119 p_out -= LeftOffset;
1125 p_out += i_out_pitch;
1129 if (!p_vout->p_sys->b_attenuate)
1131 if ((i_row == 0) && (p_vout->p_sys->i_row > 2))
1134 int height = 2 * p_vout->p_sys->i_halfHeight / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1135 TopOffset = i_lines + (2 * p_vout->p_sys->i_halfHeight) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1136 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1137 for (i_index = 0; i_index < height; i_index++)
1138 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1139 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = constantYUV[i_plane];
1140 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1142 else if ((i_row + 1 == p_vout->p_sys->i_row) && (p_vout->p_sys->i_row > 2))
1145 int height = 2 * p_vout->p_sys->i_halfHeight / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1146 TopOffset = height - (2 * p_vout->p_sys->i_halfHeight) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1147 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1148 for (i_index = 0; i_index < height; i_index++)
1149 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1150 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = constantYUV[i_plane];
1151 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1156 if (p_vout->p_sys->i_row >= 2)
1158 length = 2 * p_vout->p_sys->i_halfHeight / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1159 if (p_vout->p_sys->b_has_changed)
1162 a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
1163 a_1 = p_vout->p_sys->a_1 * length * (ACCURACY / 100);
1164 a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
1165 for(i_col_mod = 0; i_col_mod < 2; i_col_mod++)
1166 for (i_index = 0; i_index < length; i_index++)
1168 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);
1169 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;
1172 // first blended zone
1176 TopOffset = i_lines;
1177 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1178 for (i_index = 0; i_index < length; i_index++)
1179 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1181 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = (p_vout->p_sys->lambda2[1][i_plane][i_index] *
1182 (*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2))) / ACCURACY +
1183 p_vout->p_sys->cstYUV2[1][i_plane][i_index];
1186 *(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)];
1188 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1190 else if (p_vout->p_sys->i_row > 2)
1193 TopOffset = i_lines + (2 * p_vout->p_sys->i_halfHeight) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1194 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1195 for (i_index = 0; i_index < length; i_index++)
1196 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1197 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = constantYUV[i_plane];
1198 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1201 // second blended zone
1203 if (i_row + 1 < p_vout->p_sys->i_row)
1206 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1207 for (i_index = 0; i_index < length; i_index++)
1208 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1210 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = (p_vout->p_sys->lambda2[0][i_plane][i_index] *
1211 (*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2))) / ACCURACY +
1212 p_vout->p_sys->cstYUV2[0][i_plane][i_index];
1215 *(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)];
1218 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1220 else if (p_vout->p_sys->i_row > 2)
1223 TopOffset = length - (2 * p_vout->p_sys->i_halfHeight) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
1224 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1225 for (i_index = 0; i_index < length; i_index++)
1226 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1227 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = constantYUV[i_plane];
1228 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1234 // bug for wall filter : fix by CC
1235 // pi_left_skip[i_plane] += i_out_pitch;
1236 pi_left_skip[i_plane] += i_copy_pitch;
1239 vout_UnlinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1241 vout_DisplayPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1246 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1248 pi_top_skip[i_plane] += p_vout->p_sys->pp_vout[ i_vout ].i_height
1249 * p_pic->p[i_plane].i_lines
1250 / p_vout->output.i_height
1251 * p_pic->p[i_plane].i_pitch;
1256 if (p_vout->p_sys->b_has_changed) p_vout->p_sys->b_has_changed = false;
1261 /*****************************************************************************
1262 * RenderPackedRGB: displays previously rendered output
1263 *****************************************************************************
1264 * This function send the currently rendered image to Wall image, waits
1265 * until it is displayed and switch the two rendering buffers, preparing next
1267 *****************************************************************************/
1268 static void RenderPackedRGB( vout_thread_t *p_vout, picture_t *p_pic )
1270 picture_t *p_outpic = NULL;
1271 int i_col, i_row, i_vout, i_plane;
1272 int pi_left_skip[VOUT_MAX_PLANES], pi_top_skip[VOUT_MAX_PLANES];
1274 int LeftOffset, TopOffset;
1279 int i_index, i_index2;
1284 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1286 pi_top_skip[i_plane] = 0;
1289 for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
1291 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1293 pi_left_skip[i_plane] = 0;
1296 for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
1298 if( !p_vout->p_sys->pp_vout[ i_vout ].b_active )
1300 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1302 pi_left_skip[i_plane] +=
1303 p_vout->p_sys->pp_vout[ i_vout ].i_width * p_pic->p->i_pixel_pitch;
1310 vout_CreatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1314 if( p_vout->b_die || p_vout->b_error )
1316 vout_DestroyPicture(
1317 p_vout->p_sys->pp_vout[ i_vout ].p_vout, p_outpic );
1321 msleep( VOUT_OUTMEM_SLEEP );
1324 vout_DatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1325 p_outpic, p_pic->date );
1326 vout_LinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1329 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1331 uint8_t *p_in, *p_in_end, *p_out;
1332 int i_in_pitch = p_pic->p[i_plane].i_pitch;
1333 int i_out_pitch = p_outpic->p[i_plane].i_pitch;
1334 int i_copy_pitch = p_outpic->p[i_plane].i_visible_pitch;
1337 if (i_col) pi_left_skip[i_plane] -= (2 * p_vout->p_sys->i_halfLength) * p_pic->p->i_pixel_pitch;
1338 if ((i_row) && (!i_col)) pi_top_skip[i_plane] -= (2 * p_vout->p_sys->i_halfHeight * p_pic->p[i_plane].i_pitch);
1339 if ((!p_vout->p_sys->pp_vout[p_vout->p_sys->i_col].b_active))
1340 pi_top_skip[i_plane] -= (2 * p_vout->p_sys->i_halfHeight * i_row * p_pic->p[i_plane].i_pitch);
1341 // i_n : previous inactive pp_vout
1343 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++;
1344 if ((i_col > 1) && i_n)
1345 pi_left_skip[i_plane] -= i_n*(2 * p_vout->p_sys->i_halfLength ) * p_pic->p->i_pixel_pitch;
1347 p_in = p_pic->p[i_plane].p_pixels
1348 /* Wall proprities */
1349 + pi_top_skip[i_plane] + pi_left_skip[i_plane];
1351 int i_lines = p_outpic->p[i_plane].i_visible_lines;
1352 // 1088 lines bug in a mpeg2 stream of 1080 lines
1353 if ((p_vout->p_sys->i_row - 1 == i_row) &&
1354 (p_pic->p[i_plane].i_lines == 1088))
1357 p_in_end = p_in + i_lines * p_pic->p[i_plane].i_pitch;
1359 p_in = p_pic->p[i_plane].p_pixels
1360 + pi_top_skip[i_plane] + pi_left_skip[i_plane];
1362 p_in_end = p_in + p_outpic->p[i_plane].i_visible_lines
1363 * p_pic->p[i_plane].i_pitch;
1366 p_out = p_outpic->p[i_plane].p_pixels;
1370 if ((p_vout->p_sys->i_row > 2) && (!i_row))
1371 p_out += (p_outpic->p[i_plane].i_pitch * (2 * p_vout->p_sys->i_halfHeight) * p_pic->p->i_pixel_pitch);
1374 length = 2 * p_vout->p_sys->i_halfLength * p_pic->p->i_pixel_pitch;
1376 if (p_vout->p_sys->b_has_changed)
1380 Denom = F2(length / p_pic->p->i_pixel_pitch);
1381 a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
1382 a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfLength * (ACCURACY / 100);
1383 a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
1384 for(i_col_mod = 0; i_col_mod < 2; i_col_mod++)
1385 for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index++)
1386 for (i_plane_ = 0; i_plane_ < p_pic->p->i_pixel_pitch; i_plane_++)
1387 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);
1390 while( p_in < p_in_end )
1393 p_vout->p_libvlc->pf_memcpy( p_out, p_in, i_copy_pitch);
1395 if (p_vout->p_sys->i_col > 2)
1400 p_vout->p_libvlc->pf_memcpy( p_out + length, p_in, i_copy_pitch - length);
1401 else if (i_col + 1 == p_vout->p_sys->i_col)
1402 p_vout->p_libvlc->pf_memcpy( p_out, p_in - length, i_copy_pitch - length);
1404 p_vout->p_libvlc->pf_memcpy( p_out, p_in - length, i_copy_pitch);
1410 p_out += LeftOffset;
1412 for (i_index = 0; i_index < length; i_index++)
1413 *(p_out + i_index) = 0;
1414 p_out -= LeftOffset;
1417 else if ((i_col + 1 == p_vout->p_sys->i_col ))
1420 LeftOffset = i_copy_pitch - length;
1421 p_out += LeftOffset;
1423 for (i_index = 0; i_index < length; i_index++)
1424 *(p_out + i_index) = 0;
1425 p_out -= LeftOffset;
1431 p_vout->p_libvlc->pf_memcpy( p_out, p_in, i_copy_pitch);
1434 // first blended zone
1438 p_out += LeftOffset;
1439 for (i_index = 0; i_index < length; i_index++)
1441 *(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] *
1442 (*(p_out + i_index))) / ACCURACY;
1444 *(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)];
1446 p_out -= LeftOffset;
1448 // second blended zone
1449 if (i_col + 1 < p_vout->p_sys->i_col)
1451 LeftOffset = i_copy_pitch - length;
1452 p_out += LeftOffset;
1453 for (i_index = 0; i_index < length; i_index++)
1455 *(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] *
1456 (*(p_out + i_index))) / ACCURACY;
1458 *(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)];
1460 p_out -= LeftOffset;
1465 p_out += i_out_pitch;
1469 if (!p_vout->p_sys->b_attenuate)
1471 if ((i_row == 0) && (p_vout->p_sys->i_row > 2))
1474 TopOffset = i_lines + (2 * p_vout->p_sys->i_halfHeight);
1475 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1476 for (i_index = 0; i_index < length; i_index++)
1477 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1478 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = 0;
1479 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1481 else if ((i_row + 1 == p_vout->p_sys->i_row) && (p_vout->p_sys->i_row > 2))
1484 TopOffset = length - (2 * p_vout->p_sys->i_halfHeight);
1485 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1486 for (i_index = 0; i_index < length; i_index++)
1487 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1488 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = 0;
1489 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1494 if (p_vout->p_sys->i_row >= 2)
1496 length = 2 * p_vout->p_sys->i_halfHeight;
1497 if (p_vout->p_sys->b_has_changed)
1502 a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
1503 a_1 = p_vout->p_sys->a_1 * length * (ACCURACY / 100);
1504 a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
1505 for(i_row_mod = 0; i_row_mod < 2; i_row_mod++)
1506 for (i_index = 0; i_index < length; i_index++)
1507 for (i_plane_ = 0; i_plane_ < p_pic->p->i_pixel_pitch; i_plane_++)
1508 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);
1510 // first blended zone
1514 TopOffset = i_lines;
1515 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1516 for (i_index = 0; i_index < length; i_index++)
1517 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1519 *(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] *
1520 (*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2))) / ACCURACY;
1522 *(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)];
1524 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1526 else if (p_vout->p_sys->i_row > 2)
1529 TopOffset = i_lines + (2 * p_vout->p_sys->i_halfHeight);
1530 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1531 for (i_index = 0; i_index < length; i_index++)
1532 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1533 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = 0;
1534 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1537 // second blended zone
1539 if (i_row + 1 < p_vout->p_sys->i_row)
1542 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1543 for (i_index = 0; i_index < length; i_index++)
1544 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1546 *(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] *
1547 (*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2))) / ACCURACY;
1549 *(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)];
1552 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1554 else if (p_vout->p_sys->i_row > 2)
1557 TopOffset = length - (2 * p_vout->p_sys->i_halfHeight);
1558 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1559 for (i_index = 0; i_index < length; i_index++)
1560 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1561 *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = 0;
1562 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1568 // bug for wall filter : fix by CC
1569 // pi_left_skip[i_plane] += i_out_pitch;
1570 pi_left_skip[i_plane] += i_copy_pitch;
1573 vout_UnlinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1575 vout_DisplayPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1580 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1582 pi_top_skip[i_plane] += p_vout->p_sys->pp_vout[ i_vout ].i_height
1583 * p_pic->p[i_plane].i_lines
1584 / p_vout->output.i_height
1585 * p_pic->p[i_plane].i_pitch;
1589 if (p_vout->p_sys->b_has_changed) p_vout->p_sys->b_has_changed = false;
1595 // WARNING : NO DEBUGGED
1596 /*****************************************************************************
1597 * RenderPackedYUV: displays previously rendered output
1598 *****************************************************************************
1599 * This function send the currently rendered image to Wall image, waits
1600 * until it is displayed and switch the two rendering buffers, preparing next
1602 *****************************************************************************/
1603 static void RenderPackedYUV( vout_thread_t *p_vout, picture_t *p_pic )
1605 picture_t *p_outpic = NULL;
1606 int i_col, i_row, i_vout, i_plane;
1607 int pi_left_skip[VOUT_MAX_PLANES], pi_top_skip[VOUT_MAX_PLANES];
1609 int LeftOffset, TopOffset;
1610 int constantYUV[3] = {0,128,128};
1615 int i_index, i_index2;
1621 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1623 pi_top_skip[i_plane] = 0;
1626 for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
1628 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1630 pi_left_skip[i_plane] = 0;
1633 for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
1635 if( !p_vout->p_sys->pp_vout[ i_vout ].b_active )
1637 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1639 pi_left_skip[i_plane] +=
1640 p_vout->p_sys->pp_vout[ i_vout ].i_width
1641 * p_pic->p[i_plane].i_pitch / p_vout->output.i_width;
1648 vout_CreatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1652 if( p_vout->b_die || p_vout->b_error )
1654 vout_DestroyPicture(
1655 p_vout->p_sys->pp_vout[ i_vout ].p_vout, p_outpic );
1659 msleep( VOUT_OUTMEM_SLEEP );
1662 vout_DatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1663 p_outpic, p_pic->date );
1664 vout_LinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1667 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1669 uint8_t *p_in, *p_in_end, *p_out;
1670 int i_in_pitch = p_pic->p[i_plane].i_pitch;
1671 int i_out_pitch = p_outpic->p[i_plane].i_pitch;
1672 int i_copy_pitch = p_outpic->p[i_plane].i_visible_pitch;
1675 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);
1676 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);
1677 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);
1678 if ((!p_vout->p_sys->pp_vout[p_vout->p_sys->i_col].b_active))
1679 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);
1680 // i_n : previous inactive pp_vout
1682 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++;
1683 if ((i_col > 1) && i_n)
1684 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);
1686 p_in = p_pic->p[i_plane].p_pixels
1687 /* Wall proprities */
1688 + pi_top_skip[i_plane] + pi_left_skip[i_plane];
1690 int i_lines = p_outpic->p[i_plane].i_visible_lines;
1691 // 1088 lines bug in a mpeg2 stream of 1080 lines
1692 if ((p_vout->p_sys->i_row - 1 == i_row) &&
1693 (p_pic->p[i_plane].i_lines == 1088))
1696 p_in_end = p_in + i_lines * p_pic->p[i_plane].i_pitch;
1698 p_in = p_pic->p[i_plane].p_pixels
1699 + pi_top_skip[i_plane] + pi_left_skip[i_plane];
1701 p_in_end = p_in + p_outpic->p[i_plane].i_visible_lines
1702 * p_pic->p[i_plane].i_pitch;
1704 p_out = p_outpic->p[i_plane].p_pixels;
1707 length = 2 * p_vout->p_sys->i_halfLength * p_pic->p->i_pixel_pitch;
1708 LeftOffset = (i_col ? 0 : i_copy_pitch - length);
1709 if (p_vout->p_sys->b_has_changed)
1713 for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index++)
1714 for (i_plane_ = 0; i_plane_ < p_pic->p->i_pixel_pitch; i_plane_++)
1715 for (i_index2 = 0; i_index2 < 256; i_index2++)
1716 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_]));
1718 switch (p_vout->output.i_chroma)
1720 case VLC_FOURCC('Y','U','Y','2'): // packed by 2
1721 case VLC_FOURCC('Y','U','N','V'): // packed by 2
1722 Denom = F2(length / p_pic->p->i_pixel_pitch);
1723 a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
1724 a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfLength * (ACCURACY / 100);
1725 a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
1726 for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index+=p_pic->p->i_pixel_pitch)
1727 // for each macropixel
1729 // first image pixel
1730 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);
1731 p_vout->p_sys->cstYUV[i_col][0][i_index] = ((ACCURACY - p_vout->p_sys->lambda[i_col][0][i_index]) * constantYUV[0]) / ACCURACY;
1732 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);
1733 p_vout->p_sys->cstYUV[i_col][1][i_index] = ((ACCURACY - p_vout->p_sys->lambda[i_col][1][i_index]) * constantYUV[1]) / ACCURACY;
1734 // second image pixel
1735 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);
1736 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;
1737 p_vout->p_sys->lambda[i_col][1][i_index + 1] = p_vout->p_sys->lambda[i_col][1][i_index];
1738 p_vout->p_sys->cstYUV[i_col][1][i_index + 1] = p_vout->p_sys->cstYUV[i_col][1][i_index];
1741 case VLC_FOURCC('U','Y','V','Y'): // packed by 2
1742 case VLC_FOURCC('U','Y','N','V'): // packed by 2
1743 case VLC_FOURCC('Y','4','2','2'): // packed by 2
1744 Denom = F2(length / p_pic->p->i_pixel_pitch);
1745 a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
1746 a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfLength * (ACCURACY / 100);
1747 a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
1748 for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index+=p_pic->p->i_pixel_pitch)
1749 // for each macropixel
1751 // first image pixel
1752 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);
1753 p_vout->p_sys->cstYUV[i_col][0][i_index] = ((ACCURACY - p_vout->p_sys->lambda[i_col][0][i_index]) * constantYUV[1]) / ACCURACY;
1754 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);
1755 p_vout->p_sys->cstYUV[i_col][1][i_index] = ((ACCURACY - p_vout->p_sys->lambda[i_col][1][i_index]) * constantYUV[0]) / ACCURACY;
1756 // second image pixel
1757 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);
1758 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;
1759 p_vout->p_sys->lambda[i_col][1][i_index + 1] = p_vout->p_sys->lambda[i_col][1][i_index];
1760 p_vout->p_sys->cstYUV[i_col][1][i_index + 1] = p_vout->p_sys->cstYUV[i_col][1][i_index];
1768 while( p_in < p_in_end )
1771 p_vout->p_libvlc->pf_memcpy( p_out, p_in, i_copy_pitch);
1773 p_vout->p_libvlc->pf_memcpy( p_out + i_col * length, p_in + i_col * length, i_copy_pitch - length);
1774 p_out += LeftOffset;
1777 for (i_index = 0; i_index < length; i_index++)
1778 *(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] *
1779 (*(p_in + i_index))) / ACCURACY +
1780 p_vout->p_sys->cstYUV[i_col][i_index % p_pic->p->i_pixel_pitch][i_index / p_pic->p->i_pixel_pitch];
1782 for (i_index = 0; i_index < length; i_index++)
1783 *(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] *
1784 (*(p_in + i_index))) / ACCURACY +
1785 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];
1787 p_out -= LeftOffset;
1791 p_out += i_out_pitch;
1794 if (p_vout->p_sys->i_row == 2)
1796 length = 2 * p_vout->p_sys->i_halfHeight * p_pic->p->i_pixel_pitch;
1797 TopOffset = (i_row ? i_lines : length / p_pic->p->i_pixel_pitch);
1798 if (p_vout->p_sys->b_has_changed)
1802 for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index++)
1803 for (i_plane_ = 0; i_plane_ < p_pic->p->i_pixel_pitch; i_plane_++)
1804 for (i_index2 = 0; i_index2 < 256; i_index2++)
1805 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_]));
1807 switch (p_vout->output.i_chroma)
1809 case VLC_FOURCC('Y','U','Y','2'): // packed by 2
1810 case VLC_FOURCC('Y','U','N','V'): // packed by 2
1811 Denom = F2(length / p_pic->p->i_pixel_pitch);
1812 a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
1813 a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfHeight * (ACCURACY / 100);
1814 a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
1815 for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index+=p_pic->p->i_pixel_pitch)
1816 // for each macropixel
1818 // first image pixel
1819 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);
1820 p_vout->p_sys->cstYUV2[i_row][0][i_index] = ((ACCURACY - p_vout->p_sys->lambda2[i_row][0][i_index]) * constantYUV[0]) / ACCURACY;
1821 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);
1822 p_vout->p_sys->cstYUV2[i_row][1][i_index] = ((ACCURACY - p_vout->p_sys->lambda2[i_row][1][i_index]) * constantYUV[1]) / ACCURACY;
1823 // second image pixel
1824 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);
1825 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;
1826 p_vout->p_sys->lambda2[i_row][1][i_index + 1] = p_vout->p_sys->lambda2[i_row][1][i_index];
1827 p_vout->p_sys->cstYUV2[i_row][1][i_index + 1] = p_vout->p_sys->cstYUV2[i_row][1][i_index];
1830 case VLC_FOURCC('U','Y','V','Y'): // packed by 2
1831 case VLC_FOURCC('U','Y','N','V'): // packed by 2
1832 case VLC_FOURCC('Y','4','2','2'): // packed by 2
1833 Denom = F2(length / p_pic->p->i_pixel_pitch);
1834 a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
1835 a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfHeight * (ACCURACY / 100);
1836 a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
1837 for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index+=p_pic->p->i_pixel_pitch)
1838 // for each macropixel
1840 // first image pixel
1841 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);
1842 p_vout->p_sys->cstYUV2[i_row][0][i_index] = ((ACCURACY - p_vout->p_sys->lambda2[i_col][0][i_index]) * constantYUV[1]) / ACCURACY;
1843 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);
1844 p_vout->p_sys->cstYUV2[i_row][1][i_index] = ((ACCURACY - p_vout->p_sys->lambda2[i_row][1][i_index]) * constantYUV[0]) / ACCURACY;
1845 // second image pixel
1846 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);
1847 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;
1848 p_vout->p_sys->lambda2[i_row][1][i_index + 1] = p_vout->p_sys->lambda2[i_row][1][i_index];
1849 p_vout->p_sys->cstYUV2[i_row][1][i_index + 1] = p_vout->p_sys->cstYUV2[i_row][1][i_index];
1856 p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
1858 for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index++)
1859 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1860 *(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] *
1861 (*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2))) / ACCURACY +
1862 p_vout->p_sys->cstYUV2[i_row][i_index2 % p_pic->p->i_pixel_pitch][i_index];
1864 for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index++)
1865 for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
1866 *(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] *
1867 (*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2))) / ACCURACY +
1868 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];
1871 p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
1874 // bug for wall filter : fix by CC
1875 // pi_left_skip[i_plane] += i_out_pitch;
1876 pi_left_skip[i_plane] += i_copy_pitch;
1879 vout_UnlinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1881 vout_DisplayPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
1886 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
1888 pi_top_skip[i_plane] += p_vout->p_sys->pp_vout[ i_vout ].i_height
1889 * p_pic->p[i_plane].i_lines
1890 / p_vout->output.i_height
1891 * p_pic->p[i_plane].i_pitch;
1895 if (p_vout->p_sys->b_has_changed) p_vout->p_sys->b_has_changed = false;
1901 /*****************************************************************************
1902 * RemoveAllVout: destroy all the child video output threads
1903 *****************************************************************************/
1904 static void RemoveAllVout( vout_thread_t *p_vout )
1906 while( p_vout->p_sys->i_vout )
1908 --p_vout->p_sys->i_vout;
1909 if( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].b_active )
1912 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout,
1915 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout );
1917 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout );
1922 /*****************************************************************************
1923 * SendEvents: forward mouse and keyboard events to the parent p_vout
1924 *****************************************************************************/
1925 static int SendEvents( vlc_object_t *p_this, char const *psz_var,
1926 vlc_value_t oldval, vlc_value_t newval, void *_p_vout )
1929 vout_thread_t *p_vout = (vout_thread_t *)_p_vout;
1931 vlc_value_t sentval = newval;
1933 /* Find the video output index */
1934 for( i_vout = 0; i_vout < p_vout->p_sys->i_vout; i_vout++ )
1936 if( p_this == (vlc_object_t *)p_vout->p_sys->pp_vout[ i_vout ].p_vout )
1942 if( i_vout == p_vout->p_sys->i_vout )
1944 return VLC_EGENERIC;
1947 /* Translate the mouse coordinates */
1948 if( !strcmp( psz_var, "mouse-x" ) )
1951 int i_overlap = ((p_vout->p_sys->i_col > 2) ? 0 : 2 * p_vout->p_sys->i_halfLength);
1952 sentval.i_int += (p_vout->output.i_width - i_overlap)
1954 sentval.i_int += p_vout->output.i_width
1956 * (i_vout % p_vout->p_sys->i_col)
1957 / p_vout->p_sys->i_col;
1959 else if( !strcmp( psz_var, "mouse-y" ) )
1962 int i_overlap = ((p_vout->p_sys->i_row > 2) ? 0 : 2 * p_vout->p_sys->i_halfHeight);
1963 sentval.i_int += (p_vout->output.i_height - i_overlap)
1965 sentval.i_int += p_vout->output.i_height
1967 //bug fix in Wall plug-in
1968 // * (i_vout / p_vout->p_sys->i_row)
1969 * (i_vout / p_vout->p_sys->i_col)
1970 / p_vout->p_sys->i_row;
1973 var_Set( p_vout, psz_var, sentval );
1978 /*****************************************************************************
1979 * SendEventsToChild: forward events to the child/children vout
1980 *****************************************************************************/
1981 static int SendEventsToChild( vlc_object_t *p_this, char const *psz_var,
1982 vlc_value_t oldval, vlc_value_t newval, void *p_data )
1984 VLC_UNUSED(oldval); VLC_UNUSED(p_data);
1985 vout_thread_t *p_vout = (vout_thread_t *)p_this;
1986 int i_row, i_col, i_vout = 0;
1988 for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
1990 for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
1992 var_Set( p_vout->p_sys->pp_vout[ i_vout ].p_vout, psz_var, newval);
1993 if( !strcmp( psz_var, "fullscreen" ) ) break;