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

📄 panoramix.c

📁 VLC Player Source Code
💻 C
📖 第 1 页 / 共 5 页
字号:
                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;                var_SetInteger( p_vout, "bz-length", p_vout->p_sys->bz_length);                var_SetInteger( 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) ;                var_SetInteger( 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        p_vout->p_sys->i_halfLength = 0;    return i_offset;}#endif/***************************************************************************** * Init: initialize Wall video thread output method *****************************************************************************/#define VLC_XCHG( type, a, b ) do { type __tmp = (b); (b) = (a); (a) = __tmp; } while(0)static int Init( vout_thread_t *p_vout ){    int i_index, i_row, i_col;    picture_t *p_pic;    I_OUTPUTPICTURES = 0;    /* 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;    int i_video_x = var_GetInteger( p_vout, "video-x");    int i_video_y = var_GetInteger( p_vout, "video-y");#ifdef GAMMA    if (p_vout->p_sys->b_attenuate)    {        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] = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-red" );        p_vout->p_sys->f_gamma[1] = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-green" );        p_vout->p_sys->f_gamma[2] = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-blue" );        f_BlackCrush[0] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blackcrush-red" ) / 255.0;        f_BlackCrush[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blackcrush-green" ) / 255.0;        f_BlackCrush[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blackcrush-blue" ) / 255.0;        f_WhiteCrush[0] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitecrush-red" ) / 255.0;        f_WhiteCrush[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitecrush-green" ) / 255.0;        f_WhiteCrush[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitecrush-blue" ) / 255.0;        f_BlackLevel[0] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blacklevel-red" ) / 255.0;        f_BlackLevel[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blacklevel-green" ) / 255.0;        f_BlackLevel[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blacklevel-blue" ) / 255.0;        f_WhiteLevel[0] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitelevel-red" ) / 255.0;        f_WhiteLevel[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitelevel-green" ) / 255.0;        f_WhiteLevel[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitelevel-blue" ) / 255.0;        for( int i = 3; i < VOUT_MAX_PLANES; i++ )        {            /* Initialize unsupported planes */            f_BlackCrush[i] = 140.0/255.0;            f_WhiteCrush[i] = 200.0/255.0;            f_BlackLevel[i] = 150.0/255.0;            f_WhiteLevel[i] = 0.0/255.0;            p_vout->p_sys->f_gamma[i] = 1.0;        }        switch (p_vout->render.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                VLC_XCHG( float, p_vout->p_sys->f_gamma[1], p_vout->p_sys->f_gamma[2] );                VLC_XCHG( float, f_BlackCrush[1], f_BlackCrush[2] );                VLC_XCHG( float, f_WhiteCrush[1], f_WhiteCrush[2] );                VLC_XCHG( float, f_BlackLevel[1], f_BlackLevel[2] );                VLC_XCHG( float, f_WhiteLevel[1], f_WhiteLevel[2] );        // 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;        }    }#endif    if (p_vout->p_sys->i_offset_x)        p_vout->p_sys->i_offset_x = AdjustHeight(p_vout);    else        AdjustHeight(p_vout);    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);    }#endif    /* Try to open the real video output */    msg_Dbg( p_vout, "spawning the real video outputs" );    /* FIXME: use bresenham instead of those ugly divisions */    p_vout->p_sys->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++, p_vout->p_sys->i_vout++ )        {            struct vout_list_t *p_entry = &p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ];            video_format_t fmt;            int i_width, i_height;            /* */            i_width = ( p_vout->render.i_width / p_vout->p_sys->i_col ) & ~0x1;            if( i_col + 1 == p_vout->p_sys->i_col )                i_width = p_vout->render.i_width - i_col * i_width;#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 &= ~0x1;#endif            /* */            i_height = ( p_vout->render.i_height / p_vout->p_sys->i_row ) & ~0x3;            if( i_row + 1 == p_vout->p_sys->i_row )                i_height = p_vout->render.i_height - i_row * i_height;#ifdef OVERLAP            if(p_vout->p_sys->i_row >= 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 &= ~0x1;#endif            p_entry->i_width = i_width;            p_entry->i_height = i_height;            if( !p_entry->b_active )                continue;            /* */            memset( &fmt, 0, sizeof(video_format_t) );            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)            {                var_SetInteger(p_vout, "video-x", -p_vout->p_sys->i_offset_x);                p_vout->p_sys->i_offset_x = 0;            }#endif            p_entry->p_vout = vout_Create( p_vout, &fmt);            if( p_entry->p_vout == NULL )            {                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;            }            ADD_CALLBACKS( p_entry->p_vout, SendEvents );#ifdef OVERLAP            p_entry->p_vout->i_alignment = 0;            if (i_col == 0)                p_entry->p_vout->i_alignment |= VOUT_ALIGN_RIGHT;            else if (i_col == p_vout->p_sys->i_col -1)                p_entry->p_vout->i_alignment |= VOUT_ALIGN_LEFT;            if (p_vout->p_sys->i_row > 1)            {                if (i_row == 0)                    p_entry->p_vout->i_alignment |= VOUT_ALIGN_BOTTOM;                else if (i_row == p_vout->p_sys->i_row -1)                    p_entry->p_vout->i_alignment |= VOUT_ALIGN_TOP;            }            // i_n : number of active pp_vout            int i_active = 0;            for( int i = 0; i <= p_vout->p_sys->i_vout; i++ )            {                if( p_vout->p_sys->pp_vout[i].b_active )                    i_active++;            }            var_SetInteger( p_vout, "align", p_entry->p_vout->i_alignment );            var_SetInteger( p_vout, "video-x", i_video_x + p_vout->p_sys->i_offset_x + ((i_active + 1) % p_vout->p_sys->i_col) * p_vout->i_window_width);            var_SetInteger( p_vout, "video-y", i_video_y +                             ((i_active + 1) / p_vout->p_sys->i_col) * p_vout->i_window_height);#endif        }    }    ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );    ADD_PARENT_CALLBACKS( SendEventsToChild );    return VLC_SUCCESS;}/***************************************************************************** * End: terminate Wall video thread output method *****************************************************************************/

⌨️ 快捷键说明

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