2008-04-23 17:50:58 Adding fdct_bfin.s to libjpeg (a makefile question)
Frank Van Hooft (CANADA)
Message: 54809 I'm currently using ffmpeg to create (encode) jpeg files on a BF537-STAMP using 2008R1, however ffmpeg is very large (it pushes me into a larger flash device) and has a tendency to malloc() large chunks of RAM, which causes me the odd problem. So I'm trying to move away from it.
libjpeg is nice & easy to use, however it's too slow. I benchmarked both the 'slow' and 'fast' integer DCT encoders provided in libjpeg, and found only a few percent speed difference between them. In an effort to speed libjpeg up (& hopefully help others here who also could use a faster, relatively small jpeg encoder) I'm trying to reuse the fast blackfin DCT that was written for ffmpeg. Those files are:
uclinux-dist/lib/ffmpeg/ffmpeg-svn-11114/libavcodec/bfin/fdct_bfin.S & config_bfin.h
I copied these two files into my libjpeg directory (uclinux-dist/lib/libjpeg/) and am currently trying to hack the libjpeg Makefile to have it build the fdct_bfin.S file. I've copied my edited Makefile below (my edits are in red). When I run make, I get the following response:
<snip>
make[2]: Entering directory `/home/frank/blackfin-sources/branch-2008R1/uclinux-dist/lib'
make -C libg
make -C libjpeg
make[3]: Entering directory `/home/frank/blackfin-sources/branch-2008R1/uclinux-dist/lib/libg'
for i in gtermcap ; do make -C $i || exit gtermcap ; done
make[4]: Entering directory `/home/frank/blackfin-sources/branch-2008R1/uclinux-dist/lib/libg/gtermcap'
make[4]: warning: jobserver unavailable: using -j1. Add `+' to parent make rule.
#@rm -f termcap.o tparam.o
make[3]: Entering directory `/home/frank/blackfin-sources/branch-2008R1/uclinux-dist/lib/libjpeg'
rm -f libjpeg.a
make[4]: Leaving directory `/home/frank/blackfin-sources/branch-2008R1/uclinux-dist/lib/libg/gtermcap'
make[3]: Leaving directory `/home/frank/blackfin-sources/branch-2008R1/uclinux-dist/lib/libg'
make -C zlib
make[3]: *** No rule to make target `fdct_bfin.pic.o', needed by `libjpeg.so'. Stop.
<snip>
I'm sure this is a perfectly reasonable response to some foolish makefile slashing on my part, however I've been fiddling with this for a while now, and the solution is not obvious to me. It seems I'm not very good with makefiles. Any help or suggestions would be appreciated. Thanks a lot.
# Generated automatically from makefile.cfg by configure.
# Makefile for Independent JPEG Group's software
# makefile.cfg is edited by configure to produce a custom Makefile.
# Read installation instructions before saying "make" !!
# For compiling with source and object files in different directories.
srcdir = .
# Where to install the programs and man pages.
prefix = /usr/local
exec_prefix = ${prefix}
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
includedir = $(prefix)/include
binprefix =
manprefix =
manext = 1
mandir = $(prefix)/man/man$(manext)
# The name of your C compiler:
#CC= gcc
# You may need to adjust these cc options:
CFLAGS += -I$(srcdir)
# Generally, we recommend defining any configuration symbols in jconfig.h,
# NOT via -D switches here.
# However, any special defines for ansi2knr.c may be included here:
ANSI2KNRFLAGS=
# Link-time cc options:
LDFLAGS=
# To link any special libraries, add the necessary -l commands here.
LDLIBS=
# If using GNU libtool, LIBTOOL references it; if not, LIBTOOL is empty.
LIBTOOL =
# $(O) expands to "lo" if using libtool, plain "o" if not.
# Similarly, $(A) expands to "la" or "a".
O = o
A = a
# Library version ID; libtool uses this for the shared library version number.
# Note: we suggest this match the macro of the same name in jpeglib.h.
JPEG_LIB_VERSION = 62
# Put here the object file name for the correct system-dependent memory
# manager file. For Unix this is usually jmemnobs.o, but you may want
# to use jmemansi.o or jmemname.o if you have limited swap space.
SYSDEPMEM= jmemnobs.$(O)
# miscellaneous OS-dependent stuff
SHELL= /bin/sh
# linker
#LN= $(CC)
# file deletion command
RM= rm -f
# directory creation command
MKDIR= mkdir
# library (.a) file creation command
MYAR= $(AR) rc
# second step in .a creation (use "touch" if not needed)
#AR2= ranlib
MYAR2 = $(RANLIB)
# installation program
INSTALL= /usr/bin/install -c
INSTALL_PROGRAM= ${INSTALL}
INSTALL_LIB= ${INSTALL} -m 644
INSTALL_DATA= ${INSTALL} -m 644
# End of configurable options.
# source files: JPEG library proper
LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \
jquant2.c jutils.c jmemmgr.c fdct_bfin.S
# memmgr back ends: compile only one of these into a working library
SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
# source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom
APPSOURCES= cjpeg.c djpeg.c jpegtran.c rdjpgcom.c wrjpgcom.c cdjpeg.c \
rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \
rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c
SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES)
# files included by source files
INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h config_bfin.h
# documentation, test, and support files
DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \
coderules.doc filelist.doc change.log
MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \
makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \
makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \
maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \
makvms.opt
CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
jconfig.vms
CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh
OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm
TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \
testimgp.jpg
DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \
$(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES)
# library object files common to compression and decompression
COMOBJECTS= jcomapi.$(O) jutils.$(O) jerror.$(O) jmemmgr.$(O) $(SYSDEPMEM)
# compression library object files
CLIBOBJECTS= jcapimin.$(O) jcapistd.$(O) jctrans.$(O) jcparam.$(O) \
jdatadst.$(O) jcinit.$(O) jcmaster.$(O) jcmarker.$(O) jcmainct.$(O) \
jcprepct.$(O) jccoefct.$(O) jccolor.$(O) jcsample.$(O) jchuff.$(O) \
jcphuff.$(O) jcdctmgr.$(O) jfdctfst.$(O) jfdctflt.$(O) \
jfdctint.$(O) fdct_bfin.$(O)
# decompression library object files
DLIBOBJECTS= jdapimin.$(O) jdapistd.$(O) jdtrans.$(O) jdatasrc.$(O) \
jdmaster.$(O) jdinput.$(O) jdmarker.$(O) jdhuff.$(O) jdphuff.$(O) \
jdmainct.$(O) jdcoefct.$(O) jdpostct.$(O) jddctmgr.$(O) \
jidctfst.$(O) jidctflt.$(O) jidctint.$(O) jidctred.$(O) \
jdsample.$(O) jdcolor.$(O) jquant1.$(O) jquant2.$(O) jdmerge.$(O)
# These objectfiles are included in libjpeg.a
LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
# object files for sample applications (excluding library files)
COBJECTS= cjpeg.$(O) rdppm.$(O) rdgif.$(O) rdtarga.$(O) rdrle.$(O) \
rdbmp.$(O) rdswitch.$(O) cdjpeg.$(O)
DOBJECTS= djpeg.$(O) wrppm.$(O) wrgif.$(O) wrtarga.$(O) wrrle.$(O) \
wrbmp.$(O) rdcolmap.$(O) cdjpeg.$(O)
TROBJECTS= jpegtran.$(O) rdswitch.$(O) cdjpeg.$(O) transupp.$(O)
OBJSDLL = $(LIBOBJECTS:.o=.pic.o)
#all: libjpeg.$(A) cjpeg djpeg jpegtran rdjpgcom wrjpgcom
ifeq ($(CONFIG_FMT_USE_FDPIC_ELF),y)
all: libjpeg.$(A) libjpeg.so
install -d $(STAGEDIR)/usr/lib
install -d $(STAGEDIR)/usr/include
install -m0644 libjpeg.$(A) $(STAGEDIR)/usr/lib
install -m0755 libjpeg.so $(STAGEDIR)/usr/lib/libjpeg.so.62
ln -sf libjpeg.so.62 $(STAGEDIR)/usr/lib/libjpeg.so
install -m0644 jpeglib.h $(STAGEDIR)/usr/include
install -m0644 jconfig.h $(STAGEDIR)/usr/include
install -m0644 jmorecfg.h $(STAGEDIR)/usr/include
install -m0644 jerror.h $(STAGEDIR)/usr/include
else
all: libjpeg.$(A)
install -d $(STAGEDIR)/usr/lib
install -d $(STAGEDIR)/usr/include
install -m0644 libjpeg.$(A) $(STAGEDIR)/usr/lib
install -m0644 jpeglib.h $(STAGEDIR)/usr/include
install -m0644 jconfig.h $(STAGEDIR)/usr/include
install -m0644 jmorecfg.h $(STAGEDIR)/usr/include
install -m0644 jerror.h $(STAGEDIR)/usr/include
endif
# Special compilation rules to support ansi2knr and libtool.
.SUFFIXES: .lo .la .c .S .o .pic.o
.c.pic.o:
$(CC) -c $(CFLAGS) -o $@ $*.c
# How to compile with libtool.
# .c.lo:
# $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/$*.c
# How to use ansi2knr, when not using libtool.
# .c.o:
# ./ansi2knr $(srcdir)/$*.c knr/$*.c
# $(CC) $(CFLAGS) -c knr/$*.c
# $(RM) knr/$*.c
# How to use ansi2knr AND libtool.
# .c.lo:
# ./ansi2knr $(srcdir)/$*.c knr/$*.c
# $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c knr/$*.c
# $(RM) knr/$*.c
ansi2knr: ansi2knr.c
$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr $(srcdir)/ansi2knr.c
$(MKDIR) knr
# the library:
# without libtool:
libjpeg.a: $(LIBOBJECTS)
$(RM) libjpeg.a
$(MYAR) libjpeg.a $(LIBOBJECTS)
$(MYAR2) libjpeg.a
# with libtool:
libjpeg.la: $(LIBOBJECTS)
$(LIBTOOL) --mode=link $(CC) -o libjpeg.la $(LIBOBJECTS) \
-rpath $(libdir) -version-info $(JPEG_LIB_VERSION)
# libjpeg.so
ifeq ($(CONFIG_FMT_USE_FDPIC_ELF),y)
libjpeg.so: $(OBJSDLL)
$(CC) $(CFLAGS) -shared -Wl,-soname,libjpeg.so.62 -o libjpeg.so \
$(OBJSDLL) -lm -lc
endif
# sample programs:
cjpeg: $(COBJECTS) libjpeg.$(A)
$(LN) $(LDFLAGS) -o cjpeg $(COBJECTS) libjpeg.$(A) $(LDLIBS)
djpeg: $(DOBJECTS) libjpeg.$(A)
$(LN) $(LDFLAGS) -o djpeg $(DOBJECTS) libjpeg.$(A) $(LDLIBS)
jpegtran: $(TROBJECTS) libjpeg.$(A)
$(LN) $(LDFLAGS) -o jpegtran $(TROBJECTS) libjpeg.$(A) $(LDLIBS)
rdjpgcom: rdjpgcom.$(O)
$(LN) $(LDFLAGS) -o rdjpgcom rdjpgcom.$(O) $(LDLIBS)
wrjpgcom: wrjpgcom.$(O)
$(LN) $(LDFLAGS) -o wrjpgcom wrjpgcom.$(O) $(LDLIBS)
# Installation rules:
install: cjpeg djpeg jpegtran rdjpgcom wrjpgcom
$(INSTALL_PROGRAM) cjpeg $(bindir)/$(binprefix)cjpeg
$(INSTALL_PROGRAM) djpeg $(bindir)/$(binprefix)djpeg
$(INSTALL_PROGRAM) jpegtran $(bindir)/$(binprefix)jpegtran
$(INSTALL_PROGRAM) rdjpgcom $(bindir)/$(binprefix)rdjpgcom
$(INSTALL_PROGRAM) wrjpgcom $(bindir)/$(binprefix)wrjpgcom
$(INSTALL_DATA) $(srcdir)/cjpeg.1 $(mandir)/$(manprefix)cjpeg.$(manext)
$(INSTALL_DATA) $(srcdir)/djpeg.1 $(mandir)/$(manprefix)djpeg.$(manext)
$(INSTALL_DATA) $(srcdir)/jpegtran.1 $(mandir)/$(manprefix)jpegtran.$(manext)
$(INSTALL_DATA) $(srcdir)/rdjpgcom.1 $(mandir)/$(manprefix)rdjpgcom.$(manext)
$(INSTALL_DATA) $(srcdir)/wrjpgcom.1 $(mandir)/$(manprefix)wrjpgcom.$(manext)
install-lib: libjpeg.$(A) install-headers
$(INSTALL_LIB) libjpeg.$(A) $(libdir)/$(binprefix)libjpeg.$(A)
install-headers: jconfig.h
$(INSTALL_DATA) jconfig.h $(includedir)/jconfig.h
$(INSTALL_DATA) $(srcdir)/jpeglib.h $(includedir)/jpeglib.h
$(INSTALL_DATA) $(srcdir)/jmorecfg.h $(includedir)/jmorecfg.h
$(INSTALL_DATA) $(srcdir)/jerror.h $(includedir)/jerror.h
romfs:
if [ "$(CONFIG_FMT_USE_FDPIC_ELF)" = "y" ]; then \
$(ROMFSINST) libjpeg.so /lib/libjpeg.so.62 ; \
fi
clean:
-$(RM) *.o *.lo libjpeg.a libjpeg.la *.so
-$(RM) cjpeg djpeg jpegtran rdjpgcom wrjpgcom
-$(RM) ansi2knr core testout* config.log config.status
-$(RM) -r knr .libs _libs
distclean: clean
$(RM) Makefile jconfig.h libtool config.cache
test: cjpeg djpeg jpegtran
$(RM) testout*
./djpeg -dct int -ppm -outfile testout.ppm $(srcdir)/testorig.jpg
./djpeg -dct int -bmp -colors 256 -outfile testout.bmp $(srcdir)/testorig.jpg
./cjpeg -dct int -outfile testout.jpg $(srcdir)/testimg.ppm
./djpeg -dct int -ppm -outfile testoutp.ppm $(srcdir)/testprog.jpg
./cjpeg -dct int -progressive -opt -outfile testoutp.jpg $(srcdir)/testimg.ppm
./jpegtran -outfile testoutt.jpg $(srcdir)/testprog.jpg
cmp $(srcdir)/testimg.ppm testout.ppm
cmp $(srcdir)/testimg.bmp testout.bmp
cmp $(srcdir)/testimg.jpg testout.jpg
cmp $(srcdir)/testimg.ppm testoutp.ppm
cmp $(srcdir)/testimgp.jpg testoutp.jpg
cmp $(srcdir)/testorig.jpg testoutt.jpg
check: test
# Mistake catcher:
jconfig.h: jconfig.doc
echo You must prepare a system-dependent jconfig.h file.
echo Please read the installation directions in install.doc.
exit 1
# GNU Make likes to know which target names are not really files to be made:
.PHONY: all install install-lib install-headers clean distclean test check
jcapimin.$(O): jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcapistd.$(O): jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jccoefct.$(O): jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jccolor.$(O): jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcdctmgr.$(O): jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jchuff.$(O): jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
jcinit.$(O): jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcmainct.$(O): jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcmarker.$(O): jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcmaster.$(O): jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcomapi.$(O): jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcparam.$(O): jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcphuff.$(O): jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
jcprepct.$(O): jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcsample.$(O): jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jctrans.$(O): jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdapimin.$(O): jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdapistd.$(O): jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdatadst.$(O): jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
jdatasrc.$(O): jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
jdcoefct.$(O): jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdcolor.$(O): jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jddctmgr.$(O): jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jdhuff.$(O): jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
jdinput.$(O): jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdmainct.$(O): jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdmarker.$(O): jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdmaster.$(O): jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdmerge.$(O): jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdphuff.$(O): jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
jdpostct.$(O): jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdsample.$(O): jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdtrans.$(O): jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jerror.$(O): jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
jfdctflt.$(O): jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jfdctfst.$(O): jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
fdct_bfin.$(O): fdct_bfin.S config_bfin.h
jfdctint.$(O): jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jidctflt.$(O): jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jidctfst.$(O): jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jidctint.$(O): jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jidctred.$(O): jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jquant1.$(O): jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jquant2.$(O): jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jutils.$(O): jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jmemmgr.$(O): jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemansi.$(O): jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemname.$(O): jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemnobs.$(O): jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemdos.$(O): jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemmac.$(O): jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
cjpeg.$(O): cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
djpeg.$(O): djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
jpegtran.$(O): jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h
rdjpgcom.$(O): rdjpgcom.c jinclude.h jconfig.h
wrjpgcom.$(O): wrjpgcom.c jinclude.h jconfig.h
cdjpeg.$(O): cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdcolmap.$(O): rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdswitch.$(O): rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
transupp.$(O): transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h
rdppm.$(O): rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrppm.$(O): wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdgif.$(O): rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrgif.$(O): wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdtarga.$(O): rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrtarga.$(O): wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdbmp.$(O): rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrbmp.$(O): wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdrle.$(O): rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrrle.$(O): wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
QuoteReplyEditDelete
2008-04-24 00:17:16 Re: Adding fdct_bfin.s to libjpeg (a makefile question)
Mike Frysinger (UNITED STATES)
Message: 54819 you declared a dependency, but you didnt declare the actual rule to compile the code
<target>: <dependency>
<tab><command to generate target>
QuoteReplyEditDelete
2008-04-24 14:32:00 Re: Adding fdct_bfin.s to libjpeg (a makefile question)
Frank Van Hooft (CANADA)
Message: 54885 I'm sorry Mike, I'm still confused. I understand what you're saying (I think :-) but I still don't see where the problem is.
I declared fdct_bfin.$(O) as part of CLIBOBJECTS
Then CLIBOBJECTS becomes part of LIBOBJECTS which is followed by:
OBJSDLL = $(LIBOBJECTS:.o=.pic.o)
Is this the line that's then causing me the grief:
.c.pic.o:
$(CC) -c $(CFLAGS) -o $@ $*.c
? It's unable to handle a .S file? Or am I completely off base here?
Thanks a lot.
QuoteReplyEditDelete
2008-04-24 15:41:32 Re: Adding fdct_bfin.s to libjpeg (a makefile question)
Mike Frysinger (UNITED STATES)
Message: 54890 the implicit rule defined is:
.c.pic.o
that tells make that the rule can be used to generate a .pic.o file from a .c file. since there is no fdct_bfin.c file, that implicit rule does not apply. you'll have to either create your own new implicit rule or just create explicit rules for the fdct_bfin objects.
QuoteReplyEditDelete
2008-04-25 00:24:00 Re: Adding fdct_bfin.s to libjpeg (a makefile question)
Frank Van Hooft (CANADA)
Message: 54919 Thanks Mike; it's building to completion. Now to see if it even works.
QuoteReplyEditDelete
2008-04-25 13:50:54 Re: Adding fdct_bfin.s to libjpeg (a makefile question)
Frank Van Hooft (CANADA)
Message: 54960 It doesn't work. The code runs, but produces the wrong output data. In case anyone else (who's got some assembly language skills) wants to pick this up in the future, I'll briefly describe what I found. The assembly code in ffmpeg (fdct_bfin.S) uses Chen's DCT algorithm. The C code in libjpeg (jfdctint.c) uses Loeffler's DCT algorithm. Although very similar, these two algorithms output their results data in different orders, and with different scalings. I've attached a document where Figure 1 shows the two algorithm diagrams side-by-side; you can clearly see the difference.
I also looked at modifying the libjpeg code (jchuff.c) to accept the Chen DCT's output instead of the current Loeffler's; this appeared much less simple than modifying the well-documented DCT algorithm.
In short, I think the best bet is to take the fdct_bfin.S assembly code & modify it to implement the Loeffler algorithm, as shown in the attached doc and as already implemented in C in jfdctint.c. This would require some blackfin assembly language skill, which definitely is not me; looks like we're back to using ffmpeg. Ah well.
binDCT.pdf
QuoteReplyEditDelete
2008-04-27 19:04:59 Re: Adding fdct_bfin.s to libjpeg (a makefile question)
Robin Getz (UNITED STATES)
Message: 55065 Frank:
What is the performance difference between ffpmeg (optimized assembly) & libjpg(all C)?
-Robin
QuoteReplyEditDelete
2008-04-28 12:07:49 Re: Adding fdct_bfin.s to libjpeg (a makefile question)
Frank Van Hooft (CANADA)
Message: 55159 Hi Robin,
It's somewhere around 3 times the performance.
I'm jpeg'ing RGB24 images from a CMOS sensor of resolution 752 x 512. Using libjpeg I've benchmarked it running at 2.4 frames/sec. Using ffmpeg I've done 6 frames/sec; ffmpeg may well go faster; it's sometimes difficult to know.
One thing I have noticed with ffmpeg is that if it can't keep up it'll start to "cheat" by duplicating frames to maintain the framerate. This cheating can make benchmarking a little misleading. However when you're creating jpegs this cheating is fairly easy to spot because you'll start seeing sequential jpeg files with identical filesizes. I've seen ffmpeg run at 6 frames/sec without cheating, so I know it can do that. That would make ffmpeg 2.5 times the speed of libjpeg. I suspect the real speed difference is significantly greater than that, because our image capture driver contains bayer interpolation code which doesn't run terribly fast; I've not benchmarked that.
Both libjpeg & ffmpeg have options to control the resulting image quality / filesize. In my experimenting I've found that libjpeg seems to produce a better image quality for a given filesize (or alternatively a smaller filesize for a given image quality). I guess this shouldn't be a surprise given that libjpeg is the reference standard for jpeg, still it's interesting to see.
Frank.
QuoteReplyEditDelete
2008-04-29 10:30:35 Re: Adding fdct_bfin.s to libjpeg (a makefile question)
Robin Getz (UNITED STATES)
Message: 55228 Frank:
Thanks for the info - I'll borrow/find someone who is willing to help with this.
-Robin
QuoteReplyEditDelete
2008-04-29 17:36:33 Re: Adding fdct_bfin.s to libjpeg (a makefile question)
Frank Van Hooft (CANADA)
Message: 55245 Thank *you* Robin.
QuoteReplyEditDelete
2008-04-30 00:47:46 Re: Adding fdct_bfin.s to libjpeg (a makefile question)
Robin Getz (UNITED STATES)
Message: 55269 Frank:
Don't thanks me until I con^Hconvince someone to do the work
-Robin