Changeset 00a30b7bca39ee783fb2912aa15962dcf18dd97b

Show
Ignore:
Timestamp:
09/01/03 18:47:05 (6 years ago)
Author:
Sam Hocevar <sam@videolan.org>
git-committer:
Sam Hocevar <sam@videolan.org> 1042134425 +0000
git-parent:

[b7529857e7411546c14d3513b74be4b5b109f4d8]

git-author:
Sam Hocevar <sam@videolan.org> 1042134425 +0000
Message:
  • ./modules/video_filter/*.c: all filters now properly use i_visible_pitch
    instead of i_pitch for pixel access (Closes: #30).
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/video_filter/adjust.c

    rb752985 r00a30b7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2000, 2001 VideoLAN 
    5  * $Id: adjust.c,v 1.7 2003/01/09 16:26:14 sam Exp $ 
     5 * $Id: adjust.c,v 1.8 2003/01/09 17:47:05 sam Exp $ 
    66 * 
    77 * Authors: Simon Latapie <garf@via.ecp.fr>, Samuel Hocevar <sam@zoy.org> 
     
    196196 
    197197    picture_t *p_outpic; 
    198     uint8_t *p_in, *p_in_u, *p_in_v, *p_in_end, *p_line_end; 
    199     uint8_t *p_out, *p_out_u, *p_out_v; 
     198    uint8_t *p_in, *p_in_v, *p_in_end, *p_line_end; 
     199    uint8_t *p_out, *p_out_v; 
    200200 
    201201    double  f_hue; 
     
    264264 
    265265        p_in += p_pic->p[0].i_pitch - p_pic->p[0].i_visible_pitch; 
     266        p_out += p_outpic->p[0].i_pitch - p_outpic->p[0].i_visible_pitch; 
    266267    } 
    267268 
     
    270271     */ 
    271272 
    272     p_in_u = p_pic->p[1].p_pixels; 
     273    p_in = p_pic->p[1].p_pixels; 
    273274    p_in_v = p_pic->p[2].p_pixels; 
    274     p_in_end = p_in_u + p_pic->p[1].i_lines * p_pic->p[1].i_pitch - 8; 
    275  
    276     p_out_u = p_outpic->p[1].p_pixels; 
     275    p_in_end = p_in + p_pic->p[1].i_lines * p_pic->p[1].i_pitch - 8; 
     276 
     277    p_out = p_outpic->p[1].p_pixels; 
    277278    p_out_v = p_outpic->p[2].p_pixels; 
    278279 
     
    286287    { 
    287288#define WRITE_UV_CLIP() \ 
    288     i_u = *p_in_u++ ; i_v = *p_in_v++ ; \ 
    289     *p_out_u++ = clip( (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \ 
     289    i_u = *p_in++ ; i_v = *p_in_v++ ; \ 
     290    *p_out++ = clip( (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \ 
    290291                           * i_sat) >> 8) + 128); \ 
    291292    *p_out_v++ = clip( (( ((i_v * i_cos - i_u * i_sin - i_y) >> 8) \ 
     
    294295        uint8_t i_u, i_v; 
    295296 
    296         for( ; p_in_u < p_in_end ; ) 
    297         { 
    298             p_line_end = p_in_u + p_pic->p[1].i_visible_pitch - 8; 
    299  
    300             for( ; p_in_u < p_line_end ; ) 
     297        for( ; p_in < p_in_end ; ) 
     298        { 
     299            p_line_end = p_in + p_pic->p[1].i_visible_pitch - 8; 
     300 
     301            for( ; p_in < p_line_end ; ) 
    301302            { 
    302303                /* Do 8 pixels at a time */ 
     
    309310            p_line_end += 8; 
    310311 
    311             for( ; p_in_u < p_line_end ; ) 
     312            for( ; p_in < p_line_end ; ) 
    312313            { 
    313314                WRITE_UV_CLIP(); 
    314315            } 
    315316 
    316             p_in_u += p_pic->p[1].i_pitch - p_pic->p[1].i_visible_pitch; 
     317            p_in += p_pic->p[1].i_pitch - p_pic->p[1].i_visible_pitch; 
    317318            p_in_v += p_pic->p[2].i_pitch - p_pic->p[2].i_visible_pitch; 
    318             p_out_u += p_pic->p[1].i_pitch - p_pic->p[1].i_visible_pitch; 
    319             p_out_v += p_pic->p[2].i_pitch - p_pic->p[2].i_visible_pitch; 
     319            p_out += p_outpic->p[1].i_pitch - p_outpic->p[1].i_visible_pitch; 
     320            p_out_v += p_outpic->p[2].i_pitch - p_outpic->p[2].i_visible_pitch; 
    320321        } 
    321322    } 
     
    323324    { 
    324325#define WRITE_UV() \ 
    325     i_u = *p_in_u++ ; i_v = *p_in_v++ ; \ 
    326     *p_out_u++ = (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \ 
     326    i_u = *p_in++ ; i_v = *p_in_v++ ; \ 
     327    *p_out++ = (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \ 
    327328                       * i_sat) >> 8) + 128; \ 
    328329    *p_out_v++ = (( ((i_v * i_cos - i_u * i_sin - i_y) >> 8) \ 
     
    331332        uint8_t i_u, i_v; 
    332333 
    333         for( ; p_in_u < p_in_end ; ) 
     334        for( ; p_in < p_in_end ; ) 
    334335        { 
    335336            p_line_end = p_in + p_pic->p[1].i_visible_pitch - 8; 
    336337 
    337             for( ; p_in_u < p_line_end ; ) 
     338            for( ; p_in < p_line_end ; ) 
    338339            { 
    339340                /* Do 8 pixels at a time */ 
     
    344345            p_line_end += 8; 
    345346 
    346             for( ; p_in_u < p_line_end ; ) 
     347            for( ; p_in < p_line_end ; ) 
    347348            { 
    348349                WRITE_UV(); 
    349350            } 
    350351 
    351             p_in_u += p_pic->p[1].i_pitch - p_pic->p[1].i_visible_pitch; 
     352            p_in += p_pic->p[1].i_pitch - p_pic->p[1].i_visible_pitch; 
    352353            p_in_v += p_pic->p[2].i_pitch - p_pic->p[2].i_visible_pitch; 
    353             p_out_u += p_pic->p[1].i_pitch - p_pic->p[1].i_visible_pitch; 
    354             p_out_v += p_pic->p[2].i_pitch - p_pic->p[2].i_visible_pitch; 
     354            p_out += p_outpic->p[1].i_pitch - p_outpic->p[1].i_visible_pitch; 
     355            p_out_v += p_outpic->p[2].i_pitch - p_outpic->p[2].i_visible_pitch; 
    355356        } 
    356357    } 
  • modules/video_filter/clone.c

    re2da42f r00a30b7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: clone.c,v 1.3 2002/11/28 17:35:00 sam Exp $ 
     5 * $Id: clone.c,v 1.4 2003/01/09 17:47:05 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    1111 * the Free Software Foundation; either version 2 of the License, or 
    1212 * (at your option) any later version. 
    13  *  
     13 * 
    1414 * This program is distributed in the hope that it will be useful, 
    1515 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     
    122122    int   i_index, i_vout; 
    123123    picture_t *p_pic; 
    124      
     124 
    125125    I_OUTPUTPICTURES = 0; 
    126126 
     
    218218        for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ ) 
    219219        { 
    220             u8 *p_in, *p_in_end, *p_out; 
     220            uint8_t *p_in, *p_in_end, *p_out; 
    221221            int i_in_pitch = p_pic->p[i_plane].i_pitch; 
    222222            const int i_out_pitch = p_outpic->p[i_plane].i_pitch; 
     223            const int i_copy_pitch = p_outpic->p[i_plane].i_visible_pitch; 
    223224 
    224225            p_in = p_pic->p[i_plane].p_pixels; 
    225  
    226             p_in_end = p_in + p_outpic->p[i_plane].i_lines 
    227                                * p_pic->p[i_plane].i_pitch; 
    228  
    229226            p_out = p_outpic->p[i_plane].p_pixels; 
    230227 
    231             while( p_in < p_in_end ) 
     228            if( i_in_pitch == i_copy_pitch 
     229                 && i_out_pitch == i_copy_pitch ) 
    232230            { 
    233                 p_vout->p_vlc->pf_memcpy( p_out, p_in, i_out_pitch ); 
    234                 p_in += i_in_pitch; 
    235                 p_out += i_out_pitch; 
     231                p_vout->p_vlc->pf_memcpy( p_out, p_in, i_in_pitch 
     232                                           * p_outpic->p[i_plane].i_lines ); 
     233            } 
     234            else 
     235            { 
     236                p_in_end = p_in + i_in_pitch * p_outpic->p[i_plane].i_lines; 
     237 
     238                while( p_in < p_in_end ) 
     239                { 
     240                    p_vout->p_vlc->pf_memcpy( p_out, p_in, i_copy_pitch ); 
     241                    p_in += i_in_pitch; 
     242                    p_out += i_out_pitch; 
     243                } 
    236244            } 
    237245        } 
  • modules/video_filter/crop.c

    rade615b r00a30b7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: crop.c,v 1.5 2002/12/06 16:34:07 sam Exp $ 
     5 * $Id: crop.c,v 1.6 2003/01/09 17:47:05 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    1111 * the Free Software Foundation; either version 2 of the License, or 
    1212 * (at your option) any later version. 
    13  *  
     13 * 
    1414 * This program is distributed in the hope that it will be useful, 
    1515 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     
    9999    { 
    100100        msg_Err( p_vout, "out of memory" ); 
    101         return 1
     101        return VLC_ENOMEM
    102102    } 
    103103 
     
    108108    p_vout->pf_display = NULL; 
    109109 
    110     return 0
     110    return VLC_SUCCESS
    111111} 
    112112 
     
    119119    char *psz_var; 
    120120    picture_t *p_pic; 
    121      
     121 
    122122    I_OUTPUTPICTURES = 0; 
    123123 
    124124    p_vout->p_sys->i_lastchange = 0; 
    125     p_vout->p_sys->b_changed = 0
     125    p_vout->p_sys->b_changed = VLC_FALSE
    126126 
    127127    /* Initialize the output structure */ 
     
    239239    { 
    240240        msg_Err( p_vout, "failed to create vout" ); 
    241         return 0
     241        return VLC_EGENERIC
    242242    } 
    243243 
    244244    ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES ); 
    245245 
    246     return 0
     246    return VLC_SUCCESS
    247247} 
    248248 
     
    285285    if( !p_vout->p_sys->b_changed ) 
    286286    { 
    287         return 0
     287        return VLC_SUCCESS
    288288    } 
    289289 
     
    296296    { 
    297297        msg_Err( p_vout, "failed to create vout" ); 
    298         return 1
    299     } 
    300  
    301     p_vout->p_sys->b_changed = 0
     298        return VLC_EGENERIC
     299    } 
     300 
     301    p_vout->p_sys->b_changed = VLC_FALSE
    302302    p_vout->p_sys->i_lastchange = 0; 
    303303 
    304     return 0
     304    return VLC_SUCCESS
    305305} 
    306306 
     
    340340    for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ ) 
    341341    { 
    342         u8 *p_in, *p_out, *p_out_end; 
     342        uint8_t *p_in, *p_out, *p_out_end; 
    343343        int i_in_pitch = p_pic->p[i_plane].i_pitch; 
    344344        const int i_out_pitch = p_outpic->p[i_plane].i_pitch; 
     345        const int i_copy_pitch = p_outpic->p[i_plane].i_visible_pitch; 
    345346 
    346347        p_in = p_pic->p[i_plane].p_pixels 
     
    356357        while( p_out < p_out_end ) 
    357358        { 
    358             p_vout->p_vlc->pf_memcpy( p_out, p_in, i_out_pitch ); 
     359            p_vout->p_vlc->pf_memcpy( p_out, p_in, i_copy_pitch ); 
    359360            p_in += i_in_pitch; 
    360361            p_out += i_out_pitch; 
     
    366367 
    367368    /* The source image may still be in the cache ... parse it! */ 
    368     if( !p_vout->p_sys->b_autocrop ) 
    369     { 
    370         return; 
    371     } 
    372  
    373     UpdateStats( p_vout, p_pic ); 
     369    if( p_vout->p_sys->b_autocrop ) 
     370    { 
     371        UpdateStats( p_vout, p_pic ); 
     372    } 
    374373} 
    375374 
     
    378377    uint8_t *p_in = p_pic->p[0].p_pixels; 
    379378    int i_pitch = p_pic->p[0].i_pitch; 
     379    int i_visible_pitch = p_pic->p[0].i_visible_pitch; 
    380380    int i_lines = p_pic->p[0].i_lines; 
    381381    int i_firstwhite = -1, i_lastwhite = -1, i; 
     
    392392 
    393393            if( p_in[i_col/2] > 40 
    394                  && p_in[i_pitch / 2] > 40 
    395                  && p_in[i_pitch/2 + i_col/2] > 40 ) 
     394                 && p_in[i_visible_pitch/2] > 40 
     395                 && p_in[i_visible_pitch/2 + i_col/2] > 40 ) 
    396396            { 
    397397                if( i_lastwhite == -1 ) 
     
    458458                            * p_vout->p_sys->i_width / p_vout->output.i_width; 
    459459 
    460     p_vout->p_sys->b_changed = 1; 
    461 
     460    p_vout->p_sys->b_changed = VLC_TRUE; 
     461
     462 
  • modules/video_filter/distort.c

    re2da42f r00a30b7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2000, 2001 VideoLAN 
    5  * $Id: distort.c,v 1.4 2002/11/28 17:35:00 sam Exp $ 
     5 * $Id: distort.c,v 1.5 2003/01/09 17:47:05 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    1111 * the Free Software Foundation; either version 2 of the License, or 
    1212 * (at your option) any later version. 
    13  *  
     13 * 
    1414 * This program is distributed in the hope that it will be useful, 
    1515 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     
    100100    { 
    101101        msg_Err( p_vout, "out of memory" ); 
    102         return( 1 )
     102        return VLC_ENOMEM
    103103    } 
    104104 
     
    114114    { 
    115115        msg_Err( p_vout, "configuration variable %s empty", "filter" ); 
    116         return( 1 )
     116        return VLC_EGENERIC
    117117    } 
    118118    while( *psz_method && *psz_method != ':' ) 
     
    142142        } 
    143143        else { 
    144          
     144 
    145145            if( !strcmp( psz_method, "wave" ) ) 
    146146            { 
     
    151151                p_vout->p_sys->i_mode = DISTORT_MODE_RIPPLE; 
    152152            } 
    153              
    154153            else 
    155154            { 
     
    161160    } 
    162161    free( psz_method_tmp ); 
    163      
    164     return( 0 )
    165 } 
    166      
     162 
     163    return VLC_SUCCESS
     164} 
     165 
    167166/***************************************************************************** 
    168167 * Init: initialize Distort video thread output method 
     
    193192        msg_Err( p_vout, "cannot open vout, aborting" ); 
    194193 
    195         return( 0 )
     194        return VLC_EGENERIC
    196195    } 
    197196 
     
    201200    p_vout->p_sys->last_date = 0; 
    202201 
    203     return( 0 )
     202    return VLC_SUCCESS
    204203} 
    205204 
     
    291290    { 
    292291        int i_line, i_num_lines, i_offset; 
    293         u8 black_pixel; 
    294         u8 *p_in, *p_out; 
     292        uint8_t black_pixel; 
     293        uint8_t *p_in, *p_out; 
    295294 
    296295        p_in = p_inpic->p[i_index].p_pixels; 
     
    305304        { 
    306305            /* Calculate today's offset, don't go above 1/20th of the screen */ 
    307             i_offset = (int)( (double)(p_inpic->p[i_index].i_pitch) 
     306            i_offset = (int)( (double)(p_inpic->p[i_index].i_visible_pitch) 
    308307                         * sin( f_angle + 10.0 * (double)i_line 
    309308                                               / (double)i_num_lines ) 
     
    315314                { 
    316315                    p_vout->p_vlc->pf_memcpy( p_out, p_in - i_offset, 
    317                                  p_inpic->p[i_index].i_pitch + i_offset ); 
     316                             p_inpic->p[i_index].i_visible_pitch + i_offset ); 
    318317                    p_in += p_inpic->p[i_index].i_pitch; 
    319318                    p_out += p_outpic->p[i_index].i_pitch; 
     
    323322                { 
    324323                    p_vout->p_vlc->pf_memcpy( p_out + i_offset, p_in, 
    325                                  p_inpic->p[i_index].i_pitch - i_offset ); 
     324                             p_inpic->p[i_index].i_visible_pitch - i_offset ); 
    326325                    memset( p_out, black_pixel, i_offset ); 
    327326                    p_in += p_inpic->p[i_index].i_pitch; 
     
    332331            { 
    333332                p_vout->p_vlc->pf_memcpy( p_out, p_in, 
    334                                           p_inpic->p[i_index].i_pitch ); 
     333                                          p_inpic->p[i_index].i_visible_pitch ); 
    335334                p_in += p_inpic->p[i_index].i_pitch; 
    336335                p_out += p_outpic->p[i_index].i_pitch; 
     
    358357    { 
    359358        int i_line, i_first_line, i_num_lines, i_offset; 
    360         u8 black_pixel; 
    361         u8 *p_in, *p_out; 
     359        uint8_t black_pixel; 
     360        uint8_t *p_in, *p_out; 
    362361 
    363362        black_pixel = ( i_index == Y_PLANE ) ? 0x00 : 0x80; 
     
    370369        p_out = p_outpic->p[i_index].p_pixels; 
    371370 
    372         p_vout->p_vlc->pf_memcpy( p_out, p_in, 
    373                                   i_first_line * p_inpic->p[i_index].i_pitch ); 
    374  
    375         p_in += i_first_line * p_inpic->p[i_index].i_pitch; 
    376         p_out += i_first_line * p_outpic->p[i_index].i_pitch; 
     371        for( i_line = 0 ; i_line < i_first_line ; i_line++ ) 
     372        { 
     373            p_vout->p_vlc->pf_memcpy( p_out, p_in, 
     374                                      p_inpic->p[i_index].i_visible_pitch ); 
     375            p_in += p_inpic->p[i_index].i_pitch; 
     376            p_out += p_outpic->p[i_index].i_pitch; 
     377        } 
    377378 
    378379        /* Ok, we do 3 times the sin() calculation for each line. So what ? */ 
     
    393394                { 
    394395                    p_vout->p_vlc->pf_memcpy( p_out, p_in - i_offset, 
    395                                  p_inpic->p[i_index].i_pitch + i_offset ); 
     396                             p_inpic->p[i_index].i_visible_pitch + i_offset ); 
    396397                    p_in -= p_inpic->p[i_index].i_pitch; 
    397398                    p_out += p_outpic->p[i_index].i_pitch; 
     
    401402                { 
    402403                    p_vout->p_vlc->pf_memcpy( p_out + i_offset, p_in, 
    403                                  p_inpic->p[i_index].i_pitch - i_offset ); 
     404                             p_inpic->p[i_index].i_visible_pitch - i_offset ); 
    404405                    memset( p_out, black_pixel, i_offset ); 
    405406                    p_in -= p_inpic->p[i_index].i_pitch; 
     
    410411            { 
    411412                p_vout->p_vlc->pf_memcpy( p_out, p_in, 
    412                                           p_inpic->p[i_index].i_pitch ); 
     413                                          p_inpic->p[i_index].i_visible_pitch ); 
    413414                p_in -= p_inpic->p[i_index].i_pitch; 
    414415                p_out += p_outpic->p[i_index].i_pitch; 
  • modules/video_filter/invert.c

    re2da42f r00a30b7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2000, 2001 VideoLAN 
    5  * $Id: invert.c,v 1.3 2002/11/28 17:35:00 sam Exp $ 
     5 * $Id: invert.c,v 1.4 2003/01/09 17:47:05 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    1111 * the Free Software Foundation; either version 2 of the License, or 
    1212 * (at your option) any later version. 
    13  *  
     13 * 
    1414 * This program is distributed in the hope that it will be useful, 
    1515 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     
    120120        return( 0 ); 
    121121    } 
    122   
     122 
    123123    ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES ); 
    124124 
     
    147147 *****************************************************************************/ 
    148148static void Destroy( vlc_object_t *p_this ) 
    149 {    
     149{ 
    150150    vout_thread_t *p_vout = (vout_thread_t *)p_this; 
    151151 
     
    176176        } 
    177177        msleep( VOUT_OUTMEM_SLEEP ); 
    178     }    
     178    } 
    179179 
    180180    vout_DatePicture( p_vout->p_sys->p_vout, p_outpic, p_pic->date ); 
     
    183183    for( i_index = 0 ; i_index < p_pic->i_planes ; i_index++ ) 
    184184    { 
    185         u8 *p_in, *p_in_end, *p_out; 
     185        uint8_t *p_in, *p_in_end, *p_line_end, *p_out; 
    186186 
    187187        p_in = p_pic->p[i_index].p_pixels; 
    188         p_in_end = p_in - 64 + p_pic->p[i_index].i_lines 
    189                                 * p_pic->p[i_index].i_pitch; 
     188        p_in_end = p_in + p_pic->p[i_index].i_lines 
     189                           * p_pic->p[i_index].i_pitch; 
    190190 
    191191        p_out = p_outpic->p[i_index].p_pixels; 
     
    193193        for( ; p_in < p_in_end ; ) 
    194194        { 
    195             /* Do 64 pixels at a time */ 
    196             *((u64*)p_out)++ = ~( *((u64*)p_in)++ ); 
    197             *((u64*)p_out)++ = ~( *((u64*)p_in)++ ); 
    198             *((u64*)p_out)++ = ~( *((u64*)p_in)++ ); 
    199             *((u64*)p_out)++ = ~( *((u64*)p_in)++ ); 
    200             *((u64*)p_out)++ = ~( *((u64*)p_in)++ ); 
    201             *((u64*)p_out)++ = ~( *((u64*)p_in)++ ); 
    202             *((u64*)p_out)++ = ~( *((u64*)p_in)++ ); 
    203             *((u64*)p_out)++ = ~( *((u64*)p_in)++ ); 
     195            p_line_end = p_in + p_pic->p[i_index].i_visible_pitch - 64; 
     196 
     197            for( ; p_in < p_line_end ; ) 
     198            { 
     199                /* Do 64 pixels at a time */ 
     200                *((uint64_t*)p_out)++ = ~( *((uint64_t*)p_in)++ ); 
     201                *((uint64_t*)p_out)++ = ~( *((uint64_t*)p_in)++ ); 
     202                *((uint64_t*)p_out)++ = ~( *((uint64_t*)p_in)++ ); 
     203                *((uint64_t*)p_out)++ = ~( *((uint64_t*)p_in)++ ); 
     204                *((uint64_t*)p_out)++ = ~( *((uint64_t*)p_in)++ ); 
     205                *((uint64_t*)p_out)++ = ~( *((uint64_t*)p_in)++ ); 
     206                *((uint64_t*)p_out)++ = ~( *((uint64_t*)p_in)++ ); 
     207                *((uint64_t*)p_out)++ = ~( *((uint64_t*)p_in)++ ); 
     208            } 
     209 
     210            p_line_end += 64; 
     211 
     212            for( ; p_in < p_line_end ; ) 
     213            { 
     214                *p_out++ = ~( *p_in++ ); 
     215            } 
     216 
     217            p_in += p_pic->p[i_index].i_pitch 
     218                     - p_pic->p[i_index].i_visible_pitch; 
     219            p_out += p_outpic->p[i_index].i_pitch 
     220                     - p_outpic->p[i_index].i_visible_pitch; 
    204221        } 
    205  
    206         p_in_end += 64; 
    207  
    208         for( ; p_in < p_in_end ; ) 
    209         { 
    210             /* Do 1 pixel at a time */ 
    211             *p_out++ = ~( *p_in++ ); 
    212         } 
    213222    } 
    214223 
  • modules/video_filter/motionblur.c

    re2da42f r00a30b7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2000, 2001 VideoLAN 
    5  * $Id: motionblur.c,v 1.4 2002/11/28 17:35:00 sam Exp $ 
     5 * $Id: motionblur.c,v 1.5 2003/01/09 17:47:05 sam Exp $ 
    66 * 
    77 * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> 
     
    1111 * the Free Software Foundation; either version 2 of the License, or 
    1212 * (at your option) any later version. 
    13  *  
     13 * 
    1414 * This program is distributed in the hope that it will be useful, 
    1515 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     
    8484 *****************************************************************************/ 
    8585static int Create( vlc_object_t *p_this ) 
    86 {    
     86{ 
    8787    vout_thread_t *p_vout = (vout_thread_t *)p_this; 
    8888 
     
    9292    { 
    9393        msg_Err( p_vout, "out of memory" ); 
    94         return 1
     94        return VLC_ENOMEM
    9595    } 
    9696 
     
    106106    p_vout->p_sys->p_lastpic = NULL; 
    107107 
    108     return 0
     108    return VLC_SUCCESS
    109109} 
    110110 
     
    116116    int i_index; 
    117117    picture_t *p_pic; 
    118      
     118 
    119119    I_OUTPUTPICTURES = 0; 
    120120 
     
    134134 
    135135        default: 
    136             return 0; /* unknown chroma */ 
     136            return VLC_EGENERIC; /* unknown chroma */ 
    137137            break; 
    138138    } 
     
    158158        msg_Err( p_vout, "cannot open vout, aborting" ); 
    159159 
    160         return 0
    161     } 
    162   
     160        return VLC_EGENERIC
     161    } 
     162 
    163163    ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES ); 
    164164 
    165     return 0
     165    return VLC_SUCCESS
    166166} 
    167167 
     
    215215    } 
    216216    vout_DatePicture( p_vout, p_outpic, p_pic->date ); 
    217      
     217 
    218218    if ( p_vout->p_sys->p_lastpic == NULL ) 
    219219    { 
     
    253253    CopyPicture( p_vout, p_vout->p_sys->p_lastpic, p_outpic ); 
    254254    vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic ); 
    255  
    256 
    257  
    258 static void CopyPicture( vout_thread_t *p_vout, 
    259                          picture_t *p_dest, picture_t *p_source) 
    260 
    261     int i_plane; 
    262  
    263     for( i_plane = 0 ; i_plane < p_dest->i_planes ; i_plane++ ) 
    264     { 
    265         u8 *p_in, *p_out; 
    266  
    267         p_in = p_source->p[i_plane].p_pixels; 
    268  
    269         p_out = p_dest->p[i_plane].p_pixels; 
    270         p_vout->p_vlc->pf_memcpy( p_out, p_in, 
    271                                   p_dest->p[i_plane].i_pitch * 
    272                                   p_dest->p[i_plane].i_lines); 
    273     } 
    274 
    275 /***************************************************************************** 
    276  * RenderBob: renders a bob picture 
     255
     256 
     257/* FIXME: this is a verbatim copy from src/video_output/vout_pictures.c */ 
     258/* XXX: the order is fucked up!! */ 
     259static void CopyPicture( vout_thread_t * p_vout, 
     260                         picture_t *p_dest, picture_t *p_src ) 
     261
     262    int i; 
     263 
     264    for( i = 0; i < p_src->i_planes ; i++ ) 
     265    { 
     266        if( p_src->p[i].i_pitch == p_dest->p[i].i_pitch ) 
     267        { 
     268            /* There are margins, but with the same width : perfect ! */ 
     269            p_vout->p_vlc->pf_memcpy( 
     270                         p_dest->p[i].p_pixels, p_src->p[i].p_pixels, 
     271                         p_src->p[i].i_pitch * p_src->p[i].i_lines ); 
     272        } 
     273        else 
     274        { 
     275            /* We need to proceed line by line */ 
     276            uint8_t *p_in = p_src->p[i].p_pixels; 
     277            uint8_t *p_out = p_dest->p[i].p_pixels; 
     278            int i_line; 
     279 
     280            for( i_line = p_src->p[i].i_lines; i_line--; ) 
     281            { 
     282                p_vout->p_vlc->pf_memcpy( p_out, p_in, 
     283                                          p_src->p[i].i_visible_pitch ); 
     284                p_in += p_src->p[i].i_pitch; 
     285                p_out += p_dest->p[i].i_pitch; 
     286            } 
     287        } 
     288    } 
     289
     290 
     291/***************************************************************************** 
     292 * RenderBlur: renders a blurred picture 
    277293 *****************************************************************************/ 
    278294static void RenderBlur( vout_thread_t *p_vout, picture_t *p_oldpic, 
     
    284300    for( i_plane = 0; i_plane < p_outpic->i_planes; i_plane++ ) 
    285301    { 
    286         u8 *p_old, *p_new, *p_out, *p_out_end; 
     302        uint8_t *p_old, *p_new, *p_out, *p_out_end, *p_out_line_end; 
    287303        p_out = p_outpic->p[i_plane].p_pixels; 
    288304        p_new = p_newpic->p[i_plane].p_pixels; 
    289305        p_old = p_oldpic->p[i_plane].p_pixels; 
    290306        p_out_end = p_out + p_outpic->p[i_plane].i_pitch * 
    291             p_outpic->p[i_plane].i_lines; 
     307                             p_outpic->p[i_plane].i_lines; 
    292308        while ( p_out < p_out_end ) 
    293309        { 
    294             *p_out++ = (((*p_old++) * i_oldfactor) + 
    295                         ((*p_new++) * i_newfactor)) >> 7; 
    296              
    297 //            *p_out++ = (*p_old++ >> 1) + (*p_new++ >> 1); 
    298                  
    299         } 
    300     } 
    301 
     310            p_out_line_end = p_out + p_outpic->p[i_plane].i_visible_pitch; 
     311 
     312            while ( p_out < p_out_line_end ) 
     313            { 
     314                *p_out++ = (((*p_old++) * i_oldfactor) + 
     315                            ((*p_new++) * i_newfactor)) >> 7; 
     316 
     317//                *p_out++ = (*p_old++ >> 1) + (*p_new++ >> 1); 
     318            } 
     319 
     320            p_old += p_oldpic->p[i_plane].i_pitch 
     321                      - p_oldpic->p[i_plane].i_visible_pitch; 
     322            p_new += p_newpic->p[i_plane].i_pitch 
     323                      - p_newpic->p[i_plane].i_visible_pitch; 
     324            p_out += p_outpic->p[i_plane].i_pitch 
     325                      - p_outpic->p[i_plane].i_visible_pitch; 
     326        } 
     327    } 
     328
     329 
  • modules/video_filter/transform.c

    rf86eec5 r00a30b7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2000, 2001 VideoLAN 
    5  * $Id: transform.c,v 1.5 2003/01/09 14:00:00 sam Exp $ 
     5 * $Id: transform.c,v 1.6 2003/01/09 17:47:05 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    289289 
    290290        case TRANSFORM_MODE_180: 
    291             /* FIXME: we should use i_visible_pitch here */ 
    292291            for( i_index = 0 ; i_index < p_pic->i_planes ; i_index++ ) 
    293292            { 
     
    300299                for( ; p_in < p_in_end ; ) 
    301300                { 
    302                     *p_out++ = *(--p_in_end); 
     301                    uint8_t *p_line_start = p_in - p_pic->p[i_index].i_pitch; 
     302                    p_in_end -= p_pic->p[i_index].i_pitch 
     303                                 - p_pic->p[i_index].i_visible_pitch; 
     304 
     305                    for( ; p_line_start < p_in_end ; ) 
     306                    { 
     307                        *p_out++ = *(--p_in_end); 
     308                    } 
     309 
     310                    p_out += p_outpic->p[i_index].i_pitch 
     311                              - p_outpic->p[i_index].i_visible_pitch; 
    303312                } 
    304313            } 
  • modules/video_filter/wall.c

    re2da42f r00a30b7  
    33 ***************************************************************************** 
    44 * Copyright (C) 2000, 2001 VideoLAN 
    5  * $Id: wall.c,v 1.4 2002/11/28 17:35:00 sam Exp $ 
     5 * $Id: wall.c,v 1.5 2003/01/09 17:47:05 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    1111 * the Free Software Foundation; either version 2 of the License, or 
    1212 * (at your option) any later version. 
    13  *  
     13 * 
    1414 * This program is distributed in the hope that it will be useful, 
    1515 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     
    107107    { 
    108108        msg_Err( p_vout, "out of memory" ); 
    109         return( 1 )
     109        return VLC_ENOMEM
    110110    } 
    111111 
     
    133133        msg_Err( p_vout, "out of memory" ); 
    134134        free( p_vout->p_sys ); 
    135         return( 1 )
     135        return VLC_ENOMEM
    136136    } 
    137137 
     
    186186    free( psz_method_tmp ); 
    187187 
    188     return( 0 )
     188    return VLC_SUCCESS
    189189} 
    190190 
     
    196196    int i_index, i_row, i_col, i_width, i_height; 
    197197    picture_t *p_pic; 
    198      
     198 
    199199    I_OUTPUTPICTURES = 0; 
    200200 
     
    259259                                 p_vout->p_sys->i_col, p_vout->p_sys->i_row ); 
    260260                RemoveAllVout( p_vout ); 
    261                 return 0
     261                return VLC_EGENERIC
    262262            } 
    263263 
     
    268268    ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES ); 
    269269 
    270     return( 0 )
     270    return VLC_SUCCESS
    271271} 
    272272 
     
    364364            for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ ) 
    365365            { 
    366                 u8 *p_in, *p_in_end, *p_out; 
     366                uint8_t *p_in, *p_in_end, *p_out; 
    367367                int i_in_pitch = p_pic->p[i_plane].i_pitch; 
    368368                int i_out_pitch = p_outpic->p[i_plane].i_pitch; 
     369                int i_copy_pitch = p_outpic->p[i_plane].i_visible_pitch; 
    369370 
    370371                p_in = p_pic->p[i_plane].p_pixels 
     
    378379                while( p_in < p_in_end ) 
    379380                { 
    380                     p_vout->p_vlc->pf_memcpy( p_out, p_in, i_out_pitch ); 
     381                    p_vout->p_vlc->pf_memcpy( p_out, p_in, i_copy_pitch ); 
    381382                    p_in += i_in_pitch; 
    382383                    p_out += i_out_pitch;