delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/11/14/10:54:33

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Hannu E K Nevalainen" <garbage_collector AT telia DOT com>
To: <cygwin AT cygwin DOT com>
Subject: RE: FYI: bladeenc - fairly easy port.
Date: Fri, 14 Nov 2003 16:52:08 +0100
Message-ID: <NGBBLLIAMFLGJEOAJCCEGEEGDGAA.garbage_collector@telia.com>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
Importance: Normal
In-Reply-To: <NGBBLLIAMFLGJEOAJCCECEHNDEAA.garbage_collector@telia.com>
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165

------=_NextPart_000_0000_01C3AACF.A432F120
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

> From: Hannu E K Nevalainen
> Sent: Wednesday, September 24, 2003 12:26 AM

MOTIVATION:

Gerrit, about a Windows-native version:
> >  How fast is it compared with the Cygwin version?
>
Hannu:
> Answer: Approximately 20-40% faster in "cmd native mode"
>
> IMO the better "compatibility" with the other cygwin tools is worth more
> than the extra speed.


 Well, here it finally is; the patch(es?) for the executable version - for
those that have interest in it. (using: bladeenc 0.94.2 & gcc 3.3.1)

Mostly due to the usual excuse (i.e. "lack of time") I have chosen to not
create a cygwin package. A secondary reason; This might also be problematic
due to mp3-licensing.

 Feel free to use the patch as you wish. I *might* 'enhance' it further, but
don't count on it. ;-)  e.g. I've not tried -mno-cygwin yet ;-) FWIW.

/Hannu E K Nevalainen, B.Sc. EE - 59+16.37'N, 17+12.60'E
-- printf("LocalTime: UTC+%02d\n",(DST)? 2:1); --
--END OF MESSAGE--

------=_NextPart_000_0000_01C3AACF.A432F120
Content-Type: application/octet-stream;
	name="bladeenc-0.94.2-stable-cygwin.sh"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="bladeenc-0.94.2-stable-cygwin.sh"

#!/bin/bash=0A=
=0A=
# GPL stuff, (C) Copyright by Hannu E K Nevalainen, Mariefred, Sweden=0A=
# garbage_collector AT telia DOT com=0A=
#=0A=
# Launch this script with full path, or with cwd =3D=3D containing dir.=0A=
# Assumes that the source AND patch exists in this dir.=0A=
# One arg possible, where to put "be-build/" dir. Not given -> "./"=0A=
=0A=
be=3D"bladeenc-0.94.2"=0A=
=0A=
if [ -z "$1" ] ;then=0A=
  prefix=3D.=0A=
else=0A=
  prefix=3D"$1"=0A=
fi=0A=
=0A=
source=3D"${0%/*}"=0A=
if [ "$source" =3D=3D "." ] ;then=0A=
  source=3D"$(pwd)"=0A=
fi=0A=
=0A=
cd "$prefix"=0A=
if [ ! -d be-build ]; then=0A=
  mkdir be-build=0A=
fi=0A=
cd be-build; =0A=
=0A=
if [ ! -f "$source/${be}-src-stable.tar.gz" ] ;then=0A=
  echo "can't find $source/${be}-src-stable.tar.gz"=0A=
else=0A=
=0A=
  tar -zxf $source/${be}-src-stable.tar.gz=0A=
  if [ ! -d "${be}" ]; then=0A=
    echo "No $be directory? Can't continue."=0A=
    exit 1=0A=
  fi=0A=
  cd "$be/"=0A=
=0A=
  case "$(uname -s)" in=0A=
    CYGWIN_*)=0A=
=0A=
      if [ ! -f "$source/${be}-stable-cygwin.patch" ] ;then=0A=
        echo "can't find $source/${be}-stable-cygwin.patch, can't =
patch..."=0A=
        echo "\a\e[7m prepare to fail... \e[m"=0A=
      else=0A=
        if [ ! -f "bladeenc/cygwin.h" ]; then=0A=
          patch -Np1 <$source/${be}-stable-cygwin.patch=0A=
        else=0A=
          echo "Patch already applied!? bladeenc/cygwin.h exists, =
