[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-multimedia
Subject:    [Bug 52008] New: synaescope and tippercanoe don't work with Sparc Solaris - endian problem
From:       aaronw () net ! com
Date:       2002-12-17 7:31:10
[Download RAW message or body]

------- 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@kde.org
        ReportedBy: aaronw@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;
_______________________________________________
kde-multimedia mailing list
kde-multimedia@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-multimedia
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic