[MPlayer-cvslog] r38149 - trunk/sub/osd_template.c

reimar subversion at mplayerhq.hu
Thu Jul 4 14:28:01 EEST 2019


Author: reimar
Date: Thu Jul  4 14:28:01 2019
New Revision: 38149

Log:
osd_template: fix possible subtitle corruption.

Stride padding of alpha is not guaranteed to be
zerod, which can result in some corruption on the
right border.
Change SSE2 code to fall back to C code for the
last part if width is not a multiple of 16.

Modified:
   trunk/sub/osd_template.c

Modified: trunk/sub/osd_template.c
==============================================================================
--- trunk/sub/osd_template.c	Sat Jun 29 00:05:15 2019	(r38148)
+++ trunk/sub/osd_template.c	Thu Jul  4 14:28:01 2019	(r38149)
@@ -147,7 +147,7 @@ static inline void RENAME(vo_draw_alpha_
 	}
 #elif HAVE_SSE2
         __m128i zero = _mm_setzero_si128();
-        for(x=0;x+8<w;x+=16){
+        for(x=0;x+15<w;x+=16){
             __m128i mmsrc, mmdst, res;
             __m128i mmsrca = _mm_load_si128((const __m128i *)(srca + x));
 
@@ -242,7 +242,7 @@ static inline void RENAME(vo_draw_alpha_
         __m128i zero = _mm_setzero_si128();
         __m128i ymask = _mm_set1_epi16(0xff);
         __m128i uvofs = _mm_set1_epi16(0x8000);
-        for(x=0;x+12<w;x+=16){
+        for(x=0;x+15<w;x+=16){
             __m128i mmsrc, mmsrcalo, mmsrcahi, mmdst, mmdst2, mmlow, mmhigh, mmy, mmuv, res;
             __m128i mmsrca = _mm_load_si128((const __m128i *)(srca + x));
             int alpha = _mm_movemask_epi8(_mm_cmpeq_epi8(mmsrca, zero));
@@ -323,7 +323,7 @@ static inline void RENAME(vo_draw_alpha_
 #if HAVE_SSE2
         __m128i zero = _mm_setzero_si128();
         __m128i uvofs = _mm_set1_epi16(0x80);
-        for(x=0;x+12<w;x+=16){
+        for(x=0;x+15<w;x+=16){
             __m128i mmsrc, mmsrcalo, mmsrcahi, mmdst, mmdst2, mmlow, mmhigh, mmy, mmuv, res;
             __m128i mmsrca = _mm_load_si128((const __m128i *)(srca + x));
             int alpha = _mm_movemask_epi8(_mm_cmpeq_epi8(mmsrca, zero));
@@ -459,7 +459,7 @@ static inline void RENAME(vo_draw_alpha_
 #elif HAVE_SSE2
         __m128i one_in_three_mask = _mm_set_epi32(0xff0000ffu, 0x0000ff00u, 0x00ff0000u, 0xff0000ffu);
         __m128i zero = _mm_setzero_si128();
-        for(x=0;x+14<w;x+=16){
+        for(x=0;x+15<w;x+=16){
             __m128i mmsrc, mmtmp, mmtmpa, mmdst, res;
             __m128i mmsrca = _mm_load_si128((const __m128i *)(srca + x));
             int alpha = _mm_movemask_epi8(_mm_cmpeq_epi8(mmsrca, zero));


More information about the MPlayer-cvslog mailing list