LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File mjpegtools-vector_alignment.patch of Package mjpegtools (Project home:mvaldina)

---
 mpeg2enc/imageplanes.cc |   11 +++++++----
 mpeg2enc/imageplanes.hh |    1 +
 2 files changed, 8 insertions(+), 4 deletions(-)

Index: mpeg2enc/imageplanes.cc
===================================================================
--- mpeg2enc/imageplanes.cc.orig
+++ mpeg2enc/imageplanes.cc
@@ -19,19 +19,22 @@ ImagePlanes::ImagePlanes( EncoderParams
         switch( c )
         {
             case 0 : // Y plane
-                planes[c] = new uint8_t[encparams.lum_buffer_size];
+                raw_planes[c] = new uint8_t[encparams.lum_buffer_size + 0x10];
+                planes[c] = (uint8_t *)((((unsigned long)raw_planes[c]) + 0x10) & ~0xf);
                 BorderMark( planes[c] ,
                             encparams.enc_width,encparams.enc_height,
                             encparams.phy_width,encparams.phy_height);
                 break;
             case 1 : // U plane
             case 2 :  // V plane
-                planes[c] = new uint8_t[encparams.chrom_buffer_size];
+                raw_planes[c] = new uint8_t[encparams.chrom_buffer_size + 0x10];
+                planes[c] = (uint8_t *)((((unsigned long)raw_planes[c]) + 0x10) & ~0xf);
                 BorderMark( planes[c],
                             encparams.enc_chrom_width, encparams.enc_chrom_height,
                             encparams.phy_chrom_width,encparams.phy_chrom_height);
                 break;
             default : // TODO: shift Y subsampled data from appended in Y buffer to seperate planes
+                raw_planes[c] = 0;
                 planes[c] = 0;
                 break;
         }
@@ -43,8 +46,8 @@ ImagePlanes::ImagePlanes( EncoderParams
 {
     for( int c = 0; c < NUM_PLANES; ++c )
     { 
-        if( planes[c] != 0 )
-            delete [] planes[c];
+        if( raw_planes[c] != 0 )
+            delete [] raw_planes[c];
     }
 }
 
Index: mpeg2enc/imageplanes.hh
===================================================================
--- mpeg2enc/imageplanes.hh.orig
+++ mpeg2enc/imageplanes.hh
@@ -50,6 +50,7 @@ class ImagePlanes
                                 int image_data_width, int image_data_height);
     protected:
         uint8_t *planes[NUM_PLANES];
+        uint8_t *raw_planes[NUM_PLANES];
 };