contents:"=0A=
          cat bladeenc/cygwin.h=0A=
          echo "--- eof ---"=0A=
        fi=0A=
      fi=0A=
      ;;=0A=
  esac=0A=
=0A=
  configure; make CFLAGS=3D"-O3"; echo -e "\aDone.\n"=0A=
=0A=
  ls -l $(pwd)/bladeenc/bladeenc.exe=0A=
=0A=
  if [ ! -z "$(which upx)" ]; then=0A=
    upx --best bladeenc/bladeenc.exe;=0A=
    ls -l $(pwd)/bladeenc/bladeenc.exe=0A=
  fi=0A=
fi=0A=

------=_NextPart_000_0000_01C3AACF.A432F120
Content-Type: application/octet-stream;
	name="bladeenc-0.94.2-stable-cygwin.README"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="bladeenc-0.94.2-stable-cygwin.README"

Patches to make bladeenc-0.94.2-stable compile on cygwin 1.5=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
Created Nov 13 2003 by Hannu E K Nevalainen, Mariefred, Sweden=0A=
garbage_collector AT telia DOT com=0A=
=0A=
=0A=
Patch created with=0A=
------------------=0A=
$ rm cygwin/stamp-h cygwin/bladeenc/Makefile =
cygwin/bladeenc/system.h.orig \=0A=
cygwin/config.cache cygwin/config.h cygwin/config.log =
cygwin/config.status=0A=
$ LC_ALL=3DC TZ=3DUTC0 diff -Naur original/ cygwin/ =
>bladeenc-0.94.2-stable-cygwin.patch=0A=
$ diff --version=0A=
diff (GNU diffutils) 2.8.4=0A=
<SNIP>=0A=
=0A=
Original source code=0A=
--------------------=0A=
Webpage at http://bladeenc.mp3.no, click on 'sourcecode' - or do:=0A=
=0A=
$ wget http://bladeenc.mp3.no/source/bladeenc-0.94.2-src-stable.tar.gz \=0A=
       http://bladeenc.mp3.no/source/extras.tar.gz=0A=
=0A=
=0A=
=0A=
COMMENTS=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=0A=
 As cygwin is an *emulated* Unix-like environment many things are slower=0A=
than on a 'native' Unix/Linux. This makes trying different compiler=0A=
optimization worthwhile - e.g. having a version of bladeenc compiled with=0A=
-O3 instead of -O2 (default) increases execution speed by 10-30%, when=0A=
running on an old P2 at 450 Mhz (achieves approx 1.8x on most input).=0A=
=0A=
i.e. build it with:=0A=
=0A=
$ make CFLAGS=3D"-O3"=0A=
=0A=
Removing the -g option (defaults to on) also reduces excutable size.=0A=
It can then be further decreased with:=0A=
=0A=
$ upx --best bladeenc/bladeenc.exe=0A=
=0A=
=0A=
=0A=
=0A=
CHANGES APPLIED - as included in the patch=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
=0A=
cygwin.h=0A=
--------=0A=
Created. For tracking version of this patch/avoiding patch problems.=0A=
#define BE_CYGPATCH 1 //  for now, will increase if patch changes.=0A=
=0A=
=0A=
bladesys.c=0A=
----------=0A=
Adjusted to make it possible to conditionally compile relevant parts.=0A=
=0A=
=0A=
loop.c=0A=
------=0A=
Replacing "infinty" with "local_inf" all over, due to a clash=0A=
with "inifnity" in the standard include files.=0A=
=0A=
=0A=
system.h=0A=
--------=0A=
All the changes to enable "autodetection" of current CYGWIN=0A=
=0A=
=0A=
configure=0A=
---------=0A=
Bug in detection of BYTE_ORDER; "faster" non-working code=0A=
replaced with something that DOES work. (autoconfig "bug"?)=0A=
=0A=
=0A=
=0A=
HOWTO=0A=
=3D=3D=3D=3D=3D=0A=
Prerequisites:=0A=
- Relevant cygwin packages (gcc...) has been installed=0A=
  e.g. cygwin 1.5.5 and gcc 3.3.1 at the time of writing.=0A=
- /mp3/ contains the patch and the source tarball.=0A=
=0A=
$ bash=0A=
$ cd; md tests; cd tests; tar -zxf =
/mp3/bladeenc-0.94.2-src-stable.tar.gz =0A=
=0A=
$ ls -l=0A=
total 0=0A=
drwxr-xr-x    4 Hannu           0 May  8  2001 bladeenc-0.94.2/=0A=
=0A=
$ cd bladeenc-0.94.2/ ; ls -l=0A=
total 171=0A=
-rw-r--r--    1 Hannu        2954 Jan 10  2001 AUTHORS=0A=
-rw-r--r--    1 Hannu       26416 Jun 10  2000 COPYING=0A=
-rw-r--r--    1 Hannu       23720 Mar  7  2001 ChangeLog=0A=
-rw-r--r--    1 Hannu        3606 Nov 28  2000 INSTALL=0A=
-rw-r--r--    1 Hannu         165 Feb 21  2001 Makefile.am=0A=
-rw-r--r--    1 Hannu       10811 May  8  2001 Makefile.in=0A=
-rw-r--r--    1 Hannu          72 Jun 10  2000 README=0A=
-rw-r--r--    1 Hannu         464 Jan 24  2001 TODO=0A=
-rw-r--r--    1 Hannu        4396 May  8  2001 aclocal.m4=0A=
drwxr-xr-x    2 Hannu           0 May  8  2001 bladeenc/=0A=
-rw-r--r--    1 Hannu       27932 May  8  2001 bladeenc.html=0A=
-rw-r--r--    1 Hannu         513 May  3  2001 bladeenc.lsm=0A=
-rw-r--r--    1 Hannu         945 May  8  2001 bladeenc.spec=0A=
-rw-r--r--    1 Hannu         323 Nov 27  2000 config.h.in=0A=
-rwxr-xr-x    1 Hannu       48667 May  8  2001 configure*=0A=
-rw-r--r--    1 Hannu         454 May  3  2001 configure.in=0A=
-rwxr-xr-x    1 Hannu        5584 Nov 24  2000 install-sh*=0A=
-rwxr-xr-x    1 Hannu        6274 Nov 24  2000 missing*=0A=
-rwxr-xr-x    1 Hannu         732 Nov 24  2000 mkinstalldirs*=0A=
drwxr-xr-x    2 Hannu           0 Mar  7  2001 other_makefiles/=0A=
-rw-r--r--    1 Hannu          10 May  8  2001 stamp-h.in=0A=
=0A=
$ patch -Np1 </mp3/bladeenc-0.94.2-stable-cygwin.patch=0A=
patching file bladeenc/cygwin.h=0A=
patching file bladeenc/bladesys.c=0A=
patching file bladeenc/loop.c=0A=
patching file bladeenc/system.h=0A=
patching file configure=0A=
=0A=
$ configure; make all; echo -e "\aDone.\n";ls -lan bladeenc/*.exe=0A=
=0A=
<-- 93 lines of output snipped -->=0A=
Done.=0A=
=0A=
-rwxr-xr-x    1 500        251737 Nov 14  2003 bladeenc/bladeenc.exe*=0A=
=0A=
$=0A=
=0A=
=0A=
/Hannu E K Nevalainen, Mariefred, Sweden - November 14, 2003=0A=

------=_NextPart_000_0000_01C3AACF.A432F120
Content-Type: application/octet-stream;
	name="bladeenc-0.94.2-stable-cygwin.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="bladeenc-0.94.2-stable-cygwin.patch"

diff -Naur original/bladeenc/cygwin.h cygwin/bladeenc/cygwin.h=0A=
--- original/bladeenc/cygwin.h	1970-01-01 00:00:00.000000000 +0000=0A=
+++ cygwin/bladeenc/cygwin.h	2003-11-14 10:59:06.000000000 +0000=0A=
@@ -0,0 +1,6 @@=0A=
+#ifndef __CYGWIN_H=0A=
+#define __CYGWIN_H=0A=
+=0A=
+#define BE_CYGPAT 1  /* bladeenc -> cygwin - PATCH version, increases =
with new ones */=0A=
+=0A=
+#endif /* __CYGWIN_H */=0A=
diff -Naur original/bladeenc/bladesys.c cygwin/bladeenc/bladesys.c=0A=
--- original/bladeenc/bladesys.c	2001-05-08 12:11:54.000000000 +0000=0A=
+++ cygwin/bladeenc/bladesys.c	2003-09-23 15:53:52.000000000 +0000=0A=
@@ -189,7 +189,9 @@=0A=
 #endif=0A=
 =0A=
 =0A=
