1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
Description: Fix AltiVec-related FTBFS on ppc64el.
Build-tested only; possibly incorrect. Ideally should be verified by
performing a runtime test.
Author: Yavor Doganov <yavor@gnu.org>
Author: Frédéric Bonnard <frediz@debian.org>
Bug-Debian: https://bugs.debian.org/893442
Forwarded: no
Last-Update: 2019-01-31
---
--- lynkeos.app.orig/application/Sources/MyDeconvolution.m
+++ lynkeos.app/application/Sources/MyDeconvolution.m
@@ -20,6 +20,9 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
#include <objc/runtime.h>
+#ifdef __ALTIVEC__
+#include <altivec.h>
+#endif
#include "MyGeneralPrefs.h"
#include "LynkeosFourierBuffer.h"
@@ -68,13 +71,13 @@
#ifdef __ALTIVEC__
// Altivec code
static const __vector REAL Vzero = { -0.0, -0.0, -0.0, -0.0 };
- static const __vector u_long Vperma = { 0x00010203, 0x00010203,
- 0x04050607, 0x04050607 };
- static const __vector u_long Vpermb = { 0x08090A0B, 0x08090A0B,
- 0x0C0D0E0F, 0x0C0D0E0F };
- const u_long byteLineWidth = spectrum->_halfw*sizeof(COMPLEX);
+ static const __vector unsigned char Vperma = { 0, 1, 2, 3, 0, 1, 2, 3,
+ 4, 5, 6, 7, 4, 5, 6, 7 };
+ static const __vector unsigned char Vpermb = { 8, 9, 10, 11, 8, 9, 10, 11,
+ 12, 13, 14, 15, 12, 13, 14, 15 };
+ const u_long byteLineWidth = spectrum->_halfw*sizeof(LNKCOMPLEX);
const u_long bytePlaneSize = spectrum->_h*spectrum->_padw*sizeof(REAL); // padw is for REALs
- COMPLEX * const linePtr = &colorComplexValue(spectrum,0,y,0);
+ LNKCOMPLEX * const linePtr = &colorComplexValue(spectrum,0,y,0);
REAL * expXptr = params->_expX;
const __vector REAL Vthr = { threshold, threshold, threshold, threshold };
const register __vector REAL Vdy = { params->_expY[y], params->_expY[y],
@@ -82,7 +85,7 @@
register __vector REAL Vdx, Vda, Vdb;
// 2 Vectors acts on 4 complex values at a time
- for( x = 0; x < byteLineWidth; x += 4*sizeof(COMPLEX), expXptr += 4 )
+ for( x = 0; x < byteLineWidth; x += 4*sizeof(LNKCOMPLEX), expXptr += 4 )
{
// Deconvolution term = source/gauss when gauss > threshold
Vdx = vec_madd( vec_ld(0,expXptr), Vdy, Vzero );
@@ -93,7 +96,7 @@
Vda = vec_perm(Vdx,Vzero,Vperma);
// Apply it on each plane
- if ( x < byteLineWidth-2*sizeof(COMPLEX) )
+ if ( x < byteLineWidth-2*sizeof(LNKCOMPLEX) )
{
Vdb = vec_perm(Vdx,Vzero,Vpermb);
for( c = x; c < x+nPlanes*bytePlaneSize; c += bytePlaneSize )
@@ -101,9 +104,9 @@
__vector REAL Vbuf = vec_ld(c,(REAL*)linePtr);
Vbuf = vec_madd( Vbuf, Vda, Vzero);
vec_st( Vbuf,c, (REAL*)linePtr );
- Vbuf = vec_ld(c+2*sizeof(COMPLEX),(REAL*)linePtr);
+ Vbuf = vec_ld(c+2*sizeof(LNKCOMPLEX),(REAL*)linePtr);
Vbuf = vec_madd( Vbuf, Vdb, Vzero);
- vec_st( Vbuf,c+2*sizeof(COMPLEX), (REAL*)linePtr );
+ vec_st( Vbuf,c+2*sizeof(LNKCOMPLEX), (REAL*)linePtr );
}
}
else
--- lynkeos.app.orig/application/Sources/MyUnsharpMask.m
+++ lynkeos.app/application/Sources/MyUnsharpMask.m
@@ -20,6 +20,9 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
#include <objc/runtime.h>
+#ifdef __ALTIVEC__
+#include <altivec.h>
+#endif
#include "MyGeneralPrefs.h"
#include "LynkeosFourierBuffer.h"
@@ -66,9 +69,9 @@
#ifdef __ALTIVEC__
// Altivec code
- const u_long byteLineWidth = spectrum->_halfw*sizeof(COMPLEX);
+ const u_long byteLineWidth = spectrum->_halfw*sizeof(LNKCOMPLEX);
const u_long bytePlaneSize = spectrum->_h*spectrum->_padw*sizeof(REAL); // padw is for REALs
- COMPLEX * const linePtr = &colorComplexValue(spectrum,0,y,0);
+ LNKCOMPLEX * const linePtr = &colorComplexValue(spectrum,0,y,0);
REAL * const expXptr = params->_expX;
const register __vector REAL Voffset = { unsharpOffset, unsharpOffset,
unsharpOffset, unsharpOffset };
@@ -78,7 +81,7 @@
register __vector REAL Vu;
// Vector acts on 2 complex values at a time
- for( x = 0; x < byteLineWidth; x += 2*sizeof(COMPLEX) )
+ for( x = 0; x < byteLineWidth; x += 2*sizeof(LNKCOMPLEX) )
{
// Unsharp term = 1 + gain*(1 - gauss)
Vu = vec_madd( vec_ld(x,expXptr), Vuy, Voffset );
|