]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/panoramix.c
Use var_InheritString for --decklink-video-connection.
[vlc] / modules / video_filter / panoramix.c
index a4536951d7e01b19ef728d08d11e702b7ece05fa..68819e24cac9e599e0145b697d94be38f7d394b7 100644 (file)
@@ -2,7 +2,7 @@
  * panoramix.c : Wall panoramic video with edge blending plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
- * $Id: panoramix.c  2006-08-29 16:20:15Z ced $
+ * $Id$
  *
  * Authors: Cedric Cocquebert <cedric.cocquebert@supelec.fr>
  *          based on Samuel Hocevar <sam@zoy.org>
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
 
-#include <vlc/vlc.h>
-#include <vlc/vout.h>
-
-#include "filter_common.h"
-
-// add by cedric.cocquebert@supelec.fr
-#define OVERLAP        2350
-#ifdef OVERLAP
-    #include <math.h>
-    // OS CODE DEPENDANT to get display dimensions
-    #ifdef SYS_LINUX
-        #include <X11/Xlib.h>
-    #else
-    #ifdef SYS_MINGW32
-        #include <windows.h>
-    #endif
-    #endif
-    #define GAMMA        1
-//  #define PACKED_YUV    1
-    #define F2(a) ((a)*(a))
-    #define F4(a,b,x) ((a)*(F2(x))+((b)*(x)))
-    #define ACCURACY 255
-    #define RATIO_MAX 2500
-    #define CLIP_01(a) (a < 0.0 ? 0.0 : (a > 1.0 ? 1.0 : a))
-//    #define CLIP_0A(a) (a < 0.0 ? 0.0 : (a > ACCURACY ? ACCURACY : a))
+#ifdef HAVE_CONFIG_H
+# include "config.h"
 #endif
+#include <math.h>
+#include <assert.h>
 
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-static int  Create    ( vlc_object_t * );
-static void Destroy   ( vlc_object_t * );
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+#include <vlc_video_splitter.h>
 
-static int  Init      ( vout_thread_t * );
-static void End       ( vout_thread_t * );
-#ifdef PACKED_YUV
-static void RenderPackedYUV   ( vout_thread_t *, picture_t * );
-#endif
-static void RenderPlanarYUV   ( vout_thread_t *, picture_t * );
-static void RenderPackedRGB   ( vout_thread_t *, picture_t * );
+/* FIXME it is needed for VOUT_ALIGN_* only */
+#include <vlc_vout.h>
 
-static void RemoveAllVout  ( vout_thread_t *p_vout );
+#define OVERLAP
 
-static int  SendEvents( vlc_object_t *, char const *,
-                        vlc_value_t, vlc_value_t, void * );
+#ifdef OVERLAP
+/* OS CODE DEPENDENT to get display dimensions */
+#   ifdef WIN32
+#       include <windows.h>
+#   else
+#       include <xcb/xcb.h>
+#       include <xcb/randr.h>
+#   endif
+#endif
 
 /*****************************************************************************
  * Module descriptor
@@ -89,61 +66,65 @@ static int  SendEvents( vlc_object_t *, char const *,
 #define ACTIVE_LONGTEXT N_("Comma separated list of active windows, " \
     "defaults to all")
 
-vlc_module_begin();
-    set_description( _("Panoramix: wall with overlap video filter") );
-    set_shortname( N_("Panoramix" ));
-    set_capability( "video filter", 0 );
-    set_category( CAT_VIDEO );
-    set_subcategory( SUBCAT_VIDEO_VFILTER );
+#define CFG_PREFIX "panoramix-"
 
-    add_integer( "panoramix-cols", -1, NULL, COLS_TEXT, COLS_LONGTEXT, VLC_TRUE );
-    add_integer( "panoramix-rows", -1, NULL, ROWS_TEXT, ROWS_LONGTEXT, VLC_TRUE );
+#define PANORAMIX_HELP N_("Split the video in multiple windows to " \
+    "display on a wall of screens")
 
-#ifdef OVERLAP
-#define OFFSET_X_TEXT N_("Offset X offset (automatic compensation)")
-#define OFFSET_X_LONGTEXT N_("Select if you want an automatic offset in horizontal (in case of misalignment due to autoratio control)")
-    add_bool( "offset-x", 1, NULL, OFFSET_X_TEXT, OFFSET_X_LONGTEXT, VLC_TRUE );
+static int  Open ( vlc_object_t * );
+static void Close( vlc_object_t * );
+
+vlc_module_begin()
+    set_description( N_("Panoramix: wall with overlap video filter") )
+    set_shortname( N_("Panoramix" ))
+    set_help(PANORAMIX_HELP)
+    set_capability( "video splitter", 0 )
+    set_category( CAT_VIDEO )
+    set_subcategory( SUBCAT_VIDEO_VFILTER )
+
+    add_integer( CFG_PREFIX "cols", -1, NULL, COLS_TEXT, COLS_LONGTEXT, true )
+    add_integer( CFG_PREFIX "rows", -1, NULL, ROWS_TEXT, ROWS_LONGTEXT, true )
 
+#ifdef OVERLAP
 #define LENGTH_TEXT N_("length of the overlapping area (in %)")
 #define LENGTH_LONGTEXT N_("Select in percent the length of the blended zone")
-    add_integer_with_range( "bz-length", 100, 0, 100, NULL, LENGTH_TEXT, LENGTH_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-length", 100, 0, 100, NULL, LENGTH_TEXT, LENGTH_LONGTEXT, true )
 
 #define HEIGHT_TEXT N_("height of the overlapping area (in %)")
 #define HEIGHT_LONGTEXT N_("Select in percent the height of the blended zone (case of 2x2 wall)")
-    add_integer_with_range( "bz-height", 100, 0, 100, NULL, HEIGHT_TEXT, HEIGHT_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-height", 100, 0, 100, NULL, HEIGHT_TEXT, HEIGHT_LONGTEXT, true )
 
 #define ATTENUATION_TEXT N_("Attenuation")
 #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)")
-    add_bool( "panoramix-attenuate", 1, NULL, ATTENUATION_TEXT, ATTENUATION_LONGTEXT, VLC_FALSE );
+    add_bool( CFG_PREFIX "attenuate", true, NULL, ATTENUATION_TEXT, ATTENUATION_LONGTEXT, false )
 
 #define BEGIN_TEXT N_("Attenuation, begin (in %)")
 #define BEGIN_LONGTEXT N_("Select in percent the Lagrange coeff of the beginning blended zone")
-    add_integer_with_range( "bz-begin", 0, 0, 100, NULL, BEGIN_TEXT, BEGIN_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-begin", 0, 0, 100, NULL, BEGIN_TEXT, BEGIN_LONGTEXT, true )
 
 #define MIDDLE_TEXT N_("Attenuation, middle (in %)")
 #define MIDDLE_LONGTEXT N_("Select in percent the Lagrange coeff of the middle of blended zone")
-    add_integer_with_range( "bz-middle", 50, 0, 100, NULL, MIDDLE_TEXT, MIDDLE_LONGTEXT, VLC_FALSE );
+    add_integer_with_range( CFG_PREFIX "bz-middle", 50, 0, 100, NULL, MIDDLE_TEXT, MIDDLE_LONGTEXT, false )
 
 #define END_TEXT N_("Attenuation, end (in %)")
 #define END_LONGTEXT N_("Select in percent the Lagrange coeff of the end of blended zone")
-    add_integer_with_range( "bz-end", 100, 0, 100, NULL, END_TEXT, END_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-end", 100, 0, 100, NULL, END_TEXT, END_LONGTEXT, true )
 
 #define MIDDLE_POS_TEXT N_("middle position (in %)")
 #define MIDDLE_POS_LONGTEXT N_("Select in percent (50 is center) the position of the middle point (Lagrange) of blended zone")
-    add_integer_with_range( "bz-middle-pos", 50, 1, 99, NULL, MIDDLE_POS_TEXT, MIDDLE_POS_LONGTEXT, VLC_FALSE );
-#ifdef GAMMA
+    add_integer_with_range( CFG_PREFIX "bz-middle-pos", 50, 1, 99, NULL, MIDDLE_POS_TEXT, MIDDLE_POS_LONGTEXT, false )
 #define RGAMMA_TEXT N_("Gamma (Red) correction")
 #define RGAMMA_LONGTEXT N_("Select the gamma for the correction of blended zone (Red or Y component)")
-    add_float_with_range( "bz-gamma-red", 1, 0, 5, NULL, RGAMMA_TEXT, RGAMMA_LONGTEXT, VLC_TRUE );
+    add_float_with_range( CFG_PREFIX "bz-gamma-red", 1, 0, 5, NULL, RGAMMA_TEXT, RGAMMA_LONGTEXT, true )
 
 #define GGAMMA_TEXT N_("Gamma (Green) correction")
 #define GGAMMA_LONGTEXT N_("Select the gamma for the correction of blended zone (Green or U component)")
-    add_float_with_range( "bz-gamma-green", 1, 0, 5, NULL, GGAMMA_TEXT, GGAMMA_LONGTEXT, VLC_TRUE );
+    add_float_with_range( CFG_PREFIX "bz-gamma-green", 1, 0, 5, NULL, GGAMMA_TEXT, GGAMMA_LONGTEXT, true )
 
 #define BGAMMA_TEXT N_("Gamma (Blue) correction")
 #define BGAMMA_LONGTEXT N_("Select the gamma for the correction of blended zone (Blue or V component)")
-    add_float_with_range( "bz-gamma-blue", 1, 0, 5, NULL, BGAMMA_TEXT, BGAMMA_LONGTEXT, VLC_TRUE );
-#endif
+    add_float_with_range( CFG_PREFIX "bz-gamma-blue", 1, 0, 5, NULL, BGAMMA_TEXT, BGAMMA_LONGTEXT, true )
+
 #define RGAMMA_BC_TEXT N_("Black Crush for Red")
 #define RGAMMA_BC_LONGTEXT N_("Select the Black Crush of blended zone (Red or Y component)")
 #define GGAMMA_BC_TEXT N_("Black Crush for Green")
@@ -171,1818 +152,930 @@ vlc_module_begin();
 #define GGAMMA_WL_LONGTEXT N_("Select the White Level of blended zone (Green or U component)")
 #define BGAMMA_WL_TEXT N_("White Level for Blue")
 #define BGAMMA_WL_LONGTEXT N_("Select the White Level of blended zone (Blue or V component)")
-    add_integer_with_range( "bz-blackcrush-red", 140, 0, 255, NULL, RGAMMA_BC_TEXT, RGAMMA_BC_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-blackcrush-green", 140, 0, 255, NULL, GGAMMA_BC_TEXT, GGAMMA_BC_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-blackcrush-blue", 140, 0, 255, NULL, BGAMMA_BC_TEXT, BGAMMA_BC_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-whitecrush-red", 200, 0, 255, NULL, RGAMMA_WC_TEXT, RGAMMA_WC_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-whitecrush-green", 200, 0, 255, NULL, GGAMMA_WC_TEXT, GGAMMA_WC_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-whitecrush-blue", 200, 0, 255, NULL, BGAMMA_WC_TEXT, BGAMMA_WC_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-blacklevel-red", 150, 0, 255, NULL, RGAMMA_BL_TEXT, RGAMMA_BL_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-blacklevel-green", 150, 0, 255, NULL, GGAMMA_BL_TEXT, GGAMMA_BL_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-blacklevel-blue", 150, 0, 255, NULL, BGAMMA_BL_TEXT, BGAMMA_BL_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-whitelevel-red", 0, 0, 255, NULL, RGAMMA_WL_TEXT, RGAMMA_WL_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-whitelevel-green", 0, 0, 255, NULL, GGAMMA_WL_TEXT, GGAMMA_WL_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-whitelevel-blue", 0, 0, 255, NULL, BGAMMA_WL_TEXT, BGAMMA_WL_LONGTEXT, VLC_TRUE );
-#ifdef SYS_LINUX
-#define XINERAMA_TEXT N_("Xinerama option")
-#define XINERAMA_LONGTEXT N_("Uncheck if you have not used xinerama")
-    add_bool( "xinerama", 1, NULL, XINERAMA_TEXT, XINERAMA_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-blackcrush-red", 140, 0, 255, NULL, RGAMMA_BC_TEXT, RGAMMA_BC_LONGTEXT, true )
+    add_integer_with_range( CFG_PREFIX "bz-blackcrush-green", 140, 0, 255, NULL, GGAMMA_BC_TEXT, GGAMMA_BC_LONGTEXT, true )
+    add_integer_with_range( CFG_PREFIX "bz-blackcrush-blue", 140, 0, 255, NULL, BGAMMA_BC_TEXT, BGAMMA_BC_LONGTEXT, true )
+    add_integer_with_range( CFG_PREFIX "bz-whitecrush-red", 200, 0, 255, NULL, RGAMMA_WC_TEXT, RGAMMA_WC_LONGTEXT, true )
+    add_integer_with_range( CFG_PREFIX "bz-whitecrush-green", 200, 0, 255, NULL, GGAMMA_WC_TEXT, GGAMMA_WC_LONGTEXT, true )
+    add_integer_with_range( CFG_PREFIX "bz-whitecrush-blue", 200, 0, 255, NULL, BGAMMA_WC_TEXT, BGAMMA_WC_LONGTEXT, true )
+    add_integer_with_range( CFG_PREFIX "bz-blacklevel-red", 150, 0, 255, NULL, RGAMMA_BL_TEXT, RGAMMA_BL_LONGTEXT, true )
+    add_integer_with_range( CFG_PREFIX "bz-blacklevel-green", 150, 0, 255, NULL, GGAMMA_BL_TEXT, GGAMMA_BL_LONGTEXT, true )
+    add_integer_with_range( CFG_PREFIX "bz-blacklevel-blue", 150, 0, 255, NULL, BGAMMA_BL_TEXT, BGAMMA_BL_LONGTEXT, true )
+    add_integer_with_range( CFG_PREFIX "bz-whitelevel-red", 0, 0, 255, NULL, RGAMMA_WL_TEXT, RGAMMA_WL_LONGTEXT, true )
+    add_integer_with_range( CFG_PREFIX "bz-whitelevel-green", 0, 0, 255, NULL, GGAMMA_WL_TEXT, GGAMMA_WL_LONGTEXT, true )
+    add_integer_with_range( CFG_PREFIX "bz-whitelevel-blue", 0, 0, 255, NULL, BGAMMA_WL_TEXT, BGAMMA_WL_LONGTEXT, true )
+#ifndef WIN32
+    add_obsolete_bool( CFG_PREFIX "xinerama" );
 #endif
+    add_obsolete_bool( CFG_PREFIX "offset-x" )
 #endif
 
-    add_string( "wall-active", NULL, NULL, ACTIVE_TEXT, ACTIVE_LONGTEXT, VLC_TRUE );
+    add_string( CFG_PREFIX "active", NULL, NULL, ACTIVE_TEXT, ACTIVE_LONGTEXT, true )
+
+    add_shortcut( "panoramix" )
+    set_callbacks( Open, Close )
+vlc_module_end()
 
-    add_shortcut( "panoramix" );
-    set_callbacks( Create, Destroy );
-vlc_module_end();
 
 /*****************************************************************************
- * vout_sys_t: Wall video output method descriptor
- *****************************************************************************
- * This structure is part of the video output thread descriptor.
- * It describes the Wall specific properties of an output thread.
+ * Local prototypes
  *****************************************************************************/