+=0A=
 #ifdef	UNIX_SYSTEM=0A=
+#ifdef	PRIO=0A=
 	pid_t					my_pid;=0A=
 	int						prio;=0A=
 =0A=
@@ -209,6 +211,8 @@=0A=
 	my_pid =3D getpid();=0A=
 	setpriority (PRIO_PROCESS, my_pid, prio);=0A=
 #endif=0A=
+#endif=0A=
+=0A=
 =0A=
 #if SYSTEM =3D=3D AMIGA_WOS /* WarpOS. */=0A=
 =0A=
diff -Naur original/bladeenc/loop.c cygwin/bladeenc/loop.c=0A=
--- original/bladeenc/loop.c	2001-05-08 12:11:54.000000000 +0000=0A=
+++ cygwin/bladeenc/loop.c	2003-09-22 19:22:40.000000000 +0000=0A=
@@ -95,7 +95,7 @@=0A=
 =0A=
 =0A=
 =0A=
-#define		infinity				99999999=0A=
+#define		local_inf				999999=0A=
 =0A=
 =0A=
 =0A=
@@ -709,8 +709,8 @@=0A=
 =0A=
 	double					xmax, the_xmax;=0A=
 =0A=
-	the_lo_quant =3D -infinity;   /* "-infinity" */=0A=
-	the_hi_quant =3D -infinity;   /* the real maximum for high_quant is =
about +4 ! */=0A=
+	the_lo_quant =3D -local_inf;   /* "-infinity" */=0A=
+	the_hi_quant =3D -local_inf;   /* the real maximum for high_quant is =
about +4 ! */=0A=
 =0A=
 	the_xmax =3D -1.0;=0A=
 =0A=
