[haiku-commits] r34047 - haiku/trunk/src/add-ons/media/plugins/ffmpeg

  • From: dlmcpaul@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 14 Nov 2009 23:45:18 +0100 (CET)

Author: dlmcpaul
Date: 2009-11-14 23:45:18 +0100 (Sat, 14 Nov 2009)
New Revision: 34047
Changeset: http://dev.haiku-os.org/changeset/34047/haiku
Ticket: http://dev.haiku-os.org/ticket/4948

Modified:
   haiku/trunk/src/add-ons/media/plugins/ffmpeg/gfx_conv_mmx.cpp
Log:
ensure buffers are aligned 32 for SSE2 should fix #4948

Modified: haiku/trunk/src/add-ons/media/plugins/ffmpeg/gfx_conv_mmx.cpp
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/ffmpeg/gfx_conv_mmx.cpp       
2009-11-14 22:06:19 UTC (rev 34046)
+++ haiku/trunk/src/add-ons/media/plugins/ffmpeg/gfx_conv_mmx.cpp       
2009-11-14 22:45:18 UTC (rev 34047)
@@ -41,8 +41,11 @@
 // Planar YUV420
 void gfx_conv_yuv420p_rgba32_sse2(AVFrame *in, AVFrame *out, int width, int 
height)
 {
-       // width must be divisibile by 8 and height divisible by 2
-       if (width % 8 == 0 && height % 2 == 0) {
+       // width must be divisible by 8 and height divisible by 2
+       // also in and out must be aligned to 32 bytes
+       if (width % 8 == 0 && height % 2 == 0 
+               && (off_t)out->data[0] % 32 == 0 && (off_t)in->data[0] % 32 == 
0 
+               && (off_t)in->data[1] % 32 == 0 && (off_t)in->data[2] % 32 == 
0) {
        
                uint8 *ybase = (uint8 *)in->data[0];
                uint8 *ubase = (uint8 *)in->data[1];
@@ -69,7 +72,10 @@
 void gfx_conv_yuv422p_rgba32_sse2(AVFrame *in, AVFrame *out, int width, int 
height)
 {
        // width must be divisibile by 8 
-       if (width % 8 == 0) {
+       // also in and out must be aligned to 32 bytes
+       if (width % 8 == 0
+               && (off_t)out->data[0] % 32 == 0 && (off_t)in->data[0] % 32 == 
0) {
+               
                uint8 *ybase = (uint8 *)in->data[0];
                uint8 *rgbbase = (uint8 *)out->data[0];
 


Other related posts:

  • » [haiku-commits] r34047 - haiku/trunk/src/add-ons/media/plugins/ffmpeg - dlmcpaul