🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.graphics.algorithms
Article #24

Re: IJG JPEG Engine and Win32

#24
From: Tom Lane
Date: Fri, 05 Jan 1996 14:54
45 lines
2805 bytes
fortunat@interpath.com (Jumpstile Turner) writes:
> tgl@netcom.com said:
>> * Compiling them with different declarations for "boolean".  The IJG
>> code by default defines boolean = int, but Windows prefers
>> boolean = unsigned char.

>   Well I think this is my problem.  I don't know how to go about fixing it 
> though.  Being as my application is a GUI application I NEED to include the 
> windows.h file, so "BOOLEAN" will be defined as an unsigned char, however 
> "boolean" is defined in one of the jpeglib includes as int.

Just change the definition of boolean in jmorecfg.h.  There's specific
advice to do that for Windows apps in install.doc, btw.

> Incidently as of right now I converted all the stdlib functions into Windows 
> API functions (i.e. CreateFile instead of fopen, ReadFile instead of the 
> JFREAD macro, HeapAlloc instead of malloc) and everything appears to work 
> until I try to allocate a buffer with the jpeglib's memory allocation 
> functions.  Then I get an invalid page fault.

Hm.  That one I don't have an answer for offhand.  Which memory manager
back end are you using --- jmemnobs.c, or something more complex?

> Oh yes, and lastly, with the borland BCC32 command line compiler, jdmerge.c 
> will not compile.  I get an internal backend C1107 error at line 280.  This 
> seems like a bug in the borland compiler.

Yes, it is.  Here's the latest dope from the current version of install.doc:


Borland C++ 4.5 fails with an internal compiler error when trying to compile
jdmerge.c in 32-bit mode.  If enough people complain, perhaps Borland will fix
it.  In the meantime, the simplest known workaround is to add a redundant
definition of the variable range_limit in h2v1_merged_upsample(), at the head
of the block that handles odd image width (about line 268 in v6 jdmerge.c):
  /* If image width is odd, do the last output column separately */
  if (cinfo->output_width & 1) {
    register JSAMPLE * range_limit = cinfo->sample_range_limit; /* ADD THIS */
    cb = GETJSAMPLE(*inptr1);
Pretty bizarre, especially since the very similar routine h2v2_merged_upsample
doesn't trigger the bug.


			regards, tom lane
			organizer, Independent JPEG Group
Technical Details
Message-ID: <TGL.96Jan5065424@netcom21.netcom.com>
Path: arc1-ca.pugleaf.net!netcom.com!tgl
References: <4cemir$6vb@redstone.interpath.net> <TGL.96Jan3202549@netcom21.netcom.com> <4cj5ct$nth@redstone.interpath.net>

Show Full Headers
Complete Article Headers
Newsgroups: comp.graphics.algorithms,comp.lang.c++,comp.os.ms-windows.programmer.graphics,comp.os.ms-windows.programmer.multimedia,comp.os.ms-windows.programmer.win32
Path: arc1-ca.pugleaf.net!netcom.com!tgl
From: tgl@netcom.com (Tom Lane)
Subject: Re: IJG JPEG Engine and Win32
Message-ID: <TGL.96Jan5065424@netcom21.netcom.com>
Sender: tgl@netcom21.netcom.com
Organization: Netcom Online Communications Services
References: <4cemir$6vb@redstone.interpath.net> <TGL.96Jan3202549@netcom21.netcom.com>
 <4cj5ct$nth@redstone.interpath.net>
Date: Fri, 5 Jan 1996 14:54:24 GMT