@@ -719,8 +719,8 @@=0A=
 		xmax =3D xmax_l[sfb];=0A=
 		if (xmax =3D=3D 0.0)=0A=
 		{=0A=
-			lo_quant_l[sfb] =3D -infinity;=0A=
-			hi_quant_l[sfb] =3D -infinity;=0A=
+			lo_quant_l[sfb] =3D -local_inf;=0A=
+			hi_quant_l[sfb] =3D -local_inf;=0A=
 		}=0A=
 		else=0A=
 		{=0A=
@@ -743,8 +743,8 @@=0A=
 			xmax =3D xmax_s[sfb][b];=0A=
 			if (xmax =3D=3D 0.0)=0A=
 			{=0A=
-				lo_quant_s[sfb][b] =3D -infinity;=0A=
-				hi_quant_s[sfb][b] =3D -infinity;=0A=
+				lo_quant_s[sfb][b] =3D -local_inf;=0A=
+				hi_quant_s[sfb][b] =3D -local_inf;=0A=
 			}=0A=
 			else=0A=
 			{=0A=
@@ -885,7 +885,7 @@=0A=
 		partial_quantize ();=0A=
 #if ORG_BINARY_SEARCH || ORG_QUANTANF_INIT || CHECK_TJ_OVERFLOW=0A=
 		if (tjBitOverflow2)=0A=
-			bits =3D infinity;=0A=
+			bits =3D local_inf;=0A=
 		else=0A=
 			bits =3D count_bits ();=0A=
 #else=0A=
@@ -899,7 +899,7 @@=0A=
 			tjBitOverflow2 =3D FALSE;=0A=
 			quantize ();=0A=
 			if (tjBitOverflow2)=0A=
-				bits =3D infinity;=0A=
+				bits =3D local_inf;=0A=
 			else=0A=
 				bits =3D count_bits ();=0A=
 #else=0A=
@@ -950,7 +950,7 @@=0A=
 	counts the bits needed to code the scale factors =
(cod_info->part2_length)=0A=
 	and the compression index (cod_info->scalefac_compress).=0A=
 =0A=
-	If there is no suitable index, it returns "infinity".=0A=
+	If there is no suitable index, it returns "local_inf".=0A=
 */=0A=
 =0A=
 static	int				needed_bits_for_storing_scalefactors=0A=
@@ -1044,7 +1044,7 @@=0A=
 	}=0A=
 =0A=
 =0A=
-	cod_info->part2_length =3D infinity;=0A=
+	cod_info->part2_length =3D local_inf;=0A=
 =0A=
 	for (k =3D 0;  k < 16;  k++)=0A=
 	{=0A=
@@ -1732,7 +1732,7 @@=0A=
 		tjBitOverflow2 =3D FALSE;=0A=
 		quantize ();=0A=
 		if (tjBitOverflow2)=0A=
-			bits =3D infinity;=0A=
+			bits =3D local_inf;=0A=
 		else=0A=
 			bits =3D count_bits ();=0A=
 =0A=
@@ -1754,7 +1754,7 @@=0A=
 		tjBitOverflow2 =3D FALSE;=0A=
 		quantize ();=0A=
 		if (tjBitOverflow2)=0A=
-			bits =3D infinity;=0A=
+			bits =3D local_inf;=0A=
 		else=0A=
 			bits =3D count_bits ();=0A=
 #else=0A=
diff -Naur original/bladeenc/system.h cygwin/bladeenc/system.h=0A=
--- original/bladeenc/system.h	2001-05-08 12:11:54.000000000 +0000=0A=
+++ cygwin/bladeenc/system.h	2003-09-23 15:47:54.000000000 +0000=0A=
@@ -28,6 +28,10 @@=0A=
 	-	Added Andrea Vallinotto's Amiga WarpOS changes.=0A=
 	-	Added some more defines and cleaned up.=0A=
 =0A=
+	2003-09-23	Hannu E K Nevalainen=0A=
+	=0A=
+	- Added simple "autodetection" for Cygwin (www.cygwin.com)=0A=
+=0A=
 */=0A=
 =0A=
 #ifndef		__SYSTEM__=0A=
@@ -82,6 +86,10 @@=0A=
 #       define  	SYSTEM      MSDOS_DJGPP=0A=
 #	endif=0A=
 =0A=
+#	ifdef __CYGWIN__						/* www.cygwin.com, unix emulation layer for =
WinXX */=0A=
+#       define  	SYSTEM      UNIX_AUTOCONF=0A=
+#	endif=0A=
+=0A=
 #	if	defined(__dest_os) && (__dest_os =3D=3D __mac_os)   /* defined in =
"ansi_prefix.mac.h" */=0A=
 #		define		SYSTEM		MAC_OS=0A=
 #	endif=0A=
@@ -267,6 +275,9 @@=0A=
 #	define			DIRECTORY_SEPARATOR		'/'=0A=
 #endif=0A=
 =0A=
+#ifdef __CYGWIN__						/* www.cygwin.com, unix emulation layer for =
WinXX */=0A=
+# undef PRIO								/* not correclty emulated? */=0A=
+#endif=0A=
 =0A=
 /*=3D=3D=3D=3D COMPILER SPECIFIC DEFINES =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */=0A=
 /*=0A=
diff -Naur original/configure cygwin/configure=0A=
--- original/configure	2001-05-08 12:11:56.000000000 +0000=0A=
+++ cygwin/configure	2003-09-22 19:41:58.000000000 +0000=0A=
@@ -1064,7 +1064,7 @@=0A=
 int main() {=0A=
 =0A=
 #if BYTE_ORDER !=3D BIG_ENDIAN=0A=
- not big endian=0A=
+ return 1; // not big endian=0A=
 #endif=0A=
 ; return 0; }=0A=
 EOF=0A=


------=_NextPart_000_0000_01C3AACF.A432F120
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
------=_NextPart_000_0000_01C3AACF.A432F120--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019