From 7ec2cc7f8ee03a02662f5071164f7939dd44b8f3 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 20 Mar 2011 23:32:44 +0000 Subject: Update to use official libwebp 0.1 Remove libvpx references as no longer needed. svn path=/trunk/netsurf/; revision=12115 --- Makefile.defaults | 8 ++++---- amiga/Makefile.target | 2 +- amiga/dist/Install | 2 -- amiga/pkg/makepackage | 2 +- gtk/Makefile.target | 2 +- image/webp.c | 45 +++++++++++++++------------------------------ 6 files changed, 22 insertions(+), 39 deletions(-) diff --git a/Makefile.defaults b/Makefile.defaults index cd70eefb3..adcc2f799 100644 --- a/Makefile.defaults +++ b/Makefile.defaults @@ -53,7 +53,7 @@ NETSURF_USE_PNG := YES # Valid options: YES, NO (at least one of PNG/MNG highly recommended) NETSURF_USE_MNG := YES -# Enable NetSurf's use of libwebp/libvpx for displaying WebPs +# Enable NetSurf's use of libwebp for displaying WebPs # Valid options: YES, NO NETSURF_USE_WEBP := NO @@ -220,7 +220,7 @@ ifeq ($(TARGET),amiga) # Valid options: YES, NO, AUTO NETSURF_USE_ROSPRITE := YES - # Enable NetSurf's use of libwebp/libvpx for displaying WebPs + # Enable NetSurf's use of libwebp for displaying WebPs # Valid options: YES, NO NETSURF_USE_WEBP := YES @@ -340,7 +340,7 @@ ifeq ($(TARGET),atari) # Valid options: YES, NO, AUTO NETSURF_USE_ROSPRITE := NO - # Enable NetSurf's use of libwebp/libvpx for displaying WebPs + # Enable NetSurf's use of libwebp for displaying WebPs # Valid options: YES, NO NETSURF_USE_WEBP := NO @@ -379,7 +379,7 @@ ifeq ($(TARGET),cocoa) # Valid options: YES, NO, AUTO NETSURF_USE_ROSPRITE := NO - # Enable NetSurf's use of libwebp/libvpx for displaying WebPs + # Enable NetSurf's use of libwebp for displaying WebPs # Valid options: YES, NO NETSURF_USE_WEBP := NO diff --git a/amiga/Makefile.target b/amiga/Makefile.target index 94fa8dd49..551d12cf9 100644 --- a/amiga/Makefile.target +++ b/amiga/Makefile.target @@ -22,7 +22,7 @@ ifeq ($(HOST),amiga) $(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) )) $(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG (libsvgtiny))) $(eval $(call feature_enabled,MNG,,-llcms -ljpeg,PNG/JNG/MNG (libmng))) - $(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp -lvpx,WebP (libwebp))) + $(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp,WebP (libwebp))) $(eval $(call feature_enabled,AMIGA_ICON,-DWITH_AMIGA_ICON,,Amiga icon )) $(eval $(call feature_enabled,PLUGINS,-DWITH_PLUGIN,,DataTypes images)) diff --git a/amiga/dist/Install b/amiga/dist/Install index 91be1623f..60dabcf99 100755 --- a/amiga/dist/Install +++ b/amiga/dist/Install @@ -484,8 +484,6 @@ (p_linksobj "libz.so.1.2.5" "libz.so") (p_linksobj "libz.so.1.2.5" "libz.so.1") (p_linksobj "libz.so.1.2.5" "libz.so.1.2") - (p_linksobj "libvpx.so.0.9.5" "libvpx.so.0") -; (p_linksobj "libpng14.so.14" "libpng.so") ) ) diff --git a/amiga/pkg/makepackage b/amiga/pkg/makepackage index ca9216c8a..c3b49133c 100755 --- a/amiga/pkg/makepackage +++ b/amiga/pkg/makepackage @@ -24,5 +24,5 @@ makedir ram:NetSurf/Libs copy libs:parserutils.library libs:nsgif.library libs:nsbmp.library libs:iconv.library libs:hubbub.library ram:NetSurf/Libs ; libs:css.library libs:wapcaplet.library makedir ram:NetSurf/SObjs -copy sobjs:libjpeg.so.8 sobjs:libmng.so.1 sobjs:liblcms.so sobjs:libxml2.so.9 sobjs:libcurl.so.7 sobjs:librtmp.so.0 sobjs:libsvgtiny.so.0 sobjs:libz.so.1.2.5 sobjs:libvpx.so.0.9.5 sobjs:libssl.so.1.0.0 sobjs:libcrypto.so.1.0.0 sobjs:libcss.so.0 sobjs:libwapcaplet.so.0 sobjs:libpng12.so ram:NetSurf/SObjs clone +copy sobjs:libjpeg.so.8 sobjs:libmng.so.1 sobjs:liblcms.so sobjs:libxml2.so.9 sobjs:libcurl.so.7 sobjs:librtmp.so.0 sobjs:libsvgtiny.so.0 sobjs:libz.so.1.2.5 sobjs:libwebp.so.0 sobjs:libssl.so.1.0.0 sobjs:libcrypto.so.1.0.0 sobjs:libcss.so.0 sobjs:libwapcaplet.so.0 sobjs:libpng12.so ram:NetSurf/SObjs clone ;sobjs:libhpdf-2.2.0.so.0.0 diff --git a/gtk/Makefile.target b/gtk/Makefile.target index 1ab4f3ca4..17dc8619e 100644 --- a/gtk/Makefile.target +++ b/gtk/Makefile.target @@ -24,7 +24,7 @@ $(eval $(call pkg_config_find_and_add,PNG,libpng,PNG )) # no pkg-config for this library - $(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp -lvpx,WebP (libwebp))) + $(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp,WebP (libwebp))) GTKCFLAGS := -std=c99 -Dgtk -Dnsgtk \ -DGTK_DISABLE_DEPRECATED \ diff --git a/image/webp.c b/image/webp.c index 449b069fb..42f8ece04 100644 --- a/image/webp.c +++ b/image/webp.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include "desktop/plotters.h" #include "image/bitmap.h" #include "content/content_protected.h" @@ -44,24 +44,21 @@ bool webp_convert(struct content *c) { union content_msg_data msg_data; - const uint8 *data; + const uint8_t *data; unsigned char *imagebuf = NULL; - uint32 *imagebufptr = NULL; + uint32_t *imagebufptr = NULL; unsigned long size; - uint8 *Y = NULL, *U = NULL, *V = NULL; int width = 0, height = 0; - uint32 offset = 0; - uint8 r, g, b, a; char title[100]; - WebPResult res = webp_success; + int res = 0; + uint8_t *res_p = NULL; data = (uint8 *)content__get_source_data(c, &size); - res = WebPDecode(data, size, &Y, &U, &V, &width, &height); - if (res != webp_success) { + res = WebPGetInfo(data, size, &width, &height); + if (res == 0) { msg_data.error = messages_get("NoMemory"); content_broadcast(c, CONTENT_MSG_ERROR, msg_data); - if(Y) free(Y); return false; } @@ -69,35 +66,23 @@ bool webp_convert(struct content *c) if (!c->bitmap) { msg_data.error = messages_get("NoMemory"); content_broadcast(c, CONTENT_MSG_ERROR, msg_data); - if(Y) free(Y); return false; } + imagebuf = bitmap_get_buffer(c->bitmap); if (!imagebuf) { msg_data.error = messages_get("NoMemory"); content_broadcast(c, CONTENT_MSG_ERROR, msg_data); - if(Y) free(Y); return false; } - unsigned int row_width = bitmap_get_rowstride(c->bitmap) / 4; - - YUV420toRGBA(Y, U, V, row_width, width, height, (uint32 *)imagebuf); - - if(Y) free(Y); - - /* Decoded data is RGBA on both big- and little-endian platforms, - * so ensure correct byte order. */ - - size = width * height * 4; + unsigned int row_width = bitmap_get_rowstride(c->bitmap); - for (offset = 0; offset < size; offset += 4) { - a = imagebuf[offset+3]; - b = imagebuf[offset+2]; - g = imagebuf[offset+1]; - r = imagebuf[offset]; - - imagebufptr = imagebuf + offset; - *imagebufptr = r << 24 | g << 16 | b << 8 | a; + res_p = WebPDecodeRGBAInto(data, size, imagebuf, + row_width * height, row_width); + if (res_p == NULL) { + msg_data.error = messages_get("NoMemory"); + content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + return false; } c->width = width; -- cgit v1.2.3