-struct vout_sys_t
-{
-#ifdef OVERLAP
-    vlc_bool_t   b_autocrop;
-    vlc_bool_t   b_attenuate;
-    unsigned int bz_length, bz_height, bz_begin, bz_middle, bz_end, bz_middle_pos;
-    unsigned int i_ratio_max;
-    unsigned int i_ratio;
-    unsigned int a_0, a_1, a_2;
-    vlc_bool_t     b_has_changed;
-    int lambda[2][VOUT_MAX_PLANES][500];
-    int cstYUV[2][VOUT_MAX_PLANES][500];
-    int lambda2[2][VOUT_MAX_PLANES][500];
-    int cstYUV2[2][VOUT_MAX_PLANES][500];
-    unsigned int i_halfLength;
-    unsigned int i_halfHeight;
-    int i_offset_x;
-    int i_offset_y;
-#ifdef GAMMA
-    float        f_gamma_red, f_gamma_green, f_gamma_blue;
-    float         f_gamma[VOUT_MAX_PLANES];
-    uint8_t         LUT[VOUT_MAX_PLANES][ACCURACY + 1][256];
-#ifdef PACKED_YUV
-    uint8_t         LUT2[VOUT_MAX_PLANES][256][500];
-#endif
-#endif
-#ifdef SYS_LINUX
-    vlc_bool_t   b_xinerama;
-#endif
-#endif
-    int    i_col;
-    int    i_row;
-    int    i_vout;
-    struct vout_list_t
-    {
-        vlc_bool_t b_active;
-        int i_width;
-        int i_height;
-        vout_thread_t *p_vout;
-    } *pp_vout;
+static const char *const ppsz_filter_options[] = {
+    "cols", "rows", "bz-length", "bz-height", "attenuate",
+    "bz-begin", "bz-middle", "bz-end", "bz-middle-pos", "bz-gamma-red",
+    "bz-gamma-green", "bz-gamma-blue", "bz-blackcrush-red",
+    "bz-blackcrush-green", "bz-blackcrush-blue", "bz-whitecrush-red",
+    "bz-whitecrush-green", "bz-whitecrush-blue", "bz-blacklevel-red",
+    "bz-blacklevel-green", "bz-blacklevel-blue", "bz-whitelevel-red",
+    "bz-whitelevel-green", "bz-whitelevel-blue", "active",
+    NULL
 };
 
+#define ROW_MAX (15)
+#define COL_MAX (15)
 
+#define ACCURACY 1000
 
-/*****************************************************************************
- * Control: control facility for the vout (forwards to child vout)
- *****************************************************************************/
-static int Control( vout_thread_t *p_vout, int i_query, va_list args )
+/* */
+static inline int clip_accuracy( int a )
 {
-    int i_row, i_col, i_vout = 0;
-
-    for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
-    {
-        for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
-        {
-            vout_vaControl( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
-                            i_query, args );
-            i_vout++;
-        }
-    }
-    return VLC_SUCCESS;
+    return (a > ACCURACY) ? ACCURACY : (a < 0) ? 0 : a;
 }
-
-/*****************************************************************************
- * Create: allocates Wall video thread output method
- *****************************************************************************
- * This function allocates and initializes a Wall vout method.
- *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static inline float clip_unit( float f )
 {
-    vout_thread_t *p_vout = (vout_thread_t *)p_this;
-    char *psz_method, *psz_tmp, *psz_method_tmp;
-    int i_vout;
+    return f < 0.0 ? 0.0 : ( f > 1.0 ? 1.0 : f );
+}
 
-    /* Allocate structure */
-    p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
-    if( p_vout->p_sys == NULL )
-    {
-        msg_Err( p_vout, "out of memory" );
-        return VLC_ENOMEM;
-    }
+/* */
+typedef struct
+{
+    float f_black_crush;
+    float f_black_level;
 
-    p_vout->pf_init = Init;
-    p_vout->pf_end = End;
-    p_vout->pf_manage = NULL;
-/* Color Format not supported
-// Planar Y, packed UV
-case VLC_FOURCC('Y','M','G','A'):
-// Packed YUV 4:2:2, U:Y:V:Y, interlaced
-case VLC_FOURCC('I','U','Y','V'):    // packed by 2
-// Packed YUV 2:1:1, Y:U:Y:V
-case VLC_FOURCC('Y','2','1','1'):     // packed by 4
-// Packed YUV Reverted
-case VLC_FOURCC('c','y','u','v'):    // packed by 2
-*/
-    switch (p_vout->render.i_chroma)
-    {
-    // planar YUV
-        case VLC_FOURCC('I','4','4','4'):
-        case VLC_FOURCC('I','4','2','2'):
-        case VLC_FOURCC('I','4','2','0'):
-        case VLC_FOURCC('Y','V','1','2'):
-        case VLC_FOURCC('I','Y','U','V'):
-        case VLC_FOURCC('I','4','1','1'):
-        case VLC_FOURCC('I','4','1','0'):
-        case VLC_FOURCC('Y','V','U','9'):
-        case VLC_FOURCC('Y','U','V','A'):
-            p_vout->pf_render = RenderPlanarYUV;
-            break;
-    // packed RGB
-        case VLC_FOURCC('R','G','B','2'):    // packed by 1
-        case VLC_FOURCC('R','V','1','5'):    // packed by 2
-        case VLC_FOURCC('R','V','1','6'):    // packed by 2
-        case VLC_FOURCC('R','V','2','4'):    // packed by 3
-        case VLC_FOURCC('R','V','3','2'):    // packed by 4
-            p_vout->pf_render = RenderPackedRGB;
-            break;
-#ifdef PACKED_YUV
-    // packed YUV
-        case VLC_FOURCC('Y','U','Y','2'):    // packed by 2
-        case VLC_FOURCC('Y','U','N','V'):    // packed by 2
-        case VLC_FOURCC('U','Y','V','Y'):    // packed by 2
-        case VLC_FOURCC('U','Y','N','V'):    // packed by 2
-        case VLC_FOURCC('Y','4','2','2'):    // packed by 2
-            p_vout->pf_render = RenderPackedYUV;
-            break;
-#endif
-        default:
-            msg_Err( p_vout, "colorspace not supported by plug-in !!!");
-            free( p_vout->p_sys );
-            return VLC_ENOMEM;
-    }
-    p_vout->pf_display = NULL;
-    p_vout->pf_control = Control;
+    float f_white_crush;
+    float f_white_level;
 
-    /* Look what method was requested */
-    p_vout->p_sys->i_col = config_GetInt( p_vout, "panoramix-cols" );
-    p_vout->p_sys->i_row = config_GetInt( p_vout, "panoramix-rows" );
+    float f_gamma;
+} panoramix_gamma_t;
 
-// OS dependant code :  Autodetect number of displays in wall
-#ifdef SYS_MINGW32
-    if ((p_vout->p_sys->i_col < 0) || (p_vout->p_sys->i_row < 0) )
+typedef struct
+{
+    struct
     {
-        int nbMonitors = GetSystemMetrics(SM_CMONITORS);
-        if (nbMonitors == 1)
-        {
-            nbMonitors = 5; // 1 display => 5x1 simulation
-            p_vout->p_sys->i_col = nbMonitors;
-            p_vout->p_sys->i_row = 1;
-        }
-        else
-        {
-            p_vout->p_sys->i_col = GetSystemMetrics( SM_CXVIRTUALSCREEN ) / GetSystemMetrics( SM_CXSCREEN );
-            p_vout->p_sys->i_row = GetSystemMetrics( SM_CYVIRTUALSCREEN ) / GetSystemMetrics( SM_CYSCREEN );
-            if (p_vout->p_sys->i_col * p_vout->p_sys->i_row != nbMonitors)
-            {
-                p_vout->p_sys->i_col = nbMonitors;
-                p_vout->p_sys->i_row = 1;
-            }
-        }
-        config_PutInt( p_vout, "panoramix-cols", p_vout->p_sys->i_col);
-        config_PutInt( p_vout, "panoramix-rows", p_vout->p_sys->i_row);
-    }
-#endif
-
-#ifdef OVERLAP
-    p_vout->p_sys->i_offset_x = config_GetInt( p_vout, "offset-x" );
-    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
-    p_vout->p_sys->b_autocrop = !(config_GetInt( p_vout, "ratio" ) == 0);
-    if (!p_vout->p_sys->b_autocrop) p_vout->p_sys->b_autocrop = config_GetInt( p_vout, "autocrop" );
-    p_vout->p_sys->b_attenuate = config_GetInt( p_vout, "panoramix-attenuate");
-    p_vout->p_sys->bz_length = config_GetInt( p_vout, "bz-length" );
-    if (p_vout->p_sys->i_row > 1)
-        p_vout->p_sys->bz_height = config_GetInt( p_vout, "bz-height" );
-    else
-        p_vout->p_sys->bz_height = 100;
-    p_vout->p_sys->bz_begin = config_GetInt( p_vout, "bz-begin" );
-    p_vout->p_sys->bz_middle = config_GetInt( p_vout, "bz-middle" );
-    p_vout->p_sys->bz_end = config_GetInt( p_vout, "bz-end" );
-    p_vout->p_sys->bz_middle_pos = config_GetInt( p_vout, "bz-middle-pos" );
-    double d_p = 100.0 / p_vout->p_sys->bz_middle_pos;
-    p_vout->p_sys->i_ratio_max = config_GetInt( p_vout, "ratio-max" ); // in crop module with autocrop ...
-    p_vout->p_sys->i_ratio = config_GetInt( p_vout, "ratio" ); // in crop module with manual ratio ...
-    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;
-    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;
-    p_vout->p_sys->a_0 =  p_vout->p_sys->bz_begin;
-
-#ifdef GAMMA
-    p_vout->p_sys->f_gamma_red = config_GetFloat( p_vout, "bz-gamma-red" );
-    p_vout->p_sys->f_gamma_green = config_GetFloat( p_vout, "bz-gamma-green" );
-    p_vout->p_sys->f_gamma_blue = config_GetFloat( p_vout, "bz-gamma-blue" );
-#endif
-#ifdef SYS_LINUX
-    p_vout->p_sys->b_xinerama= config_GetInt( p_vout, "xinerama" );
-#endif
-#else
-    p_vout->p_sys->i_col = __MAX( 1, __MIN( 15, p_vout->p_sys->i_col ) );
-    p_vout->p_sys->i_row = __MAX( 1, __MIN( 15, p_vout->p_sys->i_row ) );
-#endif
-
-    msg_Dbg( p_vout, "opening a %i x %i wall",
-             p_vout->p_sys->i_col, p_vout->p_sys->i_row );
-
-    p_vout->p_sys->pp_vout = malloc( p_vout->p_sys->i_row *
-                                     p_vout->p_sys->i_col *
-                                     sizeof(struct vout_list_t) );
-    if( p_vout->p_sys->pp_vout == NULL )
+        int i_left;
+        int i_right;
+        int i_top;
+        int i_bottom;
+    } black;
+    struct
     {
-        msg_Err( p_vout, "out of memory" );
-        free( p_vout->p_sys );
-        return VLC_ENOMEM;
-    }
-
-    psz_method_tmp = psz_method = config_GetPsz( p_vout, "wall-active" );
+        int i_left;
+        int i_right;
+        int i_top;
+        int i_bottom;
+    } attenuate;
+} panoramix_filter_t;
+
+typedef struct
+{
+    bool b_active;
+    int  i_output;
 
-    /* If no trailing vout are specified, take them all */
-    if( psz_method == NULL )
-    {
-        for( i_vout = p_vout->p_sys->i_row * p_vout->p_sys->i_col;
-             i_vout--; )
-        {
-            p_vout->p_sys->pp_vout[i_vout].b_active = 1;
-        }
-    }
-    /* If trailing vout are specified, activate only the requested ones */
-    else
-    {
-        for( i_vout = p_vout->p_sys->i_row * p_vout->p_sys->i_col;
-             i_vout--; )
-        {
-            p_vout->p_sys->pp_vout[i_vout].b_active = 0;
-        }
+    /* Output position and size */
+    int i_x;
+    int i_y;
+    int i_width;
+    int i_height;
+    int i_align;
 
-        while( *psz_method )
-        {
-            psz_tmp = psz_method;
-            while( *psz_tmp && *psz_tmp != ',' )
-            {
-                psz_tmp++;
-            }
+    /* Source position and size */
+    int  i_src_x;
+    int  i_src_y;
+    int  i_src_width;
+    int  i_src_height;
 
-            if( *psz_tmp )
-            {
-                *psz_tmp = '\0';
-                i_vout = atoi( psz_method );
-                psz_method = psz_tmp + 1;
-            }
-            else
-            {
-                i_vout = atoi( psz_method );
-                psz_method = psz_tmp;
-            }
+    /* Filter configuration to use to create the output */
+    panoramix_filter_t filter;
 
-            if( i_vout >= 0 &&
-                i_vout < p_vout->p_sys->i_row * p_vout->p_sys->i_col )
-            {
-                p_vout->p_sys->pp_vout[i_vout].b_active = 1;
-            }
-        }
-    }
+} panoramix_output_t;
 
-    free( psz_method_tmp );
+typedef struct
+{
+    vlc_fourcc_t i_chroma;
 
-    return VLC_SUCCESS;
-}
+    const int pi_div_w[VOUT_MAX_PLANES];
+    const int pi_div_h[VOUT_MAX_PLANES];
 
+    const int pi_black[VOUT_MAX_PLANES];
 
-#ifdef OVERLAP
-/*****************************************************************************
- *  Gamma: Gamma correction
- *****************************************************************************/
-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])
-{
-    float f_Input;
+    bool b_planar;
 
-    f_Input = (f_component * f_BlackLevel[i_plane]) / (f_BlackCrush[i_plane]) + (1.0 - f_BlackLevel[i_plane]);
-    if (f_component <= f_BlackCrush[i_plane])
-         return pow(f_Input, 1.0 / f_Gamma[i_plane]);
-    else if (f_component >= f_WhiteCrush[i_plane])
-    {
-        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);
-        return pow(f_Input, 1.0 / f_Gamma[i_plane]);
-    }
-           else
-            return 1.0;
-}
+} panoramix_chroma_t;
 
-#ifdef GAMMA
-/*****************************************************************************
- * CLIP_0A: clip between 0 and ACCURACY
- *****************************************************************************/
-inline static int CLIP_0A( int a )
+struct video_splitter_sys_t
 {
-    return (a > ACCURACY) ? ACCURACY : (a < 0) ? 0 : a;
-}
+    const panoramix_chroma_t *p_chroma;
 
-#ifdef PACKED_YUV
-/*****************************************************************************
- * Clip: clip an 32 bits int in 8 bits
- *****************************************************************************/
-inline static int32_t clip( int32_t a )
-{
-    return (a > 255) ? 255 : (a < 0) ? 0 : a;
-}
+    /* */
+    bool   b_attenuate;
+    unsigned int bz_length, bz_height;
+    unsigned int bz_begin, bz_middle, bz_end;
+    unsigned int bz_middle_pos;
+    unsigned int a_0, a_1, a_2;
 
