[Bug 52008] New: synaescope and tippercanoe don't work with Sparc Solaris - endian problem
aaronw at net.com
aaronw at net.com
Tue Dec 17 07:31:10 GMT 2002
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=52008
Summary: synaescope and tippercanoe don't work with Sparc Solaris
- endian problem
Product: noatun
Version: unspecified
Platform: Compiled Sources
OS/Version: Solaris
Status: UNCONFIRMED
Severity: normal
Priority: NOR
Component: general
AssignedTo: kde-multimedia at kde.org
ReportedBy: aaronw at net.com
Version: (using KDE KDE 3.0.99)
Installed from: Compiled From Sources
Compiler: gcc 2.95.3 Ultrasparc, Solaris 2.7
OS: Solaris
Both synaescope and tippercanoe have problems on big-endian platforms since
the data is little endian. Also, on Solaris it doesn't seem to detect that the system
is big endian. The following patches seem to fix the problems in both programs:
in syna.h:
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_ENDIAN_H
#include <endian.h>
+ #elif defined(_BIG_ENDIAN)
+ #define BIG_ENDIAN 1
+ #define BYTE_ORDER BIG_ENDIAN
#endif
typedef short sampleType;
#endif
in core.cpp:
bool Core::calculate()
{
double x[NumSamples], y[NumSamples];
double a[NumSamples], b[NumSamples];
int clarity[NumSamples]; //Surround sound
int i,j,k;
+ #ifndef LITTLE_ENDIAN
+ register sampleType temp;
+ #endif
int brightFactor = int(Brightness * brightnessTwiddler /(starSize+0.01));
...
for(i=0;i<NumSamples;i++)
{
+ #ifdef LITTLEENDIAN
x[i] = data[i*2];
y[i] = data[i*2+1];
+ #else
+ // Need to convert to big-endian
+ temp = data[i*2];
+ temp = (temp >> 8) | (temp << 8);
+ x[i] = temp;
+ temp = data[i*2+1];
+ temp = (temp << 8) | (temp >> 8);
+ y[i] = temp;
+#endif
}
Another problem I see is that the plugins should be run as low priority, especially on slow systems.
The following patch to main.cpp fixes this problem:
in main.cpp:
#include <fcntl.h>
+ #include <sys/resource.h>
...
int main()
{
fcntl(STDIN_FILENO, F_SETFL, fcntl(STDIN_FILENO, F_GETFL) & ~O_NONBLOCK);
KInstance in("noatunsynaescope");
+ setpriority(PRIO_PROCESS, getpid(), 17);
core=new Core;
More information about the kde-multimedia
mailing list