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

📄 panoramix.c

📁 VLC Player Source Code
💻 C
📖 第 1 页 / 共 5 页
字号:
static void End( vout_thread_t *p_vout ){    int i_index;    DEL_PARENT_CALLBACKS( SendEventsToChild );    /* Free the fake output buffers we allocated */    for( i_index = I_OUTPUTPICTURES ; i_index ; )    {        i_index--;        free( PP_OUTPUTPICTURE[ i_index ]->p_data_orig );    }    RemoveAllVout( p_vout );#ifdef OVERLAP    var_SetInteger( p_vout, "bz-length", p_vout->p_sys->bz_length);#endif}/***************************************************************************** * 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;    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 TopOffset;    int constantYUV[3] = {0,128,128};    int Denom;    int a_2;    int a_1;    int a_0;    int i_index, i_index2;#endif    for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )        pi_top_skip[i_plane] = 0;    for( i_vout = 0, 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;        for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++, i_vout++ )        {            struct vout_list_t *p_entry = &p_vout->p_sys->pp_vout[ i_vout ];            if( !p_entry->b_active )            {                for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )                {                    pi_left_skip[i_plane] += p_entry->i_width * p_pic->p[i_plane].i_pitch / p_vout->output.i_width;                }                continue;            }            while( ( p_outpic = vout_CreatePicture( p_entry->p_vout, 0, 0, 0 )) == NULL )            {                if( !vlc_object_alive(p_vout) || p_vout->b_error )                {                    vout_DestroyPicture( p_entry->p_vout, p_outpic );                    return;                }                msleep( VOUT_OUTMEM_SLEEP );            }            vout_DatePicture( p_entry->p_vout, p_outpic, p_pic->date );            vout_LinkPicture( p_entry->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;                const int i_div = p_entry->i_width / i_copy_pitch;                const bool b_row_first = i_row == 0;                const bool b_row_last = i_row + 1 == p_vout->p_sys->i_row;                const bool b_col_first = i_col == 0;                const bool b_col_last = i_col + 1 == p_vout->p_sys->i_col;#ifdef OVERLAP                if( !b_col_first )                    pi_left_skip[i_plane] -= (2 * p_vout->p_sys->i_halfLength ) / i_div;                if( p_vout->p_sys->i_row >= 2 )                {                    if( !b_row_first && b_col_first )                        pi_top_skip[i_plane] -= (2 * p_vout->p_sys->i_halfHeight * p_pic->p[i_plane].i_pitch) / i_div;                    if( p_vout->p_sys->i_row > 2 && i_row == 1 && b_col_first )                        pi_top_skip[i_plane] -= (2 * p_vout->p_sys->i_halfHeight * p_pic->p[i_plane].i_pitch) / i_div;                    if( !p_vout->p_sys->pp_vout[p_vout->p_sys->i_col-1].b_active )                        pi_top_skip[i_plane] -= (2 * p_vout->p_sys->i_halfHeight * i_row * p_pic->p[i_plane].i_pitch) / i_div;                }// i_n : previous inactive pp_vout                int i_n=0;                while( (i_col - i_n > 1) && (!p_vout->p_sys->pp_vout[i_row * p_vout->p_sys->i_col + i_col - 1 - i_n].b_active) ) i_n++;                if( i_col > 1 && i_n )                    pi_left_skip[i_plane] -= i_n * (2 * p_vout->p_sys->i_halfLength ) / i_div;                if( p_vout->p_sys->i_row > 2 && ( b_row_first || b_row_last ) )                    i_lines -= (2 * p_vout->p_sys->i_halfHeight) / i_div;// 1088 lines bug in a mpeg2 stream of 1080 lines                if( b_row_last && p_pic->p[i_plane].i_lines == 1088 )                    i_lines -= 8 / i_div;#endif                /* */                p_in = &p_pic->p[i_plane].p_pixels[ pi_top_skip[i_plane] + pi_left_skip[i_plane] ]; /* Wall proprities */                p_in_end = &p_in[i_lines * p_pic->p[i_plane].i_pitch];                p_out = p_outpic->p[i_plane].p_pixels;#ifdef OVERLAP                if( p_vout->p_sys->i_row > 2 && b_row_first )                    p_out += p_outpic->p[i_plane].i_pitch * (2 * p_vout->p_sys->i_halfHeight) / i_div;                int i_col_mod;                int length = 2 * p_vout->p_sys->i_halfLength / i_div;                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->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                    vlc_memcpy( p_out, p_in, i_copy_pitch);#else                    if( p_vout->p_sys->i_col > 2 )                    {                        const int halfl = length / 2;                        if( b_col_first == 0)                            vlc_memcpy( &p_out[halfl], &p_in[0], i_copy_pitch - halfl );                        else if( b_col_last )                            vlc_memcpy( &p_out[    0], &p_in[-halfl], i_copy_pitch - halfl );                        else                            vlc_memcpy( &p_out[    0], &p_in[-halfl], i_copy_pitch);                        // black bar                        if( b_col_first )                            memset( &p_out[0], constantYUV[i_plane], halfl);                        else if( b_col_last )                            memset( &p_out[i_copy_pitch - halfl], constantYUV[i_plane], halfl );                    }                    else                    {                        vlc_memcpy( p_out , p_in, i_copy_pitch );                    }                    if( p_vout->p_sys->b_attenuate )                    {                        // vertical blend                        // first blended zone                        if( !b_col_first )                        {                            uint8_t *p_dst = &p_out[0];                            for (i_index = 0; i_index < length; i_index++)                            {#ifndef GAMMA                                p_dst[i_index] = (p_vout->p_sys->lambda[1][i_plane][i_index] * p_dst[i_index]) / ACCURACY +                                                        p_vout->p_sys->cstYUV[1][i_plane][i_index];#else                                p_dst[i_index] = p_vout->p_sys->LUT[i_plane][p_vout->p_sys->lambda[1][i_plane][i_index]][p_dst[i_index]];#endif                            }                        }                        // second blended zone                        if( !b_col_last )                        {                            uint8_t *p_dst = &p_out[i_copy_pitch - length];                            for (i_index = 0; i_index < length; i_index++)                            {#ifndef GAMMA                                p_dst[i_index] = (p_vout->p_sys->lambda[0][i_plane][i_index] * p_dst[i_index]) / ACCURACY +                                                        p_vout->p_sys->cstYUV[0][i_plane][i_index];#else                                fprintf( stderr, "r=%d c=%d, i_plane=%d i_index=%d | %d %d\n", i_row, i_col, i_plane, i_index,                                         i_copy_pitch, length );                                fprintf( stderr, "# %d\n", p_dst[i_index] );                                p_dst[i_index] = p_vout->p_sys->LUT[i_plane][p_vout->p_sys->lambda[0][i_plane][i_index]][p_dst[i_index]];#endif                            }                        }                        // end blended zone                    }#endif                    p_in += i_in_pitch;                    p_out += i_out_pitch;                }#ifdef OVERLAP                // horizontal blend                if( p_vout->p_sys->i_row > 2 )                {                    length = 2 * p_vout->p_sys->i_halfHeight / i_div;                    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;                        }                    }                    if( b_row_first )                    {                        // black bar                        TopOffset = i_lines + (2 * p_vout->p_sys->i_halfHeight) / i_div;                        uint8_t *p_dst = p_out - TopOffset * i_out_pitch;                        for (i_index = 0; i_index < length; i_index++)                            memset( &p_dst[i_index * i_out_pitch], constantYUV[i_plane], i_copy_pitch );                    }                    else if( p_vout->p_sys->b_attenuate )                    {                        // first blended zone                        TopOffset = i_lines;                        uint8_t *p_dst = p_out - TopOffset * i_out_pitch;                        for (i_index = 0; i_index < length; i_index++)                        {                            for (i_index2 = 0; i_index2 < i_copy_pitch; i_index2++)                            {#ifndef GAMMA                                p_dst[i_index * i_out_pitch + i_index2] = ( p_vout->p_sys->lambda2[1][i_plane][i_index] *                                             p_dst[i_index * i_out_pitch + i_index2] ) / ACCURACY +                                             p_vout->p_sys->cstYUV2[1][i_plane][i_index];#else                                p_dst[i_index * i_out_pitch + i_index2] = p_vout->p_sys->LUT[i_plane][p_vout->p_sys->lambda2[1][i_plane][i_index]][p_dst[i_index * i_out_pitch + i_index2]];#endif                            }                        }                    }                    if( b_row_last )                    {                        // black bar                        TopOffset = length - (2 * p_vout->p_sys->i_halfHeight) / i_div;                        uint8_t *p_dst = p_out - TopOffset * p_outpic->p[i_plane].i_pitch;                        for (i_index = 0; i_index < length; i_index++)                            memset( &p_dst[i_index * i_out_pitch], constantYUV[i_plane], i_copy_pitch );                    }                    else if( p_vout->p_sys->b_attenuate )                    {                    // second blended zone                        TopOffset = length;                        uint8_t *p_dst = 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++)                            {

⌨️ 快捷键说明

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