[OpenWrt-Devel] [PATCH-v2] Libjpeg-turbo to replace libjpeg

Ian Leonard antonlacon at gmail.com
Mon Dec 12 02:13:34 CET 2011


On 12/11/2011 05:07 PM, Ian Leonard wrote:
> This patch adds libjpeg-turbo 1.1.1 and adjusts all packages depending on libjpeg to instead depend on libjpeg-turbo. Packages built against the current jpeg-6gb in the tree will need to be rebuilt. If you want a drop-in replacement for the current tree, remove the "--with-jpeg8" line from the configure section.
> 
> Libjpeg-turbo is a fork of jpeg-6b, which includes MMX, SSE and NEON acceleration and other performance enhancements. It is meant to be ABI/API compatible with the Independent JPEG Group's (IJG) jpeg implementation. Since its initial release, it also emulates jpeg 7 or 8, and has been adopted as the system jpeg library of Fedora, and an option in Gentoo.
> 
> The SIMD acceleration provides a 2-4x speedup. On non-SIMD machines the enhancements provides up to a 25% improvement.
> 
> Signed-off-by: Ian Leonard <antonlacon at gmail.com>
> ---
> The Makefile disables SIMD support, as I believe the only platform OpenWRT supports them might be the Geode. I don't have one to test. Before enabling, an assembler will need to be added (nasm?).
> 
> I have not checked the size in comparison to the IJG's jpeg or checked the performance improvements. Numbers above are as reported by the developer. I also have not checked the compatibility with every application I adjusted the dependencies for. It does work for me with minidlna and libgd.
> 
> Testers welcome. After the New Year, my ability to work on this will be severely limited. If there is something extensive, someone else will need to invest the time in correcting it.
> 
> Does OpenWRT wish to switch libjpeg providers? Is there a better way to replace libjpeg?
> 
---
An unrelated change to FFmpeg was in the previous patch. Corrected one here.

---
Index: packages/utils/hplip/Makefile
===================================================================
--- packages/utils/hplip/Makefile	(revision 29504)
+++ packages/utils/hplip/Makefile	(working copy)
@@ -25,7 +25,7 @@
   CATEGORY:=Utilities
   TITLE:=HP Linux Imaging and Printing
   URL:=http://sourceforge.net/projects/hplip/
-  DEPENDS+=+libjpeg +libtiff +libusb +cups +sane-libs
+  DEPENDS+=+libjpeg-turbo +libtiff +libusb +cups +sane-libs
 endef
 
 define Package/hplip/description
Index: packages/utils/sane-backends/Makefile
===================================================================
--- packages/utils/sane-backends/Makefile	(revision 29504)
+++ packages/utils/sane-backends/Makefile	(working copy)
@@ -47,7 +47,7 @@
   $(call Package/sane-backends/Default)
   SECTION:=libs
   CATEGORY:=Libraries
-  DEPENDS:=+libjpeg +libtiff +libusb
+  DEPENDS:=+libjpeg-turbo +libtiff +libusb
   TITLE+= (libraries)
 endef
 
Index: packages/lang/python-imaging-library/Makefile
===================================================================
--- packages/lang/python-imaging-library/Makefile	(revision 29504)
+++ packages/lang/python-imaging-library/Makefile	(working copy)
@@ -27,7 +27,7 @@
   SUBMENU:=Python
   TITLE:=Python Imaging Library (PIL)
   URL:=http://www.pythonware.com/products/pil/
-  DEPENDS:=+python +libfreetype +libjpeg +zlib
+  DEPENDS:=+python +libfreetype +libjpeg-turbo +zlib
 endef
 
 define Package/python-imaging-library/description
Index: packages/net/cups/Makefile
===================================================================
--- packages/net/cups/Makefile	(revision 29504)
+++ packages/net/cups/Makefile	(working copy)
@@ -25,7 +25,7 @@
 define Package/cups
   SECTION:=net
   CATEGORY:=Network
-  DEPENDS:=+zlib +libpthread +libpng +libjpeg +libstdcpp
+  DEPENDS:=+zlib +libpthread +libpng +libjpeg-turbo +libstdcpp
   TITLE:=Common UNIX Printing System
   URL:=http://www.cups.org/
 endef
Index: packages/net/vnc-reflector/Makefile
===================================================================
--- packages/net/vnc-reflector/Makefile	(revision 29504)
+++ packages/net/vnc-reflector/Makefile	(working copy)
@@ -22,7 +22,7 @@
 define Package/vnc-reflector
   SECTION:=net
   CATEGORY:=Network
-  DEPENDS:=+libjpeg +zlib
+  DEPENDS:=+libjpeg-turbo +zlib
   TITLE:=VNC proxy for multiple clients
   URL:=http://sourceforge.net/projects/vnc-reflector
 endef
Index: packages/net/freeswitch/Makefile
===================================================================
--- packages/net/freeswitch/Makefile	(revision 29504)
+++ packages/net/freeswitch/Makefile	(working copy)
@@ -761,7 +761,7 @@
 $(eval $(call BuildPlugin,snmp,Simple Network Management Protocol,mod_snmp,,+libnetsnmp))
 $(eval $(call BuildPlugin,snom,SNOM specific features,mod_snom,,))
 $(eval $(call BuildPlugin,sofia,SIP,mod_sofia,,))
-$(eval $(call BuildPlugin,spandsp,Span DSP,mod_spandsp,,+libjpeg))
+$(eval $(call BuildPlugin,spandsp,Span DSP,mod_spandsp,,+libjpeg-turbo))
 $(eval $(call BuildPlugin,speex,Speex codec,mod_speex,,))
 $(eval $(call BuildPlugin,spidermonkey,JavaScript,mod_spidermonkey,, at BROKEN)) # fails in js
 $(eval $(call BuildPlugin,spidermonkey-core_db,JavaScript DB,mod_spidermonkey_core_db,, at BROKEN))
Index: packages/libs/tiff/Makefile
===================================================================
--- packages/libs/tiff/Makefile	(revision 29504)
+++ packages/libs/tiff/Makefile	(working copy)
@@ -35,7 +35,7 @@
   SECTION:=libs
   CATEGORY:=Libraries
   TITLE+= library
-  DEPENDS:=+zlib +libjpeg
+  DEPENDS:=+zlib +libjpeg-turbo
 endef
 
 define Package/libtiffxx
Index: packages/libs/vips/Makefile
===================================================================
--- packages/libs/vips/Makefile	(revision 29504)
+++ packages/libs/vips/Makefile	(working copy)
@@ -27,7 +27,7 @@
   CATEGORY:=Multimedia
   TITLE:=An image manipulation library
   URL:=http://www.vips.ecs.soton.ac.uk/
-  DEPENDS:=+glib2 +libexif +libjpeg +libpng +libxml2 $(INTL_DEPENDS)
+  DEPENDS:=+glib2 +libexif +libjpeg-turbo +libpng +libxml2 $(INTL_DEPENDS)
 endef
 
 TARGET_LDFLAGS+= \
Index: packages/libs/libdirectfb/Makefile
===================================================================
--- packages/libs/libdirectfb/Makefile	(revision 29504)
+++ packages/libs/libdirectfb/Makefile	(working copy)
@@ -25,7 +25,7 @@
     SECTION:=libs
     CATEGORY:=Libraries
     URL:=http://directfb.org
-    DEPENDS:=+libpng +libjpeg +libpthread +libfreetype
+    DEPENDS:=+libpng +libjpeg-turbo +libpthread +libfreetype
 endef
 
 define Package/directfb/description
Index: packages/libs/gd/Makefile
===================================================================
--- packages/libs/gd/Makefile	(revision 29504)
+++ packages/libs/gd/Makefile	(working copy)
@@ -25,7 +25,7 @@
 define Package/libgd
   SECTION:=libs
   CATEGORY:=Libraries
-  DEPENDS:=+libjpeg +libpng
+  DEPENDS:=+libjpeg-turbo +libpng
   TITLE:=The GD graphics library
   URL:=http://www.libgd.org/
 endef
Index: packages/libs/libjpeg-turbo/Makefile
===================================================================
--- packages/libs/libjpeg-turbo/Makefile	(revision 0)
+++ packages/libs/libjpeg-turbo/Makefile	(revision 0)
@@ -0,0 +1,82 @@
+# 
+# Copyright (C) 20011 OpenWrt.org
+#
+# This is free software, licensed under the wxWindows Library Licence, Version 3.1.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libjpeg-turbo
+PKG_VERSION:=1.1.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/libjpeg-turbo
+PKG_MD5SUM:=03b9c1406c7bfdc204313c2917ce6962
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libjpeg-turbo/Default
+  TITLE:=Fork of libjpeg with performance improvements
+  URL:=http://libjpeg-turbo.virtualgl.org/
+endef
+
+define Package/libjpeg-turbo
+  $(call Package/libjpeg-turbo/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= runtime library
+endef
+
+define Package/jpeg-tools
+  $(call Package/libjpeg-turbo/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libjpeg-turbo
+  TITLE+= manipulation tools
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+	--enable-shared \
+	--enable-static \
+	--with-jpeg8 \
+	--without-simd \
+
+#
+# libjpegturbo.{a,so} provides the TurboJPEG/OSS interface. 
+# No known use in OpenWRT at this time. 14/11/11
+#
+
+define Build/InstallDev
+	$(INSTALL_DIR) $(1)/usr/include
+	$(CP) $(PKG_BUILD_DIR)/jpeglib.h $(1)/usr/include/
+	$(CP) $(PKG_BUILD_DIR)/jpegint.h $(1)/usr/include/
+	$(CP) $(PKG_BUILD_DIR)/j{config,error,morecfg}.h $(1)/usr/include/
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_BUILD_DIR)/.libs/libjpeg.{a,so*} $(1)/usr/lib/
+#	$(CP) $(PKG_BUILD_DIR)/.libs/libturbojpeg.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/libjpeg-turbo/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_BUILD_DIR)/.libs/libjpeg.{a,so*} $(1)/usr/lib/
+#	$(CP) $(PKG_BUILD_DIR)/.libs/libturbojpeg.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/jpeg-tools/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/{c,d}jpeg $(1)/usr/bin/
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/jpeg{tran,gut} $(1)/usr/bin/
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/{rd,wr}jpgcom $(1)/usr/bin/
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/jpgtest $(1)/usr/bin/
+endef
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,libjpeg-turbo))
+$(eval $(call BuildPackage,jpeg-tools))
Index: packages/libs/libtwin/Makefile
===================================================================
--- packages/libs/libtwin/Makefile	(revision 29504)
+++ packages/libs/libtwin/Makefile	(working copy)
@@ -23,7 +23,7 @@
 define Package/libtwin
 	SECTION:=libs
 	CATEGORY:=Libraries
-	DEPENDS:=+zlib +libpng +libjpeg +libfreetype
+	DEPENDS:=+zlib +libpng +libjpeg-turbo +libfreetype
 	TITLE:=The tiny windowing system library
 	URL:=http://ozlabs.org/~jk/projects/petitboot/
 	MAINTAINER:=Geoff Levand <geoffrey.levand at am.sony.com>
Index: packages/libs/libgphoto2/Makefile
===================================================================
--- packages/libs/libgphoto2/Makefile	(revision 29504)
+++ packages/libs/libgphoto2/Makefile	(working copy)
@@ -30,7 +30,7 @@
 
 define Package/libgphoto2
   $(call Package/libgphoto2/Default)
-  DEPENDS:=+libusb +libexif +libjpeg +libpthread +libltdl $(ICONV_DEPENDS)
+  DEPENDS:=+libusb +libexif +libjpeg-turbo +libpthread +libltdl $(ICONV_DEPENDS)
   TITLE:=The basic library of the gphoto2 program.
   MENU:=1
 endef
Index: packages/libs/leptonica/Makefile
===================================================================
--- packages/libs/leptonica/Makefile	(revision 29504)
+++ packages/libs/leptonica/Makefile	(working copy)
@@ -25,7 +25,7 @@
   CATEGORY:=Libraries
   TITLE:=A library for efficient image processing and image analysis operations
   URL:=http://leptonica.googlecode.com/
-  DEPENDS:=+giflib +libjpeg +libpng +libtiff +zlib
+  DEPENDS:=+giflib +libjpeg-turbo +libpng +libtiff +zlib
 endef
 
 TARGET_CFLAGS += $(FPIC)
Index: packages/multimedia/imagemagick/Makefile
===================================================================
--- packages/multimedia/imagemagick/Makefile	(revision 29504)
+++ packages/multimedia/imagemagick/Makefile	(working copy)
@@ -42,7 +42,7 @@
 define Package/imagemagick-jpeg
   $(call Package/imagemagick/Default)
   TITLE+= (jpeg)
-  DEPENDS:=+imagemagick +libjpeg +zlib
+  DEPENDS:=+imagemagick +libjpeg-turbo +zlib
 endef
 
 define Package/imagemagick-jpeg/description
Index: packages/multimedia/motion/Makefile
===================================================================
--- packages/multimedia/motion/Makefile	(revision 29504)
+++ packages/multimedia/motion/Makefile	(working copy)
@@ -23,7 +23,7 @@
 define Package/motion
   SECTION:=multimedia
   CATEGORY:=Multimedia
-  DEPENDS:=+libjpeg +libpthread
+  DEPENDS:=+libjpeg-turbo +libpthread
   TITLE:=webcam motion sensing and logging
   URL:=http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome
 endef
Index: packages/multimedia/kissdx/Makefile
===================================================================
--- packages/multimedia/kissdx/Makefile	(revision 29504)
+++ packages/multimedia/kissdx/Makefile	(working copy)
@@ -23,7 +23,7 @@
 define Package/kissdx
   SECTION:=multimedia
   CATEGORY:=Multimedia
-  DEPENDS:=+libjpeg +libdvdread $(ICONV_DEPENDS)
+  DEPENDS:=+libjpeg-turbo +libdvdread $(ICONV_DEPENDS)
   TITLE:=PC-Link clone for KiSS media players
   URL:=http://kissdx.vidartysse.net
 endef
Index: packages/multimedia/minidlna/Makefile
===================================================================
--- packages/multimedia/minidlna/Makefile	(revision 29504)
+++ packages/multimedia/minidlna/Makefile	(working copy)
@@ -26,7 +26,7 @@
   CATEGORY:=Multimedia
   TITLE:=UPnP A/V & DLNA Media Server
   URL:=http://minidlna.sourceforge.net/
-  DEPENDS:= +libpthread +libexif +libjpeg +libsqlite3 +libffmpeg \
+  DEPENDS:= +libpthread +libexif +libjpeg-turbo +libsqlite3 +libffmpeg \
   	+libid3tag +libflac +libvorbis +libuuid \
   	$(ICONV_DEPENDS) $(INTL_DEPENDS)
 endef
Index: packages/multimedia/palantir/Makefile
===================================================================
--- packages/multimedia/palantir/Makefile	(revision 29504)
+++ packages/multimedia/palantir/Makefile	(working copy)
@@ -15,12 +15,12 @@
 PKG_SOURCE_URL:=http://www.fastpath.it/products/palantir/pub/
 PKG_MD5SUM:=3a5b1fb340857f6d8e357bf39b77583e
 
-PKG_BUILD_DEPENDS:=libjpeg
+PKG_BUILD_DEPENDS:=libjpeg-turbo
 
 define Package/palantir
   SECTION:=multimedia
   CATEGORY:=Multimedia
-  DEPENDS:=+libjpeg +libpthread
+  DEPENDS:=+libjpeg-turbo +libpthread
   TITLE:=A multichannel interactive streaming solution
   URL:=http://www.fastpath.it/products/palantir/
 endef
Index: packages/multimedia/graphicsmagick/Makefile
===================================================================
--- packages/multimedia/graphicsmagick/Makefile	(revision 29504)
+++ packages/multimedia/graphicsmagick/Makefile	(working copy)
@@ -40,7 +40,7 @@
 define Package/GraphicsMagick-jpeg
   $(call Package/GraphicsMagick/Default)
   TITLE+= (jpeg)
-  DEPENDS:=+GraphicsMagick +libjpeg +zlib
+  DEPENDS:=+GraphicsMagick +libjpeg-turbo +zlib
 endef
 
 define Package/GraphicsMagick-jpeg/description
Index: packages/multimedia/mjpg-streamer/Makefile
===================================================================
--- packages/multimedia/mjpg-streamer/Makefile	(revision 29504)
+++ packages/multimedia/mjpg-streamer/Makefile	(working copy)
@@ -24,7 +24,7 @@
   SECTION:=multimedia
   CATEGORY:=Multimedia
   TITLE:=MJPG-streamer
-  DEPENDS:=+libpthread +libjpeg
+  DEPENDS:=+libpthread +libjpeg-turbo
   URL:=http://mjpg-streamer.wiki.sourceforge.net/
 endef
 




More information about the openwrt-devel mailing list