Changeset 1360a812c7f40bf8e5c2caaaffaab6cf4aaa8271

Show
Ignore:
Timestamp:
02/02/07 21:51:11 (2 years ago)
Author:
Antoine Cellerier <dionoea@videolan.org>
git-committer:
Antoine Cellerier <dionoea@videolan.org> 1170449471 +0000
git-parent:

[0a40fae13a6daf6e924f83c10b3064f72087ae7a]

git-author:
Antoine Cellerier <dionoea@videolan.org> 1170449471 +0000
Message:

Copy clip_uint8() function from ffmpeg and replace where applicable for video filters.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_common.h

    r4ce5cc2 r1360a81  
    628628} 
    629629 
     630/* function imported from libavutil/common.h */ 
     631static inline uint8_t clip_uint8_vlc( int32_t a ) 
     632{ 
     633    if( a&(~255) ) return (-a)>>31; 
     634    else           return a; 
     635} 
     636 
    630637/* Malloc with automatic error */ 
    631638#define MALLOC_VOID( var, type ) { var = (type*)malloc( sizeof( type) ); \ 
  • modules/video_filter/adjust.c

    rd3fe7f2 r1360a81  
    106106{ 
    107107}; 
    108  
    109 inline static int32_t clip( int32_t a ) 
    110 { 
    111     return (a > 255) ? 255 : (a < 0) ? 0 : a; 
    112 } 
    113108 
    114109/***************************************************************************** 
     
    260255        for( i = 0 ; i < 256 ; i++ ) 
    261256        { 
    262           pi_gamma[ i ] = clip( pow(i / 255.0, f_gamma) * 255.0); 
     257          pi_gamma[ i ] = clip_uint8_vlc( pow(i / 255.0, f_gamma) * 255.0); 
    263258        } 
    264259 
     
    266261        for( i = 0 ; i < 256 ; i++ ) 
    267262        { 
    268             pi_luma[ i ] = pi_gamma[clip( i_lum + i_cont * i / 256)]; 
     263            pi_luma[ i ] = pi_gamma[clip_uint8_vlc( i_lum + i_cont * i / 256)]; 
    269264        } 
    270265    } 
     
    344339#define WRITE_UV_CLIP() \ 
    345340    i_u = *p_in++ ; i_v = *p_in_v++ ; \ 
    346     *p_out++ = clip( (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \ 
     341    *p_out++ = clip_uint8_vlc( (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \ 
    347342                           * i_sat) >> 8) + 128); \ 
    348     *p_out_v++ = clip( (( ((i_v * i_cos - i_u * i_sin - i_y) >> 8) \ 
     343    *p_out_v++ = clip_uint8_vlc( (( ((i_v * i_cos - i_u * i_sin - i_y) >> 8) \ 
    349344                           * i_sat) >> 8) + 128) 
    350345 
  • modules/video_filter/gradient.c

    rae6af36 r1360a81  
    419419        { 
    420420            FOR 
    421             if( a>>8 ) 
    422                 p_outpix[y*i_dst_pitch+x] = 255; 
    423             else 
    424                 p_outpix[y*i_dst_pitch+x] = (uint8_t)a; 
     421            p_outpix[y*i_dst_pitch+x] = clip_uint8( a ); 
    425422            }} 
    426423        } 
  • modules/video_filter/panoramix.c

    r9ed0ed0 r1360a81  
    4141    #ifdef SYS_MINGW32 
    4242        #include <windows.h> 
    43     #else  
    44         #include <X11/Xlib.h>    
     43    #else 
     44        #include <X11/Xlib.h> 
    4545    #endif 
    4646    #define GAMMA        1 
     
    368368#ifdef OVERLAP 
    369369    p_vout->p_sys->i_offset_x = var_CreateGetInteger( p_vout, "offset-x" ); 
    370     if (p_vout->p_sys->i_col > 2) p_vout->p_sys->i_offset_x = 0; // offset-x is used in case of 2x1 wall & autocrop     
     370    if (p_vout->p_sys->i_col > 2) p_vout->p_sys->i_offset_x = 0; // offset-x is used in case of 2x1 wall & autocrop 
    371371    p_vout->p_sys->b_autocrop = !(var_CreateGetInteger( p_vout, "crop-ratio" ) == 0); 
    372372    if (!p_vout->p_sys->b_autocrop) p_vout->p_sys->b_autocrop = var_CreateGetInteger( p_vout, "autocrop" );      
     
    384384    p_vout->p_sys->i_ratio_max = var_CreateGetInteger( p_vout, "autocrop-ratio-max" ); // in crop module with autocrop ... 
    385385    p_vout->p_sys->i_ratio = var_CreateGetInteger( p_vout, "crop-ratio" ); // in crop module with manual ratio ...   
    386      
     386 
    387387    p_vout->p_sys->a_2 = d_p * p_vout->p_sys->bz_begin - (double)(d_p * d_p / (d_p - 1)) * p_vout->p_sys->bz_middle + (double)(d_p / (d_p - 1)) * p_vout->p_sys->bz_end; 
    388388    p_vout->p_sys->a_1 = -(d_p + 1) * p_vout->p_sys->bz_begin + (double)(d_p * d_p / (d_p - 1)) * p_vout->p_sys->bz_middle - (double)(1 / (d_p - 1)) * p_vout->p_sys->bz_end; 
     
    499499 
    500500#ifdef PACKED_YUV 
    501 /***************************************************************************** 
    502  * Clip: clip an 32 bits int in 8 bits 
    503  *****************************************************************************/ 
    504 inline static int32_t clip( int32_t a ) 
    505 { 
    506     return (a > 255) ? 255 : (a < 0) ? 0 : a; 
    507 } 
    508501 
    509502/***************************************************************************** 
     
    517510 
    518511 if (input < 0.5) 
    519      return clip((255 * pow(2 * input, gamma)) / 2); 
     512     return clip_uint8((255 * pow(2 * input, gamma)) / 2); 
    520513 else 
    521      return clip(255 * (1 - pow(2 * (1 - input), gamma) / 2)); 
     514     return clip_uint8(255 * (1 - pow(2 * (1 - input), gamma) / 2)); 
    522515 
    523516} 
     
    544537            i_window_width  = GetSystemMetrics(SM_CXSCREEN); 
    545538            i_window_height = GetSystemMetrics(SM_CYSCREEN); 
    546 #else             
     539#else 
    547540            Display *p_display = XOpenDisplay( "" ); 
    548541            if (p_vout->p_sys->b_xinerama) 
     
    555548                i_window_width = DisplayWidth(p_display, 0); 
    556549                i_window_height = DisplayHeight(p_display, 0); 
    557             }  
    558             XCloseDisplay( p_display );      
    559             free(p_display);   
     550            } 
     551            XCloseDisplay( p_display ); 
     552            free(p_display); 
    560553#endif 
    561554        var_SetInteger( p_vout, "width", i_window_width);