-/*****************************************************************************
- * F: Function to calculate Gamma correction
- *****************************************************************************/
-static uint8_t F(uint8_t i, float gamma)
-{
- double input = (double) i / 255.0;
+    int lambdav[VOUT_MAX_PLANES][2][ACCURACY/2]; /* [plane][position][?] */
+    int lambdah[VOUT_MAX_PLANES][2][ACCURACY/2];
 
-// return clip(255 * pow(input, 1.0 / gamma));
+    unsigned int i_overlap_w2;  /* Half overlap width */
+    unsigned int i_overlap_h2;  /* Half overlap height */
+    uint8_t      p_lut[VOUT_MAX_PLANES][ACCURACY + 1][256];
 
- if (input < 0.5)
-     return clip((255 * pow(2 * input, gamma)) / 2);
- else
-     return clip(255 * (1 - pow(2 * (1 - input), gamma) / 2));
+    /* */
+    int i_col;
+    int i_row;
+    panoramix_output_t pp_output[COL_MAX][ROW_MAX]; /* [x][y] */
+};
 
-}
-#endif
-#endif
+/* */
+static int Filter( video_splitter_t *, picture_t *pp_dst[], picture_t * );
+
+static int Mouse( video_splitter_t *, vlc_mouse_t *,
+                  int i_index,
+                  const vlc_mouse_t *p_old, const vlc_mouse_t *p_new );
+
+
+/* */
+static int Configuration( panoramix_output_t pp_output[ROW_MAX][COL_MAX],
+                          int i_col, int i_row,
+                          int i_src_width, int i_src_height,
+                          int i_half_w, int i_half_h,
+                          bool b_attenuate,
+                          const bool *pb_active );
+static double GammaFactor( const panoramix_gamma_t *, float f_value );
+
+static void FilterPlanar( uint8_t *p_out, int i_out_pitch,
+                          const uint8_t *p_in, int i_in_pitch,
+                          int i_copy_pitch,
+                          int i_copy_lines,
+                          int i_pixel_black,
+                          const panoramix_filter_t *,
+                          uint8_t p_lut[ACCURACY + 1][256],
+                          int lambdav[2][ACCURACY/2],
+                          int lambdah[2][ACCURACY/2] );
+
+/* */
+static const panoramix_chroma_t p_chroma_array[] = {
+    /* Planar chroma */
+    { VLC_CODEC_I410, { 1, 4, 4, }, { 1, 1, 1, }, { 0, 128, 128 }, true },
+    { VLC_CODEC_I411, { 1, 4, 4, }, { 1, 4, 4, }, { 0, 128, 128 }, true },
+    { VLC_CODEC_YV12, { 1, 2, 2, }, { 1, 2, 2, }, { 0, 128, 128 }, true },
+    { VLC_CODEC_I420, { 1, 2, 2, }, { 1, 2, 2, }, { 0, 128, 128 }, true },
+    { VLC_CODEC_J420, { 1, 2, 2, }, { 1, 2, 2, }, { 0, 128, 128 }, true },
+    { VLC_CODEC_I422, { 1, 2, 2, }, { 1, 1, 1, }, { 0, 128, 128 }, true },
+    { VLC_CODEC_J422, { 1, 2, 2, }, { 1, 1, 1, }, { 0, 128, 128 }, true },
+    { VLC_CODEC_I440, { 1, 1, 1, }, { 1, 2, 2, }, { 0, 128, 128 }, true },
+    { VLC_CODEC_J440, { 1, 1, 1, }, { 1, 2, 2, }, { 0, 128, 128 }, true },
+    { VLC_CODEC_I444, { 1, 1, 1, }, { 1, 1, 1, }, { 0, 128, 128 }, true },
+    /* TODO packed chroma (yuv/rgb) ? */
+
+    { 0, {0, }, { 0, }, { 0, 0, 0 }, false }
+};
 
-/*****************************************************************************
- * AdjustHeight: ajust p_sys->i_height to have same BZ width for any ratio
- *****************************************************************************/
-static int AdjustHeight( vout_thread_t *p_vout )
+#ifndef WIN32
+/* Get the number of outputs */
+static unsigned CountMonitors( vlc_object_t *obj )
 {
-    vlc_bool_t b_fullscreen = config_GetInt( p_vout, "fullscreen" );
-    int i_window_width = p_vout->i_window_width;
-    int i_window_height = p_vout->i_window_height;
-    double d_halfLength = 0;
-    double d_halfLength_crop;
-    double d_halfLength_calculated;
-    int    i_offset = 0;
-
-// OS DEPENDANT CODE to get display dimensions
-        if (b_fullscreen)
-        {
-#ifdef SYS_LINUX
-            Display *p_display = XOpenDisplay( "" );
-        if (p_vout->p_sys->b_xinerama)
-         if (p_vout->p_sys->i_row == 2)
-         {
-            i_window_width = DisplayWidth(p_display, 0) / 2;
-            i_window_height = DisplayHeight(p_display, 0) /2;
-         }
-         else // p_vout->p_sys->i_row == 1
+    char *psz_display = var_CreateGetNonEmptyString( obj, "x11-display" );
+    int snum;
+    xcb_connection_t *conn = xcb_connect( psz_display, &snum );
+    free( psz_display );
+    if( xcb_connection_has_error( conn ) )
+        return 0;
+
+    const xcb_setup_t *setup = xcb_get_setup( conn );
+    xcb_screen_t *scr = NULL;
+    for( xcb_screen_iterator_t i = xcb_setup_roots_iterator( setup );
+         i.rem > 0; xcb_screen_next( &i ) )
+    {
+         if( snum == 0 )
          {
-            i_window_width = DisplayWidth(p_display, 0) / 2;
-            i_window_height = DisplayHeight(p_display, 0);
+             scr = i.data;
+             break;
          }
-        else
-        {
-            i_window_width = DisplayWidth(p_display, 0);
-            i_window_height = DisplayHeight(p_display, 0);
-        }
-#elif SYS_MINGW32
-            i_window_width  = GetSystemMetrics(SM_CXSCREEN);
-            i_window_height = GetSystemMetrics(SM_CYSCREEN);
-#endif
-        config_PutInt( p_vout, "width", i_window_width);
-        config_PutInt( p_vout, "height", i_window_height);
-        var_SetInteger( p_vout, "width", i_window_width);
-        var_SetInteger( p_vout, "height", i_window_height);
-        p_vout->i_window_width = i_window_width;
-           p_vout->i_window_height = i_window_height;
-        }
+         snum--;
+    }
 
-        if (p_vout->p_sys->bz_length)
-        if ((!p_vout->p_sys->b_autocrop) && (!p_vout->p_sys->i_ratio))
-        {
-            if ((p_vout->p_sys->i_row > 1) || (p_vout->p_sys->i_col > 1))
-            {
-              while ((d_halfLength <= 0) || (d_halfLength > p_vout->render.i_width / (2 * p_vout->p_sys->i_col)))
-              {
-                if (p_vout->p_sys->bz_length >= 50)
-                    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);
-                else
-                {
-                    d_halfLength = (p_vout->render.i_width * p_vout->p_sys->bz_length) / (100.0 * p_vout->p_sys->i_col);
-                    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);
-                }
-                if ((d_halfLength <= 0) || (d_halfLength > p_vout->render.i_width / (2 * p_vout->p_sys->i_col))) p_vout->p_sys->i_row--;
-                if (p_vout->p_sys->i_row < 1 )
-                {
-                    p_vout->p_sys->i_row = 1;
-                    break;
-                }
-              }
-              p_vout->p_sys->i_halfLength = (d_halfLength + 0.5);
-              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;
-              config_PutInt( p_vout, "bz-length", p_vout->p_sys->bz_length);
-              config_PutInt( p_vout, "panoramix-rows", p_vout->p_sys->i_row);
-              }
-        }
-        else
-        {
-            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;
-            d_halfLength_crop = d_halfLength * VOUT_ASPECT_FACTOR * (double)p_vout->output.i_width
-                        / (double)i_window_height / (double)p_vout->render.i_aspect;
-            p_vout->p_sys->i_halfLength = (d_halfLength_crop + 0.5);
-            d_halfLength_calculated = p_vout->p_sys->i_halfLength * (double)i_window_height *
-                                (double)p_vout->render.i_aspect  /     VOUT_ASPECT_FACTOR / (double)p_vout->output.i_width;
-
-            if (!p_vout->p_sys->b_attenuate)
-            {
-                double d_bz_length = (p_vout->p_sys->i_halfLength * p_vout->p_sys->i_col * 100.0) / p_vout->render.i_width;
-                // F(2x) != 2F(x) in opengl module
-                if (p_vout->p_sys->i_col == 2) d_bz_length = (100.0 * d_bz_length) / (100.0 - d_bz_length) ;
-                config_PutInt( p_vout, "bz-length", (int)(d_bz_length + 0.5));
-            }
-            i_offset =  (int)d_halfLength - (int)
-                        (p_vout->p_sys->i_halfLength * (double)i_window_height *
-                        (double)p_vout->render.i_aspect  /     VOUT_ASPECT_FACTOR / (double)p_vout->output.i_width);
-        }
-        else
-            d_halfLength = 0;
+    unsigned n = 0;
+    if( scr == NULL )
+        goto error;
+
+    xcb_randr_query_version_reply_t *v =
+        xcb_randr_query_version_reply( conn,
+            xcb_randr_query_version( conn, 1, 2 ), NULL );
+    if( v == NULL )
+        goto error;
+    msg_Dbg( obj, "using X RandR extension v%"PRIu32".%"PRIu32,
+             v->major_version, v->minor_version );
+    free( v );
+
+    xcb_randr_get_screen_resources_reply_t *r =
+        xcb_randr_get_screen_resources_reply( conn,
+            xcb_randr_get_screen_resources( conn, scr->root ), NULL );
+    if( r == NULL )
+        goto error;
+
+    const xcb_randr_output_t *outputs =
+        xcb_randr_get_screen_resources_outputs( r );
+    for( unsigned i = 0; i < r->num_outputs; i++ )
+    {
+        xcb_randr_get_output_info_reply_t *output =
+            xcb_randr_get_output_info_reply( conn,
+                xcb_randr_get_output_info( conn, outputs[i], 0 ), NULL );
+        if( output == NULL )
+            continue;
+        /* FIXME: do not count cloned outputs multiple times */
+        /* XXX: what to do with UNKNOWN state connections? */
+        n += output->connection == XCB_RANDR_CONNECTION_CONNECTED;
+        free( output );
+    }
+    free( r );
+    msg_Dbg( obj, "X randr has %u outputs", n );
 
-        return i_offset;
+error:
+    xcb_disconnect( conn );
+    return n;
 }
 #endif
 
-
 /*****************************************************************************
- * Init: initialize Wall video thread output method
+ * Open: allocates Wall video thread output method
+ *****************************************************************************
+ * This function allocates and initializes a Wall vout method.
  *****************************************************************************/
