Changeset f4f90e674b23ba5a949d0bffd942451685d31907

Show
Ignore:
Timestamp:
17/06/07 00:13:47 (1 year ago)
Author:
Damien Fouilleul <damienf@videolan.org>
git-committer:
Damien Fouilleul <damienf@videolan.org> 1182032027 +0000
git-parent:

[a3eb2a7047a551239dfe1b6dd9cd59dee6718313]

git-author:
Damien Fouilleul <damienf@videolan.org> 1182032027 +0000
Message:

video_chroma: a few SSE2 fixes

Files:

Legend:

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

    r9acaa4b rf4f90e6  
    449449            p_buffer = b_hscale ? p_buffer_start : p_pic; 
    450450        } 
    451         /* make sure all SSE2 stores are visible thereafter */ 
    452 #if defined (CAN_COMPILE_SSE2) 
    453         __asm__ __volatile__ ( "sfence" ); 
    454 #else 
    455         _mm_sfence(); 
    456 #endif 
    457451    } 
    458452    else 
     
    527521        } 
    528522    } 
     523 
     524    /* make sure all SSE2 stores are visible thereafter */ 
     525#if defined (CAN_COMPILE_SSE2) 
     526    __asm__ __volatile__ ( "sfence" ::: "memory" ); 
     527#else 
     528    _mm_sfence(); 
     529#endif 
     530 
    529531#else // defined (MODULE_NAME_IS_i420_rgb_mmx) 
    530532 
     
    756758            p_buffer = b_hscale ? p_buffer_start : p_pic; 
    757759        } 
    758         /* make sure all SSE2 stores are visible thereafter */ 
    759 #if defined (CAN_COMPILE_SSE2) 
    760         __asm__ __volatile__ ( "sfence" ); 
    761 #else 
    762         _mm_sfence(); 
    763 #endif 
    764760    } 
    765761    else 
     
    834830        } 
    835831    } 
     832 
     833    /* make sure all SSE2 stores are visible thereafter */ 
     834#if defined (CAN_COMPILE_SSE2) 
     835    __asm__ __volatile__ ( "sfence" ::: "memory" ); 
     836#else 
     837    _mm_sfence(); 
     838#endif 
     839 
    836840#else // defined (MODULE_NAME_IS_i420_rgb_mmx) 
    837841 
     
    11801184            p_buffer = b_hscale ? p_buffer_start : p_pic; 
    11811185        } 
    1182         /* make sure all SSE2 stores are visible thereafter */ 
    1183 #if defined (CAN_COMPILE_SSE2) 
    1184         __asm__ __volatile__ ( "sfence" ); 
    1185 #else 
    1186         _mm_sfence(); 
    1187 #endif 
    11881186    } 
    11891187    else 
     
    12641262    } 
    12651263 
    1266 #else 
     1264    /* make sure all SSE2 stores are visible thereafter */ 
     1265#if defined (CAN_COMPILE_SSE2) 
     1266    __asm__ __volatile__ ( "sfence" ::: "memory" ); 
     1267#else 
     1268    _mm_sfence(); 
     1269#endif 
     1270 
     1271#else // defined (MODULE_NAME_IS_i420_rgb_mmx) 
    12671272 
    12681273    if( p_vout->render.i_width & 7 ) 
     
    15011506            p_buffer = b_hscale ? p_buffer_start : p_pic; 
    15021507        } 
    1503         /* make sure all SSE2 stores are visible thereafter */ 
    1504 #if defined (CAN_COMPILE_SSE2) 
    1505         __asm__ __volatile__ ( "sfence" ); 
    1506 #else 
    1507         _mm_sfence(); 
    1508 #endif 
    15091508    } 
    15101509    else 
  • modules/video_chroma/i420_rgb_mmx.h

    r9acaa4b rf4f90e6  
    6262 
    6363#define SSE2_INIT_16_ALIGNED "                                              \n\ 
    64 prefetcht1  (%3)            # cache preload for image                       \n\ 
    6564movq        (%1), %%xmm0    # Load 8 Cb       00 00 00 00 u3 u2 u1 u0       \n\ 
    6665movq        (%2), %%xmm1    # Load 8 Cr       00 00 00 00 v3 v2 v1 v0       \n\ 
     
    7069 
    7170#define SSE2_INIT_16_UNALIGNED "                                            \n\ 
    72 prefetcht1  (%3)            # cache preload for image                       \n\ 
    7371movq        (%1), %%xmm0    # Load 8 Cb       00 00 00 00 u3 u2 u1 u0       \n\ 
    7472movq        (%2), %%xmm1    # Load 8 Cr       00 00 00 00 v3 v2 v1 v0       \n\ 
    7573pxor      %%xmm4, %%xmm4    # zero mm4                                      \n\ 
    7674movdqu      (%0), %%xmm6    # Load 16 Y       Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0       \n\ 
     75prefetchnta (%3)            # Tell CPU not to cache output RGB data         \n\ 
    7776" 
    7877 
     
    9291 
    9392#define SSE2_INTRINSICS_INIT_16_UNALIGNED   \ 
    94     _mm_prefetch(p_buffer, _MM_HINT_T1);    \ 
    9593    xmm0 = _mm_loadl_epi64((__m128i *)p_u); \ 
    9694    xmm1 = _mm_loadl_epi64((__m128i *)p_v); \ 
    9795    xmm4 = _mm_setzero_si128();             \ 
    9896    xmm6 = _mm_loadu_si128((__m128i *)p_y); \ 
     97    _mm_prefetch(p_buffer, _MM_HINT_NTA);    \ 
    9998 
    10099#define MMX_INIT_16_GRAY "                                                  \n\ 
     
    119118 
    120119#define SSE2_INIT_32_UNALIGNED "                                            \n\ 
    121 prefetcht1  (%3)            # cache preload for image                       \n\ 
    122120movq        (%1), %%xmm0    # Load 8 Cb       00 00 00 00 u3 u2 u1 u0       \n\ 
    123121movq        (%2), %%xmm1    # Load 8 Cr       00 00 00 00 v3 v2 v1 v0       \n\ 
    124122pxor      %%xmm4, %%xmm4    # zero mm4                                      \n\ 
    125123movdqu      (%0), %%xmm6    # Load 16 Y       Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0       \n\ 
     124prefetchnta (%3)            # Tell CPU not to cache output RGB data         \n\ 
    126125" 
    127126 
     
    142141 
    143142#define SSE2_INTRINSICS_INIT_32_UNALIGNED    \ 
    144     _mm_prefetch(p_buffer, _MM_HINT_T1);     \ 
    145143    xmm0 = _mm_loadl_epi64((__m128i *)p_u); \ 
    146144    xmm1 = _mm_loadl_epi64((__m128i *)p_v); \ 
    147145    xmm4 = _mm_setzero_si128();             \ 
    148146    xmm6 = _mm_loadu_si128((__m128i *)p_y); \ 
     147    _mm_prefetch(p_buffer, _MM_HINT_NTA); \ 
    149148 
    150149/* 
     
    261260    xmm0 = _mm_unpacklo_epi8(xmm0, xmm4); \ 
    262261    xmm1 = _mm_unpacklo_epi8(xmm1, xmm4); \ 
    263     xmm5 = _mm_set1_epi32(0x80808080UL); \ 
     262    xmm5 = _mm_set1_epi32(0x00800080UL); \ 
    264263    xmm0 = _mm_subs_epi16(xmm0, xmm5); \ 
    265264    xmm1 = _mm_subs_epi16(xmm1, xmm5); \ 
     
    10021001    xmm3 = _mm_unpacklo_epi16(xmm3, xmm1); \ 
    10031002    _mm_stream_si128((__m128i*)(p_buffer+8), xmm3); \ 
    1004     xmm5 = _xmm_unpackhi_pi16(xmm5, xmm4); \ 
     1003    xmm5 = _mm_unpackhi_epi16(xmm5, xmm4); \ 
    10051004    _mm_stream_si128((__m128i*)(p_buffer+12), xmm5); \ 
    10061005 
     
    10221021    xmm3 = _mm_unpacklo_epi16(xmm3, xmm1); \ 
    10231022    _mm_storeu_si128((__m128i*)(p_buffer+8), xmm3); \ 
    1024     xmm5 = _xmm_unpackhi_pi16(xmm5, xmm4); \ 
     1023    xmm5 = _mm_unpackhi_epi16(xmm5, xmm4); \ 
    10251024    _mm_storeu_si128((__m128i*)(p_buffer+12), xmm5); \ 
    10261025