Permalink
Browse files

Pull epeg direction into fastphoto

libepeg is no longer maintained upstream, so import the source files
directly.

JPEG load/save has been pulled directly into Evas, but an Evas backend
would be slow as it always goes via RGB.
  • Loading branch information...
kfish committed Apr 17, 2010
1 parent ab5dec5 commit 71c053acfd858c963cc6c139251f42a53a4bc0fd
Showing with 1,544 additions and 36 deletions.
  1. +3 −3 README
  2. +0 −4 TODO
  3. +11 −17 configure.ac
  4. +0 −5 get_epeg_cvs.sh
  5. +76 −0 src/Epeg.h
  6. +6 −6 src/Makefile.am
  7. +1,361 −0 src/epeg_main.c
  8. +86 −0 src/epeg_private.h
  9. +1 −1 src/resize.c
View
6 README
@@ -6,9 +6,9 @@ can be installed on a web server as a handler for files of type image/jpeg,
providing fast server-side resizing with (optional) transparent caching. It
can also be used as a commandline application.
-FastPhoto uses Epeg, a high-performance JPEG resizing library which decodes
-only the DCT coefficients needed to reconstruct an image of the desired size,
-and avoids colorspace conversions where possible.
+FastPhoto is based on Epeg, high-performance JPEG resizing code which
+decodes only the DCT coefficients needed to reconstruct an image of the
+desired size, and avoids colorspace conversions where possible.
FastPhoto preserves the aspect of the original file unless both width and
height options are specified.
View
4 TODO
@@ -2,10 +2,6 @@ This is a loosely-categorized list of outstanding tasks and ideas for improving
fastphoto. When implementing any of these, please include an update to this TODO
file removing that task, in the same commit.
-* Pull epeg.c direction into fastphoto, as libepeg is no longer maintained upstream.
-(JPEG load/save has been pulled directly into Evas, but an Evas backend would be
-slow as it always goes via RGB).
-
* Horms reported a problem with passing negative values to epeg_decode_size_set():
it produces a 1x1 puce colored image. Test if this is fixed in libepeg, in
any case guard against negative values.
View
@@ -117,28 +117,22 @@ esac
# Checks for library functions.
#
-# Detect Epeg
+# Detect libjpeg
#
+AC_CHECK_HEADERS(jpeglib.h)
-export PKG_CONFIG_PATH=$PWD/epeg:$PKG_CONFIG_PATH
-PKG_CHECK_MODULES(EPEG, epeg >= 0.9.0,
- HAVE_EPEG="yes", HAVE_EPEG="no")
+if test "$HAVE_JPEGLIB_H" = "no"; then
+ AC_MSG_ERROR(jpeglib.h not found! try --with-jpeg-dir=<DIR>)
+fi
-if test "$HAVE_EPEG" = "yes" ; then
- AC_DEFINE([HAVE_EPEG], [], [Define if epeg is found])
- AC_SUBST(EPEG_CFLAGS)
- AC_SUBST(EPEG_LIBS)
-else
- AC_MSG_ERROR([
-***
-*** Epeg 1.0 development library is not installed
-***
-*** Please update PKG_CONFIG_PATH to point to Epeg's source folder
-*** or run ./get_epeg_cvs.sh
-***
-])
+AC_CHECK_LIB(jpeg,jpeg_read_header)
+
+if test "$HAVE_LIBJPEG" = "no"; then
+ AC_MSG_ERROR(libjpeg not found! try --with-jpeg-dir=<DIR>)
fi
+#LIBS="$LIBS -ljpeg"
+
dnl
dnl Configuration tests complete -- provide summary of results.
dnl
View
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-cvs -z3 -d :pserver:anonymous@anoncvs.enlightenment.org:/var/cvs/e co e17/libs/epeg
-mv e17/libs/epeg . && rm -rf e17
-cd epeg && ./autogen.sh && make
View
@@ -0,0 +1,76 @@
+#ifndef _EPEG_H
+#define _EPEG_H
+
+#ifdef EAPI
+#undef EAPI
+#endif
+#ifdef WIN32
+# ifdef BUILDING_DLL
+# define EAPI __declspec(dllexport)
+# else
+# define EAPI __declspec(dllimport)
+# endif
+#else
+# ifdef __GNUC__
+# if __GNUC__ >= 4
+# define EAPI __attribute__ ((visibility("default")))
+# else
+# define EAPI
+# endif
+# else
+# define EAPI
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ typedef enum _Epeg_Colorspace
+ {
+ EPEG_GRAY8,
+ EPEG_YUV8,
+ EPEG_RGB8,
+ EPEG_BGR8,
+ EPEG_RGBA8,
+ EPEG_BGRA8,
+ EPEG_ARGB32,
+ EPEG_CMYK
+ }
+ Epeg_Colorspace;
+
+ typedef struct _Epeg_Image Epeg_Image;
+ typedef struct _Epeg_Thumbnail_Info Epeg_Thumbnail_Info;
+
+ struct _Epeg_Thumbnail_Info
+ {
+ char *uri;
+ unsigned long long int mtime;
+ int w, h;
+ char *mimetype;
+ };
+
+ EAPI Epeg_Image *epeg_file_open (const char *file);
+ EAPI Epeg_Image *epeg_memory_open (unsigned char *data, int size);
+ EAPI void epeg_size_get (Epeg_Image *im, int *w, int *h);
+ EAPI void epeg_decode_size_set (Epeg_Image *im, int w, int h);
+ EAPI void epeg_colorspace_get (Epeg_Image *im, int *space);
+ EAPI void epeg_decode_colorspace_set (Epeg_Image *im, Epeg_Colorspace colorspace);
+ EAPI const void *epeg_pixels_get (Epeg_Image *im, int x, int y, int w, int h);
+ EAPI void epeg_pixels_free (Epeg_Image *im, const void *data);
+ EAPI const char *epeg_comment_get (Epeg_Image *im);
+ EAPI void epeg_thumbnail_comments_get (Epeg_Image *im, Epeg_Thumbnail_Info *info);
+ EAPI void epeg_comment_set (Epeg_Image *im, const char *comment);
+ EAPI void epeg_quality_set (Epeg_Image *im, int quality);
+ EAPI void epeg_thumbnail_comments_enable (Epeg_Image *im, int onoff);
+ EAPI void epeg_file_output_set (Epeg_Image *im, const char *file);
+ EAPI void epeg_memory_output_set (Epeg_Image *im, unsigned char **data, int *size);
+ EAPI int epeg_encode (Epeg_Image *im);
+ EAPI int epeg_trim (Epeg_Image *im);
+ EAPI void epeg_close (Epeg_Image *im);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
View
@@ -1,6 +1,6 @@
# Process this file with automake to produce Makefile.in
-AM_CFLAGS = $(EPEG_CFLAGS)
+AM_CFLAGS = $(JPEG_CFLAGS)
bin_PROGRAMS = fastphoto
noinst_PROGRAMS = httpdate_test cgi_test
@@ -9,12 +9,12 @@ TESTS_ENVIRONMENT = $(VALGRIND_ENVIRONMENT)
TESTS = httpdate_test cgi_test
-noinst_HEADERS = fastphoto.h alloc_snprintf.h cache.h cgi.h cmd.h read_config.h header.h httpdate.h memory.h photo.h resize.h tests.h xini.h
+noinst_HEADERS = Epeg.h epeg_private.h fastphoto.h alloc_snprintf.h cache.h cgi.h cmd.h read_config.h header.h httpdate.h memory.h photo.h resize.h tests.h xini.h
-fastphoto_SOURCES = main.c alloc_snprintf.c cache.c cgi.c cmd.c read_config.c header.c httpdate.c memory.c photo.c resize.c xini.c
-fastphoto_LDADD = $(EPEG_LIBS)
+fastphoto_SOURCES = main.c alloc_snprintf.c cache.c cgi.c cmd.c epeg_main.c read_config.c header.c httpdate.c memory.c photo.c resize.c xini.c
+fastphoto_LDADD = $(JPEG_LIBS)
httpdate_test_SOURCES = httpdate.c httpdate_test.c
-cgi_test_SOURCES = cgi_test.c cgi.c alloc_snprintf.c cache.c read_config.c httpdate.c header.c photo.c resize.c memory.c xini.c
-cgi_test_LDADD = $(EPEG_LIBS)
+cgi_test_SOURCES = cgi_test.c cgi.c alloc_snprintf.c cache.c epeg_main.c read_config.c httpdate.c header.c photo.c resize.c memory.c xini.c
+cgi_test_LDADD = $(JPEG_LIBS)
Oops, something went wrong.

0 comments on commit 71c053a

Please sign in to comment.