-static int Init( vout_thread_t *p_vout )
+static int Open( vlc_object_t *p_this )
 {
-    int i_index, i_row, i_col, i_width, i_height;
-    picture_t *p_pic;
-
-    I_OUTPUTPICTURES = 0;
+    video_splitter_t *p_splitter = (video_splitter_t*)p_this;
+    video_splitter_sys_t *p_sys;
 
-    /* Initialize the output structure */
-    p_vout->output.i_chroma = p_vout->render.i_chroma;
-    p_vout->output.i_width  = p_vout->render.i_width;
-    p_vout->output.i_height = p_vout->render.i_height;
-    p_vout->output.i_aspect = p_vout->render.i_aspect;
-#ifdef OVERLAP
-    p_vout->p_sys->b_has_changed = p_vout->p_sys->b_attenuate;
-#ifdef GAMMA
-    if (p_vout->p_sys->b_attenuate)
+    const panoramix_chroma_t *p_chroma;
+    for( int i = 0; ; i++ )
     {
-        int i_index2, i_plane;
-        int constantYUV[3] = {0,128,128};
-        float    f_BlackCrush[VOUT_MAX_PLANES];
-        float    f_BlackLevel[VOUT_MAX_PLANES];
-        float    f_WhiteCrush[VOUT_MAX_PLANES];
-        float    f_WhiteLevel[VOUT_MAX_PLANES];
-        p_vout->p_sys->f_gamma[0] = config_GetFloat( p_vout, "bz-gamma-red" );
-        p_vout->p_sys->f_gamma[1] = config_GetFloat( p_vout, "bz-gamma-green" );
-        p_vout->p_sys->f_gamma[2] = config_GetFloat( p_vout, "bz-gamma-blue" );
-        f_BlackCrush[0] = (float)config_GetInt( p_vout, "bz-blackcrush-red" ) / 255.0;
-        f_BlackCrush[1] = (float)config_GetInt( p_vout, "bz-blackcrush-green" ) / 255.0;
-        f_BlackCrush[2] = (float)config_GetInt( p_vout, "bz-blackcrush-blue" ) / 255.0;
-        f_WhiteCrush[0] = (float)config_GetInt( p_vout, "bz-whitecrush-red" ) / 255.0;
-        f_WhiteCrush[1] = (float)config_GetInt( p_vout, "bz-whitecrush-green" ) / 255.0;
-        f_WhiteCrush[2] = (float)config_GetInt( p_vout, "bz-whitecrush-blue" ) / 255.0;
-        f_BlackLevel[0] = (float)config_GetInt( p_vout, "bz-blacklevel-red" ) / 255.0;
-        f_BlackLevel[1] = (float)config_GetInt( p_vout, "bz-blacklevel-green" ) / 255.0;
-        f_BlackLevel[2] = (float)config_GetInt( p_vout, "bz-blacklevel-blue" ) / 255.0;
-        f_WhiteLevel[0] = (float)config_GetInt( p_vout, "bz-whitelevel-red" ) / 255.0;
-        f_WhiteLevel[1] = (float)config_GetInt( p_vout, "bz-whitelevel-green" ) / 255.0;
-        f_WhiteLevel[2] = (float)config_GetInt( p_vout, "bz-whitelevel-blue" ) / 255.0;
-        switch (p_vout->render.i_chroma)
+        vlc_fourcc_t i_chroma = p_chroma_array[i].i_chroma;
+        if( !i_chroma )
         {
-        // planar YVU
-            case VLC_FOURCC('Y','V','1','2'):
-            case VLC_FOURCC('Y','V','U','9'):
-        // packed UYV
-            case VLC_FOURCC('U','Y','V','Y'):    // packed by 2
-            case VLC_FOURCC('U','Y','N','V'):    // packed by 2
-            case VLC_FOURCC('Y','4','2','2'):    // packed by 2
-    //        case VLC_FOURCC('c','y','u','v'):    // packed by 2
-                p_vout->p_sys->f_gamma[2] = config_GetFloat( p_vout, "bz-gamma-green" );
-                p_vout->p_sys->f_gamma[1] = config_GetFloat( p_vout, "bz-gamma-blue" );
-                f_BlackCrush[2] = (float)config_GetInt( p_vout, "bz-blackcrush-green" ) / 255.0;
-                f_BlackCrush[1] = (float)config_GetInt( p_vout, "bz-blackcrush-blue" ) / 255.0;
-                f_WhiteCrush[2] = (float)config_GetInt( p_vout, "bz-whitecrush-green" ) / 255.0;
-                f_WhiteCrush[1] = (float)config_GetInt( p_vout, "bz-whitecrush-blue" ) / 255.0;
-                f_BlackLevel[2] = (float)config_GetInt( p_vout, "bz-blacklevel-green" ) / 255.0;
-                f_BlackLevel[1] = (float)config_GetInt( p_vout, "bz-blacklevel-blue" ) / 255.0;
-                f_WhiteLevel[2] = (float)config_GetInt( p_vout, "bz-whitelevel-green" ) / 255.0;
-                f_WhiteLevel[1] = (float)config_GetInt( p_vout, "bz-whitelevel-blue" ) / 255.0;
-        // planar YUV
-            case VLC_FOURCC('I','4','4','4'):
-            case VLC_FOURCC('I','4','2','2'):
-            case VLC_FOURCC('I','4','2','0'):
-            case VLC_FOURCC('I','4','1','1'):
-            case VLC_FOURCC('I','4','1','0'):
-            case VLC_FOURCC('I','Y','U','V'):
-            case VLC_FOURCC('Y','U','V','A'):
-        // packed YUV
-            case VLC_FOURCC('Y','U','Y','2'):    // packed by 2
-            case VLC_FOURCC('Y','U','N','V'):    // packed by 2
-                for (i_index = 0; i_index < 256; i_index++)
-                    for (i_index2 = 0; i_index2 <= ACCURACY; i_index2++)
-                        for (i_plane = 0; i_plane < VOUT_MAX_PLANES; i_plane++)
-                        {
-                            float f_lut = CLIP_01(1.0 -
-                                     ((ACCURACY - (float)i_index2)
-                                     * Gamma_Correction(i_plane, (float)i_index / 255.0, f_BlackCrush, f_WhiteCrush, f_BlackLevel, f_WhiteLevel, p_vout->p_sys->f_gamma)
-                                     / (ACCURACY - 1)));
-                            p_vout->p_sys->LUT[i_plane][i_index2][i_index] = f_lut * i_index + (int)((1.0 - f_lut) * (float)constantYUV[i_plane]);
-                        }
-                break;
-        // packed RGB
-            case VLC_FOURCC('R','G','B','2'):    // packed by 1
-            case VLC_FOURCC('R','V','1','5'):    // packed by 2
-            case VLC_FOURCC('R','V','1','6'):    // packed by 2
-            case VLC_FOURCC('R','V','2','4'):    // packed by 3
-            case VLC_FOURCC('R','V','3','2'):    // packed by 4
-            for (i_index = 0; i_index < 256; i_index++)
-                    for (i_index2 = 0; i_index2 <= ACCURACY; i_index2++)
-                        for (i_plane = 0; i_plane < VOUT_MAX_PLANES; i_plane++)
-                        {
-                            float f_lut = CLIP_01(1.0 -
-                                     ((ACCURACY - (float)i_index2)
-                                     * Gamma_Correction(i_plane, (float)i_index / 255.0, f_BlackCrush, f_WhiteCrush, f_BlackLevel, f_WhiteLevel, p_vout->p_sys->f_gamma)
-                                     / (ACCURACY - 1)));
-                            p_vout->p_sys->LUT[i_plane][i_index2][i_index] = f_lut * i_index;
-                        }
-                break;
-            default:
-                msg_Err( p_vout, "colorspace not supported by plug-in !!!");
-                free( p_vout->p_sys );
-                return VLC_ENOMEM;
+            msg_Err( p_splitter, "colorspace not supported by plug-in !" );
+            return VLC_EGENERIC;
         }
-    }
-#endif
-    if (p_vout->p_sys->i_offset_x)
-        p_vout->p_sys->i_offset_x = AdjustHeight(p_vout);
-    else
-        AdjustHeight(p_vout);
-#endif
-
-    /* Try to open the real video output */
-    msg_Dbg( p_vout, "spawning the real video outputs" );
-
-    p_vout->p_sys->i_vout = 0;
-
-    /* FIXME: use bresenham instead of those ugly divisions */
-    for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
-    {
-        for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
+        if( i_chroma == p_splitter->fmt.i_chroma )
         {
-            if( i_col + 1 < p_vout->p_sys->i_col )
-            {
-                i_width = ( p_vout->render.i_width
-                             / p_vout->p_sys->i_col ) & ~0x1;
-            }
-            else
-            {
-                i_width = p_vout->render.i_width
-                           - ( ( p_vout->render.i_width
-                                  / p_vout->p_sys->i_col ) & ~0x1 ) * i_col;
+            p_chroma = &p_chroma_array[i];
+            break;
+        }
+    }
 
-            }
-#ifdef OVERLAP
-            i_width += p_vout->p_sys->i_halfLength;
-            if (p_vout->p_sys->i_col > 2 ) i_width += p_vout->p_sys->i_halfLength;
-            i_width -= i_width % 2;
-#endif
-            if( i_row + 1 < p_vout->p_sys->i_row )
-            {
-                i_height = ( p_vout->render.i_height
-                              / p_vout->p_sys->i_row ) & ~0x3;
-            }
-            else
-            {
-                i_height = p_vout->render.i_height
-                            - ( ( p_vout->render.i_height
-                                   / p_vout->p_sys->i_row ) & ~0x3 ) * i_row;
-            }
+    /* Allocate structure */
+    p_splitter->p_sys = p_sys = malloc( sizeof( *p_sys ) );
+    if( !p_sys )
+        return VLC_ENOMEM;
 
-#ifdef OVERLAP
-            if (p_vout->p_sys->i_row >= 2)
-            {
-                p_vout->p_sys->i_halfHeight = (p_vout->p_sys->i_halfLength * p_vout->p_sys->bz_height) / 100;
-                p_vout->p_sys->i_halfHeight -= (p_vout->p_sys->i_halfHeight % 2);
-                i_height += p_vout->p_sys->i_halfHeight;
-                if (p_vout->p_sys->i_row > 2) i_height += p_vout->p_sys->i_halfHeight;
-            }
-            i_height -= i_height % 2;
-#endif
-            p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].i_width = i_width;
-            p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].i_height = i_height;
+    /* */
+    p_sys->p_chroma = p_chroma;
 
-            if( !p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].b_active )
-            {
-                p_vout->p_sys->i_vout++;
-                continue;
-            }
+    /* */
+    config_ChainParse( p_splitter, CFG_PREFIX, ppsz_filter_options,
+                       p_splitter->p_cfg );
 
-           video_format_t fmt = {0};
-
-            fmt.i_width = fmt.i_visible_width = p_vout->render.i_width;
-            fmt.i_height = fmt.i_visible_height = p_vout->render.i_height;
-            fmt.i_x_offset = fmt.i_y_offset = 0;
-            fmt.i_chroma = p_vout->render.i_chroma;
-            fmt.i_aspect = p_vout->render.i_aspect;
-            fmt.i_sar_num = p_vout->render.i_aspect * fmt.i_height / fmt.i_width;
-            fmt.i_sar_den = VOUT_ASPECT_FACTOR;
-            fmt.i_width = fmt.i_visible_width = i_width;
-            fmt.i_height = fmt.i_visible_height = i_height;
-            fmt.i_aspect = p_vout->render.i_aspect
-                              * p_vout->render.i_height / i_height
-                              * i_width / p_vout->render.i_width;
-#ifdef OVERLAP
-            if (p_vout->p_sys->i_offset_x < 0)
-            {
-                config_PutInt(p_vout, "video-x", -p_vout->p_sys->i_offset_x);
-                var_SetInteger(p_vout, "video-x", -p_vout->p_sys->i_offset_x);
-                p_vout->p_sys->i_offset_x = 0;
-            }
-#endif
-            p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout =
-                vout_Create( p_vout, &fmt);
+    /* */
+    p_sys->i_col = var_CreateGetInteger( p_splitter, CFG_PREFIX "cols" );
+    p_sys->i_row = var_CreateGetInteger( p_splitter, CFG_PREFIX "rows" );
 
-            if( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout == NULL )
+    /* Autodetect number of displays */
+    if( p_sys->i_col < 0 || p_sys->i_row < 0 )
+    {
+#ifdef WIN32
+        const int i_monitor_count = GetSystemMetrics(SM_CMONITORS);
+        if( i_monitor_count > 1 )
+        {
+            p_sys->i_col = GetSystemMetrics( SM_CXVIRTUALSCREEN ) / GetSystemMetrics( SM_CXSCREEN );
+            p_sys->i_row = GetSystemMetrics( SM_CYVIRTUALSCREEN ) / GetSystemMetrics( SM_CYSCREEN );
+            if( p_sys->i_col * p_sys->i_row != i_monitor_count )
             {
-                msg_Err( p_vout, "failed to get %ix%i vout threads",
-                                 p_vout->p_sys->i_col, p_vout->p_sys->i_row );
-                RemoveAllVout( p_vout );
-                return VLC_EGENERIC;
+                p_sys->i_col = i_monitor_count;
+                p_sys->i_row = 1;
             }
-            ADD_CALLBACKS(
-                p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout,
-                SendEvents );
-#ifdef OVERLAP
-            p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout->i_alignment = 0;
-            if (i_col == 0) p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout->i_alignment |= VOUT_ALIGN_RIGHT;
-            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;
-            if (p_vout->p_sys->i_row > 1)
+        }
+#else
+        const unsigned i_monitors = CountMonitors( p_this );
+        if( i_monitors > 1 ) /* Find closest to square */
+            for( unsigned w = 1; (i_monitors / w) >= w ; w++ )
             {
-                if (i_row == 0) p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout->i_alignment |= VOUT_ALIGN_BOTTOM;
-                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;
+                if( i_monitors % w )
+                    continue;
+                p_sys->i_row = w;
+                p_sys->i_col = i_monitors / w;
             }
-    // i_n : number of active pp_vout
-            int i_index, i_n = p_vout->p_sys->i_vout;
-                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;
-            var_SetInteger( p_vout, "align", p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout->i_alignment );
-            var_SetInteger( p_vout, "video-x", p_vout->p_sys->i_offset_x + ((i_n + 1) % p_vout->p_sys->i_col) * p_vout->i_window_width);
-            var_SetInteger( p_vout, "video-y", ((i_n + 1) / p_vout->p_sys->i_col) * p_vout->i_window_height);
 #endif
-            p_vout->p_sys->i_vout++;
-        }
+        /* By default do 2x1 */
+        if( p_sys->i_row < 0 )
+            p_sys->i_row = 1;
+        if( p_sys->i_col < 0 )
+            p_sys->i_col = 2;
+        var_SetInteger( p_splitter, CFG_PREFIX "cols", p_sys->i_col);
+        var_SetInteger( p_splitter, CFG_PREFIX "rows", p_sys->i_row);
     }
 
-    ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
-
-    ADD_PARENT_CALLBACKS( SendEventsToChild );
-
-    return VLC_SUCCESS;
-}
-
-/*****************************************************************************
- * End: terminate Wall video thread output method
- *****************************************************************************/
-static void End( vout_thread_t *p_vout )
-{
-    int i_index;
-
-#ifdef OVERLAP
-    config_PutInt( p_vout, "bz-length", p_vout->p_sys->bz_length);
-#endif
-    /* Free the fake output buffers we allocated */
-    for( i_index = I_OUTPUTPICTURES ; i_index ; )
+    /* */
+    p_sys->b_attenuate = var_CreateGetBool( p_splitter, CFG_PREFIX "attenuate");
+    p_sys->bz_length = var_CreateGetInteger( p_splitter, CFG_PREFIX "bz-length" );
+    p_sys->bz_height = var_CreateGetInteger( p_splitter, CFG_PREFIX "bz-height" );
+    p_sys->bz_begin = var_CreateGetInteger( p_splitter, CFG_PREFIX "bz-begin" );
+    p_sys->bz_middle = var_CreateGetInteger( p_splitter, CFG_PREFIX "bz-middle" );
+    p_sys->bz_end = var_CreateGetInteger( p_splitter, CFG_PREFIX "bz-end" );
+    p_sys->bz_middle_pos = var_CreateGetInteger( p_splitter, CFG_PREFIX "bz-middle-pos" );
+    double d_p = 100.0 / p_sys->bz_middle_pos;
+
+    p_sys->a_2 = d_p * p_sys->bz_begin - (double)(d_p * d_p / (d_p - 1)) * p_sys->bz_middle + (double)(d_p / (d_p - 1)) * p_sys->bz_end;
+    p_sys->a_1 = -(d_p + 1) * p_sys->bz_begin + (double)(d_p * d_p / (d_p - 1)) * p_sys->bz_middle - (double)(1 / (d_p - 1)) * p_sys->bz_end;
+    p_sys->a_0 =  p_sys->bz_begin;
+
+    /* */
+    p_sys->i_col = __MAX( 1, __MIN( COL_MAX, p_sys->i_col ) );
+    p_sys->i_row = __MAX( 1, __MIN( ROW_MAX, p_sys->i_row ) );
+    msg_Dbg( p_splitter, "opening a %i x %i wall",
+             p_sys->i_col, p_sys->i_row );
+
+    if( p_sys->bz_length > 0 && ( p_sys->i_row > 1 || p_sys->i_col > 1 ) )
     {
-        i_index--;
-        free( PP_OUTPUTPICTURE[ i_index ]->p_data_orig );
-    }
-}
-
-/*****************************************************************************
- * Destroy: destroy Wall video thread output method
- *****************************************************************************
- * Terminate an output method created by WallCreateOutputMethod
- *****************************************************************************/
-static void Destroy( vlc_object_t *p_this )
-{
-    vout_thread_t *p_vout = (vout_thread_t *)p_this;
-
-#ifdef GLOBAL_OUTPUT
-    DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents);
-    vlc_object_detach( p_vout->p_sys->p_vout );
-    vout_Destroy( p_vout->p_sys->p_vout );
-    DEL_PARENT_CALLBACKS( SendEventsToChild);
-#endif
-
-    RemoveAllVout( p_vout );
-    DEL_PARENT_CALLBACKS( SendEventsToChild );
-
-    free( p_vout->p_sys->pp_vout );
-    free( p_vout->p_sys );
-
-}
-
-/*****************************************************************************
- * RenderPlanarYUV: displays previously rendered output
- *****************************************************************************
- * This function send the currently rendered image to Wall image, waits
- * until it is displayed and switch the two rendering buffers, preparing next
- * frame.
- *****************************************************************************/
-static void RenderPlanarYUV( vout_thread_t *p_vout, picture_t *p_pic )
-{
-    picture_t *p_outpic = NULL;
-    int i_col, i_row, i_vout, i_plane;
-    int pi_left_skip[VOUT_MAX_PLANES], pi_top_skip[VOUT_MAX_PLANES];
-#ifdef OVERLAP
-    int LeftOffset, TopOffset;
-    int constantYUV[3] = {0,128,128};
-    int Denom;
-    int a_2;
-    int a_1;
-    int a_0;
-    int i_index, i_index2;
-#endif
+        const int i_overlap_w2_max = p_splitter->fmt.i_width  / p_sys->i_col / 2;
+        const int i_overlap_h2_max = p_splitter->fmt.i_height / p_sys->i_row / 2;
+        const int i_overlap2_max = __MIN( i_overlap_w2_max, i_overlap_h2_max );
 
+        if( p_sys->i_col > 1 )
+            p_sys->i_overlap_w2 = i_overlap2_max * p_sys->bz_length / 100;
+        else
+            p_sys->i_overlap_w2 = 0;
 
-    i_vout = 0;
+        if( p_sys->i_row > 1 )
+            p_sys->i_overlap_h2 = i_overlap2_max * p_sys->bz_height / 100;
+        else
+            p_sys->i_overlap_h2 = 0;
 
-    for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
+        /* */
+        int i_div_max_w = 1;
+        int i_div_max_h = 1;
+        for( int i = 0; i < VOUT_MAX_PLANES; i++ )
+        {
+            i_div_max_w = __MAX( i_div_max_w, p_chroma->pi_div_w[i] );
+            i_div_max_h = __MAX( i_div_max_h, p_chroma->pi_div_h[i] );
+        }
+        p_sys->i_overlap_w2 = i_div_max_w * (p_sys->i_overlap_w2 / i_div_max_w);
+        p_sys->i_overlap_h2 = i_div_max_h * (p_sys->i_overlap_h2 / i_div_max_h);
+    }
+    else
     {
-        pi_top_skip[i_plane] = 0;
+        p_sys->i_overlap_w2 = 0;
+        p_sys->i_overlap_h2 = 0;
     }
 
