⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 panoramix.c

📁 VLC Player Source Code
💻 C
📖 第 1 页 / 共 5 页
字号:
/***************************************************************************** * panoramix.c : Wall panoramic video with edge blending plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN * $Id$ * * Authors: Cedric Cocquebert <cedric.cocquebert@supelec.fr> *          based on Samuel Hocevar <sam@zoy.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA. *****************************************************************************//***************************************************************************** * Preamble *****************************************************************************/#ifdef HAVE_CONFIG_H# include "config.h"#endif#include <vlc_common.h>#include <vlc_plugin.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 DEPENDENT to get display dimensions    #ifdef SYS_MINGW32        #include <windows.h>    #else        #include <X11/Xlib.h>    #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 1000    #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))#endif/***************************************************************************** * Local prototypes *****************************************************************************/static int  Create    ( vlc_object_t * );static void Destroy   ( vlc_object_t * );static int  Init      ( vout_thread_t * );static void End       ( vout_thread_t * );#ifdef PACKED_YUVstatic void RenderPackedYUV   ( vout_thread_t *, picture_t * );#endifstatic void RenderPlanarYUV   ( vout_thread_t *, picture_t * );static void RenderPackedRGB   ( vout_thread_t *, picture_t * );static void RemoveAllVout  ( vout_thread_t *p_vout );static int  SendEvents( vlc_object_t *, char const *,                        vlc_value_t, vlc_value_t, void * );/***************************************************************************** * Module descriptor *****************************************************************************/#define COLS_TEXT N_("Number of columns")#define COLS_LONGTEXT N_("Select the number of horizontal video windows in " \    "which to split the video")#define ROWS_TEXT N_("Number of rows")#define ROWS_LONGTEXT N_("Select the number of vertical video windows in " \    "which to split the video")#define ACTIVE_TEXT N_("Active windows")#define ACTIVE_LONGTEXT N_("Comma separated list of active windows, " \    "defaults to all")#define CFG_PREFIX "panoramix-"vlc_module_begin();    set_description( N_("Panoramix: wall with overlap video filter") );    set_shortname( N_("Panoramix" ));    set_capability( "video filter", 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 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( CFG_PREFIX "offset-x", 1, NULL, OFFSET_X_TEXT, OFFSET_X_LONGTEXT, true );#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( 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( 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( CFG_PREFIX "attenuate", 1, 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( 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( 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( 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( CFG_PREFIX "bz-middle-pos", 50, 1, 99, NULL, MIDDLE_POS_TEXT, MIDDLE_POS_LONGTEXT, false );#ifdef GAMMA#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( 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( 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( CFG_PREFIX "bz-gamma-blue", 1, 0, 5, NULL, BGAMMA_TEXT, BGAMMA_LONGTEXT, true );#endif#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")#define GGAMMA_BC_LONGTEXT N_("Select the Black Crush of blended zone (Green or U component)")#define BGAMMA_BC_TEXT N_("Black Crush for Blue")#define BGAMMA_BC_LONGTEXT N_("Select the Black Crush of blended zone (Blue or V component)")#define RGAMMA_WC_TEXT N_("White Crush for Red")#define RGAMMA_WC_LONGTEXT N_("Select the White Crush of blended zone (Red or Y component)")#define GGAMMA_WC_TEXT N_("White Crush for Green")#define GGAMMA_WC_LONGTEXT N_("Select the White Crush of blended zone (Green or U component)")#define BGAMMA_WC_TEXT N_("White Crush for Blue")#define BGAMMA_WC_LONGTEXT N_("Select the White Crush of blended zone (Blue or V component)")#define RGAMMA_BL_TEXT N_("Black Level for Red")#define RGAMMA_BL_LONGTEXT N_("Select the Black Level of blended zone (Red or Y component)")#define GGAMMA_BL_TEXT N_("Black Level for Green")#define GGAMMA_BL_LONGTEXT N_("Select the Black Level of blended zone (Green or U component)")#define BGAMMA_BL_TEXT N_("Black Level for Blue")#define BGAMMA_BL_LONGTEXT N_("Select the Black Level of blended zone (Blue or V component)")#define RGAMMA_WL_TEXT N_("White Level for Red")#define RGAMMA_WL_LONGTEXT N_("Select the White Level of blended zone (Red or Y component)")#define GGAMMA_WL_TEXT N_("White Level for Green")#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( 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 SYS_MINGW32#define XINERAMA_TEXT N_("Xinerama option")#define XINERAMA_LONGTEXT N_("Uncheck if you have not used xinerama")    add_bool( CFG_PREFIX "xinerama", 1, NULL, XINERAMA_TEXT, XINERAMA_LONGTEXT, true );#endif#endif    add_string( CFG_PREFIX "active", NULL, NULL, ACTIVE_TEXT, ACTIVE_LONGTEXT, true );    add_shortcut( "panoramix" );    set_callbacks( Create, Destroy );vlc_module_end();static const char *const ppsz_filter_options[] = {    "cols", "rows", "offset-x", "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", "xinerama", "active",    NULL};/***************************************************************************** * 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. *****************************************************************************/struct vout_sys_t{#ifdef OVERLAP    bool   b_autocrop;    bool   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;    bool     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#ifndef SYS_MINGW32    bool   b_xinerama;#endif#endif    int    i_col;    int    i_row;    int    i_vout;    struct vout_list_t    {        bool b_active;        int i_width;        int i_height;        vout_thread_t *p_vout;    } *pp_vout;};/***************************************************************************** * Control: control facility for the vout (forwards to child vout) *****************************************************************************/static int Control( vout_thread_t *p_vout, int i_query, va_list args ){    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;}/***************************************************************************** * Create: allocates Wall video thread output method ***************************************************************************** * This function allocates and initializes a Wall vout method. *****************************************************************************/static int Create( vlc_object_t *p_this ){    vout_thread_t *p_vout = (vout_thread_t *)p_this;    char *psz_method, *psz_tmp, *psz_method_tmp;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -