libjpeg-turbo static
Re: libjpeg-turbo static
I tried to compile the 1.5.0 version today but it's complicated.
I disabled buffer security check, commented out the putenv and all printf variations from the turbojpeg.c source, added the line for the __iob_func but keep getting four unresolved external symbol errors.
__stdio_common_vsscanf
__stdio_common_vfprintf
__acrt_iob_func
__stdio_common_vsprintf
The scanf and printf variations apparently are also used in another file but I have no idea how I can easily know which source file.
The __acrt_iob_func I have no clue about.
I disabled buffer security check, commented out the putenv and all printf variations from the turbojpeg.c source, added the line for the __iob_func but keep getting four unresolved external symbol errors.
__stdio_common_vsscanf
__stdio_common_vfprintf
__acrt_iob_func
__stdio_common_vsprintf
The scanf and printf variations apparently are also used in another file but I have no idea how I can easily know which source file.
The __acrt_iob_func I have no clue about.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: libjpeg-turbo static
try compiling one of the older ones like 1.4.2, im wondering if your errors are new to 1.5
searching for "_iob" found refs to a boolean variable need_iobuffer, perhaps its that and setting it to FALSE might turn it off but im not sure if its a compiler directive
btw also turn Whole Program Optimization off if you havent already
the vfprintf/vscanf ones i originally fixed simply by commenting them out
searching for "_iob" found refs to a boolean variable need_iobuffer, perhaps its that and setting it to FALSE might turn it off but im not sure if its a compiler directive
btw also turn Whole Program Optimization off if you havent already
the vfprintf/vscanf ones i originally fixed simply by commenting them out
Re: libjpeg-turbo static
I got it working now by removing a bit of code.
It means some environment variables aren't working anymore but I wasn't using those anyway.
The code I had to remove or comment was in three different files.
turbojpeg.c
jerror.c
jmemmgr.c
Once removed, the __acrt_iob_func missing symbol error disappeared by itself.
It means some environment variables aren't working anymore but I wasn't using those anyway.
The code I had to remove or comment was in three different files.
turbojpeg.c
jerror.c
jmemmgr.c
Once removed, the __acrt_iob_func missing symbol error disappeared by itself.
Last edited by wilbert on Sat Jul 09, 2016 7:24 am, edited 1 time in total.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: libjpeg-turbo static
Great work!!! how good does it feel when the darn thing finally compiles, 0 errors lol
I just tried it on XP using the source code from the 1st post in this thread, but that demo doesnt really do anything I can test - there's no code for showing the image, although handle=tjInitDecompress() returns valid handle anyway and there were no compiler alerts so im guessing its all good, but if you have some demo code that shows the jpeg thatd be good to test (im sure its just a simple call to ShowImage or whatever but i gather youve already got the code for that!)
I just tried it on XP using the source code from the 1st post in this thread, but that demo doesnt really do anything I can test - there's no code for showing the image, although handle=tjInitDecompress() returns valid handle anyway and there were no compiler alerts so im guessing its all good, but if you have some demo code that shows the jpeg thatd be good to test (im sure its just a simple call to ShowImage or whatever but i gather youve already got the code for that!)
Re: libjpeg-turbo static
Here's an encode example you can use to test
Code: Select all
#LIBTURBO = "turbojpeg-static_win32.lib"
Enumeration
#TJPF_RGB
#TJPF_BGR
#TJPF_RGBX
#TJPF_BGRX
#TJPF_XBGR
#TJPF_XRGB
#TJPF_GRAY
#TJPF_RGBA
#TJPF_BGRA
EndEnumeration
Enumeration
#TJSAMP_444
#TJSAMP_422
#TJSAMP_420
EndEnumeration
#TJFLAG_BOTTOMUP = 2
#TJFLAG_FASTDCT = 2048
#TJFLAG_ACCURATEDCT = 4096
ImportC #LIBTURBO
tjAlloc(bytes)
tjCompress2.l(handle, *srcBuf, width, pitch, height, pixelFormat, *p_jpegBuf, *jpegSize, jpegSubsamp, jpegQual, flags)
tjDecompress2.l(handle, *jpegBuf, jpegSize, *dstBuf, width, pitch, height, pixelFormat, flags)
tjDecompressHeader3.l(handle, *jpegBuf, jpegSize, *width, *height, *jpegSubsamp, *jpegColorspace)
tjFree(*buffer)
tjGetErrorStr()
tjInitCompress()
tjInitDecompress()
EndImport
; generate image data
Dim ImageData.l(255, 255)
For y = 0 To 255
For x = 0 To 255
ImageData(y, x) = x << 16 | y << 8 | (x ! y)
Next
Next
; write jpeg file
tjC = tjInitCompress()
*buffer = 0
If tjCompress2(tjC, @ImageData(), 256, 1024, 256, #TJPF_RGBX, @*buffer, @size, #TJSAMP_444, 95, #TJFLAG_ACCURATEDCT) = 0
If CreateFile(0, "libturbojpeg_test.jpg")
WriteData(0, *buffer, size)
CloseFile(0)
EndIf
tjFree(*buffer)
EndIf
Last edited by wilbert on Sat Jul 09, 2016 7:24 am, edited 1 time in total.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: libjpeg-turbo static
yep thats working fine, and amazing image from hardly any code!
Code: Select all
For y = 0 To 255
For x = 0 To 255
ImageData(y, x) = x << 16 | y << 8 | (x ! y)
Next
Next
Re: libjpeg-turbo static
Thanks Keya.
Last edited by wilbert on Wed May 31, 2017 2:58 pm, edited 1 time in total.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: libjpeg-turbo static
Works here with WinXPx64 and Win7x64.
Re: libjpeg-turbo static
Thank you very much for testingfryquez wrote:Works here with WinXPx64 and Win7x64.
Good to know it is working cross platform.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
- netmaestro
- PureBasic Bullfrog
- Posts: 8433
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: libjpeg-turbo static
Win 7 pro sp1 x64: Appears working perfectly. Thanks for your efforts on this Wilbert!
BERESHEIT
Re: libjpeg-turbo static
Thanks netmaestronetmaestro wrote:Win 7 pro sp1 x64: Appears working perfectly. Thanks for your efforts on this Wilbert!
Keya did a lot of the problem solving when it comes to the Windows version.
I like this lib a lot. You have more control of the output compared to what PB offers, it's cross platform and very fast.
I just read an article from the developer that he is working on AVX2 support for newer processors and expects a 20 - 30% performance increase for that.
https://sourceforge.net/blog/may-2016-c ... peg-turbo/
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)