Changeset c2633d59c55c65107505aef43331ca0caed76b83

Show
Ignore:
Timestamp:
04/01/04 14:30:07 (4 years ago)
Author:
Eric Petit <titer@videolan.org>
git-committer:
Eric Petit <titer@videolan.org> 1080822607 +0000
git-parent:

[bc138de9f090772a5bf99d93914684e3db151fa6]

git-author:
Eric Petit <titer@videolan.org> 1080822607 +0000
Message:

i420_yuy2.c: fixed AltiVec? conversion for unusual image sizes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/video_chroma/i420_yuy2.c

    r9ab737d rc2633d5  
    33 ***************************************************************************** 
    44 * Copyright (C) 2000, 2001 VideoLAN 
    5  * $Id: i420_yuy2.c,v 1.7 2004/01/27 03:22:03 titer Exp
     5 * $Id
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    166166    int i_x, i_y; 
    167167 
    168 #if !defined (MODULE_NAME_IS_i420_yuy2_altivec) 
    169     const int i_source_margin = p_source->p->i_pitch 
    170                                  - p_source->p->i_visible_pitch; 
    171     const int i_dest_margin = p_dest->p->i_pitch 
    172                                - p_dest->p->i_visible_pitch; 
    173  
    174     for( i_y = p_vout->render.i_height / 2 ; i_y-- ; ) 
    175     { 
    176         p_line1 = p_line2; 
    177         p_line2 += p_dest->p->i_pitch; 
    178  
    179         p_y1 = p_y2; 
    180         p_y2 += p_source->p[Y_PLANE].i_pitch; 
    181  
    182         for( i_x = p_vout->render.i_width / 8 ; i_x-- ; ) 
    183         { 
    184 #if defined (MODULE_NAME_IS_i420_yuy2) 
    185             C_YUV420_YUYV( ); 
    186             C_YUV420_YUYV( ); 
    187             C_YUV420_YUYV( ); 
    188             C_YUV420_YUYV( ); 
    189 #else 
    190             MMX_CALL( MMX_YUV420_YUYV ); 
    191 #endif 
    192         } 
    193  
    194         p_y1 += i_source_margin; 
    195         p_y2 += i_source_margin; 
    196         p_line1 += i_dest_margin; 
    197         p_line2 += i_dest_margin; 
    198     } 
    199 #else 
     168#if defined (MODULE_NAME_IS_i420_yuy2_altivec) 
    200169#define VEC_NEXT_LINES( ) \ 
    201170    p_line1  = p_line2; \ 
     
    222191    vector unsigned char y_vec; 
    223192 
    224     if( !( p_vout->render.i_width % 32 ) ) 
     193    if( !( ( p_vout->render.i_width % 32 ) | 
     194           ( p_vout->render.i_height % 2 ) ) ) 
    225195    { 
    226196        /* Width is a multiple of 32, we take 2 lines at a time */ 
     
    236206        } 
    237207    } 
    238     else 
     208    else if( !( ( p_vout->render.i_width % 16 ) | 
     209                ( p_vout->render.i_height % 4 ) ) ) 
    239210    { 
    240211        /* Width is only a multiple of 16, we take 4 lines at a time */ 
     
    267238        } 
    268239    } 
     240    else 
     241    { 
     242        /* Crap, use the C version */ 
    269243#undef VEC_NEXT_LINES 
    270244#undef VEC_LOAD_UV 
    271245#undef VEC_MERGE 
     246#endif 
     247 
     248    const int i_source_margin = p_source->p->i_pitch 
     249                                 - p_source->p->i_visible_pitch; 
     250    const int i_dest_margin = p_dest->p->i_pitch 
     251                               - p_dest->p->i_visible_pitch; 
     252 
     253    for( i_y = p_vout->render.i_height / 2 ; i_y-- ; ) 
     254    { 
     255        p_line1 = p_line2; 
     256        p_line2 += p_dest->p->i_pitch; 
     257 
     258        p_y1 = p_y2; 
     259        p_y2 += p_source->p[Y_PLANE].i_pitch; 
     260 
     261        for( i_x = p_vout->render.i_width / 8 ; i_x-- ; ) 
     262        { 
     263#if !defined (MODULE_NAME_IS_i420_yuy2_mmx) 
     264            C_YUV420_YUYV( ); 
     265            C_YUV420_YUYV( ); 
     266            C_YUV420_YUYV( ); 
     267            C_YUV420_YUYV( ); 
     268#else 
     269            MMX_CALL( MMX_YUV420_YUYV ); 
     270#endif 
     271        } 
     272 
     273        p_y1 += i_source_margin; 
     274        p_y2 += i_source_margin; 
     275        p_line1 += i_dest_margin; 
     276        p_line2 += i_dest_margin; 
     277    } 
     278 
     279#if defined (MODULE_NAME_IS_i420_yuy2_altivec) 
     280    } 
    272281#endif 
    273282}