-    for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
+    /* Compute attenuate parameters */
+    if( p_sys->b_attenuate )
     {
-        for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
+        panoramix_gamma_t p_gamma[VOUT_MAX_PLANES];
+
+        p_gamma[0].f_gamma = var_CreateGetFloat( p_splitter, CFG_PREFIX "bz-gamma-red" );
+        p_gamma[1].f_gamma = var_CreateGetFloat( p_splitter, CFG_PREFIX "bz-gamma-green" );
+        p_gamma[2].f_gamma = var_CreateGetFloat( p_splitter, CFG_PREFIX "bz-gamma-blue" );
+
+        p_gamma[0].f_black_crush = var_CreateGetInteger( p_splitter, CFG_PREFIX "bz-blackcrush-red" ) / 255.0;
+        p_gamma[1].f_black_crush = var_CreateGetInteger( p_splitter, CFG_PREFIX "bz-blackcrush-green" ) / 255.0;
+        p_gamma[2].f_black_crush = var_CreateGetInteger( p_splitter, CFG_PREFIX "bz-blackcrush-blue" ) / 255.0;
+        p_gamma[0].f_white_crush = var_CreateGetInteger( p_splitter, CFG_PREFIX "bz-whitecrush-red" ) / 255.0;
+        p_gamma[1].f_white_crush = var_CreateGetInteger( p_splitter, CFG_PREFIX "bz-whitecrush-green" ) / 255.0;
+        p_gamma[2].f_white_crush = var_CreateGetInteger( p_splitter, CFG_PREFIX "bz-whitecrush-blue" ) / 255.0;
+
+        p_gamma[0].f_black_level = var_CreateGetInteger( p_splitter, CFG_PREFIX "bz-blacklevel-red" ) / 255.0;
+        p_gamma[1].f_black_level = var_CreateGetInteger( p_splitter, CFG_PREFIX "bz-blacklevel-green" ) / 255.0;
+        p_gamma[2].f_black_level = var_CreateGetInteger( p_splitter, CFG_PREFIX "bz-blacklevel-blue" ) / 255.0;
+        p_gamma[0].f_white_level = var_CreateGetInteger( p_splitter, CFG_PREFIX "bz-whitelevel-red" ) / 255.0;
+        p_gamma[1].f_white_level = var_CreateGetInteger( p_splitter, CFG_PREFIX "bz-whitelevel-green" ) / 255.0;
+        p_gamma[2].f_white_level = var_CreateGetInteger( p_splitter, CFG_PREFIX "bz-whitelevel-blue" ) / 255.0;
+
+        for( int i = 3; i < VOUT_MAX_PLANES; i++ )
         {
-            pi_left_skip[i_plane] = 0;
+            /* Initialize unsupported planes */
+            p_gamma[i].f_gamma = 1.0;
+            p_gamma[i].f_black_crush = 140.0/255.0;
+            p_gamma[i].f_white_crush = 200.0/255.0;
+            p_gamma[i].f_black_level = 150.0/255.0;
+            p_gamma[i].f_white_level = 0.0/255.0;
         }
 
-        for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
+        if( p_chroma->i_chroma == VLC_CODEC_YV12 )
+        {
+            /* Exchange U and V */
+            panoramix_gamma_t t = p_gamma[1];
+            p_gamma[1] = p_gamma[2];
+            p_gamma[2] = t;
+        }
+        
+        for( int i_index = 0; i_index < 256; i_index++ )
         {
-            if( !p_vout->p_sys->pp_vout[ i_vout ].b_active )
+            for( int i_index2 = 0; i_index2 <= ACCURACY; i_index2++ )
             {
-                for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
+                for( int i_plane = 0; i_plane < VOUT_MAX_PLANES; i_plane++ )
                 {
-                    pi_left_skip[i_plane] +=
-                        p_vout->p_sys->pp_vout[ i_vout ].i_width
-                         * p_pic->p[i_plane].i_pitch / p_vout->output.i_width;
-                }
-                i_vout++;
-                continue;
-            }
+                    double f_factor = GammaFactor( &p_gamma[i_plane], (float)i_index / 255.0 );
 
-            while( ( p_outpic =
-                vout_CreatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
-                                    0, 0, 0 )
-                   ) == NULL )
-            {
-                if( p_vout->b_die || p_vout->b_error )
-                {
-                    vout_DestroyPicture(
-                        p_vout->p_sys->pp_vout[ i_vout ].p_vout, p_outpic );
-                    return;
-                }
+                    float f_lut = clip_unit( 1.0 - ((ACCURACY - (float)i_index2) * f_factor / (ACCURACY - 1)) );
 
-                msleep( VOUT_OUTMEM_SLEEP );
+                    p_sys->p_lut[i_plane][i_index2][i_index] = f_lut * i_index + (int)( (1.0 - f_lut) * (float)p_chroma->pi_black[i_plane] );
+                }
             }
+        }
 
-            vout_DatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
-                              p_outpic, p_pic->date );
-            vout_LinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
-                              p_outpic );
-
-            for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
-            {
-                uint8_t *p_in, *p_in_end, *p_out;
-                int i_in_pitch = p_pic->p[i_plane].i_pitch;
-                int i_out_pitch = p_outpic->p[i_plane].i_pitch;
-                int i_copy_pitch = p_outpic->p[i_plane].i_visible_pitch;
-                int i_lines = p_outpic->p[i_plane].i_visible_lines;
-#ifdef OVERLAP
-                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);
-                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);
-                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);
-                if ((!p_vout->p_sys->pp_vout[p_vout->p_sys->i_col].b_active))
-                    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);
-// i_n : previous inactive pp_vout
-                int i_n=0;
-                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++;
-                if ((i_col > 1) && i_n)
-                    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);
-
-                p_in = p_pic->p[i_plane].p_pixels
-                /* Wall proprities */
-                + pi_top_skip[i_plane] + pi_left_skip[i_plane];
-
-                if ((p_vout->p_sys->i_row > 2) &&
-                    ((!i_row) || (i_row + 1 == p_vout->p_sys->i_row)))
-                        i_lines -= (2 * p_vout->p_sys->i_halfHeight) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
-
-// 1088 lines bug in a mpeg2 stream of 1080 lines
-                if ((p_vout->p_sys->i_row - 1 == i_row) &&
-                    (p_pic->p[i_plane].i_lines == 1088))
-                        i_lines -= 8 / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
-
-                p_in_end = p_in + i_lines * p_pic->p[i_plane].i_pitch;
-#else
-                p_in = p_pic->p[i_plane].p_pixels
-                        + pi_top_skip[i_plane] + pi_left_skip[i_plane];
-
-                p_in_end = p_in + i_lines * p_pic->p[i_plane].i_pitch;
-#endif
-                p_out = p_outpic->p[i_plane].p_pixels;
-#ifdef OVERLAP
-        if ((p_vout->p_sys->i_row > 2) && (!i_row))
-            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));
-
-        int length;
-        int i_col_mod;
-        length = 2 * p_vout->p_sys->i_halfLength / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
-
-        if (p_vout->p_sys->b_has_changed)
+        for( int i_plane = 0; i_plane < VOUT_MAX_PLANES; i_plane++ )
         {
-            Denom = F2(length);
-            a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
-            a_1 = p_vout->p_sys->a_1 * length * (ACCURACY / 100);
-            a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
-            for(i_col_mod = 0; i_col_mod < 2; i_col_mod++)
-             for (i_index = 0; i_index < length; i_index++)
-             {
-                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);
-                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;
-             }
-        }
-#endif
-            while( p_in < p_in_end )
-            {
-#ifndef OVERLAP
-                p_vout->p_libvlc->pf_memcpy( p_out , p_in, i_copy_pitch);
-#else
-                if (p_vout->p_sys->i_col > 2)
-                {
-                    length /= 2;
-                    if (i_col == 0)
-                        p_vout->p_libvlc->pf_memcpy( p_out + length , p_in, i_copy_pitch - length);
-                    else if (i_col + 1 == p_vout->p_sys->i_col)
-                            p_vout->p_libvlc->pf_memcpy( p_out, p_in - length, i_copy_pitch - length);
-                         else
-                            p_vout->p_libvlc->pf_memcpy( p_out, p_in - length, i_copy_pitch);
-
-                    if ((i_col == 0))
-                    // black bar
-                    {
-                        LeftOffset = 0;
-                        p_out += LeftOffset;
-                        memset(p_out, constantYUV[i_plane], length);
-                        p_out -= LeftOffset;
-                    }
-                    else if ((i_col + 1 == p_vout->p_sys->i_col ))
-                    // black bar
-                        {
-                            LeftOffset = i_copy_pitch - length;
-                            p_out += LeftOffset;
-                            memset(p_out, constantYUV[i_plane], length);
-                            p_out -= LeftOffset;
-                        }
-                    length *= 2;
-                }
-                else
-                    p_vout->p_libvlc->pf_memcpy( p_out , p_in, i_copy_pitch);
+            if( !p_chroma->pi_div_w[i_plane] || !p_chroma->pi_div_h[i_plane] )
+                continue;
+            const int i_length_w = (2 * p_sys->i_overlap_w2) / p_chroma->pi_div_w[i_plane];
+            const int i_length_h = (2 * p_sys->i_overlap_h2) / p_chroma->pi_div_h[i_plane];
 
-              if (p_vout->p_sys->b_attenuate)
+            for( int i_dir = 0; i_dir < 2; i_dir++ )
             {
-// vertical blend
-// first blended zone
-                if (i_col)
-                {
-                    LeftOffset = 0;
-                    p_out += LeftOffset;
-                    for (i_index = 0; i_index < length; i_index++)
-                    {
-#ifndef GAMMA
-                        *(p_out + i_index) = (p_vout->p_sys->lambda[1][i_plane][i_index] *
-                                 (*(p_out + i_index))) / ACCURACY +
-                                     p_vout->p_sys->cstYUV[1][i_plane][i_index];
-#else
-                            *(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)];
-#endif
-                    }
-                    p_out -= LeftOffset;
-                }
-// second blended zone
-                if (i_col + 1 < p_vout->p_sys->i_col)
+                const int i_length = i_dir == 0 ? i_length_w : i_length_h;
+                const int i_den = i_length * i_length;
+                const int a_2 = p_sys->a_2 * (ACCURACY / 100);
+                const int a_1 = p_sys->a_1 * i_length * (ACCURACY / 100);
+                const int a_0 = p_sys->a_0 * i_den * (ACCURACY / 100);
+
+                for( int i_position = 0; i_position < 2; i_position++ )
                 {
-                    LeftOffset = i_copy_pitch - length;
-                    p_out +=  LeftOffset;
-                    for (i_index = 0; i_index < length; i_index++)
+                    for( int i_index = 0; i_index < i_length; i_index++ )
                     {
-#ifndef GAMMA
-                            *(p_out + i_index) = (p_vout->p_sys->lambda[0][i_plane][i_index] *
-                                     (*(p_out + i_index))) / ACCURACY +
-                                     p_vout->p_sys->cstYUV[0][i_plane][i_index];
-#else
+                        const int v = i_position == 1 ? i_index : (i_length - i_index);
+                        const int i_lambda = clip_accuracy( ACCURACY - (a_2 * v*v + a_1 * v + a_0) / i_den );
 
-                        *(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)];
-#endif
+                        if( i_dir == 0 )
+                            p_sys->lambdav[i_plane][i_position][i_index] = i_lambda;
+                        else
+                            p_sys->lambdah[i_plane][i_position][i_index] = i_lambda;
                     }
-                    p_out -= LeftOffset;
                 }
-// end blended zone
-            }
-#endif
-                p_in += i_in_pitch;
-                p_out += i_out_pitch;
-            }
-#ifdef OVERLAP
-// horizontal blend
-        if (!p_vout->p_sys->b_attenuate)
-        {
-            if ((i_row == 0) && (p_vout->p_sys->i_row > 2))
-            // black bar
-            {
-                    int height = 2 * p_vout->p_sys->i_halfHeight / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
-                    TopOffset = i_lines + (2 * p_vout->p_sys->i_halfHeight) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
-                    p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
-                    for (i_index = 0; i_index < height; i_index++)
-                        for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
-                            *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = constantYUV[i_plane];
-                    p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
             }
-            else if ((i_row + 1 == p_vout->p_sys->i_row) && (p_vout->p_sys->i_row > 2))
-            // black bar
-                {
-                        int height = 2 * p_vout->p_sys->i_halfHeight / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
-                        TopOffset = height - (2 * p_vout->p_sys->i_halfHeight) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
-                        p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
-                        for (i_index = 0; i_index < height; i_index++)
-                            for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
-                                *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = constantYUV[i_plane];
-                        p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
-                }
         }
-        else
-        {
-            if (p_vout->p_sys->i_row >= 2)
-            {
-                length = 2 * p_vout->p_sys->i_halfHeight / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
-                if (p_vout->p_sys->b_has_changed)
-                {
-                    Denom = F2(length);
-                    a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
-                    a_1 = p_vout->p_sys->a_1 * length * (ACCURACY / 100);
-                    a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
-                   for(i_col_mod = 0; i_col_mod < 2; i_col_mod++)
-                    for (i_index = 0; i_index < length; i_index++)
-                    {
-                        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);
-                        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;
-                    }
-                }
-// first blended zone
-
-            if (i_row)
-            {
-                TopOffset = i_lines;
-                p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
-                for (i_index = 0; i_index < length; i_index++)
-                    for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
-#ifndef GAMMA
-                        *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = (p_vout->p_sys->lambda2[1][i_plane][i_index] *
-                                     (*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2))) / ACCURACY +
-                                     p_vout->p_sys->cstYUV2[1][i_plane][i_index];
-#else
-
-                        *(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)];
-#endif
-                p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
-            }
-            else if (p_vout->p_sys->i_row > 2)
-            // black bar
-            {
-                TopOffset = i_lines + (2 * p_vout->p_sys->i_halfHeight) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
-                p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
-                for (i_index = 0; i_index < length; i_index++)
-                    for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
-                        *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = constantYUV[i_plane];
-                p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
-            }
-
-// second blended zone
+    }
 
-            if (i_row + 1 < p_vout->p_sys->i_row)
-            {
-                TopOffset = length;
-                p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
-                for (i_index = 0; i_index < length; i_index++)
-                    for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
-#ifndef GAMMA
-                        *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = (p_vout->p_sys->lambda2[0][i_plane][i_index] *
-                                     (*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2))) / ACCURACY +
-                                     p_vout->p_sys->cstYUV2[0][i_plane][i_index];
-#else
+    /* */
+    char *psz_state = var_CreateGetNonEmptyString( p_splitter, CFG_PREFIX "active" );
 
