Page 1 of 1

WebP v0.4.3

Posted: Fri Apr 03, 2015 4:31 pm
by Roger Hågensen
https://developers.google.com/speed/webp/
Roger Hågensen wrote:And for those with no clue what WebP is:

WebP provides lossy image compression based on WebM video frame compression. Quality/compression is in the same general area as JPEG.
In addition WebP support lossless compression. Compression here is in the same area as PNG.
Also important is that WebP support a alpha channel, this alpha channel can independently of the image be lossy or lossless.

This means you could use lossy compression for the image but lossless compression for the alpha channel, giving perfect edges.
You can also define the compression ratio for lossless and the ratio/quality for lossy compression.

The WebP specs now support/have WebP animation in the works.

WebP's goal is a all in once format to replace JPEG, PNG, GIF.
Of the browsers out there Chrome, Opera and Android support WebP.
And technically any browser that support WebM should be able to support WebP as well.

GridStream Player has made use of WebP for it's images/skin/GUI for over two years now without issues.
Being able to use lossless and lossy for both the image and the alpha channel in a single file is hugely practical.
I can easily see games and various other software benefiting from this.

WebP is also not patent encumbered and it's licensing/royalty free.
v0.4.3 is available.

It is now possible to build it in such a way that libwepdecoder will work on Windows 2000 and later (rather than just Windows XP SP3+).

There is a legacy flag that can be used like this: (example build.bat script placed in the source directory of webp)

Code: Select all

@echo off
CLS
nmake /nologo /f makefile.vc CFG=release-static RTLIBCFG=legacy clean >NUL
nmake /f makefile.vc CFG=release-static RTLIBCFG=legacy all


The compiled "webpdecoder.lib" can now be imported into PureBasic and used to decode WebP images.

The legacy flag was an idea I came up with that was added to the WebP v0.4.3 Makefile.vc so that it was possible to import webpdecoder.lib and make the resulting program work on Windows 2000 (and later) without errors due to certain missing XP SP3+ features.

Prior to v0.4.3 of WebP I used a custom .vc but now it's possible using the official one.

I needed WebP decoding to work on Windows 2000 and up for GridStream Player (a shoutcast stream player).

This legacy build flag also makes it possible to do WebP decoding on deprecated Windows OS versions (like W2K) to ensure the widest possible adoption of WebP.
If webP images can be decoded on any Windows then it is more likely more will adopt it ("build it and they shall come" as one might say).

Maybe the PureBasic team will consider a WebP plugin using the source as well?


Note! When not specifying the legacy flag MSVC/MSVS will compile with certain API features that requires XP SP3 as minimum, this will cause errors when a program is run/loaded on Windows 2000 to XP SP2.

Re: WebP v0.4.3

Posted: Sat Apr 04, 2015 4:24 pm
by chi
Sounds interesting... Do you have a working example for PB?

Re: WebP v0.4.3

Posted: Sun Apr 05, 2015 4:24 pm
by Roger Hågensen
I posted one previously over here http://www.purebasic.fr/english/viewtop ... 12&t=51167

As mentioned by Wilbert and Rings thee is a compile issue there regarding __security_cookie this is a MSVC/MSVS issue (the platform target is XP SP3 and later).
With WebP v0.4.3 the Makefile.vc has as I mentioned earlier the legacy flag which let you compile without that artificial limitation.

On Mac and Linux this should not be an issue at all, Wilbert posted a example for that.


I'm not happy with the scanline inversion loop though. It uses CopyMemory but ideally it should be a tight loop in assembler.
If there was a WebP decoder plugin for PureBasic then all that would be automatically handled by that instead and more efficiently.

Re: WebP v0.4.3

Posted: Wed Apr 15, 2015 7:02 pm
by Seymour Clufley
Hate to ask this, but... what about a WebP encoder for PB?