Changeset e2ff540dbb82d5505d869e422255fa57bc7b202a

Show
Ignore:
Timestamp:
05/08/04 12:16:58 (4 years ago)
Author:
Gildas Bazin <gbazin@videolan.org>
git-committer:
Gildas Bazin <gbazin@videolan.org> 1091701018 +0000
git-parent:

[d82767397e842b8a2e5cd323bec6482116fed0c2]

git-author:
Gildas Bazin <gbazin@videolan.org> 1091701018 +0000
Message:

* modules/video_filter/blend.c: sanity checks.

Files:

Legend:

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

    r7476804 re2ff540  
    4545                   int, int ); 
    4646static void BlendI420( filter_t *, picture_t *, picture_t *, picture_t *, 
    47                        int, int ); 
     47                       int, int, int, int ); 
    4848static void BlendR16( filter_t *, picture_t *, picture_t *, picture_t *, 
    49                       int, int ); 
     49                      int, int, int, int ); 
    5050static void BlendR24( filter_t *, picture_t *, picture_t *, picture_t *, 
    51                       int, int ); 
     51                      int, int, int, int ); 
    5252static void BlendYUY2( filter_t *, picture_t *, picture_t *, picture_t *, 
    53                        int, int ); 
     53                       int, int, int, int ); 
    5454static void BlendPalI420( filter_t *, picture_t *, picture_t *, picture_t *, 
    55                           int, int ); 
     55                          int, int, int, int ); 
    5656static void BlendPalYUY2( filter_t *, picture_t *, picture_t *, picture_t *, 
    57                           int, int ); 
     57                          int, int, int, int ); 
    5858static void BlendPalRV( filter_t *, picture_t *, picture_t *, picture_t *, 
    59                         int, int ); 
     59                        int, int, int, int ); 
    6060 
    6161/***************************************************************************** 
     
    118118                   int i_x_offset, int i_y_offset ) 
    119119{ 
     120    int i_width, i_height; 
     121 
     122    i_width = __MIN( p_filter->fmt_out.video.i_visible_width - i_x_offset, 
     123                     p_filter->fmt_in.video.i_visible_width ); 
     124 
     125    i_height = __MIN( p_filter->fmt_out.video.i_visible_height - i_y_offset, 
     126                      p_filter->fmt_in.video.i_visible_height ); 
     127 
     128    if( i_width <= 0 || i_height <= 0 ) return; 
     129 
    120130    if( p_filter->fmt_in.video.i_chroma == VLC_FOURCC('Y','U','V','A') && 
    121131        ( p_filter->fmt_out.video.i_chroma == VLC_FOURCC('I','4','2','0') || 
     
    123133    { 
    124134        BlendI420( p_filter, p_dst, p_dst_orig, p_src, 
    125                    i_x_offset, i_y_offset ); 
     135                   i_x_offset, i_y_offset, i_width, i_height ); 
    126136        return; 
    127137    } 
     
    130140    { 
    131141        BlendYUY2( p_filter, p_dst, p_dst_orig, p_src, 
    132                    i_x_offset, i_y_offset ); 
     142                   i_x_offset, i_y_offset, i_width, i_height ); 
    133143        return; 
    134144    } 
     
    137147    { 
    138148        BlendR16( p_filter, p_dst, p_dst_orig, p_src, 
    139                   i_x_offset, i_y_offset ); 
     149                  i_x_offset, i_y_offset, i_width, i_height ); 
    140150        return; 
    141151    } 
     
    145155    { 
    146156        BlendR24( p_filter, p_dst, p_dst_orig, p_src, 
    147                   i_x_offset, i_y_offset ); 
     157                  i_x_offset, i_y_offset, i_width, i_height ); 
    148158        return; 
    149159    } 
     
    153163    { 
    154164        BlendPalI420( p_filter, p_dst, p_dst_orig, p_src, 
    155                       i_x_offset, i_y_offset ); 
     165                      i_x_offset, i_y_offset, i_width, i_height ); 
    156166        return; 
    157167    } 
     
    160170    { 
    161171        BlendPalYUY2( p_filter, p_dst, p_dst_orig, p_src, 
    162                       i_x_offset, i_y_offset ); 
     172                      i_x_offset, i_y_offset, i_width, i_height ); 
    163173        return; 
    164174    } 
     
    169179    { 
    170180        BlendPalRV( p_filter, p_dst, p_dst_orig, p_src, 
    171                     i_x_offset, i_y_offset ); 
     181                    i_x_offset, i_y_offset, i_width, i_height ); 
    172182        return; 
    173183    } 
     
    178188static void BlendI420( filter_t *p_filter, picture_t *p_dst, 
    179189                       picture_t *p_dst_orig, picture_t *p_src, 
    180                        int i_x_offset, int i_y_offset ) 
     190                       int i_x_offset, int i_y_offset, 
     191                       int i_width, int i_height ) 
    181192{ 
    182193    int i_src1_pitch, i_src2_pitch, i_dst_pitch; 
     
    185196    uint8_t *p_src1_v, *p_src2_v, *p_dst_v; 
    186197    uint8_t *p_trans; 
    187     int i_width, i_height, i_x, i_y; 
     198    int i_x, i_y; 
    188199    vlc_bool_t b_even_scanline = i_y_offset % 2; 
    189200 
     
    231242              p_src->p[A_PLANE].i_pitch * p_filter->fmt_in.video.i_y_offset; 
    232243 
    233     i_width = __MIN( p_filter->fmt_out.video.i_visible_width - i_x_offset, 
    234                      p_filter->fmt_in.video.i_visible_width ); 
    235  
    236     i_height = __MIN( p_filter->fmt_out.video.i_visible_height - i_y_offset, 
    237                       p_filter->fmt_in.video.i_visible_height ); 
    238  
    239244#define MAX_TRANS 255 
    240245#define TRANS_BITS  8 
     
    322327static void BlendR16( filter_t *p_filter, picture_t *p_dst_pic, 
    323328                      picture_t *p_dst_orig, picture_t *p_src, 
    324                       int i_x_offset, int i_y_offset ) 
     329                      int i_x_offset, int i_y_offset, 
     330                      int i_width, int i_height ) 
    325331{ 
    326332    int i_src1_pitch, i_src2_pitch, i_dst_pitch; 
     
    328334    uint8_t *p_src2_u, *p_src2_v; 
    329335    uint8_t *p_trans; 
    330     int i_width, i_height, i_x, i_y, i_pix_pitch; 
     336    int i_x, i_y, i_pix_pitch; 
    331337    int r, g, b; 
    332338 
     
    359365              p_src->p[A_PLANE].i_pitch * p_filter->fmt_in.video.i_y_offset; 
    360366 
    361     i_width = __MIN( p_filter->fmt_out.video.i_visible_width - i_x_offset, 
    362                      p_filter->fmt_in.video.i_visible_width ); 
    363  
    364     i_height = __MIN( p_filter->fmt_out.video.i_visible_height - i_y_offset, 
    365                       p_filter->fmt_in.video.i_visible_height ); 
    366  
    367367#define MAX_TRANS 255 
    368368#define TRANS_BITS  8 
     
    408408static void BlendR24( filter_t *p_filter, picture_t *p_dst_pic, 
    409409                      picture_t *p_dst_orig, picture_t *p_src, 
    410                       int i_x_offset, int i_y_offset ) 
     410                      int i_x_offset, int i_y_offset, 
     411                      int i_width, int i_height ) 
    411412{ 
    412413    int i_src1_pitch, i_src2_pitch, i_dst_pitch; 
     
    414415    uint8_t *p_src2_u, *p_src2_v; 
    415416    uint8_t *p_trans; 
    416     int i_width, i_height, i_x, i_y, i_pix_pitch; 
     417    int i_x, i_y, i_pix_pitch; 
    417418    int r, g, b; 
    418419 
     
    445446              p_src->p[A_PLANE].i_pitch * p_filter->fmt_in.video.i_y_offset; 
    446447 
    447     i_width = __MIN( p_filter->fmt_out.video.i_visible_width - i_x_offset, 
    448                      p_filter->fmt_in.video.i_visible_width ); 
    449  
    450     i_height = __MIN( p_filter->fmt_out.video.i_visible_height - i_y_offset, 
    451                       p_filter->fmt_in.video.i_visible_height ); 
    452  
    453448#define MAX_TRANS 255 
    454449#define TRANS_BITS  8 
     
    504499static void BlendYUY2( filter_t *p_filter, picture_t *p_dst_pic, 
    505500                       picture_t *p_dst_orig, picture_t *p_src, 
    506                        int i_x_offset, int i_y_offset ) 
     501                       int i_x_offset, int i_y_offset, 
     502                       int i_width, int i_height ) 
    507503{ 
    508504    int i_src1_pitch, i_src2_pitch, i_dst_pitch; 
     
    510506    uint8_t *p_src2_u, *p_src2_v; 
    511507    uint8_t *p_trans; 
    512     int i_width, i_height, i_x, i_y, i_pix_pitch; 
     508    int i_x, i_y, i_pix_pitch; 
    513509 
    514510    i_pix_pitch = 2; 
     
    540536              p_src->p[A_PLANE].i_pitch * p_filter->fmt_in.video.i_y_offset; 
    541537 
    542     i_width = __MIN( p_filter->fmt_out.video.i_visible_width - i_x_offset, 
    543                      p_filter->fmt_in.video.i_visible_width ); 
    544  
    545     i_height = __MIN( p_filter->fmt_out.video.i_visible_height - i_y_offset, 
    546                       p_filter->fmt_in.video.i_visible_height ); 
    547  
    548538#define MAX_TRANS 255 
    549539#define TRANS_BITS  8 
     
    610600static void BlendPalI420( filter_t *p_filter, picture_t *p_dst, 
    611601                          picture_t *p_dst_orig, picture_t *p_src, 
    612                           int i_x_offset, int i_y_offset ) 
     602                          int i_x_offset, int i_y_offset, 
     603                          int i_width, int i_height ) 
    613604{ 
    614605    int i_src1_pitch, i_src2_pitch, i_dst_pitch; 
     
    616607    uint8_t *p_src1_u, *p_dst_u; 
    617608    uint8_t *p_src1_v, *p_dst_v; 
    618     int i_width, i_height, i_x, i_y; 
     609    int i_x, i_y; 
    619610    vlc_bool_t b_even_scanline = i_y_offset % 2; 
    620611 
     
    651642             i_src2_pitch * p_filter->fmt_in.video.i_y_offset; 
    652643 
    653     i_width = __MIN( p_filter->fmt_out.video.i_visible_width - i_x_offset, 
    654                      p_filter->fmt_in.video.i_visible_width ); 
    655  
    656     i_height = __MIN( p_filter->fmt_out.video.i_visible_height - i_y_offset, 
    657                       p_filter->fmt_in.video.i_visible_height ); 
    658  
    659644#define MAX_TRANS 255 
    660645#define TRANS_BITS  8 
     
    721706static void BlendPalYUY2( filter_t *p_filter, picture_t *p_dst_pic, 
    722707                          picture_t *p_dst_orig, picture_t *p_src, 
    723                           int i_x_offset, int i_y_offset ) 
     708                          int i_x_offset, int i_y_offset, 
     709                          int i_width, int i_height ) 
    724710{ 
    725711    int i_src1_pitch, i_src2_pitch, i_dst_pitch; 
    726712    uint8_t *p_src1, *p_src2, *p_dst; 
    727     int i_width, i_height, i_x, i_y, i_pix_pitch; 
     713    int i_x, i_y, i_pix_pitch; 
    728714 
    729715    i_pix_pitch = 2; 
     
    741727    p_src2 = p_src->p->p_pixels + p_filter->fmt_in.video.i_x_offset + 
    742728             i_src2_pitch * p_filter->fmt_in.video.i_y_offset; 
    743  
    744     i_width = __MIN( p_filter->fmt_out.video.i_visible_width - i_x_offset, 
    745                      p_filter->fmt_in.video.i_visible_width ); 
    746  
    747     i_height = __MIN( p_filter->fmt_out.video.i_visible_height - i_y_offset, 
    748                       p_filter->fmt_in.video.i_visible_height ); 
    749729 
    750730#define MAX_TRANS 255 
     
    814794static void BlendPalRV( filter_t *p_filter, picture_t *p_dst_pic, 
    815795                        picture_t *p_dst_orig, picture_t *p_src, 
    816                         int i_x_offset, int i_y_offset ) 
     796                        int i_x_offset, int i_y_offset, 
     797                        int i_width, int i_height ) 
    817798{ 
    818799    int i_src1_pitch, i_src2_pitch, i_dst_pitch; 
    819800    uint8_t *p_src1, *p_src2, *p_dst; 
    820     int i_width, i_height, i_x, i_y, i_pix_pitch; 
     801    int i_x, i_y, i_pix_pitch; 
    821802    int r, g, b; 
    822803    video_palette_t rgbpalette; 
     
    836817    p_src2 = p_src->p->p_pixels + p_filter->fmt_in.video.i_x_offset + 
    837818             i_src2_pitch * p_filter->fmt_in.video.i_y_offset; 
    838  
    839     i_width = __MIN( p_filter->fmt_out.video.i_visible_width - i_x_offset, 
    840                      p_filter->fmt_in.video.i_visible_width ); 
    841  
    842     i_height = __MIN( p_filter->fmt_out.video.i_visible_height - i_y_offset, 
    843                       p_filter->fmt_in.video.i_visible_height ); 
    844819 
    845820#define MAX_TRANS 255