-                        *(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)];
+    /* */
+    bool pb_active[COL_MAX*ROW_MAX];
 
-#endif
-                p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
-            }
-            else if (p_vout->p_sys->i_row > 2)
-            // black bar
-            {
-                TopOffset = length - (2 * p_vout->p_sys->i_halfHeight) / (p_vout->p_sys->pp_vout[i_vout].i_width / i_copy_pitch);
-                p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
-                for (i_index = 0; i_index < length; i_index++)
-                    for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
-                        *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = constantYUV[i_plane];
-                p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
-            }
-// end blended zone
-            }
-        }
-#endif
-// bug for wall filter : fix by CC
-//            pi_left_skip[i_plane] += i_out_pitch;
-            pi_left_skip[i_plane] += i_copy_pitch;
-            }
+    for( int i = 0; i < COL_MAX*ROW_MAX; i++ )
+        pb_active[i] = psz_state == NULL;
 
-            vout_UnlinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
-                                p_outpic );
-            vout_DisplayPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
-                                 p_outpic );
-            i_vout++;
-        }
+    /* Parse active list if provided */
+    char *psz_tmp = psz_state;
+    while( psz_tmp && *psz_tmp )
+    {
+        char *psz_next = strchr( psz_tmp, ',' );
+        if( psz_next )
+            *psz_next++ = '\0';
 
-        for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
-                {
-                    pi_top_skip[i_plane] += p_vout->p_sys->pp_vout[ i_vout ].i_height
-                                             * p_pic->p[i_plane].i_lines
-                                             / p_vout->output.i_height
-                                             * p_pic->p[i_plane].i_pitch;
-                }
+        const int i_index = atoi( psz_tmp );
+        if( i_index >= 0 && i_index < COL_MAX*ROW_MAX )
+            pb_active[i_index] = true;
 
+        psz_tmp = psz_next;
     }
-#ifdef OVERLAP
-    if (p_vout->p_sys->b_has_changed) p_vout->p_sys->b_has_changed = VLC_FALSE;
-#endif
-}
-
-
-/*****************************************************************************
- * RenderPackedRGB: displays previously rendered output
- *****************************************************************************
- * This function send the currently rendered image to Wall image, waits
- * until it is displayed and switch the two rendering buffers, preparing next
- * frame.
- *****************************************************************************/
-static void RenderPackedRGB( vout_thread_t *p_vout, picture_t *p_pic )
-{
-    picture_t *p_outpic = NULL;
-    int i_col, i_row, i_vout, i_plane;
-    int pi_left_skip[VOUT_MAX_PLANES], pi_top_skip[VOUT_MAX_PLANES];
-#ifdef OVERLAP
-    int LeftOffset, TopOffset;
-    int Denom;
-    int a_2;
-    int a_1;
-    int a_0;
-    int i_index, i_index2;
-#endif
-
-    i_vout = 0;
-
-    for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
+    free( psz_state );
+
+    /* */
+    p_splitter->i_output =
+        Configuration( p_sys->pp_output,
+                       p_sys->i_col, p_sys->i_row,
+                       p_splitter->fmt.i_width, p_splitter->fmt.i_height,
+                       p_sys->i_overlap_w2, p_sys->i_overlap_h2,
+                       p_sys->b_attenuate,
+                       pb_active );
+    p_splitter->p_output = calloc( p_splitter->i_output,
+                                   sizeof(*p_splitter->p_output) );
+    if( !p_splitter->p_output )
     {
-        pi_top_skip[i_plane] = 0;
+        free( p_sys );
+        return VLC_ENOMEM;
     }
 
-    for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
+    for( int y = 0; y < p_sys->i_row; y++ )
     {
-        for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
-        {
-            pi_left_skip[i_plane] = 0;
-        }
-
-        for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
+        for( int x = 0; x < p_sys->i_col; x++ )
         {
-            if( !p_vout->p_sys->pp_vout[ i_vout ].b_active )
-            {
-                for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
-                {
-                    pi_left_skip[i_plane] +=
-                        p_vout->p_sys->pp_vout[ i_vout ].i_width * p_pic->p->i_pixel_pitch;
-                }
-                i_vout++;
+            panoramix_output_t *p_output = &p_sys->pp_output[x][y];
+            if( !p_output->b_active )
                 continue;
-            }
 
-            while( ( p_outpic =
-                vout_CreatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
-                                    0, 0, 0 )
-                   ) == NULL )
-            {
-                if( p_vout->b_die || p_vout->b_error )
-                {
-                    vout_DestroyPicture(
-                        p_vout->p_sys->pp_vout[ i_vout ].p_vout, p_outpic );
-                    return;
-                }
+            video_splitter_output_t *p_cfg = &p_splitter->p_output[p_output->i_output];
 
-                msleep( VOUT_OUTMEM_SLEEP );
-            }
+            /* */
+            video_format_Copy( &p_cfg->fmt, &p_splitter->fmt );
+            p_cfg->fmt.i_visible_width  =
+            p_cfg->fmt.i_width          = p_output->i_width;
+            p_cfg->fmt.i_visible_height =
+            p_cfg->fmt.i_height         = p_output->i_height;
 
-            vout_DatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
-                              p_outpic, p_pic->date );
-            vout_LinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
-                              p_outpic );
+            p_cfg->window.i_x     = p_output->i_x;
+            p_cfg->window.i_y     = p_output->i_y;
+            p_cfg->window.i_align = p_output->i_align;
 
-            for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
-            {
-                uint8_t *p_in, *p_in_end, *p_out;
-                int i_in_pitch = p_pic->p[i_plane].i_pitch;
-                int i_out_pitch = p_outpic->p[i_plane].i_pitch;
-                int i_copy_pitch = p_outpic->p[i_plane].i_visible_pitch;
+            p_cfg->psz_module = NULL;
+        }
+    }
 
-#ifdef OVERLAP
-                if (i_col) pi_left_skip[i_plane] -= (2 * p_vout->p_sys->i_halfLength) * p_pic->p->i_pixel_pitch;
-                if ((i_row) && (!i_col)) pi_top_skip[i_plane] -= (2 * p_vout->p_sys->i_halfHeight * p_pic->p[i_plane].i_pitch);
-                if ((!p_vout->p_sys->pp_vout[p_vout->p_sys->i_col].b_active))
-                    pi_top_skip[i_plane] -= (2 * p_vout->p_sys->i_halfHeight * i_row * p_pic->p[i_plane].i_pitch);
-// i_n : previous inactive pp_vout
-                int i_n=0;
-                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++;
-                if ((i_col > 1) && i_n)
-                    pi_left_skip[i_plane] -= i_n*(2 * p_vout->p_sys->i_halfLength ) * p_pic->p->i_pixel_pitch;
-
-                p_in = p_pic->p[i_plane].p_pixels
-                /* Wall proprities */
-                + pi_top_skip[i_plane] + pi_left_skip[i_plane];
-
-                int i_lines = p_outpic->p[i_plane].i_visible_lines;
-// 1088 lines bug in a mpeg2 stream of 1080 lines
-                if ((p_vout->p_sys->i_row - 1 == i_row) &&
-                    (p_pic->p[i_plane].i_lines == 1088))
-                        i_lines -= 8;
-
-                p_in_end = p_in + i_lines * p_pic->p[i_plane].i_pitch;
-#else
-                p_in = p_pic->p[i_plane].p_pixels
-                        + pi_top_skip[i_plane] + pi_left_skip[i_plane];
 
-                p_in_end = p_in + p_outpic->p[i_plane].i_visible_lines
-                                        * p_pic->p[i_plane].i_pitch;
-#endif //OVERLAP
+    /* */
+    p_splitter->pf_filter = Filter;
+    p_splitter->pf_mouse  = Mouse;
 
-                p_out = p_outpic->p[i_plane].p_pixels;
+    return VLC_SUCCESS;
+}
 
+/**
+ * Terminate a splitter module
+ */
+static void Close( vlc_object_t *p_this )
+{
+    video_splitter_t *p_splitter = (video_splitter_t*)p_this;
+    video_splitter_sys_t *p_sys = p_splitter->p_sys;
 
-#ifdef OVERLAP
-        if ((p_vout->p_sys->i_row > 2) && (!i_row))
-            p_out += (p_outpic->p[i_plane].i_pitch * (2 * p_vout->p_sys->i_halfHeight) * p_pic->p->i_pixel_pitch);
+    free( p_splitter->p_output );
+    free( p_sys );
+}
 
-        int length;
-        length = 2 * p_vout->p_sys->i_halfLength * p_pic->p->i_pixel_pitch;
+/**
+ * It creates multiples pictures from the source one
+ */
+static int Filter( video_splitter_t *p_splitter, picture_t *pp_dst[], picture_t *p_src )
+{
+    video_splitter_sys_t *p_sys = p_splitter->p_sys;
 
-        if (p_vout->p_sys->b_has_changed)
-        {
-            int i_plane_;
-            int i_col_mod;
-            Denom = F2(length / p_pic->p->i_pixel_pitch);
-            a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
-            a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfLength * (ACCURACY / 100);
-            a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
-            for(i_col_mod = 0; i_col_mod < 2; i_col_mod++)
-                for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index++)
-                    for (i_plane_ =  0; i_plane_ < p_pic->p->i_pixel_pitch; i_plane_++)
-                        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);
-        }
-#endif
-            while( p_in < p_in_end )
-            {
-#ifndef OVERLAP
-                p_vout->p_libvlc->pf_memcpy( p_out, p_in, i_copy_pitch);
-#else
-                if (p_vout->p_sys->i_col > 2)
-                {
-                    // vertical blend
-                    length /= 2;
-                    if (i_col == 0)
-                        p_vout->p_libvlc->pf_memcpy( p_out + length, p_in, i_copy_pitch - length);
-                    else if (i_col + 1 == p_vout->p_sys->i_col)
-                            p_vout->p_libvlc->pf_memcpy( p_out, p_in - length, i_copy_pitch - length);
-                         else
-                            p_vout->p_libvlc->pf_memcpy( p_out, p_in - length, i_copy_pitch);
-
-                    if ((i_col == 0))
-                    // black bar
-                    {
-                        LeftOffset = 0;
-                        p_out += LeftOffset;
-                        p_in += LeftOffset;
-                        for (i_index = 0; i_index < length; i_index++)
-                                *(p_out + i_index) = 0;
-                        p_out -= LeftOffset;
-                        p_in -= LeftOffset;
-                    }
-                    else if ((i_col + 1 == p_vout->p_sys->i_col ))
-                    // black bar
-                        {
-                            LeftOffset = i_copy_pitch - length;
-                            p_out += LeftOffset;
-                            p_in += LeftOffset;
-                            for (i_index = 0; i_index < length; i_index++)
-                                    *(p_out + i_index) = 0;
-                            p_out -= LeftOffset;
-                            p_in -= LeftOffset;
-                        }
-                    length *= 2;
-                }
-                else
-                    p_vout->p_libvlc->pf_memcpy( p_out, p_in, i_copy_pitch);
+    if( video_splitter_NewPicture( p_splitter, pp_dst ) )
+    {
+        picture_Release( p_src );
+        return VLC_EGENERIC;
+    }
 
-// vertical blend
-// first blended zone
-            if (i_col)
-            {
-                LeftOffset = 0;
-                p_out += LeftOffset;
-                for (i_index = 0; i_index < length; i_index++)
-#ifndef GAMMA
-                    *(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] *
-                                 (*(p_out + i_index))) / ACCURACY;
-#else
-                    *(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)];
-#endif
-                p_out -= LeftOffset;
-            }
-// second blended zone
-            if (i_col + 1 < p_vout->p_sys->i_col)
-            {
-                LeftOffset = i_copy_pitch - length;
-                p_out +=  LeftOffset;
-                for (i_index = 0; i_index < length; i_index++)
-#ifndef GAMMA
-                    *(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] *
-                                 (*(p_out + i_index))) / ACCURACY;
-#else
-                    *(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)];
-#endif
-                p_out -= LeftOffset;
-            }
-// end blended zone
-#endif //OVERLAP
-                p_in += i_in_pitch;
-                p_out += i_out_pitch;
-            }
-#ifdef OVERLAP
-// horizontal blend
-        if (!p_vout->p_sys->b_attenuate)
-        {
-            if ((i_row == 0) && (p_vout->p_sys->i_row > 2))
-            // black bar
-            {
-                    TopOffset = i_lines + (2 * p_vout->p_sys->i_halfHeight);
-                    p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
-                    for (i_index = 0; i_index < length; i_index++)
-                        for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
-                            *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = 0;
-                    p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
-            }
-            else if ((i_row + 1 == p_vout->p_sys->i_row) && (p_vout->p_sys->i_row > 2))
-            // black bar
-                {
-                    TopOffset = length - (2 * p_vout->p_sys->i_halfHeight);
-                    p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
-                    for (i_index = 0; i_index < length; i_index++)
-                        for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
-                            *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = 0;
-                    p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
-                }
-        }
-        else
+    for( int y = 0; y < p_sys->i_row; y++ )
+    {
+        for( int x = 0; x < p_sys->i_col; x++ )
         {
-            if (p_vout->p_sys->i_row >= 2)
-            {
-                length = 2 * p_vout->p_sys->i_halfHeight;
-                if (p_vout->p_sys->b_has_changed)
-                {
-                    int i_plane_;
-                    int i_row_mod;
-                    Denom = F2(length);
-                    a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
-                    a_1 = p_vout->p_sys->a_1 * length * (ACCURACY / 100);
-                    a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
-                    for(i_row_mod = 0; i_row_mod < 2; i_row_mod++)
-                      for (i_index = 0; i_index < length; i_index++)
-                        for (i_plane_ =  0; i_plane_ < p_pic->p->i_pixel_pitch; i_plane_++)
-                            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);
-                }
-// first blended zone
-
-            if (i_row)
-            {
-                TopOffset = i_lines;
-                p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
-                for (i_index = 0; i_index < length; i_index++)
-                    for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
-#ifndef GAMMA
-                    *(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] *
-                                 (*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2))) / ACCURACY;
-#else
-                    *(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)];
-#endif
-                p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
-            }
-            else if (p_vout->p_sys->i_row > 2)
-            // black bar
-            {
-                TopOffset = i_lines + (2 * p_vout->p_sys->i_halfHeight);
-                p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
-                for (i_index = 0; i_index < length; i_index++)
-                    for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
-                        *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = 0;
-                p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
-            }
+            const panoramix_output_t *p_output = &p_sys->pp_output[x][y];
+            if( !p_output->b_active )
+                continue;
 
-// second blended zone
+            /* */
+            picture_t *p_dst = pp_dst[p_output->i_output];
 
-            if (i_row + 1 < p_vout->p_sys->i_row)
-            {
-                TopOffset = length;
-                p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
-                for (i_index = 0; i_index < length; i_index++)
-                    for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
-#ifndef GAMMA
-                    *(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] *
-                                 (*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2))) / ACCURACY;
-#else
-                    *(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)];
+            /* */
+            picture_CopyProperties( p_dst, p_src );
 
-#endif
-                p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
-            }
-            else if (p_vout->p_sys->i_row > 2)
-            // black bar
+            /* */
+            for( int i_plane = 0; i_plane < p_src->i_planes; i_plane++ )
             {
-                TopOffset = length - (2 * p_vout->p_sys->i_halfHeight);
-                p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
-                for (i_index = 0; i_index < length; i_index++)
-                    for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
-                        *(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2) = 0;
-                p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
-            }
-// end blended zone
+                const int i_div_w = p_sys->p_chroma->pi_div_w[i_plane];
+                const int i_div_h = p_sys->p_chroma->pi_div_h[i_plane];
+
+                if( !i_div_w || !i_div_h )
+                    continue;
+
+                const plane_t *p_srcp = &p_src->p[i_plane];
+                const plane_t *p_dstp = &p_dst->p[i_plane];
+
+                /* */
+                panoramix_filter_t filter;
+                filter.black.i_right  = p_output->filter.black.i_right / i_div_w;
+                filter.black.i_left   = p_output->filter.black.i_left / i_div_w;
+                filter.black.i_top    = p_output->filter.black.i_top / i_div_h;
+                filter.black.i_bottom = p_output->filter.black.i_bottom / i_div_h;
+
+                filter.attenuate.i_right  = p_output->filter.attenuate.i_right / i_div_w;
+                filter.attenuate.i_left   = p_output->filter.attenuate.i_left / i_div_w;
+                filter.attenuate.i_top    = p_output->filter.attenuate.i_top / i_div_h;
+                filter.attenuate.i_bottom = p_output->filter.attenuate.i_bottom / i_div_h;
+
+                /* */
+                const int i_x = p_output->i_src_x/i_div_w;
+                const int i_y = p_output->i_src_y/i_div_h;
+
+                assert( p_sys->p_chroma->b_planar );
+                FilterPlanar( p_dstp->p_pixels, p_dstp->i_pitch,
+                              &p_srcp->p_pixels[i_y * p_srcp->i_pitch + i_x * p_srcp->i_pixel_pitch], p_srcp->i_pitch,
+                              p_output->i_src_width/i_div_w, p_output->i_src_height/i_div_h,
+                              p_sys->p_chroma->pi_black[i_plane],
+                              &filter,
+                              p_sys->p_lut[i_plane],
+                              p_sys->lambdav[i_plane],
+                              p_sys->lambdah[i_plane] );
             }
         }
-#endif
-// bug for wall filter : fix by CC
-//            pi_left_skip[i_plane] += i_out_pitch;
-            pi_left_skip[i_plane] += i_copy_pitch;
-            }
+    }
 
-            vout_UnlinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
-                                p_outpic );
-            vout_DisplayPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
-                                 p_outpic );
-            i_vout++;
-        }
+    picture_Release( p_src );
+    return VLC_SUCCESS;
+}
 
-        for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
+/**
+ * It converts mouse events
+ */
+static int Mouse( video_splitter_t *p_splitter, vlc_mouse_t *p_mouse,
+                  int i_index,
+                  const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
+{
+    video_splitter_sys_t *p_sys = p_splitter->p_sys;
+    VLC_UNUSED(p_old);
+
+    for( int y = 0; y < p_sys->i_row; y++ )
+    {
+        for( int x = 0; x < p_sys->i_col; x++ )
         {
-            pi_top_skip[i_plane] += p_vout->p_sys->pp_vout[ i_vout ].i_height
-                                     * p_pic->p[i_plane].i_lines
-                                     / p_vout->output.i_height
-                                     * p_pic->p[i_plane].i_pitch;
+            const panoramix_output_t *p_output = p_output = &p_sys->pp_output[x][y];
+            if( p_output->b_active && p_output->i_output == i_index )
+            {
+                const int i_x = p_new->i_x - p_output->filter.black.i_left;
+                const int i_y = p_new->i_y - p_output->filter.black.i_top;
+                if( i_x >= 0 && i_x < p_output->i_width  - p_output->filter.black.i_right &&
+                    i_y >= 0 && i_y < p_output->i_height - p_output->filter.black.i_bottom )
+                {
+                    *p_mouse = *p_new;
+                    p_mouse->i_x = p_output->i_src_x + i_x;
+                    p_mouse->i_y = p_output->i_src_y + i_y;
+                    return VLC_SUCCESS;
+                }
+            }
         }
     }
-#ifdef OVERLAP
-    if (p_vout->p_sys->b_has_changed) p_vout->p_sys->b_has_changed = VLC_FALSE;
-#endif
+    return VLC_EGENERIC;
 }
 
+/* It return a coefficient between 0.0 and 1.0 to be applied to the given
+ * value
+ */
+static double GammaFactor( const panoramix_gamma_t *g, float f_value )
+{
+    if( f_value <= g->f_black_crush )
+    {
+        float f_input = f_value * g->f_black_level / g->f_black_crush + (1.0 - g->f_black_level);
 
-#ifdef PACKED_YUV
-// WARNING : NO DEBUGGED
-/*****************************************************************************
- * RenderPackedYUV: displays previously rendered output
- *****************************************************************************
- * This function send the currently rendered image to Wall image, waits
- * until it is displayed and switch the two rendering buffers, preparing next
- * frame.
- *****************************************************************************/
-static void RenderPackedYUV( vout_thread_t *p_vout, picture_t *p_pic )
+        return pow( f_input, 1.0 / g->f_gamma );
+    }
+    else if( f_value >= g->f_white_crush )
+    {
+        float f_input = (f_value * (1.0 - (g->f_white_level + 1.0)) + (g->f_white_level + 1.0) * g->f_white_crush - 1.0) / (g->f_white_crush - 1.0);
+        return pow( f_input, 1.0 / g->f_gamma );
+    }
+    return 1.0;
+}
+
+/**
+ * It creates the panoramix configuration
+ */
+static int Configuration( panoramix_output_t pp_output[ROW_MAX][COL_MAX],
+                          int i_col, int i_row,
+                          int i_src_width, int i_src_height,
+                          int i_half_w, int i_half_h,
+                          bool b_attenuate,
+                          const bool *pb_active )
 {
-    picture_t *p_outpic = NULL;
-    int i_col, i_row, i_vout, i_plane;
-    int pi_left_skip[VOUT_MAX_PLANES], pi_top_skip[VOUT_MAX_PLANES];
 #ifdef OVERLAP
-    int LeftOffset, TopOffset;
-    int constantYUV[3] = {0,128,128};
-    int Denom;
-    int a_2;
-    int a_1;
-    int a_0;
-    int i_index, i_index2;
+    const bool b_overlap = true;
+#else
+    const bool b_overlap = false;
 #endif
 
-
-    i_vout = 0;
-
-    for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
+    /* */
+    int i_output = 0;
+    for( int y = 0, i_src_y = 0, i_dst_y = 0; y < i_row; y++ )
     {
-        pi_top_skip[i_plane] = 0;
-    }
+        const bool b_row_first = y == 0;
+        const bool b_row_last  = y == i_row - 1;
 
-    for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
-    {
-        for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
-        {
-            pi_left_skip[i_plane] = 0;
-        }
+        /* Compute source height */
+        int i_win_height = (i_src_height / i_row ) & ~1;
+        if( b_row_last )
+            i_win_height = i_src_height - y * i_win_height;
 
-        for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
+        for( int x = 0, i_src_x = 0, i_dst_x = 0; x < i_col; x++ )
         {
-            if( !p_vout->p_sys->pp_vout[ i_vout ].b_active )
+            const bool b_col_first = x == 0;
+            const bool b_col_last  = x == i_col - 1;
+
+            /* Compute source width */
+            int i_win_width  = (i_src_width  / i_col ) & ~1;
+            if( b_col_last )
+                i_win_width  = i_src_width  - x * i_win_width;
+
+            /* Compute filter configuration */
+            panoramix_filter_t cfg;
+
+            memset( &cfg, 0, sizeof(cfg) );
+            if( b_overlap && b_attenuate )
             {
-                for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
+                if( i_col > 2 )
                 {
-                    pi_left_skip[i_plane] +=
-                        p_vout->p_sys->pp_vout[ i_vout ].i_width
-                         * p_pic->p[i_plane].i_pitch / p_vout->output.i_width;
+                    if( b_col_first )
+                        cfg.black.i_left   = i_half_w;
+                    if( b_col_last )
+                        cfg.black.i_right  = i_half_w;
                 }
-                i_vout++;
-                continue;
-            }
-
-            while( ( p_outpic =
-                vout_CreatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
-                                    0, 0, 0 )
-                   ) == NULL )
-            {
-                if( p_vout->b_die || p_vout->b_error )
+                if( i_row > 2 )
                 {
-                    vout_DestroyPicture(
-                        p_vout->p_sys->pp_vout[ i_vout ].p_vout, p_outpic );
-                    return;
+                    if( b_row_first )
+                        cfg.black.i_top    = i_half_h;
+                    if( b_row_last )
+                        cfg.black.i_bottom = i_half_h;
                 }
+                if( !b_col_first )
+                    cfg.attenuate.i_left   = 2 * i_half_w;
+                if( !b_col_last )
+                    cfg.attenuate.i_right  = 2 * i_half_w;
+                if( !b_row_first )
+                    cfg.attenuate.i_top    = 2 * i_half_h;
+                if( !b_row_last )
+                    cfg.attenuate.i_bottom = 2 * i_half_h;
+            }
 
-                msleep( VOUT_OUTMEM_SLEEP );
+            /* Compute alignment */
+            int i_align = 0;
+            if( i_col > 1 )
+            {
+                if( b_col_first )
+                    i_align |= VOUT_ALIGN_RIGHT;
+                if( b_col_last )
+                    i_align |= VOUT_ALIGN_LEFT;
+            }
+            if( i_row > 1 )
+            {
+                if( b_row_first )
+                    i_align |= VOUT_ALIGN_BOTTOM;
+                if( b_row_last )
+                    i_align |= VOUT_ALIGN_TOP;
             }
 
-            vout_DatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
-                              p_outpic, p_pic->date );
-            vout_LinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
-                              p_outpic );
+            /* */
+            panoramix_output_t *p_output = &pp_output[x][y];
 
-            for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
-            {
-                uint8_t *p_in, *p_in_end, *p_out;
-                int i_in_pitch = p_pic->p[i_plane].i_pitch;
-                int i_out_pitch = p_outpic->p[i_plane].i_pitch;
-                int i_copy_pitch = p_outpic->p[i_plane].i_visible_pitch;
+            /* */
+            p_output->i_src_x = i_src_x - cfg.attenuate.i_left/2;
+            p_output->i_src_y = i_src_y - cfg.attenuate.i_top/2;
+            p_output->i_src_width  = i_win_width  + cfg.attenuate.i_left/2 + cfg.attenuate.i_right/2;
+            p_output->i_src_height = i_win_height + cfg.attenuate.i_top/2  + cfg.attenuate.i_bottom/2;
 
-#ifdef OVERLAP
-                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);
-                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);
-                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);
-                if ((!p_vout->p_sys->pp_vout[p_vout->p_sys->i_col].b_active))
-                    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);
-// i_n : previous inactive pp_vout
-                int i_n=0;
-                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++;
-                if ((i_col > 1) && i_n)
-                    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);
-
-                p_in = p_pic->p[i_plane].p_pixels
-                /* Wall proprities */
-                + pi_top_skip[i_plane] + pi_left_skip[i_plane];
-
-                int i_lines = p_outpic->p[i_plane].i_visible_lines;
-// 1088 lines bug in a mpeg2 stream of 1080 lines
-                if ((p_vout->p_sys->i_row - 1 == i_row) &&
-                    (p_pic->p[i_plane].i_lines == 1088))
-                        i_lines -= 8;
-
-                p_in_end = p_in + i_lines * p_pic->p[i_plane].i_pitch;
-#else
-                p_in = p_pic->p[i_plane].p_pixels
-                        + pi_top_skip[i_plane] + pi_left_skip[i_plane];
+            /* */
+            p_output->filter = cfg;
 
-                p_in_end = p_in + p_outpic->p[i_plane].i_visible_lines
-                                        * p_pic->p[i_plane].i_pitch;
-#endif
-                p_out = p_outpic->p[i_plane].p_pixels;
-#ifdef OVERLAP
-        int length;
-        length = 2 * p_vout->p_sys->i_halfLength * p_pic->p->i_pixel_pitch;
-        LeftOffset = (i_col ? 0 : i_copy_pitch - length);
-        if (p_vout->p_sys->b_has_changed)
-        {
-#ifdef GAMMA
-            int i_plane_;
-            for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index++)
-                for (i_plane_ =  0; i_plane_ < p_pic->p->i_pixel_pitch; i_plane_++)
-                    for (i_index2 = 0; i_index2 < 256; i_index2++)
-                            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_]));
-#endif
-            switch (p_vout->output.i_chroma)
-                {
-                    case VLC_FOURCC('Y','U','Y','2'):    // packed by 2
-                    case VLC_FOURCC('Y','U','N','V'):    // packed by 2
-                        Denom = F2(length / p_pic->p->i_pixel_pitch);
-                        a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
-                        a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfLength * (ACCURACY / 100);
-                        a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
-                        for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index+=p_pic->p->i_pixel_pitch)
-                        // for each macropixel
-                        {
-                                // first image pixel
-                                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);
-                                p_vout->p_sys->cstYUV[i_col][0][i_index] = ((ACCURACY - p_vout->p_sys->lambda[i_col][0][i_index]) * constantYUV[0]) / ACCURACY;
-                                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);
-                                p_vout->p_sys->cstYUV[i_col][1][i_index] = ((ACCURACY - p_vout->p_sys->lambda[i_col][1][i_index]) * constantYUV[1]) / ACCURACY;
-                                // second image pixel
-                                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);
-                                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;
-                                p_vout->p_sys->lambda[i_col][1][i_index + 1] = p_vout->p_sys->lambda[i_col][1][i_index];
-                                p_vout->p_sys->cstYUV[i_col][1][i_index + 1] = p_vout->p_sys->cstYUV[i_col][1][i_index];
-                        }
-                        break;
-                    case VLC_FOURCC('U','Y','V','Y'):    // packed by 2
-                    case VLC_FOURCC('U','Y','N','V'):    // packed by 2
-                    case VLC_FOURCC('Y','4','2','2'):    // packed by 2
-                        Denom = F2(length / p_pic->p->i_pixel_pitch);
-                        a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
-                        a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfLength * (ACCURACY / 100);
-                        a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
-                        for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index+=p_pic->p->i_pixel_pitch)
-                        // for each macropixel
-                        {
-                                // first image pixel
-                                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);
-                                p_vout->p_sys->cstYUV[i_col][0][i_index] = ((ACCURACY - p_vout->p_sys->lambda[i_col][0][i_index]) * constantYUV[1]) / ACCURACY;
-                                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);
-                                p_vout->p_sys->cstYUV[i_col][1][i_index] = ((ACCURACY - p_vout->p_sys->lambda[i_col][1][i_index]) * constantYUV[0]) / ACCURACY;
-                                // second image pixel
-                                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);
-                                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;
-                                p_vout->p_sys->lambda[i_col][1][i_index + 1] = p_vout->p_sys->lambda[i_col][1][i_index];
-                                p_vout->p_sys->cstYUV[i_col][1][i_index + 1] = p_vout->p_sys->cstYUV[i_col][1][i_index];
-                        }
-                        break;
-                    default :
-                        break;
-                }
-        }
-#endif
-            while( p_in < p_in_end )
-            {
-#ifndef OVERLAP
-                p_vout->p_libvlc->pf_memcpy( p_out, p_in, i_copy_pitch);
-#else
-                p_vout->p_libvlc->pf_memcpy( p_out + i_col * length, p_in + i_col * length, i_copy_pitch - length);
-                p_out += LeftOffset;
-                p_in += LeftOffset;
-#ifndef GAMMA
-                for (i_index = 0; i_index < length; i_index++)
-                    *(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] *
-                             (*(p_in + i_index))) / ACCURACY +
-                             p_vout->p_sys->cstYUV[i_col][i_index % p_pic->p->i_pixel_pitch][i_index / p_pic->p->i_pixel_pitch];
-#else
-                for (i_index = 0; i_index < length; i_index++)
-                    *(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] *
-                             (*(p_in + i_index))) / ACCURACY +
-                             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];
-#endif
-                p_out -= LeftOffset;
-                p_in -= LeftOffset;
-#endif
-                p_in += i_in_pitch;
-                p_out += i_out_pitch;
-            }
-#ifdef OVERLAP
-            if (p_vout->p_sys->i_row == 2)
-            {
-                        length = 2 * p_vout->p_sys->i_halfHeight * p_pic->p->i_pixel_pitch;
-                        TopOffset = (i_row ? i_lines : length / p_pic->p->i_pixel_pitch);
-                        if (p_vout->p_sys->b_has_changed)
-                        {
-#ifdef GAMMA
-                                int i_plane_;
-                                for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index++)
-                                    for (i_plane_ =  0; i_plane_ < p_pic->p->i_pixel_pitch; i_plane_++)
-                                        for (i_index2 = 0; i_index2 < 256; i_index2++)
-                                                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_]));
-#endif
-                                switch (p_vout->output.i_chroma)
-                                {
-                                    case VLC_FOURCC('Y','U','Y','2'):    // packed by 2
-                                    case VLC_FOURCC('Y','U','N','V'):    // packed by 2
-                                        Denom = F2(length / p_pic->p->i_pixel_pitch);
-                                        a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
-                                        a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfHeight * (ACCURACY / 100);
-                                        a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
-                                        for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index+=p_pic->p->i_pixel_pitch)
-                                        // for each macropixel
-                                        {
-                                                // first image pixel
-                                                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);
-                                                p_vout->p_sys->cstYUV2[i_row][0][i_index] = ((ACCURACY - p_vout->p_sys->lambda2[i_row][0][i_index]) * constantYUV[0]) / ACCURACY;
-                                                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);
-                                                p_vout->p_sys->cstYUV2[i_row][1][i_index] = ((ACCURACY - p_vout->p_sys->lambda2[i_row][1][i_index]) * constantYUV[1]) / ACCURACY;
-                                                // second image pixel
-                                                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);
-                                                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;
-                                                p_vout->p_sys->lambda2[i_row][1][i_index + 1] = p_vout->p_sys->lambda2[i_row][1][i_index];
-                                                p_vout->p_sys->cstYUV2[i_row][1][i_index + 1] = p_vout->p_sys->cstYUV2[i_row][1][i_index];
-                                        }
-                                        break;
-                                    case VLC_FOURCC('U','Y','V','Y'):    // packed by 2
-                                    case VLC_FOURCC('U','Y','N','V'):    // packed by 2
-                                    case VLC_FOURCC('Y','4','2','2'):    // packed by 2
-                                        Denom = F2(length / p_pic->p->i_pixel_pitch);
-                                        a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
-                                        a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfHeight * (ACCURACY / 100);
-                                        a_0 = p_vout->p_sys->a_0 * Denom * (ACCURACY / 100);
-                                        for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index+=p_pic->p->i_pixel_pitch)
-                                        // for each macropixel
-                                        {
-                                                // first image pixel
-                                                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);
-                                                p_vout->p_sys->cstYUV2[i_row][0][i_index] = ((ACCURACY - p_vout->p_sys->lambda2[i_col][0][i_index]) * constantYUV[1]) / ACCURACY;
-                                                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);
-                                                p_vout->p_sys->cstYUV2[i_row][1][i_index] = ((ACCURACY - p_vout->p_sys->lambda2[i_row][1][i_index]) * constantYUV[0]) / ACCURACY;
-                                                // second image pixel
-                                                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);
-                                                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;
-                                                p_vout->p_sys->lambda2[i_row][1][i_index + 1] = p_vout->p_sys->lambda2[i_row][1][i_index];
-                                                p_vout->p_sys->cstYUV2[i_row][1][i_index + 1] = p_vout->p_sys->cstYUV2[i_row][1][i_index];
-                                        }
-                                        break;
-                                    default :
-                                        break;
-                                }
-                        }
-                        p_out -= TopOffset * p_outpic->p[i_plane].i_pitch;
-#ifndef GAMMA
-                        for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index++)
-                            for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
-                                *(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] *
-                                     (*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2))) / ACCURACY +
-                                     p_vout->p_sys->cstYUV2[i_row][i_index2 % p_pic->p->i_pixel_pitch][i_index];
-#else
-                        for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index++)
-                            for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)
-                                *(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] *
-                                     (*(p_out + (i_index * p_outpic->p[i_plane].i_pitch) + i_index2))) / ACCURACY +
-                                     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];
+            /* */
+            p_output->i_align = i_align;
+            p_output->i_x = i_dst_x;
+            p_output->i_y = i_dst_y;
 
-#endif
-                        p_out += TopOffset * p_outpic->p[i_plane].i_pitch;
-            }
-#endif
-// bug for wall filter : fix by CC
-//            pi_left_skip[i_plane] += i_out_pitch;
-            pi_left_skip[i_plane] += i_copy_pitch;
-            }
+            p_output->i_width  = cfg.black.i_left + p_output->i_src_width  + cfg.black.i_right;
+            p_output->i_height = cfg.black.i_top  + p_output->i_src_height + cfg.black.i_bottom;
 
-            vout_UnlinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
-                                p_outpic );
-            vout_DisplayPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
-                                 p_outpic );
-            i_vout++;
-        }
+            /* */
+            p_output->b_active = pb_active[y * i_col + x] &&
+                                 p_output->i_width > 0 &&
+                                 p_output->i_height > 0;
+            if( p_output->b_active )
+                p_output->i_output = i_output++;
 
-        for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
-        {
-            pi_top_skip[i_plane] += p_vout->p_sys->pp_vout[ i_vout ].i_height
-                                     * p_pic->p[i_plane].i_lines
-                                     / p_vout->output.i_height
-                                     * p_pic->p[i_plane].i_pitch;
+            /* */
+            i_src_x += i_win_width;
+            i_dst_x += p_output->i_width;
         }
+        i_src_y += i_win_height;
+        i_dst_y += pp_output[0][y].i_height;
     }
-#ifdef OVERLAP
-    if (p_vout->p_sys->b_has_changed) p_vout->p_sys->b_has_changed = VLC_FALSE;
-#endif
+    return i_output;
 }
-#endif
-
 
-/*****************************************************************************
- * RemoveAllVout: destroy all the child video output threads
- *****************************************************************************/
-static void RemoveAllVout( vout_thread_t *p_vout )
+/**
+ * It filters a video plane
+ */
+static void FilterPlanar( uint8_t *p_out, int i_out_pitch,
+                          const uint8_t *p_in, int i_in_pitch,
+                          int i_copy_pitch,
+                          int i_copy_lines,
+                          int i_pixel_black,
+                          const panoramix_filter_t *p_cfg,
+                          uint8_t p_lut[ACCURACY + 1][256],
+                          int lambdav[2][ACCURACY/2],
+                          int lambdah[2][ACCURACY/2] )
 {
-    while( p_vout->p_sys->i_vout )
+    /* */
+    assert( !p_cfg->black.i_left   || !p_cfg->attenuate.i_left );
+    assert( !p_cfg->black.i_right  || !p_cfg->attenuate.i_right );
+    assert( !p_cfg->black.i_top    || !p_cfg->attenuate.i_top );
+    assert( !p_cfg->black.i_bottom || !p_cfg->attenuate.i_bottom );
+
+    const int i_out_width = p_cfg->black.i_left + i_copy_pitch + p_cfg->black.i_right;
+
+    /* Top black border */
+    for( int b = 0; b < p_cfg->black.i_top; b++ )
     {
-         --p_vout->p_sys->i_vout;
-         if( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].b_active )
-         {
-             DEL_CALLBACKS(
-                 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout,
-                 SendEvents );
-             vlc_object_detach(
-                 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout );
-             vout_Destroy(
-                 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout );
-         }
+        vlc_memset( p_out, i_pixel_black, i_out_width );
+        p_out += i_out_pitch;
     }
-}
-
-/*****************************************************************************
- * SendEvents: forward mouse and keyboard events to the parent p_vout
- *****************************************************************************/
-static int SendEvents( vlc_object_t *p_this, char const *psz_var,
-                       vlc_value_t oldval, vlc_value_t newval, void *_p_vout )
-{
-    vout_thread_t *p_vout = (vout_thread_t *)_p_vout;
-    int i_vout;
-    vlc_value_t sentval = newval;
 
-    /* Find the video output index */
-    for( i_vout = 0; i_vout < p_vout->p_sys->i_vout; i_vout++ )
+    for( int y = 0; y < i_copy_lines; y++ )
     {
-        if( p_this == (vlc_object_t *)p_vout->p_sys->pp_vout[ i_vout ].p_vout )
+        const uint8_t *p_src = p_in;
+        uint8_t *p_dst = p_out;
+
+        /* Black border on the left */
+        if( p_cfg->black.i_left > 0 )
         {
-            break;
+            memset( p_dst, i_pixel_black, p_cfg->black.i_left );
+            p_dst += p_cfg->black.i_left;
+        }
+        /* Attenuated video on the left */
+        for( int i = 0; i < p_cfg->attenuate.i_left; i++ )
+            *p_dst++ = p_lut[lambdav[0][i]][*p_src++];
+
+        /* Unmodified video */
+        const int i_unmodified_width = i_copy_pitch - p_cfg->attenuate.i_left - p_cfg->attenuate.i_right;
+        vlc_memcpy( p_dst, p_src, i_unmodified_width );
+        p_dst += i_unmodified_width;
+        p_src += i_unmodified_width;
+
+        /* Attenuated video on the right */
+        for( int i = 0; i < p_cfg->attenuate.i_right; i++ )
+            *p_dst++ = p_lut[lambdav[1][i]][*p_src++];
+        /* Black border on the right */
+        if( p_cfg->black.i_right > 0 )
+        {
+            memset( p_dst, i_pixel_black, p_cfg->black.i_right );
+            p_dst += p_cfg->black.i_right;
         }
-    }
 
-    if( i_vout == p_vout->p_sys->i_vout )
-    {
-        return VLC_EGENERIC;
-    }
+        /* Attenuate complete line at top/bottom */
+        const bool b_attenuate_top    = y < p_cfg->attenuate.i_top;
+        const bool b_attenuate_bottom = y >= i_copy_lines - p_cfg->attenuate.i_bottom;
+        if( b_attenuate_top || b_attenuate_bottom )
+        {
+            const int i_index = b_attenuate_top ? lambdah[0][y] : lambdah[1][y - (i_copy_lines - p_cfg->attenuate.i_bottom)];
+            uint8_t *p_dst = &p_out[0];
+            for( int i = 0; i < i_out_width; i++)
+                p_dst[i] = p_lut[i_index][p_dst[i]];
+        }
 
-    /* Translate the mouse coordinates */
-    if( !strcmp( psz_var, "mouse-x" ) )
-    {
-#ifdef OVERLAP
-        int i_overlap = ((p_vout->p_sys->i_col > 2) ? 0 : 2 * p_vout->p_sys->i_halfLength);
-           sentval.i_int += (p_vout->output.i_width - i_overlap)
-#else
-           sentval.i_int += p_vout->output.i_width
-#endif
-                         * (i_vout % p_vout->p_sys->i_col)
-                          / p_vout->p_sys->i_col;
+        /* */
+        p_in  += i_in_pitch;
+        p_out += i_out_pitch;
     }
-    else if( !strcmp( psz_var, "mouse-y" ) )
+    /* Bottom black border */
+    for( int b = 0; b < p_cfg->black.i_bottom; b++ )
     {
-#ifdef OVERLAP
-        int i_overlap = ((p_vout->p_sys->i_row > 2) ? 0 : 2 * p_vout->p_sys->i_halfHeight);
-           sentval.i_int += (p_vout->output.i_height - i_overlap)
-#else
-           sentval.i_int += p_vout->output.i_height
-#endif
-//bug fix in Wall plug-in
-//                         * (i_vout / p_vout->p_sys->i_row)
-                         * (i_vout / p_vout->p_sys->i_col)
-                          / p_vout->p_sys->i_row;
+        vlc_memset( p_out, i_pixel_black, i_out_width );
+        p_out += i_out_pitch;
     }
+}
 
-    var_Set( p_vout, psz_var, sentval );
 
-    return VLC_SUCCESS;
-}
 
-/*****************************************************************************
- * SendEventsToChild: forward events to the child/children vout
- *****************************************************************************/
-static int SendEventsToChild( vlc_object_t *p_this, char const *psz_var,
-                       vlc_value_t oldval, vlc_value_t newval, void *p_data )
+#if 0
+static void RenderPackedRGB( vout_thread_t *p_vout, picture_t *p_pic )
 {
+    int length;
+    length = 2 * p_sys->i_overlap_w2 * p_pic->p->i_pixel_pitch;
 
-    vout_thread_t *p_vout = (vout_thread_t *)p_this;
-    int i_row, i_col, i_vout = 0;
-
-    for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
+    if (p_sys->b_has_changed)
     {
-        for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
-        {
-            var_Set( p_vout->p_sys->pp_vout[ i_vout ].p_vout, psz_var, newval);
-            if( !strcmp( psz_var, "fullscreen" ) ) break;
-            i_vout++;
-        }
+        int i_plane_;
+        int i_col_mod;
+        Denom = F2(length / p_pic->p->i_pixel_pitch);
+        a_2 = p_sys->a_2 * (ACCURACY / 100);
+        a_1 = p_sys->a_1 * 2 * p_sys->i_overlap_w2 * (ACCURACY / 100);
+        a_0 = p_sys->a_0 * Denom * (ACCURACY / 100);
+        for(i_col_mod = 0; i_col_mod < 2; i_col_mod++)
+            for (i_index = 0; i_index < length / p_pic->p->i_pixel_pitch; i_index++)
+                for (i_plane_ =  0; i_plane_ < p_pic->p->i_pixel_pitch; i_plane_++)
+                    p_sys->lambda[i_col_mod][i_plane_][i_index] = clip_accuracy(!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);
     }
 
-    return VLC_SUCCESS;
+    length = 2 * p_sys->i_overlap_h2;
+    if (p_sys->b_has_changed)
+    {
+        int i_plane_;
+        int i_row_mod;
+        Denom = F2(length);
+        a_2 = p_sys->a_2 * (ACCURACY / 100);
+        a_1 = p_sys->a_1 * length * (ACCURACY / 100);
+        a_0 = p_sys->a_0 * Denom * (ACCURACY / 100);
+        for(i_row_mod = 0; i_row_mod < 2; i_row_mod++)
+          for (i_index = 0; i_index < length; i_index++)
+            for (i_plane_ =  0; i_plane_ < p_pic->p->i_pixel_pitch; i_plane_++)
+                p_sys->lambda2[i_row_mod][i_plane_][i_index] = clip_accuracy(!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);
+    }
 }
+#endif
+
+