summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-02-07 11:59:40 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-02-07 11:59:40 +0100
commitcb1c3828de71185f02b21a69150f968d64412cc5 (patch)
tree383bbff3b0da9b627d11d55ba3880cbe12463b6d
parente0cb4500dd05050e60414b7bb25d91f392435437 (diff)
parent1d259b115c302a23c6e2ccfe96b88e5135d033e7 (diff)
Merge branch 'master' into devel
Conflicts: Makefile.am configure.ac plugins/ffmpeg/ffmpeg.c plugins/gtkui/gtkui.c streamer.c
-rw-r--r--AUTHORS4
-rw-r--r--ChangeLog20
-rw-r--r--Makefile.am28
-rw-r--r--PKGBUILD8
-rw-r--r--README3
-rw-r--r--configure.ac27
-rw-r--r--main.c1
-rw-r--r--playlist.c29
-rw-r--r--plugins/alsa/alsa.c76
-rw-r--r--plugins/ape/Makefile.am7
-rw-r--r--plugins/ape/ape.c259
-rw-r--r--plugins/ape/apewrapper.cpp77
-rw-r--r--plugins/ape/apewrapper.h139
-rw-r--r--plugins/demac/Makefile.am33
-rw-r--r--plugins/demac/demac.c656
-rw-r--r--plugins/demac/libdemac/SOURCES15
-rw-r--r--plugins/demac/libdemac/crc.c120
-rw-r--r--plugins/demac/libdemac/decoder.c192
-rw-r--r--plugins/demac/libdemac/decoder.h40
-rw-r--r--plugins/demac/libdemac/demac.h45
-rw-r--r--plugins/demac/libdemac/demac_config.h112
-rw-r--r--plugins/demac/libdemac/entropy.c464
-rw-r--r--plugins/demac/libdemac/entropy.h40
-rw-r--r--plugins/demac/libdemac/filter.c252
-rw-r--r--plugins/demac/libdemac/filter.h50
-rw-r--r--plugins/demac/libdemac/filter_1280_15.c27
-rw-r--r--plugins/demac/libdemac/filter_16_11.c27
-rw-r--r--plugins/demac/libdemac/filter_256_13.c27
-rw-r--r--plugins/demac/libdemac/filter_32_10.c27
-rw-r--r--plugins/demac/libdemac/filter_64_11.c27
-rw-r--r--plugins/demac/libdemac/parser.c402
-rw-r--r--plugins/demac/libdemac/parser.h137
-rw-r--r--plugins/demac/libdemac/predictor-arm.S694
-rw-r--r--plugins/demac/libdemac/predictor-cf.S659
-rw-r--r--plugins/demac/libdemac/predictor.c271
-rw-r--r--plugins/demac/libdemac/predictor.h38
-rw-r--r--plugins/demac/libdemac/vector_math16_armv5te.h312
-rw-r--r--plugins/demac/libdemac/vector_math16_armv6.h289
-rw-r--r--plugins/demac/libdemac/vector_math16_cf.h326
-rw-r--r--plugins/demac/libdemac/vector_math32_armv4.h205
-rw-r--r--plugins/demac/libdemac/vector_math_generic.h160
-rw-r--r--plugins/ffmpeg/ffmpeg.c2
-rw-r--r--plugins/gtkui/Makefile.am4
-rw-r--r--plugins/gtkui/callbacks.c6
-rw-r--r--plugins/gtkui/gtkplaylist.c40
-rw-r--r--plugins/gtkui/gtkui.c53
-rw-r--r--plugins/gtkui/gtkui.h4
-rw-r--r--plugins/gtkui/pluginconf.c11
-rw-r--r--plugins/lastfm/lastfm.c4
-rw-r--r--plugins/notification/Makefile.am5
-rw-r--r--plugins/notification/notification.c63
-rw-r--r--plugins/vfs_curl/vfs_curl.c4
-rw-r--r--web/faq.txt9
-rw-r--r--web/index.html380
-rw-r--r--web/oldnews.html308
55 files changed, 573 insertions, 6645 deletions
diff --git a/AUTHORS b/AUTHORS
index 03f6c24d..0aac4c41 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,3 +1,3 @@
code: Alexey Yakovenko <waker@users.sourceforge.net>
-button images: Stas "uncle lag" Akimushkin <uncle.lag@gmail.com>
-hotkeys plugin: Viktor Semykin <thesame.ml@gmail.com>
+icon: Stas "uncle lag" Akimushkin <uncle.lag@gmail.com>
+hotkeys, cdda plugins: Viktor Semykin <thesame.ml@gmail.com>
diff --git a/ChangeLog b/ChangeLog
index 95207794..fdd41ad5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+version 0.3.3
+ fixed "unknown response" in command line
+ fixed winkey in global hotkeys plugin
+ fixed crash in id3v1 parser
+ fixed crash in mp3 plugin
+ fixed few bugs/problems in ALSA plugin (now works on wider range of soundcards)
+ fixed playback of multichannel FLAC files
+ fixed 24 bit wavpack playback
+ fixed duration calculation and seeking bugs in mp3 plugin
+ added support for older versions of ffmpeg
+ added OSS(3,4) support
+ experimental FreeBSD support
+ experimental OpenSolaris support
+ improved GUI dialogs
+ added new "File Number" column type
+ added new "File Name" custom column conversion
+ added option to disable nowplaying notifications in lastfm plugin
+ added support for icy metadata (title in shoutcast streams)
+ added experimental (optional) support for notifications using libnotify
+
version 0.3.2
all GTK+ UI code is now in plugin
improved main menu layout in GTK UI
diff --git a/Makefile.am b/Makefile.am
index 5b5fe6ea..1f2df71e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,11 +3,12 @@ SUBDIRS = ${MPGMAD_DIR}\
gme/Game_Music_Emu-0.5.2/gme\
pixmaps\
icons\
- plugins/hotkeys\
plugins/nullout\
plugins/sid\
plugins/ffap\
- plugins/notification\
+ plugins/vtx\
+ plugins/adplug\
+ ${HOTKEYS_DIR}\
${ALSA_DIR}\
${LFM_DIR}\
${VFS_CURL_DIR}\
@@ -17,32 +18,9 @@ SUBDIRS = ${MPGMAD_DIR}\
${FLAC_DIR}\
${SNDFILE_DIR}\
${WAVPACK_DIR}\
- plugins/vtx\
- plugins/adplug\
${CDDA_DIR}\
${OSS_DIR}
-#SUBDIRS = gme/Game_Music_Emu-0.5.2\
-# sid/sidplay-libs-2.1.0\
-# dumb\
-# pixmaps\
-# icons\
-# plugins/hotkeys\
-# plugins/nullout\
-# plugins/vtx\
-# plugins/adplug\
-# ${ALSA_DIR}\
-# ${LFM_DIR}\
-# ${MPGMAD_DIR}\
-# ${VORBIS_DIR}\
-# ${FLAC_DIR}\
-# ${WAVPACK_DIR}\
-# ${SNDFILE_DIR}\
-# ${VFS_CURL_DIR}\
-# ${CDDA_DIR}\
-# ${GTKUI_DIR}\
-# ${FFMPEG_DIR}
-
dumbpath=@top_srcdir@/dumb
gmepath=@top_srcdir@/gme/Game_Music_Emu-0.5.2
diff --git a/PKGBUILD b/PKGBUILD
index cdca004c..8f008ec0 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,18 +1,18 @@
# Maintainer: Alexey Yakovenko <waker@users.sourceforge.net>
pkgname=deadbeef
-pkgver=0.3.2
+pkgver=0.3.3
pkgrel=1
pkgdesc="mp3/ogg/flac/ape/sid/mod/nsf/m4a/mpc/shn music player based on GTK2"
arch=(i686 x86_64)
url="http://deadbeef.sourceforge.net"
license=('GPL2')
-makedepends=('gtk2', 'libsamplerate', 'libvorbis', 'libmad', 'flac', 'curl', 'alsa-lib', 'wavpack', 'libsndfile', 'libcdio', 'ffmpeg')
+makedepends=('gtk2', 'libsamplerate', 'libvorbis', 'libmad', 'flac', 'curl', 'alsa-lib', 'wavpack', 'libsndfile', 'libcdio', 'libcddb', 'ffmpeg')
depends=('gtk2' 'libsamplerate' 'alsa-lib')
-optdepends=('libvorbis: ogg vorbis playback', 'libmad: mp1/2/3 playback', 'flac: flac playback', 'curl: lastfm scrobbler, shoutcast, icecast, podcast support', 'wavpack: wv playback', 'libsndfile: wav playback', "libcdio: audio cd playback", "ffmpeg: for aac, mpc, shn, aa3, oma, ac3, etc")
+optdepends=('libvorbis: ogg vorbis playback', 'libmad: mp1/2/3 playback', 'flac: flac playback', 'curl: lastfm scrobbler, shoutcast, icecast, podcast support', 'wavpack: wv playback', 'libsndfile: wav playback', "libcdio and libcddb: audio cd playback", "ffmpeg: for aac, mpc, shn, aa3, oma, ac3, etc")
makedepends=('pkgconfig')
source=(http://downloads.sourceforge.net/project/$pkgname/$pkgname-$pkgver.tar.gz)
-md5sums=('85a9a63dd507dec5b3070551107aaf17')
+md5sums=('5f6a00dd18cd27f488f0660ce675182a')
build() {
cd $srcdir/$pkgname-$pkgver
diff --git a/README b/README
index 911ba2bd..b76dd10d 100644
--- a/README
+++ b/README
@@ -10,8 +10,9 @@ optional/build dependencies
libFLAC: for flac plugin
wavpack: for wavpack plugin
libsndfile: for sndfile plugin
- libcdio: for cd audio plugin
+ libcdio + libcddb: for cd audio plugin
ffmpeg: for ffmpeg plugin
+ xlib: for global hotkeys
if you want to build from git - install autotools, and run autoreconf
diff --git a/configure.ac b/configure.ac
index 2d697e5a..9af176be 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,8 +48,18 @@ PKG_CHECK_MODULES(DEPS, samplerate)
PKG_CHECK_MODULES(GTKUI_DEPS, gtk+-2.0 >= 2.12 gthread-2.0 glib-2.0, HAVE_GTK=1, NO_GTK=1)
PKG_CHECK_MODULES(ALSA_DEPS, alsa, HAVE_ALSA=1, NO_ALSA=1)
PKG_CHECK_MODULES(FFMPEG_DEPS, libavcodec >= 51.0.0 libavutil libavformat >= 52.0.0, HAVE_FFMPEG=1, NO_FFMPEG=1)
+
+AC_ARG_ENABLE(libnotify, [ --enable-libnotify Enable support for OSD notifications], [libnotify=yes])
+
+if test "x${libnotify}" = "xyes" ; then
+PKG_CHECK_MODULES(NOTIFY_DEPS, libnotify >= 0.4.4, HAVE_NOTIFY=1, NO_NOTIFY=1)
+fi
+
AC_CHECK_LIB([pthread], [main])
AC_CHECK_LIB([dl], [main])
+
+AC_CHECK_HEADER([iconv.h],[],[iconv.h not found.])
+
AC_CHECK_LIB([iconv], [main], [have_iconv=yes], [have_iconv=no])
if test "x${have_iconv}" = "xyes" ; then
ICONV_LIB="-liconv"
@@ -185,6 +195,19 @@ if test ${HAVE_FFMPEG}; then
AC_SUBST(FFMPEG_DIR)
fi
+AM_CONDITIONAL(HAVE_NOTIFY, test $HAVE_NOTIFY)
+if test ${HAVE_NOTIFY}; then
+ AC_DEFINE(HAVE_NOTIFY,1,[Use libnotify])
+ AC_SUBST(NOTIFY_DEPS_CFLAGS)
+ AC_SUBST(NOTIFY_DEPS_LIBS)
+fi
+
+AC_CHECK_HEADER([X11/Xlib.h], HAVE_XLIB_H=yes)
+if test "x$HAVE_XLIB_H" = "xyes"; then
+ HOTKEYS_DIR="plugins/hotkeys"
+ AC_SUBST(HOTKEYS_DIR)
+fi
+
dnl *** OSS output (partly stolen from audacious)
have_oss=no
@@ -265,8 +288,9 @@ PRINT_PLUGIN_INFO([vfs_curl],[http/ftp streaming support],[test $HAVE_CURL])
dnl PRINT_PLUGIN_INFO([faad2],[aac/mp4 player],[test $HAVE_FAAD && test $HAVE_MP4FF])
PRINT_PLUGIN_INFO([cdda],[cd audio player],[test $HAVE_CDIO && test $HAVE_CDDB])
PRINT_PLUGIN_INFO([gtkui],[GTK user interface],[test $HAVE_GTK])
+PRINT_PLUGIN_INFO([hotkeys],[Global hotkeys support],[test "x$HAVE_XLIB_H" = "xyes"])
+PRINT_PLUGIN_INFO([libnotify],[Current track notification],[test $HAVE_NOTIFY])
PRINT_PLUGIN_INFO([ffmpeg],[ffmpeg codecs],[test $HAVE_FFMPEG])
-PRINT_PLUGIN_INFO([notification],[Current track notification],[true])
PRINT_PLUGIN_INFO([oss],[oss output plugin],[test "x$have_oss" = "xyes"])
echo
@@ -295,7 +319,6 @@ plugins/vtx/Makefile
plugins/adplug/Makefile
plugins/ffmpeg/Makefile
plugins/sid/Makefile
-plugins/notification/Makefile
plugins/oss/Makefile
deadbeef.desktop
])
diff --git a/main.c b/main.c
index d555a291..0e86a29d 100644
--- a/main.c
+++ b/main.c
@@ -419,6 +419,7 @@ sigterm_handler (int sig) {
int
main (int argc, char *argv[]) {
+ fprintf (stderr, "starting deadbeef " VERSION "\n");
srand (time (NULL));
#ifdef __linux__
prctl (PR_SET_NAME, "deadbeef-main", 0, 0, 0, 0);
diff --git a/playlist.c b/playlist.c
index 6ac561bc..ac8e31c1 100644
--- a/playlist.c
+++ b/playlist.c
@@ -377,8 +377,8 @@ pl_insert_cue_from_buffer (playItem_t *after, playItem_t *origin, const uint8_t
p++;
}
if (p-buffer > 2048) { // huge string, ignore
- buffer = p;
buffersize -= p-buffer;
+ buffer = p;
continue;
}
char str[p-buffer+1];
@@ -1821,30 +1821,25 @@ pl_sort (int iter, int id, const char *format, int ascending) {
if (!next) {
break;
}
- char title1[1024];
- char title2[1024];
- if (id == DB_COLUMN_TRACK) {
+ int cmp;
+ if (id == DB_COLUMN_DURATION) {
+ cmp = ascending ? next->_duration > it->_duration : it->_duration > next->_duration;
+ }
+ else if (id == DB_COLUMN_TRACK) {
const char *t;
t = pl_find_meta (it, "track");
- if (!t || !isdigit (*t)) {
- strcpy (title1, "-1");
- }
- else {
- snprintf (title1, sizeof (title1), "%03d", atoi (t));
- }
+ int a = t ? atoi (t) : -1;
t = pl_find_meta (next, "track");
- if (!t || !isdigit (*t)) {
- strcpy (title2, "-1");
- }
- else {
- snprintf (title2, sizeof (title2), "%03d", atoi (t));
- }
+ int b = t ? atoi (t) : -1;
+ cmp = ascending ? b > a : a > b;
}
else {
+ char title1[1024];
+ char title2[1024];
pl_format_title (it, -1, title1, sizeof (title1), id, format);
pl_format_title (next, -1, title2, sizeof (title2), id, format);
+ cmp = ascending ? strcmp (title1, title2) < 0 : strcmp (title1, title2) > 0;
}
- int cmp = ascending ? strcmp (title1, title2) < 0 : strcmp (title1, title2) > 0;
if (cmp) {
// printf ("%p %p swapping %s and %s\n", it, next, meta1, meta2);
sorted = 0;
diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c
index 9e6370e4..2cf8fbef 100644
--- a/plugins/alsa/alsa.c
+++ b/plugins/alsa/alsa.c
@@ -28,6 +28,9 @@
#define min(x,y) ((x)<(y)?(x):(y))
+#define LOCK {deadbeef->mutex_lock (mutex);}
+#define UNLOCK {deadbeef->mutex_unlock (mutex);}
+
static DB_output_t plugin;
DB_functions_t *deadbeef;
@@ -284,8 +287,6 @@ palsa_init (void) {
goto open_error;
}
- snd_pcm_start (audio);
-
alsa_terminate = 0;
alsa_tid = deadbeef->thread_start (palsa_thread, NULL);
@@ -314,10 +315,10 @@ palsa_change_rate (int rate) {
return rate;
}
state = OUTPUT_STATE_STOPPED;
+ LOCK;
snd_pcm_drop (audio);
- deadbeef->mutex_lock (mutex);
int ret = palsa_set_hw_params (rate);
- deadbeef->mutex_unlock (mutex);
+ UNLOCK;
if (ret < 0) {
trace ("palsa_change_rate: impossible to set samplerate to %d\n", rate);
return alsa_rate;
@@ -330,10 +331,10 @@ int
palsa_free (void) {
trace ("palsa_free\n");
if (audio && !alsa_terminate) {
- deadbeef->mutex_lock (mutex);
+ LOCK;
alsa_terminate = 1;
- deadbeef->mutex_unlock (mutex);
- printf ("waiting for alsa thread to finish\n");
+ UNLOCK;
+ trace ("waiting for alsa thread to finish\n");
if (alsa_tid) {
deadbeef->thread_join (alsa_tid);
alsa_tid = 0;
@@ -370,7 +371,6 @@ palsa_hw_pause (int pause) {
int
palsa_play (void) {
int err;
- trace ("palsa_play\n");
if (state == OUTPUT_STATE_STOPPED) {
if (!audio) {
if (palsa_init () < 0) {
@@ -387,14 +387,14 @@ palsa_play (void) {
}
}
if (state != OUTPUT_STATE_PLAYING) {
- deadbeef->mutex_lock (mutex);
+ LOCK;
// trace ("alsa: installing async handler\n");
// if (snd_async_add_pcm_handler (&pcm_callback, audio, alsa_callback, NULL) < 0) {
// perror ("snd_async_add_pcm_handler");
// }
// trace ("pcm_callback=%p\n", pcm_callback);
snd_pcm_start (audio);
- deadbeef->mutex_unlock (mutex);
+ UNLOCK;
state = OUTPUT_STATE_PLAYING;
}
return 0;
@@ -407,7 +407,7 @@ palsa_stop (void) {
return 0;
}
state = OUTPUT_STATE_STOPPED;
- deadbeef->mutex_lock (mutex);
+ LOCK;
snd_pcm_drop (audio);
#if 0
if (pcm_callback) {
@@ -415,7 +415,7 @@ palsa_stop (void) {
pcm_callback = NULL;
}
#endif
- deadbeef->mutex_unlock (mutex);
+ UNLOCK;
deadbeef->streamer_reset (1);
if (deadbeef->conf_get_int ("alsa.freeonstop", 0)) {
palsa_free ();
@@ -429,9 +429,9 @@ palsa_pause (void) {
return -1;
}
// set pause state
- deadbeef->mutex_lock (mutex);
+ LOCK;
palsa_hw_pause (1);
- deadbeef->mutex_unlock (mutex);
+ UNLOCK;
state = OUTPUT_STATE_PAUSED;
return 0;
}
@@ -441,9 +441,9 @@ palsa_unpause (void) {
// unset pause state
if (state == OUTPUT_STATE_PAUSED) {
state = OUTPUT_STATE_PLAYING;
- deadbeef->mutex_lock (mutex);
+ LOCK;
palsa_hw_pause (0);
- deadbeef->mutex_unlock (mutex);
+ UNLOCK;
}
return 0;
}
@@ -487,44 +487,32 @@ palsa_thread (void *context) {
usleep (10000);
continue;
}
-
- deadbeef->mutex_lock (mutex);
- if ((err = snd_pcm_wait (audio, 1000)) < 0) {
- if (err == -ESTRPIPE) {
- trace ("alsa: trying to recover from suspend... (error=%d, %s)\n", err, snd_strerror (err));
- deadbeef->sendmessage (M_REINIT_SOUND, 0, 0, 0);
- deadbeef->mutex_unlock (mutex);
- break;
- }
- else if (err == -EPIPE) {
- // this pretty frequent condition, no spam here
-// trace ("alsa: snd_pcm_wait error=%d, %s\n", err, snd_strerror (err));
- snd_pcm_prepare (audio);
- snd_pcm_start (audio);
- deadbeef->mutex_unlock (mutex);
- continue;
- }
- else {
- trace ("alsa: snd_pcm_wait error=%d, %s\n", err, snd_strerror (err));
- deadbeef->mutex_unlock (mutex);
- continue;
- }
- }
+ LOCK;
/* find out how much space is available for playback data */
int written = 0;
snd_pcm_sframes_t frames_to_deliver = snd_pcm_avail_update (audio);
while (frames_to_deliver >= period_size) {
char buf[period_size * 4];
palsa_callback (buf, period_size * 4);
- if ((err = snd_pcm_writei (audio, buf, period_size)) < 0) {
- break;
+ err = snd_pcm_writei (audio, buf, period_size);
+ if (err < 0) {
+ if (err == -ESTRPIPE) {
+ trace ("alsa: trying to recover from suspend... (error=%d, %s)\n", err, snd_strerror (err));
+ deadbeef->sendmessage (M_REINIT_SOUND, 0, 0, 0);
+ break;
+ }
+ else {
+ trace ("alsa: snd_pcm_writei error=%d, %s\n", err, snd_strerror (err));
+ snd_pcm_prepare (audio);
+ snd_pcm_start (audio);
+ continue;
+ }
}
written += period_size;
frames_to_deliver = snd_pcm_avail_update (audio);
}
-// trace ("wrote %d frames\n", written);
- deadbeef->mutex_unlock (mutex);
-// usleep (1000); // this must be here to prevent mutex deadlock
+ UNLOCK;
+ usleep (period_size * 1000000 / alsa_rate / 2);
}
}
diff --git a/plugins/ape/Makefile.am b/plugins/ape/Makefile.am
deleted file mode 100644
index d5678f4f..00000000
--- a/plugins/ape/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-apedir = $(libdir)/$(PACKAGE)
-pkglib_LTLIBRARIES = ape.la
-ape_la_SOURCES = ape.c apewrapper.cpp apewrapper.h
-ape_la_LDFLAGS = -module
-
-ape_la_LIBADD = $(LDADD) $(APE_LIBS)
-AM_CFLAGS = $(CFLAGS) -std=c99 -O0 -g
diff --git a/plugins/ape/ape.c b/plugins/ape/ape.c
deleted file mode 100644
index 9443dfa2..00000000
--- a/plugins/ape/ape.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- apedec - Monkey's Audio Decoder plugin for DeaDBeeF player
- http://deadbeef.sourceforge.net
-
- Copyright (C) 2009 Alexey Yakovenko
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Note: DeaDBeeF player itself uses different license
-*/
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include "../../deadbeef.h"
-#include "apewrapper.h"
-
-#define min(x,y) ((x)<(y)?(x):(y))
-#define max(x,y) ((x)>(y)?(x):(y))
-
-static DB_decoder_t plugin;
-static DB_functions_t *deadbeef;
-
-static void *ape_dec;
-static int ape_blk_size;
-
-#define READBUF_SIZE 0x20000
-
-static char ape_readbuf[READBUF_SIZE];
-static int ape_blocks_left;
-static int ape_total_blocks;
-static float timestart;
-static float timeend;
-static int samplesdecoded;
-
-// precalc for bps conversion
-static int32_t mask;
-static float scaler;
-static int32_t neg;
-static int32_t sign;
-static int32_t signshift;
-
-static int
-ape_seek (float seconds);
-
-static int
-ape_init (DB_playItem_t *it) {
- ape_dec = ape_decompress_create (it->fname);
- if (!ape_dec) {
- printf ("ape_decompress_create failed for file %s\n", it->fname);
- return -1;
- }
- WAVEFORMATEX wfe;
- ape_decompress_get_info_data (ape_dec, APE_INFO_WAVEFORMATEX, &wfe);
- int size = ape_decompress_get_info_int (ape_dec, APE_INFO_WAV_HEADER_BYTES);
- char buf[size];
- ape_decompress_get_info_data_sized (ape_dec, APE_INFO_WAV_HEADER_DATA, buf, size);
- ape_blk_size = ape_decompress_get_info_int (ape_dec, APE_INFO_BLOCK_ALIGN);
- ape_total_blocks = ape_blocks_left = ape_decompress_get_info_int (ape_dec, APE_DECOMPRESS_TOTAL_BLOCKS);
- samplesdecoded = 0;
- plugin.info.bps = wfe.wBitsPerSample;
- plugin.info.samplerate = wfe.nSamplesPerSec;
- plugin.info.channels = wfe.nChannels;
- plugin.info.readpos = 0;
- if (it->timeend > 0) {
- timestart = it->timestart;
- timeend = it->timeend;
- ape_seek (0);
- }
- else {
- timestart = 0;
- timeend = it->duration;
- }
-
- mask = (1<<(plugin.info.bps-1))-1;
- scaler = 1.f / ((1<<(plugin.info.bps-1))-1);
- neg = 1<<plugin.info.bps;
- sign = (1<<31);
- signshift = plugin.info.bps-1;
- return 0;
-}
-
-static void
-ape_free (void) {
- if (ape_dec) {
- ape_decompress_destroy (ape_dec);
- ape_dec = NULL;
- }
-}
-
-static int
-ape_read_int16 (char *buffer, int size) {
- int initsize = size;
- int nblocks = size / plugin.info.channels / 2;
- nblocks = min (nblocks, ape_blocks_left);
- nblocks = ape_decompress_getdata (ape_dec, ape_readbuf, nblocks);
-
- uint8_t *in = ape_readbuf;
- for (int i = 0; i < nblocks*plugin.info.channels; i++) {
- // convert from bps to int32_t
- int32_t sample = 0;
- int shift = 0;
- while (shift < plugin.info.bps - 8) {
- sample |= (*in << shift);
- in++;
- shift += 8;
- }
- sample |= ((char)(*in)) << (plugin.info.bps - 8);
- in++;
-
- // now that's convertable to 16 bit
- *((int16_t*)buffer) = (int16_t)sample;
- buffer += 2;
- }
-
- ape_blocks_left -= nblocks;
- samplesdecoded += nblocks;
- plugin.info.readpos = samplesdecoded / (float)plugin.info.samplerate - timestart;
- if (plugin.info.readpos >= timeend) {
- return 0;
- }
- return nblocks * 2 * plugin.info.channels;
-}
-
-static int
-ape_read_float32 (char *buffer, int size) {
- int initsize = size;
- int nblocks = size / plugin.info.channels / sizeof (float);
- nblocks = min (nblocks, ape_blocks_left);
- nblocks = ape_decompress_getdata (ape_dec, ape_readbuf, nblocks);
-
- uint8_t *in = ape_readbuf;
- for (int i = 0; i < nblocks*plugin.info.channels; i++) {
- // convert from bps to int32_t
- int32_t sample = 0;
- int shift = 0;
- while (shift < plugin.info.bps - 8) {
- sample |= (*in << shift);
- in++;
- shift += 8;
- }
- sample |= ((char)(*in)) << (plugin.info.bps - 8);
- in++;
-
- // now that's convertable to float32
- *((float*)buffer) = (sample - ((sample&sign)>>signshift)*neg) * scaler;
- buffer += sizeof (float);
- }
-
- ape_blocks_left -= nblocks;
- samplesdecoded += nblocks;
- plugin.info.readpos = samplesdecoded / (float)plugin.info.samplerate - timestart;
- if (plugin.info.readpos >= timeend) {
- return 0;
- }
- return nblocks * sizeof (float) * plugin.info.channels;
-}
-
-static int
-ape_seek (float seconds) {
- seconds += timestart;
- int nblock = seconds * plugin.info.samplerate;
- ape_decompress_seek (ape_dec, nblock);
- samplesdecoded = nblock;
- ape_blocks_left = ape_total_blocks - nblock;
- plugin.info.readpos = samplesdecoded / (float)plugin.info.samplerate - timestart;
- return 0;
-}
-
-static DB_playItem_t *
-ape_insert (DB_playItem_t *after, const char *fname) {
- void *dec = ape_decompress_create (fname);
- if (!dec) {
- return NULL;
- }
- WAVEFORMATEX wfe;
- ape_decompress_get_info_data (dec, APE_INFO_WAVEFORMATEX, &wfe);
-
- float duration = ape_decompress_get_info_int (dec, APE_DECOMPRESS_TOTAL_BLOCKS) / (float)wfe.nSamplesPerSec;
- ape_decompress_destroy (dec);
- DB_playItem_t *it;
- it = deadbeef->pl_insert_cue (after, fname, &plugin, "APE", duration);
- if (it) {
- return it;
- }
-
- it = deadbeef->pl_item_alloc ();
- it->decoder = &plugin;
- it->fname = strdup (fname);
- it->filetype = "APE";
- it->duration = duration;
-
- // try to read tags
- FILE *fp = fopen (fname, "rb");
- if (!fp) {
- deadbeef->pl_item_free (it);
- return NULL;
- }
-
- int v2err = deadbeef->junk_read_id3v2 (it, fp);
- int v1err = deadbeef->junk_read_id3v1 (it, fp);
- if (v1err >= 0) {
- fseek (fp, -128, SEEK_END);
- }
- else {
- fseek (fp, 0, SEEK_END);
- }
- int apeerr = deadbeef->junk_read_ape (it, fp);
- deadbeef->pl_add_meta (it, "title", NULL);
- fclose (fp);
-
- after = deadbeef->pl_insert_item (after, it);
-
- return after;
-}
-
-static const char * exts[] = { "ape", NULL };
-static const char *filetypes[] = { "APE", NULL };
-
-// define plugin interface
-static DB_decoder_t plugin = {
- DB_PLUGIN_SET_API_VERSION
- .plugin.version_major = 0,
- .plugin.version_minor = 1,
- .plugin.type = DB_PLUGIN_DECODER,
- .plugin.name = "Monkey's Audio decoder",
- .plugin.author = "Alexey Yakovenko",
- .plugin.email = "waker@users.sourceforge.net",
- .plugin.website = "http://deadbeef.sf.net",
- .init = ape_init,
- .free = ape_free,
- .read_int16 = ape_read_int16,
- .read_float32 = ape_read_float32,
- .seek = ape_seek,
- .insert = ape_insert,
- .exts = exts,
- .id = "stdape",
- .filetypes = filetypes
-};
-
-DB_plugin_t *
-ape_load (DB_functions_t *api) {
- deadbeef = api;
- return DB_PLUGIN (&plugin);
-}
-
diff --git a/plugins/ape/apewrapper.cpp b/plugins/ape/apewrapper.cpp
deleted file mode 100644
index 3e13136c..00000000
--- a/plugins/ape/apewrapper.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- apedec - Monkey's Audio Decoder plugin for DeaDBeeF player
- http://deadbeef.sourceforge.net
-
- Copyright (C) 2009 Alexey Yakovenko
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Note: DeaDBeeF player itself uses different license
-*/
-#include <mac/All.h>
-#include <mac/GlobalFunctions.h>
-#include <mac/MACLib.h>
-#include <mac/CharacterHelper.h>
-#include <mac/APETag.h>
-#include "apewrapper.h"
-
-void *
-ape_decompress_create (const char *fname) {
- int ret;
- CSmartPtr<wchar_t> str;
- str.Assign (GetUTF16FromUTF8 ((const str_utf8 *)fname), TRUE);
- IAPEDecompress *dec = CreateIAPEDecompress(str, &ret);
- return dec;
-}
-
-void
-ape_decompress_destroy (void *d) {
- IAPEDecompress *dec = (IAPEDecompress *)d;
- delete dec;
-}
-
-int
-ape_decompress_get_info_int (void *d, int id) {
- IAPEDecompress *dec = (IAPEDecompress *)d;
- return dec->GetInfo ((APE_DECOMPRESS_FIELDS)id);
-}
-
-int
-ape_decompress_get_info_data (void *d, int id, void *ptr) {
- IAPEDecompress *dec = (IAPEDecompress *)d;
- return dec->GetInfo ((APE_DECOMPRESS_FIELDS)id, (intptr_t)ptr);
-}
-
-int
-ape_decompress_get_info_data_sized (void *d, int id, void *ptr, int size) {
- IAPEDecompress *dec = (IAPEDecompress *)d;
- return dec->GetInfo ((APE_DECOMPRESS_FIELDS)id, (intptr_t)ptr, size);
-}
-
-int
-ape_decompress_getdata (void *d, char *buffer, int nblocks) {
- IAPEDecompress *dec = (IAPEDecompress *)d;
- int retr;
- int res = dec->GetData (buffer, nblocks, &retr);
- return retr;
-}
-
-int
-ape_decompress_seek (void *d, int nblockoffs) {
- IAPEDecompress *dec = (IAPEDecompress *)d;
- return dec->Seek (nblockoffs);
-}
diff --git a/plugins/ape/apewrapper.h b/plugins/ape/apewrapper.h
deleted file mode 100644
index ca3c0f92..00000000
--- a/plugins/ape/apewrapper.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- apedec - Monkey's Audio Decoder plugin for DeaDBeeF player
- http://deadbeef.sourceforge.net
-
- Copyright (C) 2009 Alexey Yakovenko
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Note: DeaDBeeF player itself uses different license
-*/
-#ifndef __APEWRAPPER_H
-#define __APEWRAPPER_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// decode process:
-// 1. get input format:
-// WAVEFORMATEX wfe;
-// GetInfo(APE_INFO_WAVEFORMATEX, (intptr_t)&wfe)
-// 2. get wav header
-// int size = GetInfo(APE_INFO_WAV_HEADER_BYTES)
-// char buf[size];
-// GetInfo (APE_INFO_WAV_HEADER_DATA, (intptr_t)buf, size);
-// 3. allocate space for readbuffer
-// int bufsize = GetInfo(APE_INFO_BLOCK_ALIGN) * BLOCKS_PER_DECODE;
-// char readbuf[bufsize];
-// 4. get total number of blocks
-// int blocksleft = GetInfo(APE_DECOMPRESS_TOTAL_BLOCKS);
-// 5. decompress
-// while (blocksleft > 0) {
-// int ndecoded;
-// GetData (readbuf, BLOCKS_PER_DECODE, &ndecoded);
-// nblocksleft -= ndecoded;
-// }
-// 6. terminate output
-// if (GetInfo(APE_INFO_WAV_TERMINATING_BYTES) > 0) {
-// GetInfo(APE_INFO_WAV_TERMINATING_DATA, (intptr_t)readbuf, GetInfo(APE_INFO_WAV_TERMINATING_BYTES));
-// }
-#ifndef APE_MACLIB_H
-
-typedef struct tWAVEFORMATEX
-{
- uint16_t wFormatTag; /* format type */
- uint16_t nChannels; /* number of channels (i.e. mono, stereo...) */
- uint32_t nSamplesPerSec; /* sample rate */
- uint32_t nAvgBytesPerSec; /* for buffer estimation */
- uint16_t nBlockAlign; /* block size of data */
- uint16_t wBitsPerSample; /* number of bits per sample of mono data */
- uint16_t cbSize; /* the count in bytes of the size of */
- /* extra information (after cbSize) */
-} WAVEFORMATEX;
-
-enum APE_DECOMPRESS_FIELDS
-{
- APE_INFO_FILE_VERSION = 1000, // version of the APE file * 1000 (3.93 = 3930) [ignored, ignored]
- APE_INFO_COMPRESSION_LEVEL = 1001, // compression level of the APE file [ignored, ignored]
- APE_INFO_FORMAT_FLAGS = 1002, // format flags of the APE file [ignored, ignored]
- APE_INFO_SAMPLE_RATE = 1003, // sample rate (Hz) [ignored, ignored]
- APE_INFO_BITS_PER_SAMPLE = 1004, // bits per sample [ignored, ignored]
- APE_INFO_BYTES_PER_SAMPLE = 1005, // number of bytes per sample [ignored, ignored]
- APE_INFO_CHANNELS = 1006, // channels [ignored, ignored]
- APE_INFO_BLOCK_ALIGN = 1007, // block alignment [ignored, ignored]
- APE_INFO_BLOCKS_PER_FRAME = 1008, // number of blocks in a frame (frames are used internally) [ignored, ignored]
- APE_INFO_FINAL_FRAME_BLOCKS = 1009, // blocks in the final frame (frames are used internally) [ignored, ignored]
- APE_INFO_TOTAL_FRAMES = 1010, // total number frames (frames are used internally) [ignored, ignored]
- APE_INFO_WAV_HEADER_BYTES = 1011, // header bytes of the decompressed WAV [ignored, ignored]
- APE_INFO_WAV_TERMINATING_BYTES = 1012, // terminating bytes of the decompressed WAV [ignored, ignored]
- APE_INFO_WAV_DATA_BYTES = 1013, // data bytes of the decompressed WAV [ignored, ignored]
- APE_INFO_WAV_TOTAL_BYTES = 1014, // total bytes of the decompressed WAV [ignored, ignored]
- APE_INFO_APE_TOTAL_BYTES = 1015, // total bytes of the APE file [ignored, ignored]
- APE_INFO_TOTAL_BLOCKS = 1016, // total blocks of audio data [ignored, ignored]
- APE_INFO_LENGTH_MS = 1017, // length in ms (1 sec = 1000 ms) [ignored, ignored]
- APE_INFO_AVERAGE_BITRATE = 1018, // average bitrate of the APE [ignored, ignored]
- APE_INFO_FRAME_BITRATE = 1019, // bitrate of specified APE frame [frame index, ignored]
- APE_INFO_DECOMPRESSED_BITRATE = 1020, // bitrate of the decompressed WAV [ignored, ignored]
- APE_INFO_PEAK_LEVEL = 1021, // peak audio level (obsolete) (-1 is unknown) [ignored, ignored]
- APE_INFO_SEEK_BIT = 1022, // bit offset [frame index, ignored]
- APE_INFO_SEEK_BYTE = 1023, // byte offset [frame index, ignored]
- APE_INFO_WAV_HEADER_DATA = 1024, // error code [buffer *, max bytes]
- APE_INFO_WAV_TERMINATING_DATA = 1025, // error code [buffer *, max bytes]
- APE_INFO_WAVEFORMATEX = 1026, // error code [waveformatex *, ignored]
- APE_INFO_IO_SOURCE = 1027, // I/O source (CIO *) [ignored, ignored]
- APE_INFO_FRAME_BYTES = 1028, // bytes (compressed) of the frame [frame index, ignored]
- APE_INFO_FRAME_BLOCKS = 1029, // blocks in a given frame [frame index, ignored]
- APE_INFO_TAG = 1030, // point to tag (CAPETag *) [ignored, ignored]
-
- APE_DECOMPRESS_CURRENT_BLOCK = 2000, // current block location [ignored, ignored]
- APE_DECOMPRESS_CURRENT_MS = 2001, // current millisecond location [ignored, ignored]
- APE_DECOMPRESS_TOTAL_BLOCKS = 2002, // total blocks in the decompressors range [ignored, ignored]
- APE_DECOMPRESS_LENGTH_MS = 2003, // total blocks in the decompressors range [ignored, ignored]
- APE_DECOMPRESS_CURRENT_BITRATE = 2004, // current bitrate [ignored, ignored]
- APE_DECOMPRESS_AVERAGE_BITRATE = 2005, // average bitrate (works with ranges) [ignored, ignored]
-
- APE_INTERNAL_INFO = 3000 // for internal use -- don't use (returns APE_FILE_INFO *) [ignored, ignored]
-};
-#endif
-
-void *
-ape_decompress_create (const char *fname);
-
-void
-ape_decompress_destroy (void *d);
-
-int
-ape_decompress_get_info_int (void *d, int id);
-
-int
-ape_decompress_get_info_data (void *d, int id, void *ptr);
-
-int
-ape_decompress_get_info_data_sized (void *d, int id, void *ptr, int size);
-
-int
-ape_decompress_getdata (void *d, char *buffer, int nblocks);
-
-int
-ape_decompress_seek (void *d, int nblockoffs);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // __APEWRAPPER_H
diff --git a/plugins/demac/Makefile.am b/plugins/demac/Makefile.am
deleted file mode 100644
index d7b6c9ea..00000000
--- a/plugins/demac/Makefile.am
+++ /dev/null
@@ -1,33 +0,0 @@
-demacdir = $(libdir)/$(PACKAGE)
-pkglib_LTLIBRARIES = demac.la
-demac_la_SOURCES = demac.c\
-libdemac/crc.c\
-libdemac/decoder.c\
-libdemac/decoder.h\
-libdemac/demac_config.h\
-libdemac/demac.h\
-libdemac/entropy.c\
-libdemac/entropy.h\
-libdemac/filter_1280_15.c\
-libdemac/filter_16_11.c\
-libdemac/filter_256_13.c\
-libdemac/filter_32_10.c\
-libdemac/filter_64_11.c\
-libdemac/filter.h\
-libdemac/parser.c\
-libdemac/parser.h\
-libdemac/predictor.c\
-libdemac/predictor.h\
-libdemac/vector_math16_armv5te.h\
-libdemac/vector_math16_armv6.h\
-libdemac/vector_math16_cf.h\
-libdemac/vector_math32_armv4.h\
-libdemac/vector_math_generic.h
-
-EXTRA_demac_la_SOURCES = libdemac/filter.c
-
-demac_la_LDFLAGS = -module
-AM_CFLAGS = $(CFLAGS) -std=c99
-
-
-
diff --git a/plugins/demac/demac.c b/plugins/demac/demac.c
deleted file mode 100644
index 508b0ac1..00000000
--- a/plugins/demac/demac.c
+++ /dev/null
@@ -1,656 +0,0 @@
-/*
- DeaDBeeF - ultimate music player for GNU/Linux systems with X11
- Copyright (C) 2009-2010 Alexey Yakovenko <waker@users.sourceforge.net>
- This plugin is based on code from demac and libdemac (C) Dave Chapman 2007
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#include <assert.h>
-#include "../../deadbeef.h"
-#include "libdemac/demac.h"
-
-#define min(x,y) ((x)<(y)?(x):(y))
-#define max(x,y) ((x)>(y)?(x):(y))
-
-static DB_decoder_t plugin;
-static DB_functions_t *deadbeef;
-
-#define CALC_CRC 0
-
-#define BLOCKS_PER_LOOP 4608
-#define MAX_CHANNELS 2
-#define MAX_BYTESPERSAMPLE 4
-
-#define INPUT_CHUNKSIZE (32*1024)
-
-/* 4608*4 = 18432 bytes per channel */
-static int32_t decoded0[BLOCKS_PER_LOOP];
-static int32_t decoded1[BLOCKS_PER_LOOP];
-
-/* We assume that 32KB of compressed data is enough to extract up to
- 27648 bytes of decompressed data. */
-
-static unsigned char inbuffer[INPUT_CHUNKSIZE];
-
-static int currentframe;
-static uint32_t frame_crc;
-static int crc_errors;
-static FILE *fp;
-static int firstbyte;
-static int bytesinbuffer;
-static struct ape_ctx_t ape_ctx;
-static int bytesconsumed;
-static int timestart;
-static int timeend;
-static int nblocks;
-static int samplestoskip;
-static int samplesdecoded;
-
-static float ape_duration;
-
-// 5x big to fit extra data while streaming
-#define WAVBUFFER_SIZE (BLOCKS_PER_LOOP*MAX_CHANNELS*MAX_BYTESPERSAMPLE * 5)
-static uint8_t wavbuffer[WAVBUFFER_SIZE];
-static int bufferfill;
-
-// precalc for converting samples from internal format to float32
-static int32_t mask;
-static float scaler;
-static int32_t neg;
-static int32_t sign;
-static int32_t signshift;
-
-inline static int
-read_uint16(FILE *fp, uint16_t* x)
-{
- unsigned char tmp[2];
- int n;
-
- n = fread(tmp, 1, 2, fp);
-
- if (n != 2)
- return -1;
-
- *x = tmp[0] | (tmp[1] << 8);
-
- return 0;
-}
-
-
-inline static int
-read_int16(FILE *fp, int16_t* x)
-{
- return read_uint16(fp, (uint16_t*)x);
-}
-
-inline static int
-read_uint32(FILE *fp, uint32_t* x)
-{
- unsigned char tmp[4];
- int n;
-
- n = fread(tmp, 1, 4, fp);
-
- if (n != 4)
- return -1;
-
- *x = tmp[0] | (tmp[1] << 8) | (tmp[2] << 16) | (tmp[3] << 24);
-
- return 0;
-}
-
-int
-demac_ape_parseheader(FILE *fp, struct ape_ctx_t* ape_ctx)
-{
- int i,n;
- memset (ape_ctx, 0, sizeof (struct ape_ctx_t));
-
- /* TODO: Skip any leading junk such as id3v2 tags */
- ape_ctx->junklength = 0;
-
- fseek(fp,ape_ctx->junklength,SEEK_SET);
-
- n = fread (&ape_ctx->magic, 1, 4, fp);
- if (n != 4) {
- return -1;
- }
-
- if (memcmp(ape_ctx->magic,"MAC ",4)!=0)
- {
- return -1;
- }
-
- if (read_int16(fp,&ape_ctx->fileversion) < 0) {
- return -1;
- }
-
- if (ape_ctx->fileversion >= 3980)
- {
- if (read_int16(fp,&ape_ctx->padding1) < 0)
- return -1;
- if (read_uint32(fp,&ape_ctx->descriptorlength) < 0)
- return -1;
- if (read_uint32(fp,&ape_ctx->headerlength) < 0)
- return -1;
- if (read_uint32(fp,&ape_ctx->seektablelength) < 0)
- return -1;
- if (read_uint32(fp,&ape_ctx->wavheaderlength) < 0)
- return -1;
- if (read_uint32(fp,&ape_ctx->audiodatalength) < 0)
- return -1;
- if (read_uint32(fp,&ape_ctx->audiodatalength_high) < 0)
- return -1;
- if (read_uint32(fp,&ape_ctx->wavtaillength) < 0)
- return -1;
- if (fread(&ape_ctx->md5, 1, 16, fp) != 16)
- return -1;
-
- /* Skip any unknown bytes at the end of the descriptor. This is for future
- compatibility */
- if (ape_ctx->descriptorlength > 52)
- fseek(fp,ape_ctx->descriptorlength - 52, SEEK_CUR);
-
- /* Read header data */
- if (read_uint16(fp,&ape_ctx->compressiontype) < 0)
- return -1;
- if (read_uint16(fp,&ape_ctx->formatflags) < 0)
- return -1;
- if (read_uint32(fp,&ape_ctx->blocksperframe) < 0)
- return -1;
- if (read_uint32(fp,&ape_ctx->finalframeblocks) < 0)
- return -1;
- if (read_uint32(fp,&ape_ctx->totalframes) < 0)
- return -1;
- if (read_uint16(fp,&ape_ctx->bps) < 0)
- return -1;
- if (read_uint16(fp,&ape_ctx->channels) < 0)
- return -1;
- if (read_uint32(fp,&ape_ctx->samplerate) < 0)
- return -1;
- } else {
- ape_ctx->descriptorlength = 0;
- ape_ctx->headerlength = 32;
-
- if (read_uint16(fp,&ape_ctx->compressiontype) < 0)
- return -1;
- if (read_uint16(fp,&ape_ctx->formatflags) < 0)
- return -1;
- if (read_uint16(fp,&ape_ctx->channels) < 0)
- return -1;
- if (read_uint32(fp,&ape_ctx->samplerate) < 0)
- return -1;
- if (read_uint32(fp,&ape_ctx->wavheaderlength) < 0)
- return -1;
- if (read_uint32(fp,&ape_ctx->wavtaillength) < 0)
- return -1;
- if (read_uint32(fp,&ape_ctx->totalframes) < 0)
- return -1;
- if (read_uint32(fp,&ape_ctx->finalframeblocks) < 0)
- return -1;
-
- if (ape_ctx->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL)
- {
- fseek(fp, 4, SEEK_CUR); /* Skip the peak level */
- ape_ctx->headerlength += 4;
- }
-
- if (ape_ctx->formatflags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS)
- {
- if (read_uint32(fp,&ape_ctx->seektablelength) < 0)
- return -1;
- ape_ctx->headerlength += 4;
- ape_ctx->seektablelength *= sizeof(int32_t);
- } else {
- ape_ctx->seektablelength = ape_ctx->totalframes * sizeof(int32_t);
- }
-
- if (ape_ctx->formatflags & MAC_FORMAT_FLAG_8_BIT)
- ape_ctx->bps = 8;
- else if (ape_ctx->formatflags & MAC_FORMAT_FLAG_24_BIT)
- ape_ctx->bps = 24;
- else
- ape_ctx->bps = 16;
-
- if (ape_ctx->fileversion >= 3950)
- ape_ctx->blocksperframe = 73728 * 4;
- else if ((ape_ctx->fileversion >= 3900) || (ape_ctx->fileversion >= 3800 && ape_ctx->compressiontype >= 4000))
- ape_ctx->blocksperframe = 73728;
- else
- ape_ctx->blocksperframe = 9216;
-
- /* Skip any stored wav header */
- if (!(ape_ctx->formatflags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER))
- {
- fseek(fp, ape_ctx->wavheaderlength, SEEK_CUR);
- }
- }
-
- ape_ctx->totalsamples = ape_ctx->finalframeblocks;
- if (ape_ctx->totalframes > 1)
- ape_ctx->totalsamples += ape_ctx->blocksperframe * (ape_ctx->totalframes-1);
-
- if (ape_ctx->seektablelength > 0)
- {
- ape_ctx->seektable = malloc(ape_ctx->seektablelength);
- if (ape_ctx->seektable == NULL)
- return -1;
- for (i=0; i < ape_ctx->seektablelength / sizeof(uint32_t); i++)
- {
- if (read_uint32(fp,&ape_ctx->seektable[i]) < 0)
- {
- free(ape_ctx->seektable);
- ape_ctx->seektable = NULL;
- return -1;
- }
- }
- ape_ctx->numseekpoints = ape_ctx->seektablelength/sizeof (int32_t);
- }
-
- ape_ctx->firstframe = ape_ctx->junklength + ape_ctx->descriptorlength +
- ape_ctx->headerlength + ape_ctx->seektablelength +
- ape_ctx->wavheaderlength;
-
- return 0;
-}
-
-static int
-demac_seek (float seconds);
-
-static int
-demac_init (DB_playItem_t *it) {
- crc_errors = 0;
- fp = fopen (it->fname, "rb");
- if (!fp) {
- return -1;
- }
- if (demac_ape_parseheader (fp, &ape_ctx) < 0) {
- fprintf (stderr, "demac: failed to read ape header\n");
- fclose (fp);
- fp = NULL;
- if (ape_ctx.seektable) {
- free (ape_ctx.seektable);
- ape_ctx.seektable = NULL;
- }
- return -1;
- }
- if ((ape_ctx.fileversion < APE_MIN_VERSION) || (ape_ctx.fileversion > APE_MAX_VERSION)) {
- fprintf(stderr, "demac: unsupported file version - %.2f\n", ape_ctx.fileversion/1000.0);
- fclose (fp);
- fp = NULL;
- if (ape_ctx.seektable) {
- free (ape_ctx.seektable);
- ape_ctx.seektable = NULL;
- }
- return -1;
- }
-// fprintf(stderr, "demac: decoding file - v%.2f, compression level %d\n", ape_ctx.fileversion/1000.0, ape_ctx.compressiontype);
-
- currentframe = 0;
- fseek (fp, ape_ctx.firstframe, SEEK_SET);
- bytesinbuffer = fread (inbuffer, 1, INPUT_CHUNKSIZE, fp);
- firstbyte = 3;
- bufferfill = 0;
- bytesconsumed = 0;
- nblocks = 0;
- samplestoskip = 0;
- samplesdecoded = 0;
-
- plugin.info.bps = ape_ctx.bps;
- plugin.info.samplerate = ape_ctx.samplerate;
- plugin.info.channels = ape_ctx.channels;
- plugin.info.readpos = 0;
- ape_duration = it->duration;
- if (it->timeend > 0) {
- timestart = it->timestart;
- timeend = it->timeend;
- demac_seek (0);
- }
- else {
- timestart = 0;
- timeend = it->duration;
- }
-
- mask = (1<<(ape_ctx.bps-1))-1;
- scaler = 1.f / ((1<<(ape_ctx.bps-1))-1);
- neg = 1<<ape_ctx.bps;
- sign = (1<<31);
- signshift = ape_ctx.bps-1;
- return 0;
-}
-
-static void
-demac_free (void) {
- if (fp) {
- fclose (fp);
- fp = NULL;
- if (ape_ctx.seektable) {
- free (ape_ctx.seektable);
- ape_ctx.seektable = NULL;
- }
- }
-}
-
-static int
-demac_decode (int size) {
- /* The main decoding loop - we decode the frames a small chunk at a time */
- int32_t mask = (1<<(ape_ctx.bps-1))-1;
- float scaler = 1.f / ((1<<(ape_ctx.bps-1))-1);
- int32_t neg = 1<<ape_ctx.bps;
- int32_t sign = (1<<31);
- int32_t signshift = ape_ctx.bps-1;
- while (currentframe < ape_ctx.totalframes && bufferfill < size)
- {
- int n, i;
- assert (bufferfill < WAVBUFFER_SIZE-(size-bufferfill));
- if (nblocks <= 0) {
- /* Calculate how many blocks there are in this frame */
- if (currentframe == (ape_ctx.totalframes - 1))
- nblocks = ape_ctx.finalframeblocks;
- else
- nblocks = ape_ctx.blocksperframe;
-
- ape_ctx.currentframeblocks = nblocks;
-
- /* Initialise the frame decoder */
- init_frame_decoder(&ape_ctx, inbuffer, &firstbyte, &bytesconsumed);
-
- /* Update buffer */
- memmove(inbuffer,inbuffer + bytesconsumed, bytesinbuffer - bytesconsumed);
- bytesinbuffer -= bytesconsumed;
-
- n = fread(inbuffer + bytesinbuffer, 1, INPUT_CHUNKSIZE - bytesinbuffer, fp);
- bytesinbuffer += n;
-
-#if CALC_CRC
- frame_crc = ape_initcrc();
-#endif
- }
-
- /* Decode the frame a chunk at a time */
- while (nblocks > 0 && bufferfill < size)
- {
- int blockstodecode = min (BLOCKS_PER_LOOP, nblocks);
- int res;
- if ((res = decode_chunk(&ape_ctx, inbuffer, &firstbyte,
- &bytesconsumed,
- decoded0, decoded1,
- blockstodecode)) < 0)
- {
- /* Frame decoding error, abort */
- return -1;
- }
-
-#if CALC_CRC
- uint8_t *pp = wavbuffer + bufferfill;
-#endif
- uint8_t *p = wavbuffer + bufferfill;
- int i = 0;
- // skip if needed
- int n = min (samplestoskip, blockstodecode);
- i += n;
- samplestoskip -= n;
- samplesdecoded += n;
-
- for (; i < blockstodecode ; i++)
- {
- int32_t sample;
- sample = decoded0[i];
- *((float *)p) = (sample - ((sample&sign)>>signshift)*neg) * scaler;
- p += sizeof (float);
- bufferfill += sizeof (float);
- if (ape_ctx.channels == 2) {
- sample = decoded1[i];
- *((float *)p) = (sample - ((sample&sign)>>signshift)*neg) * scaler;
- p += sizeof (float);
- bufferfill += sizeof (float);
- }
- samplesdecoded++;
- }
-
- assert (bufferfill <= WAVBUFFER_SIZE);
-
-#if CALC_CRC
- frame_crc = ape_updatecrc(pp, p - pp, frame_crc);
-#endif
- memmove(inbuffer,inbuffer + bytesconsumed, bytesinbuffer - bytesconsumed);
- bytesinbuffer -= bytesconsumed;
-
- n = fread(inbuffer + bytesinbuffer, 1, INPUT_CHUNKSIZE - bytesinbuffer, fp);
- bytesinbuffer += n;
-
- /* Decrement the block count */
- nblocks -= blockstodecode;
- }
-
- if (nblocks <= 0) {
-#if CALC_CRC
- frame_crc = ape_finishcrc(frame_crc);
-
- if (ape_ctx.CRC != frame_crc)
- {
- fprintf(stderr,"CRC error in frame %d\n",currentframe);
- crc_errors++;
- }
-#endif
- currentframe++;
- }
- }
- return 0;
-}
-
-static int
-demac_read_int16 (char *buffer, int size) {
- if (demac_decode (size*2) < 0) {
- return -1;
- }
- // float->int16
- int avail = bufferfill / sizeof (float);
- int s = size/2;
- int sz = min (avail, s);
- if (sz) {
- float *p = (float *)wavbuffer;
- for (int i = 0; i < sz; i++) {
- *((int16_t *)buffer) = (int16_t)(*p * 0x7fff);
- buffer += 2;
- p++;
- }
-// memcpy (buffer, wavbuffer, sz);
- if (bufferfill > sz * sizeof (float)) {
- memmove (wavbuffer, wavbuffer + (sz * sizeof (float)), bufferfill - (sz * sizeof (float)));
- }
- bufferfill -= sz * sizeof (float);
- assert (bufferfill >= 0);
- }
- plugin.info.readpos = samplesdecoded / (float)plugin.info.samplerate - timestart;
- if (plugin.info.readpos >= (timeend - timestart)) {
- return 0;
- }
- return sz * 2;
-}
-
-static int
-demac_read_float32 (char *buffer, int size) {
- if (demac_decode (size) < 0) {
- return -1;
- }
- int sz = min (bufferfill, size);
- if (sz) {
- memcpy (buffer, wavbuffer, sz);
- if (bufferfill > sz) {
- memmove (wavbuffer, wavbuffer + sz, bufferfill - sz);
- }
- bufferfill -= sz;
- assert (bufferfill >= 0);
- }
- plugin.info.readpos = samplesdecoded / (float)plugin.info.samplerate - timestart;
- if (plugin.info.readpos >= (timeend - timestart)) {
- return 0;
- }
- return sz;
-}
-
-/* Given an ape_ctx and a sample to seek to, return the file position
- to the frame containing that sample, and the number of samples to
- skip in that frame.
- */
-
-static int ape_calc_seekpos(struct ape_ctx_t* ape_ctx,
- uint32_t new_sample,
- uint32_t* newframe,
- uint32_t* filepos,
- uint32_t* samplestoskip)
-{
- uint32_t n;
-
- n = new_sample / ape_ctx->blocksperframe;
- if (n >= ape_ctx->numseekpoints)
- {
- /* We don't have a seekpoint for that frame */
- return 0;
- }
-
- *newframe = n;
- *filepos = ape_ctx->seektable[n];
- *samplestoskip = new_sample - (n * ape_ctx->blocksperframe);
-
- return 1;
-}
-
-
-static int
-demac_seek (float seconds) {
- seconds += timestart;
- uint32_t newsample = seconds * plugin.info.samplerate;
- if (newsample > ape_ctx.totalsamples) {
- return -1;
- }
- uint32_t nf, fpos;
- if (ape_calc_seekpos (&ape_ctx, newsample, &nf, &fpos, &samplestoskip)) {
- firstbyte = 3 - (fpos & 3);
- fpos &= ~3;
- fseek (fp, fpos, SEEK_SET);
- bytesinbuffer = fread (inbuffer, 1, INPUT_CHUNKSIZE, fp);
- bufferfill = 0;
- bytesconsumed = 0;
- nblocks = 0;
- samplesdecoded = newsample-samplestoskip;
- plugin.info.readpos = seconds;
- currentframe = nf;
- }
- else {
- // no seektable
- if (newsample > samplesdecoded) {
- samplestoskip = newsample - samplesdecoded;
- }
- else {
- fpos = ape_ctx.firstframe;
- samplestoskip = newsample;
- firstbyte = 3 - (fpos & 3);
- fpos &= ~3;
- fseek (fp, fpos, SEEK_SET);
- bytesinbuffer = fread (inbuffer, 1, INPUT_CHUNKSIZE, fp);
- bufferfill = 0;
- bytesconsumed = 0;
- nblocks = 0;
- samplesdecoded = 0;
- }
- }
- plugin.info.readpos = seconds - timestart;
- return 0;
-}
-
-static DB_playItem_t *
-demac_insert (DB_playItem_t *after, const char *fname) {
- struct ape_ctx_t ape_ctx;
- FILE *fp = fopen (fname, "rb");
- if (!fp) {
- return NULL;
- }
- if (demac_ape_parseheader (fp, &ape_ctx) < 0) {
- fprintf (stderr, "demac: failed to read ape header\n");
- fclose (fp);
- return NULL;
- }
-// ape_dumpinfo (&ape_ctx);
- if ((ape_ctx.fileversion < APE_MIN_VERSION) || (ape_ctx.fileversion > APE_MAX_VERSION)) {
- fprintf(stderr, "demac: unsupported file version - %.2f\n", ape_ctx.fileversion/1000.0);
- fclose (fp);
- return NULL;
- }
-
- float duration = ape_ctx.totalsamples / (float)ape_ctx.samplerate;
- DB_playItem_t *it;
- it = deadbeef->pl_insert_cue (after, fname, &plugin, "APE", duration);
- if (it) {
- fclose (fp);
- return it;
- }
-
- it = deadbeef->pl_item_alloc ();
- it->decoder = &plugin;
- it->fname = strdup (fname);
- it->filetype = "APE";
- it->duration = duration;
-
- int v2err = deadbeef->junk_read_id3v2 (it, fp);
- int v1err = deadbeef->junk_read_id3v1 (it, fp);
- if (v1err >= 0) {
- fseek (fp, -128, SEEK_END);
- }
- else {
- fseek (fp, 0, SEEK_END);
- }
- int apeerr = deadbeef->junk_read_ape (it, fp);
- deadbeef->pl_add_meta (it, "title", NULL);
- after = deadbeef->pl_insert_item (after, it);
-
- fclose (fp);
- return after;
-}
-
-static const char *exts[] = { "ape", NULL };
-static const char *filetypes[] = { "APE", NULL };
-
-// define plugin interface
-static DB_decoder_t plugin = {
- DB_PLUGIN_SET_API_VERSION
- .plugin.version_major = 0,
- .plugin.version_minor = 1,
- .plugin.type = DB_PLUGIN_DECODER,
- .plugin.name = "Monkey's Audio decoder",
- .plugin.descr = "Based on libdemac",
- .plugin.author = "Alexey Yakovenko",
- .plugin.email = "waker@users.sourceforge.net",
- .plugin.website = "http://deadbeef.sf.net",
- .init = demac_init,
- .free = demac_free,
- .read_int16 = demac_read_int16,
- .read_float32 = demac_read_float32,
- .seek = demac_seek,
- .insert = demac_insert,
- .exts = exts,
- .id = "stddemac",
- .filetypes = filetypes
-};
-
-DB_plugin_t *
-demac_load (DB_functions_t *api) {
- deadbeef = api;
- return DB_PLUGIN (&plugin);
-}
diff --git a/plugins/demac/libdemac/SOURCES b/plugins/demac/libdemac/SOURCES
deleted file mode 100644
index 5a448237..00000000
--- a/plugins/demac/libdemac/SOURCES
+++ /dev/null
@@ -1,15 +0,0 @@
-crc.c
-predictor.c
-#ifdef CPU_ARM
-predictor-arm.S
-#elif defined CPU_COLDFIRE
-predictor-cf.S
-#endif
-entropy.c
-decoder.c
-parser.c
-filter_1280_15.c
-filter_16_11.c
-filter_256_13.c
-filter_32_10.c
-filter_64_11.c
diff --git a/plugins/demac/libdemac/crc.c b/plugins/demac/libdemac/crc.c
deleted file mode 100644
index 30a49c8d..00000000
--- a/plugins/demac/libdemac/crc.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: crc.c 19643 2009-01-02 21:43:52Z bertrik $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-#include <inttypes.h>
-#include "demac.h"
-
-static const uint32_t crctab32[] =
-{
- 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
- 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
- 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
- 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
- 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
- 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
- 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
- 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
- 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
- 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
- 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
- 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
- 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
- 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
- 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
- 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
-
- 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
- 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
- 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
- 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
- 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
- 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
- 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
- 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
- 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
- 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
- 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
- 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
- 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
- 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
- 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
- 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
-
- 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
- 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
- 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
- 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
- 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
- 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
- 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
- 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
- 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
- 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
- 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
- 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
- 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
- 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
- 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
- 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
-
- 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
- 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
- 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
- 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
- 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
- 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
- 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
- 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
- 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
- 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
- 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
- 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
- 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
- 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
- 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
- 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
-};
-
-uint32_t ape_initcrc(void)
-{
- return 0xffffffff;
-}
-
-/* Update the CRC from a block of WAV-format audio data */
-uint32_t ape_updatecrc(unsigned char *block, int count, uint32_t crc)
-{
- while (count--)
- crc = (crc >> 8) ^ crctab32[(crc & 0xff) ^ *block++];
-
- return crc;
-}
-
-uint32_t ape_finishcrc(uint32_t crc)
-{
- crc ^= 0xffffffff;
- crc >>= 1;
-
- return crc;
-}
-
diff --git a/plugins/demac/libdemac/decoder.c b/plugins/demac/libdemac/decoder.c
deleted file mode 100644
index f6826fca..00000000
--- a/plugins/demac/libdemac/decoder.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: decoder.c 19552 2008-12-21 23:49:02Z amiconn $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-#include <inttypes.h>
-#include <string.h>
-
-#include "demac.h"
-#include "predictor.h"
-#include "entropy.h"
-#include "filter.h"
-#include "demac_config.h"
-
-/* Statically allocate the filter buffers */
-
-static filter_int filterbuf32[(32*3 + FILTER_HISTORY_SIZE) * 2]
- IBSS_ATTR __attribute__((aligned(16))); /* 2432/4864 bytes */
-static filter_int filterbuf256[(256*3 + FILTER_HISTORY_SIZE) * 2]
- IBSS_ATTR __attribute__((aligned(16))); /* 5120/10240 bytes */
-
-/* This is only needed for "insane" files, and no current Rockbox targets
- can hope to decode them in realtime, although the Gigabeat S comes close. */
-static filter_int filterbuf1280[(1280*3 + FILTER_HISTORY_SIZE) * 2]
- IBSS_ATTR_DEMAC_INSANEBUF __attribute__((aligned(16)));
- /* 17408 or 34816 bytes */
-
-void init_frame_decoder(struct ape_ctx_t* ape_ctx,
- unsigned char* inbuffer, int* firstbyte,
- int* bytesconsumed)
-{
- init_entropy_decoder(ape_ctx, inbuffer, firstbyte, bytesconsumed);
- //printf("CRC=0x%08x\n",ape_ctx->CRC);
- //printf("Flags=0x%08x\n",ape_ctx->frameflags);
-
- init_predictor_decoder(&ape_ctx->predictor);
-
- switch (ape_ctx->compressiontype)
- {
- case 2000:
- init_filter_16_11(filterbuf32);
- break;
-
- case 3000:
- init_filter_64_11(filterbuf256);
- break;
-
- case 4000:
- init_filter_256_13(filterbuf256);
- init_filter_32_10(filterbuf32);
- break;
-
- case 5000:
- init_filter_1280_15(filterbuf1280);
- init_filter_256_13(filterbuf256);
- init_filter_16_11(filterbuf32);
- }
-}
-
-int ICODE_ATTR_DEMAC decode_chunk(struct ape_ctx_t* ape_ctx,
- unsigned char* inbuffer, int* firstbyte,
- int* bytesconsumed,
- int32_t* decoded0, int32_t* decoded1,
- int count)
-{
- int32_t left, right;
-#ifdef ROCKBOX
- int scale = (APE_OUTPUT_DEPTH - ape_ctx->bps);
- #define SCALE(x) ((x) << scale)
-#else
- #define SCALE(x) (x)
-#endif
-
- if ((ape_ctx->channels==1) || ((ape_ctx->frameflags
- & (APE_FRAMECODE_PSEUDO_STEREO|APE_FRAMECODE_STEREO_SILENCE))
- == APE_FRAMECODE_PSEUDO_STEREO)) {
-
- entropy_decode(ape_ctx, inbuffer, firstbyte, bytesconsumed,
- decoded0, NULL, count);
-
- if (ape_ctx->frameflags & APE_FRAMECODE_MONO_SILENCE) {
- /* We are pure silence, so we're done. */
- return 0;
- }
-
- switch (ape_ctx->compressiontype)
- {
- case 2000:
- apply_filter_16_11(ape_ctx->fileversion,decoded0,NULL,count);
- break;
-
- case 3000:
- apply_filter_64_11(ape_ctx->fileversion,decoded0,NULL,count);
- break;
-
- case 4000:
- apply_filter_32_10(ape_ctx->fileversion,decoded0,NULL,count);
- apply_filter_256_13(ape_ctx->fileversion,decoded0,NULL,count);
- break;
-
- case 5000:
- apply_filter_16_11(ape_ctx->fileversion,decoded0,NULL,count);
- apply_filter_256_13(ape_ctx->fileversion,decoded0,NULL,count);
- apply_filter_1280_15(ape_ctx->fileversion,decoded0,NULL,count);
- }
-
- /* Now apply the predictor decoding */
- predictor_decode_mono(&ape_ctx->predictor,decoded0,count);
-
- if (ape_ctx->channels==2) {
- /* Pseudo-stereo - copy left channel to right channel */
- while (count--)
- {
- left = *decoded0;
- *(decoded1++) = *(decoded0++) = SCALE(left);
- }
- }
-#ifdef ROCKBOX
- else {
- /* Scale to output depth */
- while (count--)
- {
- left = *decoded0;
- *(decoded0++) = SCALE(left);
- }
- }
-#endif
- } else { /* Stereo */
- entropy_decode(ape_ctx, inbuffer, firstbyte, bytesconsumed,
- decoded0, decoded1, count);
-
- if ((ape_ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE)
- == APE_FRAMECODE_STEREO_SILENCE) {
- /* We are pure silence, so we're done. */
- return 0;
- }
-
- /* Apply filters - compression type 1000 doesn't have any */
- switch (ape_ctx->compressiontype)
- {
- case 2000:
- apply_filter_16_11(ape_ctx->fileversion,decoded0,decoded1,count);
- break;
-
- case 3000:
- apply_filter_64_11(ape_ctx->fileversion,decoded0,decoded1,count);
- break;
-
- case 4000:
- apply_filter_32_10(ape_ctx->fileversion,decoded0,decoded1,count);
- apply_filter_256_13(ape_ctx->fileversion,decoded0,decoded1,count);
- break;
-
- case 5000:
- apply_filter_16_11(ape_ctx->fileversion,decoded0,decoded1,count);
- apply_filter_256_13(ape_ctx->fileversion,decoded0,decoded1,count);
- apply_filter_1280_15(ape_ctx->fileversion,decoded0,decoded1,count);
- }
-
- /* Now apply the predictor decoding */
- predictor_decode_stereo(&ape_ctx->predictor,decoded0,decoded1,count);
-
- /* Decorrelate and scale to output depth */
- while (count--)
- {
- left = *decoded1 - (*decoded0 / 2);
- right = left + *decoded0;
-
- *(decoded0++) = SCALE(left);
- *(decoded1++) = SCALE(right);
- }
- }
- return 0;
-}
diff --git a/plugins/demac/libdemac/decoder.h b/plugins/demac/libdemac/decoder.h
deleted file mode 100644
index e8810652..00000000
--- a/plugins/demac/libdemac/decoder.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: decoder.h 19743 2009-01-10 21:10:56Z zagor $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-#ifndef _APE_DECODER_H
-#define _APE_DECODER_H
-
-#include <inttypes.h>
-#include "parser.h"
-
-void init_frame_decoder(struct ape_ctx_t* ape_ctx,
- unsigned char* inbuffer, int* firstbyte,
- int* bytesconsumed);
-
-int decode_chunk(struct ape_ctx_t* ape_ctx,
- unsigned char* inbuffer, int* firstbyte,
- int* bytesconsumed,
- int32_t* decoded0, int32_t* decoded1,
- int count);
-#endif
diff --git a/plugins/demac/libdemac/demac.h b/plugins/demac/libdemac/demac.h
deleted file mode 100644
index 9a699a6e..00000000
--- a/plugins/demac/libdemac/demac.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: demac.h 19743 2009-01-10 21:10:56Z zagor $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-#ifndef _APE_DECODER_H
-#define _APE_DECODER_H
-
-#include <inttypes.h>
-#include "parser.h"
-
-void init_frame_decoder(struct ape_ctx_t* ape_ctx,
- unsigned char* inbuffer, int* firstbyte,
- int* bytesconsumed);
-
-int decode_chunk(struct ape_ctx_t* ape_ctx,
- unsigned char* inbuffer, int* firstbyte,
- int* bytesconsumed,
- int32_t* decoded0, int32_t* decoded1,
- int count);
-
-uint32_t ape_initcrc(void);
-uint32_t ape_updatecrc(unsigned char *block, int count, uint32_t crc);
-uint32_t ape_finishcrc(uint32_t crc);
-
-#endif
diff --git a/plugins/demac/libdemac/demac_config.h b/plugins/demac/libdemac/demac_config.h
deleted file mode 100644
index 8f3ad1e0..00000000
--- a/plugins/demac/libdemac/demac_config.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: demac_config.h 19199 2008-11-24 18:40:49Z amiconn $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-#ifndef _DEMAC_CONFIG_H
-#define _DEMAC_CONFIG_H
-
-/* Build-time choices for libdemac.
- * Note that this file is included by both .c and .S files. */
-
-#ifdef ROCKBOX
-
-#include "config.h"
-
-#ifndef __ASSEMBLER__
-#include "codeclib.h"
-#include <codecs.h>
-#endif
-
-#define APE_OUTPUT_DEPTH 29
-
-/* On ARMv4, using 32 bit ints for the filters is faster. */
-#if defined(CPU_ARM) && (ARM_ARCH == 4)
-#define FILTER_BITS 32
-#endif
-
-#if CONFIG_CPU == PP5002
-/* Code in IRAM for speed, not enough IRAM for the insane filter buffer. */
-#define ICODE_SECTION_DEMAC_ARM .icode
-#define ICODE_ATTR_DEMAC ICODE_ATTR
-#define IBSS_ATTR_DEMAC_INSANEBUF
-#elif CONFIG_CPU == PP5020
-/* Not enough IRAM for the insane filter buffer. */
-#define ICODE_SECTION_DEMAC_ARM .text
-#define ICODE_ATTR_DEMAC
-#define IBSS_ATTR_DEMAC_INSANEBUF
-#else
-#define ICODE_SECTION_DEMAC_ARM .text
-#define ICODE_ATTR_DEMAC
-#define IBSS_ATTR_DEMAC_INSANEBUF IBSS_ATTR
-#endif
-
-#else /* !ROCKBOX */
-
-#define APE_OUTPUT_DEPTH (ape_ctx->bps)
-
-#define IBSS_ATTR
-#define IBSS_ATTR_DEMAC_INSANEBUF
-#define ICONST_ATTR
-#define ICODE_ATTR
-#define ICODE_ATTR_DEMAC
-
-/* Use to give gcc hints on which branch is most likely taken */
-#if defined(__GNUC__) && __GNUC__ >= 3
-#define LIKELY(x) __builtin_expect(!!(x), 1)
-#define UNLIKELY(x) __builtin_expect(!!(x), 0)
-#else
-#define LIKELY(x) (x)
-#define UNLIKELY(x) (x)
-#endif
-
-#endif /* !ROCKBOX */
-
-/* Defaults */
-
-#ifndef UDIV32
-#define UDIV32(a, b) (a / b)
-#endif
-
-#ifndef FILTER_HISTORY_SIZE
-#define FILTER_HISTORY_SIZE 512
-#endif
-
-#ifndef PREDICTOR_HISTORY_SIZE
-#define PREDICTOR_HISTORY_SIZE 512
-#endif
-
-#ifndef FILTER_BITS
-#define FILTER_BITS 16
-#endif
-
-
-#ifndef __ASSEMBLER__
-#include <inttypes.h>
-#if FILTER_BITS == 32
-typedef int32_t filter_int;
-#elif FILTER_BITS == 16
-typedef int16_t filter_int;
-#endif
-#endif
-
-#endif /* _DEMAC_CONFIG_H */
diff --git a/plugins/demac/libdemac/entropy.c b/plugins/demac/libdemac/entropy.c
deleted file mode 100644
index df6bb7fd..00000000
--- a/plugins/demac/libdemac/entropy.c
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: entropy.c 19552 2008-12-21 23:49:02Z amiconn $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-#include <inttypes.h>
-#include <string.h>
-
-#include "parser.h"
-#include "entropy.h"
-#include "demac_config.h"
-
-#define MODEL_ELEMENTS 64
-
-/*
- The following counts arrays for use with the range decoder are
- hard-coded in the Monkey's Audio decoder.
-*/
-
-static const int counts_3970[65] ICONST_ATTR =
-{
- 0,14824,28224,39348,47855,53994,58171,60926,
- 62682,63786,64463,64878,65126,65276,65365,65419,
- 65450,65469,65480,65487,65491,65493,65494,65495,
- 65496,65497,65498,65499,65500,65501,65502,65503,
- 65504,65505,65506,65507,65508,65509,65510,65511,
- 65512,65513,65514,65515,65516,65517,65518,65519,
- 65520,65521,65522,65523,65524,65525,65526,65527,
- 65528,65529,65530,65531,65532,65533,65534,65535,
- 65536
-};
-
-/* counts_diff_3970[i] = counts_3970[i+1] - counts_3970[i] */
-static const int counts_diff_3970[64] ICONST_ATTR =
-{
- 14824,13400,11124,8507,6139,4177,2755,1756,
- 1104,677,415,248,150,89,54,31,
- 19,11,7,4,2,1,1,1,
- 1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1
-};
-
-static const int counts_3980[65] ICONST_ATTR =
-{
- 0,19578,36160,48417,56323,60899,63265,64435,
- 64971,65232,65351,65416,65447,65466,65476,65482,
- 65485,65488,65490,65491,65492,65493,65494,65495,
- 65496,65497,65498,65499,65500,65501,65502,65503,
- 65504,65505,65506,65507,65508,65509,65510,65511,
- 65512,65513,65514,65515,65516,65517,65518,65519,
- 65520,65521,65522,65523,65524,65525,65526,65527,
- 65528,65529,65530,65531,65532,65533,65534,65535,
- 65536
-};
-
-/* counts_diff_3980[i] = counts_3980[i+1] - counts_3980[i] */
-
-static const int counts_diff_3980[64] ICONST_ATTR =
-{
- 19578,16582,12257,7906,4576,2366,1170,536,
- 261,119,65,31,19,10,6,3,
- 3,2,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1
-};
-
-/*
-
-Range decoder adapted from rangecod.c included in:
-
- http://www.compressconsult.com/rangecoder/rngcod13.zip
-
- rangecod.c range encoding
-
- (c) Michael Schindler
- 1997, 1998, 1999, 2000
- http://www.compressconsult.com/
- michael@compressconsult.com
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
-
-The encoding functions were removed, and functions turned into "static
-inline" functions. Some minor cosmetic changes were made (e.g. turning
-pre-processor symbols into upper-case, removing the rc parameter from
-each function (and the RNGC macro)).
-
-*/
-
-/* BITSTREAM READING FUNCTIONS */
-
-/* We deal with the input data one byte at a time - to ensure
- functionality on CPUs of any endianness regardless of any requirements
- for aligned reads.
-*/
-
-static unsigned char* bytebuffer IBSS_ATTR;
-static int bytebufferoffset IBSS_ATTR;
-
-static inline void skip_byte(void)
-{
- bytebufferoffset--;
- bytebuffer += bytebufferoffset & 4;
- bytebufferoffset &= 3;
-}
-
-static inline int read_byte(void)
-{
- int ch = bytebuffer[bytebufferoffset];
-
- skip_byte();
-
- return ch;
-}
-
-/* RANGE DECODING FUNCTIONS */
-
-/* SIZE OF RANGE ENCODING CODE VALUES. */
-
-#define CODE_BITS 32
-#define TOP_VALUE ((unsigned int)1 << (CODE_BITS-1))
-#define SHIFT_BITS (CODE_BITS - 9)
-#define EXTRA_BITS ((CODE_BITS-2) % 8 + 1)
-#define BOTTOM_VALUE (TOP_VALUE >> 8)
-
-struct rangecoder_t
-{
- uint32_t low; /* low end of interval */
- uint32_t range; /* length of interval */
- uint32_t help; /* bytes_to_follow resp. intermediate value */
- unsigned int buffer; /* buffer for input/output */
-};
-
-static struct rangecoder_t rc IBSS_ATTR;
-
-/* Start the decoder */
-static inline void range_start_decoding(void)
-{
- rc.buffer = read_byte();
- rc.low = rc.buffer >> (8 - EXTRA_BITS);
- rc.range = (uint32_t) 1 << EXTRA_BITS;
-}
-
-static inline void range_dec_normalize(void)
-{
- while (rc.range <= BOTTOM_VALUE)
- {
- rc.buffer = (rc.buffer << 8) | read_byte();
- rc.low = (rc.low << 8) | ((rc.buffer >> 1) & 0xff);
- rc.range <<= 8;
- }
-}
-
-/* Calculate culmulative frequency for next symbol. Does NO update!*/
-/* tot_f is the total frequency */
-/* or: totf is (code_value)1<<shift */
-/* returns the culmulative frequency */
-static inline int range_decode_culfreq(int tot_f)
-{
- range_dec_normalize();
- rc.help = UDIV32(rc.range, tot_f);
- return UDIV32(rc.low, rc.help);
-}
-
-static inline int range_decode_culshift(int shift)
-{
- range_dec_normalize();
- rc.help = rc.range >> shift;
- return UDIV32(rc.low, rc.help);
-}
-
-
-/* Update decoding state */
-/* sy_f is the interval length (frequency of the symbol) */
-/* lt_f is the lower end (frequency sum of < symbols) */
-static inline void range_decode_update(int sy_f, int lt_f)
-{
- rc.low -= rc.help * lt_f;
- rc.range = rc.help * sy_f;
-}
-
-
-/* Decode a byte/short without modelling */
-static inline unsigned char decode_byte(void)
-{ int tmp = range_decode_culshift(8);
- range_decode_update( 1,tmp);
- return tmp;
-}
-
-static inline int short range_decode_short(void)
-{ int tmp = range_decode_culshift(16);
- range_decode_update( 1,tmp);
- return tmp;
-}
-
-/* Decode n bits (n <= 16) without modelling - based on range_decode_short */
-static inline int range_decode_bits(int n)
-{ int tmp = range_decode_culshift(n);
- range_decode_update( 1,tmp);
- return tmp;
-}
-
-
-/* Finish decoding */
-static inline void range_done_decoding(void)
-{ range_dec_normalize(); /* normalize to use up all bytes */
-}
-
-/*
- range_get_symbol_* functions based on main decoding loop in simple_d.c from
- http://www.compressconsult.com/rangecoder/rngcod13.zip
- (c) Michael Schindler
-*/
-
-static inline int range_get_symbol_3980(void)
-{
- int symbol, cf;
-
- cf = range_decode_culshift(16);
-
- /* figure out the symbol inefficiently; a binary search would be much better */
- for (symbol = 0; counts_3980[symbol+1] <= cf; symbol++);
-
- range_decode_update(counts_diff_3980[symbol],counts_3980[symbol]);
-
- return symbol;
-}
-
-static inline int range_get_symbol_3970(void)
-{
- int symbol, cf;
-
- cf = range_decode_culshift(16);
-
- /* figure out the symbol inefficiently; a binary search would be much better */
- for (symbol = 0; counts_3970[symbol+1] <= cf; symbol++);
-
- range_decode_update(counts_diff_3970[symbol],counts_3970[symbol]);
-
- return symbol;
-}
-
-/* MAIN DECODING FUNCTIONS */
-
-struct rice_t
-{
- uint32_t k;
- uint32_t ksum;
-};
-
-static struct rice_t riceX IBSS_ATTR;
-static struct rice_t riceY IBSS_ATTR;
-
-static inline void update_rice(struct rice_t* rice, int x)
-{
- rice->ksum += ((x + 1) / 2) - ((rice->ksum + 16) >> 5);
-
- if (UNLIKELY(rice->k == 0)) {
- rice->k = 1;
- } else {
- uint32_t lim = 1 << (rice->k + 4);
- if (UNLIKELY(rice->ksum < lim)) {
- rice->k--;
- } else if (UNLIKELY(rice->ksum >= 2 * lim)) {
- rice->k++;
- }
- }
-}
-
-static inline int entropy_decode3980(struct rice_t* rice)
-{
- int base, x, pivot, overflow;
-
- pivot = rice->ksum >> 5;
- if (UNLIKELY(pivot == 0))
- pivot=1;
-
- overflow = range_get_symbol_3980();
-
- if (UNLIKELY(overflow == (MODEL_ELEMENTS-1))) {
- overflow = range_decode_short() << 16;
- overflow |= range_decode_short();
- }
-
- if (pivot >= 0x10000) {
- /* Codepath for 24-bit streams */
- int nbits, lo_bits, base_hi, base_lo;
-
- /* Count the number of bits in pivot */
- nbits = 17; /* We know there must be at least 17 bits */
- while ((pivot >> nbits) > 0) { nbits++; }
-
- /* base_lo is the low (nbits-16) bits of base
- base_hi is the high 16 bits of base
- */
- lo_bits = (nbits - 16);
-
- base_hi = range_decode_culfreq((pivot >> lo_bits) + 1);
- range_decode_update(1, base_hi);
-
- base_lo = range_decode_culshift(lo_bits);
- range_decode_update(1, base_lo);
-
- base = (base_hi << lo_bits) + base_lo;
- } else {
- /* Codepath for 16-bit streams */
- base = range_decode_culfreq(pivot);
- range_decode_update(1, base);
- }
-
- x = base + (overflow * pivot);
- update_rice(rice, x);
-
- /* Convert to signed */
- if (x & 1)
- return (x >> 1) + 1;
- else
- return -(x >> 1);
-}
-
-
-static inline int entropy_decode3970(struct rice_t* rice)
-{
- int x, tmpk;
-
- int overflow = range_get_symbol_3970();
-
- if (UNLIKELY(overflow == (MODEL_ELEMENTS - 1))) {
- tmpk = range_decode_bits(5);
- overflow = 0;
- } else {
- tmpk = (rice->k < 1) ? 0 : rice->k - 1;
- }
-
- if (tmpk <= 16) {
- x = range_decode_bits(tmpk);
- } else {
- x = range_decode_short();
- x |= (range_decode_bits(tmpk - 16) << 16);
- }
- x += (overflow << tmpk);
-
- update_rice(rice, x);
-
- /* Convert to signed */
- if (x & 1)
- return (x >> 1) + 1;
- else
- return -(x >> 1);
-}
-
-void init_entropy_decoder(struct ape_ctx_t* ape_ctx,
- unsigned char* inbuffer, int* firstbyte,
- int* bytesconsumed)
-{
- bytebuffer = inbuffer;
- bytebufferoffset = *firstbyte;
-
- /* Read the CRC */
- ape_ctx->CRC = read_byte();
- ape_ctx->CRC = (ape_ctx->CRC << 8) | read_byte();
- ape_ctx->CRC = (ape_ctx->CRC << 8) | read_byte();
- ape_ctx->CRC = (ape_ctx->CRC << 8) | read_byte();
-
- /* Read the frame flags if they exist */
- ape_ctx->frameflags = 0;
- if ((ape_ctx->fileversion > 3820) && (ape_ctx->CRC & 0x80000000)) {
- ape_ctx->CRC &= ~0x80000000;
-
- ape_ctx->frameflags = read_byte();
- ape_ctx->frameflags = (ape_ctx->frameflags << 8) | read_byte();
- ape_ctx->frameflags = (ape_ctx->frameflags << 8) | read_byte();
- ape_ctx->frameflags = (ape_ctx->frameflags << 8) | read_byte();
- }
- /* Keep a count of the blocks decoded in this frame */
- ape_ctx->blocksdecoded = 0;
-
- /* Initialise the rice structs */
- riceX.k = 10;
- riceX.ksum = (1 << riceX.k) * 16;
- riceY.k = 10;
- riceY.ksum = (1 << riceY.k) * 16;
-
- /* The first 8 bits of input are ignored. */
- skip_byte();
-
- range_start_decoding();
-
- /* Return the new state of the buffer */
- *bytesconsumed = (intptr_t)bytebuffer - (intptr_t)inbuffer;
- *firstbyte = bytebufferoffset;
-}
-
-void ICODE_ATTR_DEMAC entropy_decode(struct ape_ctx_t* ape_ctx,
- unsigned char* inbuffer, int* firstbyte,
- int* bytesconsumed,
- int32_t* decoded0, int32_t* decoded1,
- int blockstodecode)
-{
- bytebuffer = inbuffer;
- bytebufferoffset = *firstbyte;
-
- ape_ctx->blocksdecoded += blockstodecode;
-
- if ((ape_ctx->frameflags & APE_FRAMECODE_LEFT_SILENCE)
- && ((ape_ctx->frameflags & APE_FRAMECODE_RIGHT_SILENCE)
- || (decoded1 == NULL))) {
- /* We are pure silence, just memset the output buffer. */
- memset(decoded0, 0, blockstodecode * sizeof(int32_t));
- if (decoded1 != NULL)
- memset(decoded1, 0, blockstodecode * sizeof(int32_t));
- } else {
- if (ape_ctx->fileversion > 3970) {
- while (LIKELY(blockstodecode--)) {
- *(decoded0++) = entropy_decode3980(&riceY);
- if (decoded1 != NULL)
- *(decoded1++) = entropy_decode3980(&riceX);
- }
- } else {
- while (LIKELY(blockstodecode--)) {
- *(decoded0++) = entropy_decode3970(&riceY);
- if (decoded1 != NULL)
- *(decoded1++) = entropy_decode3970(&riceX);
- }
- }
- }
-
- if (ape_ctx->blocksdecoded == ape_ctx->currentframeblocks)
- {
- range_done_decoding();
- }
-
- /* Return the new state of the buffer */
- *bytesconsumed = bytebuffer - inbuffer;
- *firstbyte = bytebufferoffset;
-}
diff --git a/plugins/demac/libdemac/entropy.h b/plugins/demac/libdemac/entropy.h
deleted file mode 100644
index ffef6211..00000000
--- a/plugins/demac/libdemac/entropy.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: entropy.h 19236 2008-11-26 18:01:18Z amiconn $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-#ifndef _APE_ENTROPY_H
-#define _APE_ENTROPY_H
-
-#include <inttypes.h>
-
-void init_entropy_decoder(struct ape_ctx_t* ape_ctx,
- unsigned char* inbuffer, int* firstbyte,
- int* bytesconsumed);
-
-void entropy_decode(struct ape_ctx_t* ape_ctx,
- unsigned char* inbuffer, int* firstbyte,
- int* bytesconsumed,
- int32_t* decoded0, int32_t* decoded1,
- int blockstodecode);
-
-#endif
diff --git a/plugins/demac/libdemac/filter.c b/plugins/demac/libdemac/filter.c
deleted file mode 100644
index 9f1abfb8..00000000
--- a/plugins/demac/libdemac/filter.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: filter.c 19556 2008-12-22 08:33:49Z amiconn $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-#include <string.h>
-#include <inttypes.h>
-
-#include "demac.h"
-#include "filter.h"
-#include "demac_config.h"
-
-#if FILTER_BITS == 32
-
-#if defined(CPU_ARM) && (ARM_ARCH == 4)
-#include "vector_math32_armv4.h"
-#else
-#include "vector_math_generic.h"
-#endif
-
-#else /* FILTER_BITS == 16 */
-
-#ifdef CPU_COLDFIRE
-#include "vector_math16_cf.h"
-#elif defined(CPU_ARM) && (ARM_ARCH >= 6)
-#include "vector_math16_armv6.h"
-#elif defined(CPU_ARM) && (ARM_ARCH >= 5)
-/* Assume all our ARMv5 targets are ARMv5te(j) */
-#include "vector_math16_armv5te.h"
-#else
-#include "vector_math_generic.h"
-#endif
-
-#endif /* FILTER_BITS */
-
-struct filter_t {
- filter_int* coeffs; /* ORDER entries */
-
- /* We store all the filter delays in a single buffer */
- filter_int* history_end;
-
- filter_int* delay;
- filter_int* adaptcoeffs;
-
- int avg;
-};
-
-/* We name the functions according to the ORDER and FRACBITS
- pre-processor symbols and build multiple .o files from this .c file
- - this increases code-size but gives the compiler more scope for
- optimising the individual functions, as well as replacing a lot of
- variables with constants.
-*/
-
-#if FRACBITS == 11
- #if ORDER == 16
- #define INIT_FILTER init_filter_16_11
- #define APPLY_FILTER apply_filter_16_11
- #elif ORDER == 64
- #define INIT_FILTER init_filter_64_11
- #define APPLY_FILTER apply_filter_64_11
- #endif
-#elif FRACBITS == 13
- #define INIT_FILTER init_filter_256_13
- #define APPLY_FILTER apply_filter_256_13
-#elif FRACBITS == 10
- #define INIT_FILTER init_filter_32_10
- #define APPLY_FILTER apply_filter_32_10
-#elif FRACBITS == 15
- #define INIT_FILTER init_filter_1280_15
- #define APPLY_FILTER apply_filter_1280_15
-#endif
-
-/* Some macros to handle the fixed-point stuff */
-
-/* Convert from (32-FRACBITS).FRACBITS fixed-point format to an
- integer (rounding to nearest). */
-#define FP_HALF (1 << (FRACBITS - 1)) /* 0.5 in fixed-point format. */
-#define FP_TO_INT(x) ((x + FP_HALF) >> FRACBITS) /* round(x) */
-
-#if defined(CPU_ARM) && (ARM_ARCH >= 6)
-#define SATURATE(x) ({int __res; asm("ssat %0, #16, %1" : "=r"(__res) : "r"(x)); __res; })
-#else
-#define SATURATE(x) (LIKELY((x) == (int16_t)(x)) ? (x) : ((x) >> 31) ^ 0x7FFF)
-#endif
-
-/* Apply the filter with state f to count entries in data[] */
-
-static void ICODE_ATTR_DEMAC do_apply_filter_3980(struct filter_t* f,
- int32_t* data, int count)
-{
- int res;
- int absres;
-
-#ifdef PREPARE_SCALARPRODUCT
- PREPARE_SCALARPRODUCT
-#endif
-
- while(LIKELY(count--))
- {
- res = FP_TO_INT(scalarproduct(f->coeffs, f->delay - ORDER));
-
- if (LIKELY(*data != 0)) {
- if (*data < 0)
- vector_add(f->coeffs, f->adaptcoeffs - ORDER);
- else
- vector_sub(f->coeffs, f->adaptcoeffs - ORDER);
- }
-
- res += *data;
-
- *data++ = res;
-
- /* Update the output history */
- *f->delay++ = SATURATE(res);
-
- /* Version 3.98 and later files */
-
- /* Update the adaption coefficients */
- absres = (res < 0 ? -res : res);
-
- if (UNLIKELY(absres > 3 * f->avg))
- *f->adaptcoeffs = ((res >> 25) & 64) - 32;
- else if (3 * absres > 4 * f->avg)
- *f->adaptcoeffs = ((res >> 26) & 32) - 16;
- else if (LIKELY(absres > 0))
- *f->adaptcoeffs = ((res >> 27) & 16) - 8;
- else
- *f->adaptcoeffs = 0;
-
- f->avg += (absres - f->avg) / 16;
-
- f->adaptcoeffs[-1] >>= 1;
- f->adaptcoeffs[-2] >>= 1;
- f->adaptcoeffs[-8] >>= 1;
-
- f->adaptcoeffs++;
-
- /* Have we filled the history buffer? */
- if (UNLIKELY(f->delay == f->history_end)) {
- memmove(f->coeffs + ORDER, f->delay - (ORDER*2),
- (ORDER*2) * sizeof(filter_int));
- f->adaptcoeffs = f->coeffs + ORDER*2;
- f->delay = f->coeffs + ORDER*3;
- }
- }
-}
-
-static void ICODE_ATTR_DEMAC do_apply_filter_3970(struct filter_t* f,
- int32_t* data, int count)
-{
- int res;
-
-#ifdef PREPARE_SCALARPRODUCT
- PREPARE_SCALARPRODUCT
-#endif
-
- while(LIKELY(count--))
- {
- res = FP_TO_INT(scalarproduct(f->coeffs, f->delay - ORDER));
-
- if (LIKELY(*data != 0)) {
- if (*data < 0)
- vector_add(f->coeffs, f->adaptcoeffs - ORDER);
- else
- vector_sub(f->coeffs, f->adaptcoeffs - ORDER);
- }
-
- /* Convert res from (32-FRACBITS).FRACBITS fixed-point format to an
- integer (rounding to nearest) and add the input value to
- it */
- res += *data;
-
- *data++ = res;
-
- /* Update the output history */
- *f->delay++ = SATURATE(res);
-
- /* Version ??? to < 3.98 files (untested) */
- f->adaptcoeffs[0] = (res == 0) ? 0 : ((res >> 28) & 8) - 4;
- f->adaptcoeffs[-4] >>= 1;
- f->adaptcoeffs[-8] >>= 1;
-
- f->adaptcoeffs++;
-
- /* Have we filled the history buffer? */
- if (UNLIKELY(f->delay == f->history_end)) {
- memmove(f->coeffs + ORDER, f->delay - (ORDER*2),
- (ORDER*2) * sizeof(filter_int));
- f->adaptcoeffs = f->coeffs + ORDER*2;
- f->delay = f->coeffs + ORDER*3;
- }
- }
-}
-
-static struct filter_t filter0 IBSS_ATTR;
-static struct filter_t filter1 IBSS_ATTR;
-
-static void do_init_filter(struct filter_t* f, filter_int* buf)
-{
- f->coeffs = buf;
- f->history_end = buf + ORDER*3 + FILTER_HISTORY_SIZE;
-
- /* Init pointers */
- f->adaptcoeffs = f->coeffs + ORDER*2;
- f->delay = f->coeffs + ORDER*3;
-
- /* Zero coefficients and history buffer */
- memset(f->coeffs, 0, ORDER*3 * sizeof(filter_int));
-
- /* Zero the running average */
- f->avg = 0;
-}
-
-void INIT_FILTER(filter_int* buf)
-{
- do_init_filter(&filter0, buf);
- do_init_filter(&filter1, buf + ORDER*3 + FILTER_HISTORY_SIZE);
-}
-
-void ICODE_ATTR_DEMAC APPLY_FILTER(int fileversion, int32_t* data0,
- int32_t* data1, int count)
-{
- if (fileversion >= 3980) {
- do_apply_filter_3980(&filter0, data0, count);
- if (data1 != NULL)
- do_apply_filter_3980(&filter1, data1, count);
- } else {
- do_apply_filter_3970(&filter0, data0, count);
- if (data1 != NULL)
- do_apply_filter_3970(&filter1, data1, count);
- }
-}
diff --git a/plugins/demac/libdemac/filter.h b/plugins/demac/libdemac/filter.h
deleted file mode 100644
index 946c76c5..00000000
--- a/plugins/demac/libdemac/filter.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: filter.h 19236 2008-11-26 18:01:18Z amiconn $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-#ifndef _APE_FILTER_H
-#define _APE_FILTER_H
-
-#include "demac_config.h"
-
-void init_filter_16_11(filter_int* buf);
-void apply_filter_16_11(int fileversion, int32_t* decoded0,
- int32_t* decoded1, int count);
-
-void init_filter_64_11(filter_int* buf);
-void apply_filter_64_11(int fileversion, int32_t* decoded0,
- int32_t* decoded1, int count);
-
-void init_filter_32_10(filter_int* buf);
-void apply_filter_32_10(int fileversion, int32_t* decoded0,
- int32_t* decoded1, int count);
-
-void init_filter_256_13(filter_int* buf);
-void apply_filter_256_13(int fileversion, int32_t* decoded0,
- int32_t* decoded1, int count);
-
-void init_filter_1280_15(filter_int* buf);
-void apply_filter_1280_15(int fileversion, int32_t* decoded0,
- int32_t* decoded1, int count);
-
-#endif
diff --git a/plugins/demac/libdemac/filter_1280_15.c b/plugins/demac/libdemac/filter_1280_15.c
deleted file mode 100644
index d7916385..00000000
--- a/plugins/demac/libdemac/filter_1280_15.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: filter_1280_15.c 19743 2009-01-10 21:10:56Z zagor $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-#define ORDER 1280
-#define FRACBITS 15
-#include "filter.c"
diff --git a/plugins/demac/libdemac/filter_16_11.c b/plugins/demac/libdemac/filter_16_11.c
deleted file mode 100644
index b33e09eb..00000000
--- a/plugins/demac/libdemac/filter_16_11.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: filter_16_11.c 19743 2009-01-10 21:10:56Z zagor $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-#define ORDER 16
-#define FRACBITS 11
-#include "filter.c"
diff --git a/plugins/demac/libdemac/filter_256_13.c b/plugins/demac/libdemac/filter_256_13.c
deleted file mode 100644
index 2dd9d06d..00000000
--- a/plugins/demac/libdemac/filter_256_13.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: filter_256_13.c 19743 2009-01-10 21:10:56Z zagor $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-#define ORDER 256
-#define FRACBITS 13
-#include "filter.c"
diff --git a/plugins/demac/libdemac/filter_32_10.c b/plugins/demac/libdemac/filter_32_10.c
deleted file mode 100644
index bdafb876..00000000
--- a/plugins/demac/libdemac/filter_32_10.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: filter_32_10.c 19743 2009-01-10 21:10:56Z zagor $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-#define ORDER 32
-#define FRACBITS 10
-#include "filter.c"
diff --git a/plugins/demac/libdemac/filter_64_11.c b/plugins/demac/libdemac/filter_64_11.c
deleted file mode 100644
index 26c85f19..00000000
--- a/plugins/demac/libdemac/filter_64_11.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: filter_64_11.c 19743 2009-01-10 21:10:56Z zagor $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-#define ORDER 64
-#define FRACBITS 11
-#include "filter.c"
diff --git a/plugins/demac/libdemac/parser.c b/plugins/demac/libdemac/parser.c
deleted file mode 100644
index 948640d7..00000000
--- a/plugins/demac/libdemac/parser.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: parser.c 13601 2007-06-09 00:58:15Z dave $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-#include <inttypes.h>
-#include <string.h>
-#ifndef ROCKBOX
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#endif
-
-#include "parser.h"
-
-#ifdef APE_MAX
-#undef APE_MAX
-#endif
-#define APE_MAX(a,b) ((a)>(b)?(a):(b))
-
-
-static inline int16_t get_int16(unsigned char* buf)
-{
- return(buf[0] | (buf[1] << 8));
-}
-
-static inline uint16_t get_uint16(unsigned char* buf)
-{
- return(buf[0] | (buf[1] << 8));
-}
-
-static inline uint32_t get_uint32(unsigned char* buf)
-{
- return(buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24));
-}
-
-
-int ape_parseheaderbuf(unsigned char* buf, struct ape_ctx_t* ape_ctx)
-{
- unsigned char* header;
-
- memset(ape_ctx,0,sizeof(struct ape_ctx_t));
- /* TODO: Skip any leading junk such as id3v2 tags */
- ape_ctx->junklength = 0;
-
- memcpy(ape_ctx->magic, buf, 4);
- if (memcmp(ape_ctx->magic,"MAC ",4)!=0)
- {
- return -1;
- }
-
- ape_ctx->fileversion = get_int16(buf + 4);
-
- if (ape_ctx->fileversion >= 3980)
- {
- ape_ctx->padding1 = get_int16(buf + 6);
- ape_ctx->descriptorlength = get_uint32(buf + 8);
- ape_ctx->headerlength = get_uint32(buf + 12);
- ape_ctx->seektablelength = get_uint32(buf + 16);
- ape_ctx->wavheaderlength = get_uint32(buf + 20);
- ape_ctx->audiodatalength = get_uint32(buf + 24);
- ape_ctx->audiodatalength_high = get_uint32(buf + 28);
- ape_ctx->wavtaillength = get_uint32(buf + 32);
- memcpy(ape_ctx->md5, buf + 36, 16);
-
- header = buf + ape_ctx->descriptorlength;
-
- /* Read header data */
- ape_ctx->compressiontype = get_uint16(header + 0);
- ape_ctx->formatflags = get_uint16(header + 2);
- ape_ctx->blocksperframe = get_uint32(header + 4);
- ape_ctx->finalframeblocks = get_uint32(header + 8);
- ape_ctx->totalframes = get_uint32(header + 12);
- ape_ctx->bps = get_uint16(header + 16);
- ape_ctx->channels = get_uint16(header + 18);
- ape_ctx->samplerate = get_uint32(header + 20);
-
- ape_ctx->seektablefilepos = ape_ctx->junklength +
- ape_ctx->descriptorlength +
- ape_ctx->headerlength;
-
- ape_ctx->firstframe = ape_ctx->junklength + ape_ctx->descriptorlength +
- ape_ctx->headerlength + ape_ctx->seektablelength +
- ape_ctx->wavheaderlength;
- } else {
- ape_ctx->headerlength = 32;
- ape_ctx->compressiontype = get_uint16(buf + 6);
- ape_ctx->formatflags = get_uint16(buf + 8);
- ape_ctx->channels = get_uint16(buf + 10);
- ape_ctx->samplerate = get_uint32(buf + 12);
- ape_ctx->wavheaderlength = get_uint32(buf + 16);
- ape_ctx->totalframes = get_uint32(buf + 24);
- ape_ctx->finalframeblocks = get_uint32(buf + 28);
-
- if (ape_ctx->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL)
- {
- ape_ctx->headerlength += 4;
- }
-
- if (ape_ctx->formatflags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS)
- {
- ape_ctx->seektablelength = get_uint32(buf + ape_ctx->headerlength);
- ape_ctx->seektablelength *= sizeof(int32_t);
- ape_ctx->headerlength += 4;
- } else {
- ape_ctx->seektablelength = ape_ctx->totalframes * sizeof(int32_t);
- }
-
- if (ape_ctx->formatflags & MAC_FORMAT_FLAG_8_BIT)
- ape_ctx->bps = 8;
- else if (ape_ctx->formatflags & MAC_FORMAT_FLAG_24_BIT)
- ape_ctx->bps = 24;
- else
- ape_ctx->bps = 16;
-
- if (ape_ctx->fileversion >= 3950)
- ape_ctx->blocksperframe = 73728 * 4;
- else if ((ape_ctx->fileversion >= 3900) || (ape_ctx->fileversion >= 3800 && ape_ctx->compressiontype >= 4000))
- ape_ctx->blocksperframe = 73728;
- else
- ape_ctx->blocksperframe = 9216;
-
- ape_ctx->seektablefilepos = ape_ctx->junklength + ape_ctx->headerlength +
- ape_ctx->wavheaderlength;
-
- ape_ctx->firstframe = ape_ctx->junklength + ape_ctx->headerlength +
- ape_ctx->wavheaderlength + ape_ctx->seektablelength;
- }
-
- ape_ctx->totalsamples = ape_ctx->finalframeblocks;
- if (ape_ctx->totalframes > 1)
- ape_ctx->totalsamples += ape_ctx->blocksperframe * (ape_ctx->totalframes-1);
-
- ape_ctx->numseekpoints = APE_MAX(ape_ctx->maxseekpoints,
- ape_ctx->seektablelength / sizeof(int32_t));
-
- return 0;
-}
-
-
-#ifndef ROCKBOX
-/* Helper functions */
-
-static int read_uint16(int fd, uint16_t* x)
-{
- unsigned char tmp[2];
- int n;
-
- n = read(fd,tmp,2);
-
- if (n != 2)
- return -1;
-
- *x = tmp[0] | (tmp[1] << 8);
-
- return 0;
-}
-
-static int read_int16(int fd, int16_t* x)
-{
- return read_uint16(fd, (uint16_t*)x);
-}
-
-static int read_uint32(int fd, uint32_t* x)
-{
- unsigned char tmp[4];
- int n;
-
- n = read(fd,tmp,4);
-
- if (n != 4)
- return -1;
-
- *x = tmp[0] | (tmp[1] << 8) | (tmp[2] << 16) | (tmp[3] << 24);
-
- return 0;
-}
-
-int ape_parseheader(int fd, struct ape_ctx_t* ape_ctx)
-{
- int i,n;
-
- /* TODO: Skip any leading junk such as id3v2 tags */
- ape_ctx->junklength = 0;
-
- lseek(fd,ape_ctx->junklength,SEEK_SET);
-
- n = read(fd,&ape_ctx->magic,4);
- if (n != 4) return -1;
-
- if (memcmp(ape_ctx->magic,"MAC ",4)!=0)
- {
- return -1;
- }
-
- if (read_int16(fd,&ape_ctx->fileversion) < 0)
- return -1;
-
- if (ape_ctx->fileversion >= 3980)
- {
- if (read_int16(fd,&ape_ctx->padding1) < 0)
- return -1;
- if (read_uint32(fd,&ape_ctx->descriptorlength) < 0)
- return -1;
- if (read_uint32(fd,&ape_ctx->headerlength) < 0)
- return -1;
- if (read_uint32(fd,&ape_ctx->seektablelength) < 0)
- return -1;
- if (read_uint32(fd,&ape_ctx->wavheaderlength) < 0)
- return -1;
- if (read_uint32(fd,&ape_ctx->audiodatalength) < 0)
- return -1;
- if (read_uint32(fd,&ape_ctx->audiodatalength_high) < 0)
- return -1;
- if (read_uint32(fd,&ape_ctx->wavtaillength) < 0)
- return -1;
- if (read(fd,&ape_ctx->md5,16) != 16)
- return -1;
-
- /* Skip any unknown bytes at the end of the descriptor. This is for future
- compatibility */
- if (ape_ctx->descriptorlength > 52)
- lseek(fd,ape_ctx->descriptorlength - 52, SEEK_CUR);
-
- /* Read header data */
- if (read_uint16(fd,&ape_ctx->compressiontype) < 0)
- return -1;
- if (read_uint16(fd,&ape_ctx->formatflags) < 0)
- return -1;
- if (read_uint32(fd,&ape_ctx->blocksperframe) < 0)
- return -1;
- if (read_uint32(fd,&ape_ctx->finalframeblocks) < 0)
- return -1;
- if (read_uint32(fd,&ape_ctx->totalframes) < 0)
- return -1;
- if (read_uint16(fd,&ape_ctx->bps) < 0)
- return -1;
- if (read_uint16(fd,&ape_ctx->channels) < 0)
- return -1;
- if (read_uint32(fd,&ape_ctx->samplerate) < 0)
- return -1;
- } else {
- ape_ctx->descriptorlength = 0;
- ape_ctx->headerlength = 32;
-
- if (read_uint16(fd,&ape_ctx->compressiontype) < 0)
- return -1;
- if (read_uint16(fd,&ape_ctx->formatflags) < 0)
- return -1;
- if (read_uint16(fd,&ape_ctx->channels) < 0)
- return -1;
- if (read_uint32(fd,&ape_ctx->samplerate) < 0)
- return -1;
- if (read_uint32(fd,&ape_ctx->wavheaderlength) < 0)
- return -1;
- if (read_uint32(fd,&ape_ctx->wavtaillength) < 0)
- return -1;
- if (read_uint32(fd,&ape_ctx->totalframes) < 0)
- return -1;
- if (read_uint32(fd,&ape_ctx->finalframeblocks) < 0)
- return -1;
-
- if (ape_ctx->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL)
- {
- lseek(fd, 4, SEEK_CUR); /* Skip the peak level */
- ape_ctx->headerlength += 4;
- }
-
- if (ape_ctx->formatflags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS)
- {
- if (read_uint32(fd,&ape_ctx->seektablelength) < 0)
- return -1;
- ape_ctx->headerlength += 4;
- ape_ctx->seektablelength *= sizeof(int32_t);
- } else {
- ape_ctx->seektablelength = ape_ctx->totalframes * sizeof(int32_t);
- }
-
- if (ape_ctx->formatflags & MAC_FORMAT_FLAG_8_BIT)
- ape_ctx->bps = 8;
- else if (ape_ctx->formatflags & MAC_FORMAT_FLAG_24_BIT)
- ape_ctx->bps = 24;
- else
- ape_ctx->bps = 16;
-
- if (ape_ctx->fileversion >= 3950)
- ape_ctx->blocksperframe = 73728 * 4;
- else if ((ape_ctx->fileversion >= 3900) || (ape_ctx->fileversion >= 3800 && ape_ctx->compressiontype >= 4000))
- ape_ctx->blocksperframe = 73728;
- else
- ape_ctx->blocksperframe = 9216;
-
- /* Skip any stored wav header */
- if (!(ape_ctx->formatflags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER))
- {
- lseek(fd, ape_ctx->wavheaderlength, SEEK_CUR);
- }
- }
-
- ape_ctx->totalsamples = ape_ctx->finalframeblocks;
- if (ape_ctx->totalframes > 1)
- ape_ctx->totalsamples += ape_ctx->blocksperframe * (ape_ctx->totalframes-1);
-
- if (ape_ctx->seektablelength > 0)
- {
- ape_ctx->seektable = malloc(ape_ctx->seektablelength);
- if (ape_ctx->seektable == NULL)
- return -1;
- for (i=0; i < ape_ctx->seektablelength / sizeof(uint32_t); i++)
- {
- if (read_uint32(fd,&ape_ctx->seektable[i]) < 0)
- {
- free(ape_ctx->seektable);
- return -1;
- }
- }
- }
-
- ape_ctx->firstframe = ape_ctx->junklength + ape_ctx->descriptorlength +
- ape_ctx->headerlength + ape_ctx->seektablelength +
- ape_ctx->wavheaderlength;
-
- return 0;
-}
-
-void ape_dumpinfo(struct ape_ctx_t* ape_ctx)
-{
- int i;
-
- printf("Descriptor Block:\n\n");
- printf("magic = \"%c%c%c%c\"\n",
- ape_ctx->magic[0],ape_ctx->magic[1],
- ape_ctx->magic[2],ape_ctx->magic[3]);
- printf("fileversion = %d\n",ape_ctx->fileversion);
- printf("descriptorlength = %d\n",ape_ctx->descriptorlength);
- printf("headerlength = %d\n",ape_ctx->headerlength);
- printf("seektablelength = %d\n",ape_ctx->seektablelength);
- printf("wavheaderlength = %d\n",ape_ctx->wavheaderlength);
- printf("audiodatalength = %d\n",ape_ctx->audiodatalength);
- printf("audiodatalength_high = %d\n",ape_ctx->audiodatalength_high);
- printf("wavtaillength = %d\n",ape_ctx->wavtaillength);
- printf("md5 = ");
- for (i = 0; i < 16; i++)
- printf("%02x",ape_ctx->md5[i]);
- printf("\n");
-
- printf("\nHeader Block:\n\n");
-
- printf("compressiontype = %d\n",ape_ctx->compressiontype);
- printf("formatflags = %d\n",ape_ctx->formatflags);
- printf("blocksperframe = %d\n",ape_ctx->blocksperframe);
- printf("finalframeblocks = %d\n",ape_ctx->finalframeblocks);
- printf("totalframes = %d\n",ape_ctx->totalframes);
- printf("bps = %d\n",ape_ctx->bps);
- printf("channels = %d\n",ape_ctx->channels);
- printf("samplerate = %d\n",ape_ctx->samplerate);
-
- printf("\nSeektable\n\n");
- if ((ape_ctx->seektablelength / sizeof(uint32_t)) != ape_ctx->totalframes)
- {
- printf("No seektable\n");
- }
- else
- {
- for ( i = 0; i < ape_ctx->seektablelength / sizeof(uint32_t) ; i++)
- {
- if (i < ape_ctx->totalframes-1) {
- printf("%8d %d (%d bytes)\n",i,ape_ctx->seektable[i],ape_ctx->seektable[i+1]-ape_ctx->seektable[i]);
- } else {
- printf("%8d %d\n",i,ape_ctx->seektable[i]);
- }
- }
- }
- printf("\nCalculated information:\n\n");
- printf("junklength = %d\n",ape_ctx->junklength);
- printf("firstframe = %d\n",ape_ctx->firstframe);
- printf("totalsamples = %d\n",ape_ctx->totalsamples);
-}
-
-#endif /* !ROCKBOX */
diff --git a/plugins/demac/libdemac/parser.h b/plugins/demac/libdemac/parser.h
deleted file mode 100644
index 0cfa665d..00000000
--- a/plugins/demac/libdemac/parser.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: parser.h 19552 2008-12-21 23:49:02Z amiconn $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-#ifndef _APE_PARSER_H
-#define _APE_PARSER_H
-
-#include <inttypes.h>
-#include "demac_config.h"
-
-/* The earliest and latest file formats supported by this library */
-#define APE_MIN_VERSION 3970
-#define APE_MAX_VERSION 3990
-
-#define MAC_FORMAT_FLAG_8_BIT 1 // is 8-bit [OBSOLETE]
-#define MAC_FORMAT_FLAG_CRC 2 // uses the new CRC32 error detection [OBSOLETE]
-#define MAC_FORMAT_FLAG_HAS_PEAK_LEVEL 4 // uint32 nPeakLevel after the header [OBSOLETE]
-#define MAC_FORMAT_FLAG_24_BIT 8 // is 24-bit [OBSOLETE]
-#define MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS 16 // has the number of seek elements after the peak level
-#define MAC_FORMAT_FLAG_CREATE_WAV_HEADER 32 // create the wave header on decompression (not stored)
-
-
-/* Special frame codes:
-
- MONO_SILENCE - All PCM samples in frame are zero (mono streams only)
- LEFT_SILENCE - All PCM samples for left channel in frame are zero (stereo streams)
- RIGHT_SILENCE - All PCM samples for left channel in frame are zero (stereo streams)
- PSEUDO_STEREO - Left and Right channels are identical
-
-*/
-
-#define APE_FRAMECODE_MONO_SILENCE 1
-#define APE_FRAMECODE_LEFT_SILENCE 1 /* same as mono */
-#define APE_FRAMECODE_RIGHT_SILENCE 2
-#define APE_FRAMECODE_STEREO_SILENCE 3 /* combined */
-#define APE_FRAMECODE_PSEUDO_STEREO 4
-
-#define PREDICTOR_ORDER 8
-/* Total size of all predictor histories - 50 * sizeof(int32_t) */
-#define PREDICTOR_SIZE 50
-
-
-/* NOTE: This struct is used in predictor-arm.S - any updates need to
- be reflected there. */
-
-struct predictor_t
-{
- /* Filter histories */
- int32_t* buf;
-
- int32_t YlastA;
- int32_t XlastA;
-
- /* NOTE: The order of the next four fields is important for
- predictor-arm.S */
- int32_t YfilterB;
- int32_t XfilterA;
- int32_t XfilterB;
- int32_t YfilterA;
-
- /* Adaption co-efficients */
- int32_t YcoeffsA[4];
- int32_t XcoeffsA[4];
- int32_t YcoeffsB[5];
- int32_t XcoeffsB[5];
- int32_t historybuffer[PREDICTOR_HISTORY_SIZE + PREDICTOR_SIZE];
-};
-
-struct ape_ctx_t
-{
- /* Derived fields */
- uint32_t junklength;
- uint32_t firstframe;
- uint32_t totalsamples;
-
- /* Info from Descriptor Block */
- char magic[4];
- int16_t fileversion;
- int16_t padding1;
- uint32_t descriptorlength;
- uint32_t headerlength;
- uint32_t seektablelength;
- uint32_t wavheaderlength;
- uint32_t audiodatalength;
- uint32_t audiodatalength_high;
- uint32_t wavtaillength;
- uint8_t md5[16];
-
- /* Info from Header Block */
- uint16_t compressiontype;
- uint16_t formatflags;
- uint32_t blocksperframe;
- uint32_t finalframeblocks;
- uint32_t totalframes;
- uint16_t bps;
- uint16_t channels;
- uint32_t samplerate;
-
- /* Seektable */
- uint32_t* seektable; /* Seektable buffer */
- uint32_t maxseekpoints; /* Max seekpoints we can store (size of seektable buffer) */
- uint32_t numseekpoints; /* Number of seekpoints */
- int seektablefilepos; /* Location in .ape file of seektable */
-
- /* Decoder state */
- uint32_t CRC;
- int frameflags;
- int currentframeblocks;
- int blocksdecoded;
- struct predictor_t predictor;
-};
-
-int ape_parseheader(int fd, struct ape_ctx_t* ape_ctx);
-int ape_parseheaderbuf(unsigned char* buf, struct ape_ctx_t* ape_ctx);
-void ape_dumpinfo(struct ape_ctx_t* ape_ctx);
-
-#endif
diff --git a/plugins/demac/libdemac/predictor-arm.S b/plugins/demac/libdemac/predictor-arm.S
deleted file mode 100644
index bfb96738..00000000
--- a/plugins/demac/libdemac/predictor-arm.S
+++ /dev/null
@@ -1,694 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: predictor-arm.S 21916 2009-07-17 09:17:54Z amiconn $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-#include "demac_config.h"
-
- .section ICODE_SECTION_DEMAC_ARM,"ax",%progbits
-
- .align 2
-
-/* NOTE: The following need to be kept in sync with parser.h */
-
-#define YDELAYA 200
-#define YDELAYB 168
-#define XDELAYA 136
-#define XDELAYB 104
-#define YADAPTCOEFFSA 72
-#define XADAPTCOEFFSA 56
-#define YADAPTCOEFFSB 40
-#define XADAPTCOEFFSB 20
-
-/* struct predictor_t members: */
-#define buf 0 /* int32_t* buf */
-
-#define YlastA 4 /* int32_t YlastA; */
-#define XlastA 8 /* int32_t XlastA; */
-
-#define YfilterB 12 /* int32_t YfilterB; */
-#define XfilterA 16 /* int32_t XfilterA; */
-
-#define XfilterB 20 /* int32_t XfilterB; */
-#define YfilterA 24 /* int32_t YfilterA; */
-
-#define YcoeffsA 28 /* int32_t YcoeffsA[4]; */
-#define XcoeffsA 44 /* int32_t XcoeffsA[4]; */
-#define YcoeffsB 60 /* int32_t YcoeffsB[5]; */
-#define XcoeffsB 80 /* int32_t XcoeffsB[5]; */
-
-#define historybuffer 100 /* int32_t historybuffer[] */
-
-@ Macro for loading 2 registers, for various ARM versions.
-@ Registers must start with an even register, and must be consecutive.
-
-.macro LDR2OFS reg1, reg2, base, offset
-#if ARM_ARCH >= 6
- ldrd \reg1, [\base, \offset]
-#else /* ARM_ARCH < 6 */
-#ifdef CPU_ARM7TDMI
- add \reg1, \base, \offset
- ldmia \reg1, {\reg1, \reg2}
-#else /* ARM9 (v4 and v5) is faster this way */
- ldr \reg1, [\base, \offset]
- ldr \reg2, [\base, \offset+4]
-#endif
-#endif /* ARM_ARCH */
-.endm
-
-@ Macro for storing 2 registers, for various ARM versions.
-@ Registers must start with an even register, and must be consecutive.
-
-.macro STR2OFS reg1, reg2, base, offset
-#if ARM_ARCH >= 6
- strd \reg1, [\base, \offset]
-#else
- str \reg1, [\base, \offset]
- str \reg2, [\base, \offset+4]
-#endif
-.endm
-
- .global predictor_decode_stereo
- .type predictor_decode_stereo,%function
-
-@ Register usage:
-@
-@ r0-r11 - scratch
-@ r12 - struct predictor_t* p
-@ r14 - int32_t* p->buf
-
-@ void predictor_decode_stereo(struct predictor_t* p,
-@ int32_t* decoded0,
-@ int32_t* decoded1,
-@ int count)
-
-predictor_decode_stereo:
- stmdb sp!, {r1-r11, lr}
-
- @ r1 (decoded0) is [sp]
- @ r2 (decoded1) is [sp, #4]
- @ r3 (count) is [sp, #8]
-
- mov r12, r0 @ r12 := p
- ldr r14, [r0] @ r14 := p->buf
-
-loop:
-
-@@@@@@@@@@@@@@@@@@@@@@@@@@@ PREDICTOR Y
-
-@ Predictor Y, Filter A
-
- ldr r11, [r12, #YlastA] @ r11 := p->YlastA
-
- add r2, r14, #YDELAYA-12 @ r2 := &p->buf[YDELAYA-3]
- ldmia r2, {r2, r3, r10} @ r2 := p->buf[YDELAYA-3]
- @ r3 := p->buf[YDELAYA-2]
- @ r10 := p->buf[YDELAYA-1]
-
- add r6, r12, #YcoeffsA
- ldmia r6, {r6 - r9} @ r6 := p->YcoeffsA[0]
- @ r7 := p->YcoeffsA[1]
- @ r8 := p->YcoeffsA[2]
- @ r9 := p->YcoeffsA[3]
-
- subs r10, r11, r10 @ r10 := r11 - r10
-
- STR2OFS r10, r11, r14, #YDELAYA-4
- @ p->buf[YDELAYA-1] = r10
- @ p->buf[YDELAYA] = r11
-
- mul r0, r11, r6 @ r0 := p->buf[YDELAYA] * p->YcoeffsA[0]
- mla r0, r10, r7, r0 @ r0 += p->buf[YDELAYA-1] * p->YcoeffsA[1]
- mla r0, r3, r8, r0 @ r0 += p->buf[YDELAYA-2] * p->YcoeffsA[2]
- mla r0, r2, r9, r0 @ r0 += p->buf[YDELAYA-3] * p->YcoeffsA[3]
-
- @ flags were set above, in the subs instruction
- mvngt r10, #0
- movlt r10, #1 @ r10 := SIGN(r10) (see .c for SIGN macro)
-
- cmp r11, #0
- mvngt r11, #0
- movlt r11, #1 @ r11 := SIGN(r11) (see .c for SIGN macro)
-
- STR2OFS r10, r11, r14, #YADAPTCOEFFSA-4
- @ p->buf[YADAPTCOEFFSA-1] := r10
- @ p->buf[YADAPTCOEFFSA] := r11
-
- @ NOTE: r0 now contains predictionA - don't overwrite.
-
-@ Predictor Y, Filter B
-
- LDR2OFS r6, r7, r12, #YfilterB @ r6 := p->YfilterB
- @ r7 := p->XfilterA
-
- add r2, r14, #YDELAYB-16 @ r2 := &p->buf[YDELAYB-4]
- ldmia r2, {r2 - r4, r10} @ r2 := p->buf[YDELAYB-4]
- @ r3 := p->buf[YDELAYB-3]
- @ r4 := p->buf[YDELAYB-2]
- @ r10 := p->buf[YDELAYB-1]
-
- rsb r6, r6, r6, lsl #5 @ r6 := r6 * 32 - r6 ( == r6*31)
- sub r11, r7, r6, asr #5 @ r11 (p->buf[YDELAYB]) := r7 - (r6 >> 5)
-
- str r7, [r12, #YfilterB] @ p->YfilterB := r7 (p->XfilterA)
-
- add r5, r12, #YcoeffsB
- ldmia r5, {r5 - r9} @ r5 := p->YcoeffsB[0]
- @ r6 := p->YcoeffsB[1]
- @ r7 := p->YcoeffsB[2]
- @ r8 := p->YcoeffsB[3]
- @ r9 := p->YcoeffsB[4]
-
- subs r10, r11, r10 @ r10 := r11 - r10
-
- STR2OFS r10, r11, r14, #YDELAYB-4
- @ p->buf[YDELAYB-1] = r10
- @ p->buf[YDELAYB] = r11
-
- mul r1, r11, r5 @ r1 := p->buf[YDELAYB] * p->YcoeffsB[0]
- mla r1, r10, r6, r1 @ r1 += p->buf[YDELAYB-1] * p->YcoeffsB[1]
- mla r1, r4, r7, r1 @ r1 += p->buf[YDELAYB-2] * p->YcoeffsB[2]
- mla r1, r3, r8, r1 @ r1 += p->buf[YDELAYB-3] * p->YcoeffsB[3]
- mla r1, r2, r9, r1 @ r1 += p->buf[YDELAYB-4] * p->YcoeffsB[4]
-
- @ flags were set above, in the subs instruction
- mvngt r10, #0
- movlt r10, #1 @ r10 := SIGN(r10) (see .c for SIGN macro)
-
- cmp r11, #0
- mvngt r11, #0
- movlt r11, #1 @ r11 := SIGN(r11) (see .c for SIGN macro)
-
- STR2OFS r10, r11, r14, #YADAPTCOEFFSB-4
- @ p->buf[YADAPTCOEFFSB-1] := r10
- @ p->buf[YADAPTCOEFFSB] := r11
-
- @ r0 still contains predictionA
- @ r1 contains predictionB
-
- @ Finish Predictor Y
-
- ldr r2, [sp] @ r2 := decoded0
- add r0, r0, r1, asr #1 @ r0 := r0 + (r1 >> 1)
- ldr r4, [r12, #YfilterA] @ r4 := p->YfilterA
- ldr r3, [r2] @ r3 := *decoded0
- rsb r4, r4, r4, lsl #5 @ r4 := r4 * 32 - r4 ( == r4*31)
- add r1, r3, r0, asr #10 @ r1 := r3 + (r0 >> 10)
- str r1, [r12, #YlastA] @ p->YlastA := r1
- add r1, r1, r4, asr #5 @ r1 := r1 + (r4 >> 5)
- str r1, [r12, #YfilterA] @ p->YfilterA := r1
-
- @ r1 contains p->YfilterA
- @ r2 contains decoded0
- @ r3 contains *decoded0
-
- @ r5, r6, r7, r8, r9 contain p->YcoeffsB[0..4]
- @ r10, r11 contain p->buf[YADAPTCOEFFSB-1] and p->buf[YADAPTCOEFFSB]
-
- str r1, [r2], #4 @ *(decoded0++) := r1 (p->YfilterA)
- str r2, [sp] @ save decoded0
- cmp r3, #0
- beq 3f
-
- add r2, r14, #YADAPTCOEFFSB-16
- ldmia r2, {r2 - r4} @ r2 := p->buf[YADAPTCOEFFSB-4]
- @ r3 := p->buf[YADAPTCOEFFSB-3]
- @ r4 := p->buf[YADAPTCOEFFSB-2]
- blt 1f
-
- @ *decoded0 > 0
-
- sub r5, r5, r11 @ r5 := p->YcoeffsB[0] - p->buf[YADAPTCOEFFSB]
- sub r6, r6, r10 @ r6 := p->YcoeffsB[1] - p->buf[YADAPTCOEFFSB-1]
- sub r9, r9, r2 @ r9 := p->YcoeffsB[4] - p->buf[YADAPTCOEFFSB-4]
- sub r8, r8, r3 @ r8 := p->YcoeffsB[3] - p->buf[YADAPTCOEFFSB-3]
- sub r7, r7, r4 @ r7 := p->YcoeffsB[2] - p->buf[YADAPTCOEFFSB-2]
-
- add r0, r12, #YcoeffsB
- stmia r0, {r5 - r9} @ Save p->YcoeffsB[]
-
- add r1, r12, #YcoeffsA
- ldmia r1, {r2 - r5} @ r2 := p->YcoeffsA[0]
- @ r3 := p->YcoeffsA[1]
- @ r4 := p->YcoeffsA[2]
- @ r5 := p->YcoeffsA[3]
-
- add r6, r14, #YADAPTCOEFFSA-12
- ldmia r6, {r6 - r9} @ r6 := p->buf[YADAPTCOEFFSA-3]
- @ r7 := p->buf[YADAPTCOEFFSA-2]
- @ r8 := p->buf[YADAPTCOEFFSA-1]
- @ r9 := p->buf[YADAPTCOEFFSA]
-
- sub r5, r5, r6 @ r5 := p->YcoeffsA[3] - p->buf[YADAPTCOEFFSA-3]
- sub r4, r4, r7 @ r4 := p->YcoeffsA[2] - p->buf[YADAPTCOEFFSA-2]
- sub r3, r3, r8 @ r3 := p->YcoeffsA[1] - p->buf[YADAPTCOEFFSA-1]
- sub r2, r2, r9 @ r2 := p->YcoeffsA[0] - p->buf[YADAPTCOEFFSA]
-
- b 2f
-
-
-1: @ *decoded0 < 0
-
- add r5, r5, r11 @ r5 := p->YcoeffsB[0] + p->buf[YADAPTCOEFFSB]
- add r6, r6, r10 @ r6 := p->YcoeffsB[1] + p->buf[YADAPTCOEFFSB-1]
- add r9, r9, r2 @ r9 := p->YcoeffsB[4] + p->buf[YADAPTCOEFFSB-4]
- add r8, r8, r3 @ r9 := p->YcoeffsB[3] + p->buf[YADAPTCOEFFSB-3]
- add r7, r7, r4 @ r8 := p->YcoeffsB[2] + p->buf[YADAPTCOEFFSB-2]
-
- add r0, r12, #YcoeffsB
- stmia r0, {r5 - r9} @ Save p->YcoeffsB[]
-
- add r1, r12, #YcoeffsA
- ldmia r1, {r2 - r5} @ r2 := p->YcoeffsA[0]
- @ r3 := p->YcoeffsA[1]
- @ r4 := p->YcoeffsA[2]
- @ r5 := p->YcoeffsA[3]
-
- add r6, r14, #YADAPTCOEFFSA-12
- ldmia r6, {r6 - r9} @ r6 := p->buf[YADAPTCOEFFSA-3]
- @ r7 := p->buf[YADAPTCOEFFSA-2]
- @ r8 := p->buf[YADAPTCOEFFSA-1]
- @ r9 := p->buf[YADAPTCOEFFSA]
-
- add r5, r5, r6 @ r5 := p->YcoeffsA[3] + p->buf[YADAPTCOEFFSA-3]
- add r4, r4, r7 @ r4 := p->YcoeffsA[2] + p->buf[YADAPTCOEFFSA-2]
- add r3, r3, r8 @ r3 := p->YcoeffsA[1] + p->buf[YADAPTCOEFFSA-1]
- add r2, r2, r9 @ r2 := p->YcoeffsA[0] + p->buf[YADAPTCOEFFSA]
-
-2:
- stmia r1, {r2 - r5} @ Save p->YcoeffsA
-
-3:
-
-@@@@@@@@@@@@@@@@@@@@@@@@@@@ PREDICTOR X
-
-@ Predictor X, Filter A
-
- ldr r11, [r12, #XlastA] @ r11 := p->XlastA
-
- add r2, r14, #XDELAYA-12 @ r2 := &p->buf[XDELAYA-3]
- ldmia r2, {r2, r3, r10} @ r2 := p->buf[XDELAYA-3]
- @ r3 := p->buf[XDELAYA-2]
- @ r10 := p->buf[XDELAYA-1]
-
- add r6, r12, #XcoeffsA
- ldmia r6, {r6 - r9} @ r6 := p->XcoeffsA[0]
- @ r7 := p->XcoeffsA[1]
- @ r8 := p->XcoeffsA[2]
- @ r9 := p->XcoeffsA[3]
-
- subs r10, r11, r10 @ r10 := r11 - r10
-
- STR2OFS r10, r11, r14, #XDELAYA-4
- @ p->buf[XDELAYA-1] = r10
- @ p->buf[XDELAYA] = r11
-
- mul r0, r11, r6 @ r0 := p->buf[XDELAYA] * p->XcoeffsA[0]
- mla r0, r10, r7, r0 @ r0 += p->buf[XDELAYA-1] * p->XcoeffsA[1]
- mla r0, r3, r8, r0 @ r0 += p->buf[XDELAYA-2] * p->XcoeffsA[2]
- mla r0, r2, r9, r0 @ r0 += p->buf[XDELAYA-3] * p->XcoeffsA[3]
-
- @ flags were set above, in the subs instruction
- mvngt r10, #0
- movlt r10, #1 @ r10 := SIGN(r10) (see .c for SIGN macro)
-
- cmp r11, #0
- mvngt r11, #0
- movlt r11, #1 @ r11 := SIGN(r11) (see .c for SIGN macro)
-
- STR2OFS r10, r11, r14, #XADAPTCOEFFSA-4
- @ p->buf[XADAPTCOEFFSA-1] := r10
- @ p->buf[XADAPTCOEFFSA] := r11
-
- @ NOTE: r0 now contains predictionA - don't overwrite.
-
-@ Predictor X, Filter B
-
- LDR2OFS r6, r7, r12, #XfilterB @ r6 := p->XfilterB
- @ r7 := p->YfilterA
-
- add r2, r14, #XDELAYB-16 @ r2 := &p->buf[XDELAYB-4]
- ldmia r2, {r2 - r4, r10} @ r2 := p->buf[XDELAYB-4]
- @ r3 := p->buf[XDELAYB-3]
- @ r4 := p->buf[XDELAYB-2]
- @ r10 := p->buf[XDELAYB-1]
-
- rsb r6, r6, r6, lsl #5 @ r6 := r2 * 32 - r6 ( == r6*31)
- sub r11, r7, r6, asr #5 @ r11 (p->buf[XDELAYB]) := r7 - (r6 >> 5)
-
- str r7, [r12, #XfilterB] @ p->XfilterB := r7 (p->YfilterA)
-
- add r5, r12, #XcoeffsB
- ldmia r5, {r5 - r9} @ r5 := p->XcoeffsB[0]
- @ r6 := p->XcoeffsB[1]
- @ r7 := p->XcoeffsB[2]
- @ r8 := p->XcoeffsB[3]
- @ r9 := p->XcoeffsB[4]
-
- subs r10, r11, r10 @ r10 := r11 - r10
-
- STR2OFS r10, r11, r14, #XDELAYB-4
- @ p->buf[XDELAYB-1] = r10
- @ p->buf[XDELAYB] = r11
-
- mul r1, r11, r5 @ r1 := p->buf[XDELAYB] * p->XcoeffsB[0]
- mla r1, r10, r6, r1 @ r1 += p->buf[XDELAYB-1] * p->XcoeffsB[1]
- mla r1, r4, r7, r1 @ r1 += p->buf[XDELAYB-2] * p->XcoeffsB[2]
- mla r1, r3, r8, r1 @ r1 += p->buf[XDELAYB-3] * p->XcoeffsB[3]
- mla r1, r2, r9, r1 @ r1 += p->buf[XDELAYB-4] * p->XcoeffsB[4]
-
- @ flags were set above, in the subs instruction
- mvngt r10, #0
- movlt r10, #1 @ r10 := SIGN(r10) (see .c for SIGN macro)
-
- cmp r11, #0
- mvngt r11, #0
- movlt r11, #1 @ r11 := SIGN(r11) (see .c for SIGN macro)
-
- STR2OFS r10, r11, r14, #XADAPTCOEFFSB-4
- @ p->buf[XADAPTCOEFFSB-1] := r10
- @ p->buf[XADAPTCOEFFSB] := r11
-
- @ r0 still contains predictionA
- @ r1 contains predictionB
-
- @ Finish Predictor X
-
- ldr r2, [sp, #4] @ r2 := decoded1
- add r0, r0, r1, asr #1 @ r0 := r0 + (r1 >> 1)
- ldr r4, [r12, #XfilterA] @ r4 := p->XfilterA
- ldr r3, [r2] @ r3 := *decoded1
- rsb r4, r4, r4, lsl #5 @ r4 := r4 * 32 - r4 ( == r4*31)
- add r1, r3, r0, asr #10 @ r1 := r3 + (r0 >> 10)
- str r1, [r12, #XlastA] @ p->XlastA := r1
- add r1, r1, r4, asr #5 @ r1 := r1 + (r4 >> 5)
- str r1, [r12, #XfilterA] @ p->XfilterA := r1
-
- @ r1 contains p->XfilterA
- @ r2 contains decoded1
- @ r3 contains *decoded1
-
- @ r5, r6, r7, r8, r9 contain p->XcoeffsB[0..4]
- @ r10, r11 contain p->buf[XADAPTCOEFFSB-1] and p->buf[XADAPTCOEFFSB]
-
- str r1, [r2], #4 @ *(decoded1++) := r1 (p->XfilterA)
- str r2, [sp, #4] @ save decoded1
- cmp r3, #0
- beq 3f
-
- add r2, r14, #XADAPTCOEFFSB-16
- ldmia r2, {r2 - r4} @ r2 := p->buf[XADAPTCOEFFSB-4]
- @ r3 := p->buf[XADAPTCOEFFSB-3]
- @ r4 := p->buf[XADAPTCOEFFSB-2]
- blt 1f
-
- @ *decoded1 > 0
-
- sub r5, r5, r11 @ r5 := p->XcoeffsB[0] - p->buf[XADAPTCOEFFSB]
- sub r6, r6, r10 @ r6 := p->XcoeffsB[1] - p->buf[XADAPTCOEFFSB-1]
- sub r9, r9, r2 @ r9 := p->XcoeffsB[4] - p->buf[XADAPTCOEFFSB-4]
- sub r8, r8, r3 @ r8 := p->XcoeffsB[3] - p->buf[XADAPTCOEFFSB-3]
- sub r7, r7, r4 @ r7 := p->XcoeffsB[2] - p->buf[XADAPTCOEFFSB-2]
-
- add r0, r12, #XcoeffsB
- stmia r0, {r5 - r9} @ Save p->XcoeffsB[]
-
- add r1, r12, #XcoeffsA
- ldmia r1, {r2 - r5} @ r2 := p->XcoeffsA[0]
- @ r3 := p->XcoeffsA[1]
- @ r4 := p->XcoeffsA[2]
- @ r5 := p->XcoeffsA[3]
-
- add r6, r14, #XADAPTCOEFFSA-12
- ldmia r6, {r6 - r9} @ r6 := p->buf[XADAPTCOEFFSA-3]
- @ r7 := p->buf[XADAPTCOEFFSA-2]
- @ r8 := p->buf[XADAPTCOEFFSA-1]
- @ r9 := p->buf[XADAPTCOEFFSA]
-
- sub r5, r5, r6 @ r5 := p->XcoeffsA[3] - p->buf[XADAPTCOEFFSA-3]
- sub r4, r4, r7 @ r4 := p->XcoeffsA[2] - p->buf[XADAPTCOEFFSA-2]
- sub r3, r3, r8 @ r3 := p->XcoeffsA[1] - p->buf[XADAPTCOEFFSA-1]
- sub r2, r2, r9 @ r2 := p->XcoeffsA[0] - p->buf[XADAPTCOEFFSA]
-
- b 2f
-
-
-1: @ *decoded1 < 0
-
- add r5, r5, r11 @ r5 := p->XcoeffsB[0] + p->buf[XADAPTCOEFFSB]
- add r6, r6, r10 @ r6 := p->XcoeffsB[1] + p->buf[XADAPTCOEFFSB-1]
- add r9, r9, r2 @ r9 := p->XcoeffsB[4] + p->buf[XADAPTCOEFFSB-4]
- add r8, r8, r3 @ r8 := p->XcoeffsB[3] + p->buf[XADAPTCOEFFSB-3]
- add r7, r7, r4 @ r7 := p->XcoeffsB[2] + p->buf[XADAPTCOEFFSB-2]
-
- add r0, r12, #XcoeffsB
- stmia r0, {r5 - r9} @ Save p->XcoeffsB[]
-
- add r1, r12, #XcoeffsA
- ldmia r1, {r2 - r5} @ r2 := p->XcoeffsA[0]
- @ r3 := p->XcoeffsA[1]
- @ r4 := p->XcoeffsA[2]
- @ r5 := p->XcoeffsA[3]
-
- add r6, r14, #XADAPTCOEFFSA-12
- ldmia r6, {r6 - r9} @ r6 := p->buf[XADAPTCOEFFSA-3]
- @ r7 := p->buf[XADAPTCOEFFSA-2]
- @ r8 := p->buf[XADAPTCOEFFSA-1]
- @ r9 := p->buf[XADAPTCOEFFSA]
-
- add r5, r5, r6 @ r5 := p->XcoeffsA[3] + p->buf[XADAPTCOEFFSA-3]
- add r4, r4, r7 @ r4 := p->XcoeffsA[2] + p->buf[XADAPTCOEFFSA-2]
- add r3, r3, r8 @ r3 := p->XcoeffsA[1] + p->buf[XADAPTCOEFFSA-1]
- add r2, r2, r9 @ r2 := p->XcoeffsA[0] + p->buf[XADAPTCOEFFSA]
-
-2:
- stmia r1, {r2 - r5} @ Save p->XcoeffsA
-
-3:
-
-@@@@@@@@@@@@@@@@@@@@@@@@@@@ COMMON
-
- add r14, r14, #4 @ p->buf++
-
- add r11, r12, #historybuffer @ r11 := &p->historybuffer[0]
-
- sub r10, r14, #PREDICTOR_HISTORY_SIZE*4
- @ r10 := p->buf - PREDICTOR_HISTORY_SIZE
-
- ldr r0, [sp, #8]
- cmp r10, r11
- beq move_hist @ The history buffer is full, we need to do a memmove
-
- @ Check loop count
- subs r0, r0, #1
- strne r0, [sp, #8]
- bne loop
-
-done:
- str r14, [r12] @ Save value of p->buf
- add sp, sp, #12 @ Don't bother restoring r1-r3
- ldmia sp!, {r4 - r11, pc}
-
-move_hist:
- @ dest = r11 (p->historybuffer)
- @ src = r14 (p->buf)
- @ n = 200
-
- ldmia r14!, {r0-r9} @ 40 bytes
- stmia r11!, {r0-r9}
- ldmia r14!, {r0-r9} @ 40 bytes
- stmia r11!, {r0-r9}
- ldmia r14!, {r0-r9} @ 40 bytes
- stmia r11!, {r0-r9}
- ldmia r14!, {r0-r9} @ 40 bytes
- stmia r11!, {r0-r9}
- ldmia r14!, {r0-r9} @ 40 bytes
- stmia r11!, {r0-r9}
-
- ldr r0, [sp, #8]
- add r14, r12, #historybuffer @ p->buf = &p->historybuffer[0]
-
- @ Check loop count
- subs r0, r0, #1
- strne r0, [sp, #8]
- bne loop
-
- b done
- .size predictor_decode_stereo, .-predictor_decode_stereo
-
- .global predictor_decode_mono
- .type predictor_decode_mono,%function
-
-@ Register usage:
-@
-@ r0-r11 - scratch
-@ r12 - struct predictor_t* p
-@ r14 - int32_t* p->buf
-
-@ void predictor_decode_mono(struct predictor_t* p,
-@ int32_t* decoded0,
-@ int count)
-
-predictor_decode_mono:
- stmdb sp!, {r1, r2, r4-r11, lr}
-
- @ r1 (decoded0) is [sp]
- @ r2 (count) is [sp, #4]
-
- mov r12, r0 @ r12 := p
- ldr r14, [r0] @ r14 := p->buf
-
-loopm:
-
-@@@@@@@@@@@@@@@@@@@@@@@@@@@ PREDICTOR
-
- ldr r11, [r12, #YlastA] @ r11 := p->YlastA
-
- add r2, r14, #YDELAYA-12 @ r2 := &p->buf[YDELAYA-3]
- ldmia r2, {r2, r3, r10} @ r2 := p->buf[YDELAYA-3]
- @ r3 := p->buf[YDELAYA-2]
- @ r10 := p->buf[YDELAYA-1]
-
- add r5, r12, #YcoeffsA @ r5 := &p->YcoeffsA[0]
- ldmia r5, {r6 - r9} @ r6 := p->YcoeffsA[0]
- @ r7 := p->YcoeffsA[1]
- @ r8 := p->YcoeffsA[2]
- @ r9 := p->YcoeffsA[3]
-
- subs r10, r11, r10 @ r10 := r11 - r10
-
- STR2OFS r10, r11, r14, #YDELAYA-4
- @ p->buf[YDELAYA-1] = r10
- @ p->buf[YDELAYA] = r11
-
- mul r0, r11, r6 @ r0 := p->buf[YDELAYA] * p->YcoeffsA[0]
- mla r0, r10, r7, r0 @ r0 += p->buf[YDELAYA-1] * p->YcoeffsA[1]
- mla r0, r3, r8, r0 @ r0 += p->buf[YDELAYA-2] * p->YcoeffsA[2]
- mla r0, r2, r9, r0 @ r0 += p->buf[YDELAYA-3] * p->YcoeffsA[3]
-
- @ flags were set above, in the subs instruction
- mvngt r10, #0
- movlt r10, #1 @ r10 := SIGN(r10) (see .c for SIGN macro)
-
- cmp r11, #0
- mvngt r11, #0
- movlt r11, #1 @ r11 := SIGN(r11) (see .c for SIGN macro)
-
- STR2OFS r10, r11, r14, #YADAPTCOEFFSA-4
- @ p->buf[YADAPTCOEFFSA-1] := r10
- @ p->buf[YADAPTCOEFFSA] := r11
-
- ldr r2, [sp] @ r2 := decoded0
- ldr r4, [r12, #YfilterA] @ r4 := p->YfilterA
- ldr r3, [r2] @ r3 := *decoded0
- rsb r4, r4, r4, lsl #5 @ r4 := r4 * 32 - r4 ( == r4*31)
- add r1, r3, r0, asr #10 @ r1 := r3 + (r0 >> 10)
- str r1, [r12, #YlastA] @ p->YlastA := r1
- add r1, r1, r4, asr #5 @ r1 := r1 + (r4 >> 5)
- str r1, [r12, #YfilterA] @ p->YfilterA := r1
-
- @ r1 contains p->YfilterA
- @ r2 contains decoded0
- @ r3 contains *decoded0
-
- @ r6, r7, r8, r9 contain p->YcoeffsA[0..3]
- @ r10, r11 contain p->buf[YADAPTCOEFFSA-1] and p->buf[YADAPTCOEFFSA]
-
- str r1, [r2], #4 @ *(decoded0++) := r1 (p->YfilterA)
- str r2, [sp] @ save decoded0
- cmp r3, #0
- beq 3f
-
- LDR2OFS r2, r3, r14, #YADAPTCOEFFSA-12
- @ r2 := p->buf[YADAPTCOEFFSA-3]
- @ r3 := p->buf[YADAPTCOEFFSA-2]
- blt 1f
-
- @ *decoded0 > 0
-
- sub r6, r6, r11 @ r6 := p->YcoeffsA[0] - p->buf[YADAPTCOEFFSA]
- sub r7, r7, r10 @ r7 := p->YcoeffsA[1] - p->buf[YADAPTCOEFFSA-1]
- sub r9, r9, r2 @ r9 := p->YcoeffsA[3] - p->buf[YADAPTCOEFFSA-3]
- sub r8, r8, r3 @ r8 := p->YcoeffsA[2] - p->buf[YADAPTCOEFFSA-2]
-
- b 2f
-
-1: @ *decoded0 < 0
-
- add r6, r6, r11 @ r6 := p->YcoeffsA[0] + p->buf[YADAPTCOEFFSA]
- add r7, r7, r10 @ r7 := p->YcoeffsA[1] + p->buf[YADAPTCOEFFSA-1]
- add r9, r9, r2 @ r9 := p->YcoeffsA[3] + p->buf[YADAPTCOEFFSA-3]
- add r8, r8, r3 @ r8 := p->YcoeffsA[2] + p->buf[YADAPTCOEFFSA-2]
-
-2:
- stmia r5, {r6 - r9} @ Save p->YcoeffsA
-
-3:
-
-@@@@@@@@@@@@@@@@@@@@@@@@@@@ COMMON
-
- add r14, r14, #4 @ p->buf++
-
- add r11, r12, #historybuffer @ r11 := &p->historybuffer[0]
-
- sub r10, r14, #PREDICTOR_HISTORY_SIZE*4
- @ r10 := p->buf - PREDICTOR_HISTORY_SIZE
-
- ldr r0, [sp, #4]
- cmp r10, r11
- beq move_histm @ The history buffer is full, we need to do a memmove
-
- @ Check loop count
- subs r0, r0, #1
- strne r0, [sp, #4]
- bne loopm
-
-donem:
- str r14, [r12] @ Save value of p->buf
- add sp, sp, #8 @ Don't bother restoring r1, r2
- ldmia sp!, {r4 - r11, pc}
-
-move_histm:
- @ dest = r11 (p->historybuffer)
- @ src = r14 (p->buf)
- @ n = 200
-
- ldmia r14!, {r0-r9} @ 40 bytes
- stmia r11!, {r0-r9}
- ldmia r14!, {r0-r9} @ 40 bytes
- stmia r11!, {r0-r9}
- ldmia r14!, {r0-r9} @ 40 bytes
- stmia r11!, {r0-r9}
- ldmia r14!, {r0-r9} @ 40 bytes
- stmia r11!, {r0-r9}
- ldmia r14!, {r0-r9} @ 40 bytes
- stmia r11!, {r0-r9}
-
- ldr r0, [sp, #4]
- add r14, r12, #historybuffer @ p->buf = &p->historybuffer[0]
-
- @ Check loop count
- subs r0, r0, #1
- strne r0, [sp, #4]
- bne loopm
-
- b donem
- .size predictor_decode_mono, .-predictor_decode_mono
diff --git a/plugins/demac/libdemac/predictor-cf.S b/plugins/demac/libdemac/predictor-cf.S
deleted file mode 100644
index 341e57f1..00000000
--- a/plugins/demac/libdemac/predictor-cf.S
+++ /dev/null
@@ -1,659 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: predictor-cf.S 19296 2008-12-02 02:26:04Z amiconn $
-
-Copyright (C) Dave Chapman 2007
-
-Coldfire predictor copyright (C) 2007 Jens Arnold
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-#include "demac_config.h"
-
-/* NOTE: The following need to be kept in sync with parser.h */
-
-#define YDELAYA 200
-#define YDELAYB 168
-#define XDELAYA 136
-#define XDELAYB 104
-#define YADAPTCOEFFSA 72
-#define XADAPTCOEFFSA 56
-#define YADAPTCOEFFSB 40
-#define XADAPTCOEFFSB 20
-
-/* struct predictor_t members: */
-#define buf 0 /* int32_t* buf */
-
-#define YlastA 4 /* int32_t YlastA; */
-#define XlastA 8 /* int32_t XlastA; */
-
-#define YfilterB 12 /* int32_t YfilterB; */
-#define XfilterA 16 /* int32_t XfilterA; */
-
-#define XfilterB 20 /* int32_t XfilterB; */
-#define YfilterA 24 /* int32_t YfilterA; */
-
-#define YcoeffsA 28 /* int32_t YcoeffsA[4]; */
-#define XcoeffsA 44 /* int32_t XcoeffsA[4]; */
-#define YcoeffsB 60 /* int32_t YcoeffsB[5]; */
-#define XcoeffsB 80 /* int32_t XcoeffsB[5]; */
-
-#define historybuffer 100 /* int32_t historybuffer[] */
-
-
- .text
-
- .align 2
-
- .global predictor_decode_stereo
- .type predictor_decode_stereo,@function
-
-| void predictor_decode_stereo(struct predictor_t* p,
-| int32_t* decoded0,
-| int32_t* decoded1,
-| int count)
-
-predictor_decode_stereo:
- lea.l (-12*4,%sp), %sp
- movem.l %d2-%d7/%a2-%a6, (4,%sp)
-
- movem.l (12*4+8,%sp), %a3-%a5 | %a3 = decoded0
- | %a4 = decoded1
- move.l %a5, (%sp) | (%sp) = count
-
- move.l #0, %macsr | signed integer mode
- move.l (12*4+4,%sp), %a6 | %a6 = p
- move.l (%a6), %a5 | %a5 = p->buf
-
-.loop:
-
- | ***** PREDICTOR Y *****
-
- | Predictor Y, Filter A
-
- move.l (YlastA,%a6), %d3 | %d3 = p->YlastA
-
- movem.l (YDELAYA-12,%a5), %d0-%d2 | %d0 = p->buf[YDELAYA-3]
- | %d1 = p->buf[YDELAYA-2]
- | %d2 = p->buf[YDELAYA-1]
-
- move.l %d3, (YDELAYA,%a5) | p->buf[YDELAYA] = %d3
-
- sub.l %d3, %d2
- neg.l %d2 | %d2 = %d3 - %d2
-
- move.l %d2, (YDELAYA-4,%a5) | p->buf[YDELAYA-1] = %d2
-
- movem.l (YcoeffsA,%a6), %d4-%d7 | %d4 = p->YcoeffsA[0]
- | %d5 = p->YcoeffsA[1]
- | %d6 = p->YcoeffsA[2]
- | %d7 = p->YcoeffsA[3]
-
- mac.l %d3, %d4, %acc0 | %acc0 = p->buf[YDELAYA] * p->YcoeffsA[0]
- mac.l %d2, %d5, %acc0 | %acc0 += p->buf[YDELAYA-1] * p->YcoeffsA[1]
- mac.l %d1, %d6, %acc0 | %acc0 += p->buf[YDELAYA-2] * p->YcoeffsA[2]
- mac.l %d0, %d7, %acc0 | %acc0 += p->buf[YDELAYA-3] * p->YcoeffsA[3]
-
- tst.l %d2
- beq.s 1f
- spl.b %d2 | pos: 0x??????ff, neg: 0x??????00
- extb.l %d2 | pos: 0xffffffff, neg: 0x00000000
- or.l #1, %d2 | pos: 0xffffffff, neg: 0x00000001
-1: | %d2 = SIGN(%d2)
- move.l %d2, (YADAPTCOEFFSA-4,%a5) | p->buf[YADAPTCOEFFSA-1] = %d2
-
- tst.l %d3
- beq.s 1f
- spl.b %d3
- extb.l %d3
- or.l #1, %d3
-1: | %d3 = SIGN(%d3)
- move.l %d3, (YADAPTCOEFFSA,%a5) | p->buf[YADAPTCOEFFSA] = %d3
-
- | Predictor Y, Filter B
-
- movem.l (YfilterB,%a6), %d2-%d3 | %d2 = p->YfilterB
- | %d3 = p->XfilterA
- move.l %d3, (YfilterB,%a6) | p->YfilterB = %d3
-
- move.l %d2, %d1 | %d1 = %d2
- lsl.l #5, %d2 | %d2 = %d2 * 32
- sub.l %d1, %d2 | %d2 -= %d1 (== 31 * old_d2)
- asr.l #5, %d2 | %d2 >>= 5
- sub.l %d2, %d3 | %d3 -= %d2
-
- movem.l (YDELAYB-16,%a5), %d4-%d7 | %d4 = p->buf[YDELAYB-4]
- | %d5 = p->buf[YDELAYB-3]
- | %d6 = p->buf[YDELAYB-2]
- | %d7 = p->buf[YDELAYB-1]
- sub.l %d3, %d7
- neg.l %d7 | %d7 = %d3 - %d7
-
- move.l %d7, (YDELAYB-4,%a5) | p->buf[YDELAYB-1] = %d7
-
- movem.l (YcoeffsB,%a6), %d1-%d2/%a0-%a2 | %d1 = p->YcoeffsB[0]
- | %d2 = p->YcoeffsB[1]
- | %a0 = p->YcoeffsB[2]
- | %a1 = p->YcoeffsB[3]
- | %a2 = p->YcoeffsB[4]
-
- mac.l %d3, %d1, %acc1 | %acc1 = p->buf[YDELAYB] * p->YcoeffsB[0]
- mac.l %d7, %d2, %acc1 | %acc1 += p->buf[YDELAYB-1] * p->YcoeffsB[1]
- mac.l %d6, %a0, %acc1 | %acc1 += p->buf[YDELAYB-2] * p->YcoeffsB[2]
- mac.l %d5, %a1, %acc1 | %acc1 += p->buf[YDELAYB-3] * p->YcoeffsB[3]
- mac.l %d4, %a2, %acc1 | %acc1 += p->buf[YDELAYB-4] * p->YcoeffsB[4]
-
- move.l %d3, (YDELAYB, %a5) | p->buf[YDELAYB] = %d3
-
- tst.l %d7
- beq.s 1f
- spl.b %d7
- extb.l %d7
- or.l #1, %d7
-1: | %d7 = SIGN(%d7)
- move.l %d7, (YADAPTCOEFFSB-4,%a5) | p->buf[YADAPTCOEFFSB-1] = %d7
- tst.l %d3
- beq.s 1f
- spl.b %d3
- extb.l %d3
- or.l #1, %d3
-1: | %d3 = SIGN(%d3)
- move.l %d3, (YADAPTCOEFFSB, %a5) | p->buf[YADAPTCOEFFSB] = %d3
-
- | %d1, %d2, %a0, %a1, %a2 contain p->YcoeffsB[0..4]
- | %d7, %d3 contain p->buf[YADAPTCOEFFSB-1] and p->buf[YADAPTCOEFFSB]
-
- move.l (%a3), %d0 | %d0 = *decoded0
- beq.s 3f
-
- movem.l (YADAPTCOEFFSB-16,%a5), %d4-%d6 | %d4 = p->buf[YADAPTCOEFFSB-4]
- | %d5 = p->buf[YADAPTCOEFFSB-3]
- | %d6 = p->buf[YADAPTCOEFFSB-2]
-
- bmi.s 1f | flags still valid here
-
- | *decoded0 > 0
-
- sub.l %d3, %d1 | %d1 = p->YcoeffsB[0] - p->buf[YADAPTCOEFFSB]
- sub.l %d7, %d2 | %d2 = p->YcoeffsB[1] - p->buf[YADAPTCOEFFSB-1]
- sub.l %d6, %a0 | %a0 = p->YcoeffsB[2] - p->buf[YADAPTCOEFFSB-2]
- sub.l %d5, %a1 | %a1 = p->YcoeffsB[3] - p->buf[YADAPTCOEFFSB-3]
- sub.l %d4, %a2 | %a2 = p->YcoeffsB[4] - p->buf[YADAPTCOEFFSB-4]
-
- movem.l %d1-%d2/%a0-%a2, (YcoeffsB,%a6) | Save p->YcoeffsB[]
-
- movem.l (YcoeffsA,%a6), %d4-%d7 | %d4 = p->YcoeffsA[0]
- | %d5 = p->YcoeffsA[1]
- | %d6 = p->YcoeffsA[2]
- | %d7 = p->YcoeffsA[3]
-
- movem.l (YADAPTCOEFFSA-12,%a5), %d2/%a0-%a2
- | %d2 = p->buf[YADAPTCOEFFSA-3]
- | %a0 = p->buf[YADAPTCOEFFSA-2]
- | %a1 = p->buf[YADAPTCOEFFSA-1]
- | %a2 = p->buf[YADAPTCOEFFSA]
-
- sub.l %a2, %d4 | %d4 = p->YcoeffsA[0] - p->buf[YADAPTCOEFFSA]
- sub.l %a1, %d5 | %d5 = p->YcoeffsA[1] - p->buf[YADAPTCOEFFSA-1]
- sub.l %a0, %d6 | %d6 = p->YcoeffsA[2] - p->buf[YADAPTCOEFFSA-2]
- sub.l %d2, %d7 | %d7 = p->YcoeffsA[3] - p->buf[YADAPTCOEFFSA-3]
-
- bra.s 2f
-
-1: | *decoded0 < 0
-
- add.l %d3, %d1 | %d1 = p->YcoeffsB[0] + p->buf[YADAPTCOEFFSB]
- add.l %d7, %d2 | %d2 = p->YcoeffsB[1] + p->buf[YADAPTCOEFFSB-1]
- add.l %d6, %a0 | %a0 = p->YcoeffsB[2] + p->buf[YADAPTCOEFFSB-2]
- add.l %d5, %a1 | %a1 = p->YcoeffsB[3] + p->buf[YADAPTCOEFFSB-3]
- add.l %d4, %a2 | %a2 = p->YcoeffsB[4] + p->buf[YADAPTCOEFFSB-4]
-
- movem.l %d1-%d2/%a0-%a2, (YcoeffsB,%a6) | Save p->YcoeffsB[]
-
- movem.l (YcoeffsA,%a6), %d4-%d7 | %d4 = p->YcoeffsA[0]
- | %d5 = p->YcoeffsA[1]
- | %d6 = p->YcoeffsA[2]
- | %d7 = p->YcoeffsA[3]
-
- movem.l (YADAPTCOEFFSA-12,%a5), %d2/%a0-%a2
- | %d2 = p->buf[YADAPTCOEFFSA-3]
- | %a0 = p->buf[YADAPTCOEFFSA-2]
- | %a1 = p->buf[YADAPTCOEFFSA-1]
- | %a2 = p->buf[YADAPTCOEFFSA]
-
- add.l %a2, %d4 | %d4 = p->YcoeffsA[0] + p->buf[YADAPTCOEFFSA]
- add.l %a1, %d5 | %d5 = p->YcoeffsA[1] + p->buf[YADAPTCOEFFSA-1]
- add.l %a0, %d6 | %d6 = p->YcoeffsA[2] + p->buf[YADAPTCOEFFSA-2]
- add.l %d2, %d7 | %d7 = p->YcoeffsA[3] + p->buf[YADAPTCOEFFSA-3]
-
-2:
- movem.l %d4-%d7, (YcoeffsA,%a6) | Save p->YcoeffsA[]
-
-3:
- | Finish Predictor Y
-
- movclr.l %acc0, %d1 | %d1 = predictionA
- movclr.l %acc1, %d2 | %d2 = predictionB
- asr.l #1, %d2
- add.l %d2, %d1 | %d1 += (%d2 >> 1)
- asr.l #8, %d1
- asr.l #2, %d1 | %d1 >>= 10
- add.l %d0, %d1 | %d1 += %d0
- move.l %d1, (YlastA,%a6) | p->YlastA = %d1
-
- move.l (YfilterA,%a6), %d2 | %d2 = p->YfilterA
- move.l %d2, %d0
- lsl.l #5, %d2
- sub.l %d0, %d2 | %d2 = 31 * %d2
- asr.l #5, %d2 | %d2 >>= 5
- add.l %d1, %d2
- move.l %d2, (YfilterA,%a6) | p->YfilterA = %d2
-
- | *decoded0 stored 2 instructions down, avoiding pipeline stall
-
- | ***** PREDICTOR X *****
-
- | Predictor X, Filter A
-
- move.l (XlastA,%a6), %d3 | %d3 = p->XlastA
-
- move.l %d2, (%a3)+ | *(decoded0++) = %d2 (p->YfilterA)
-
- movem.l (XDELAYA-12,%a5), %d0-%d2 | %d0 = p->buf[XDELAYA-3]
- | %d1 = p->buf[XDELAYA-2]
- | %d2 = p->buf[XDELAYA-1]
-
- move.l %d3, (XDELAYA,%a5) | p->buf[XDELAYA] = %d3
-
- sub.l %d3, %d2
- neg.l %d2 | %d2 = %d3 -%d2
-
- move.l %d2, (XDELAYA-4,%a5) | p->buf[XDELAYA-1] = %d2
-
- movem.l (XcoeffsA,%a6), %d4-%d7 | %d4 = p->XcoeffsA[0]
- | %d5 = p->XcoeffsA[1]
- | %d6 = p->XcoeffsA[2]
- | %d7 = p->XcoeffsA[3]
-
- mac.l %d3, %d4, %acc0 | %acc0 = p->buf[XDELAYA] * p->XcoeffsA[0]
- mac.l %d2, %d5, %acc0 | %acc0 += p->buf[XDELAYA-1] * p->XcoeffsA[1]
- mac.l %d1, %d6, %acc0 | %acc0 += p->buf[XDELAYA-2] * p->XcoeffsA[2]
- mac.l %d0, %d7, %acc0 | %acc0 += p->buf[XDELAYA-3] * p->XcoeffsA[3]
-
- tst.l %d2
- beq.s 1f
- spl.b %d2 | pos: 0x??????ff, neg: 0x??????00
- extb.l %d2 | pos: 0xffffffff, neg: 0x00000000
- or.l #1, %d2 | pos: 0xffffffff, neg: 0x00000001
-1: | %d2 = SIGN(%d2)
- move.l %d2, (XADAPTCOEFFSA-4,%a5) | p->buf[XADAPTCOEFFSA-1] = %d2
-
- tst.l %d3
- beq.s 1f
- spl.b %d3
- extb.l %d3
- or.l #1, %d3
-1: | %d3 = SIGN(%d3)
- move.l %d3, (XADAPTCOEFFSA,%a5) | p->buf[XADAPTCOEFFSA] = %d3
-
- | Predictor X, Filter B
-
- movem.l (XfilterB,%a6), %d2-%d3 | %d2 = p->XfilterB
- | %d3 = p->YfilterA
- move.l %d3, (XfilterB,%a6) | p->XfilterB = %d3
-
- move.l %d2, %d1 | %d1 = %d2
- lsl.l #5, %d2 | %d2 = %d2 * 32
- sub.l %d1, %d2 | %d2 -= %d1 (== 31 * old_d2)
- asr.l #5, %d2 | %d2 >>= 5
- sub.l %d2, %d3 | %d3 -= %d2
-
- movem.l (XDELAYB-16,%a5), %d4-%d7 | %d4 = p->buf[XDELAYB-4]
- | %d5 = p->buf[XDELAYB-3]
- | %d6 = p->buf[XDELAYB-2]
- | %d7 = p->buf[XDELAYB-1]
- sub.l %d3, %d7
- neg.l %d7 | %d7 = %d3 - %d7
-
- move.l %d7, (XDELAYB-4,%a5) | p->buf[XDELAYB-1] = %d7
-
- movem.l (XcoeffsB,%a6), %d1-%d2/%a0-%a2 | %d1 = p->XcoeffsB[0]
- | %d2 = p->XcoeffsB[1]
- | %a0 = p->XcoeffsB[2]
- | %a1 = p->XcoeffsB[3]
- | %a2 = p->XcoeffsB[4]
-
- mac.l %d3, %d1, %acc1 | %acc1 = p->buf[XDELAYB] * p->XcoeffsB[0]
- mac.l %d7, %d2, %acc1 | %acc1 += p->buf[XDELAYB-1] * p->XcoeffsB[1]
- mac.l %d6, %a0, %acc1 | %acc1 += p->buf[XDELAYB-2] * p->XcoeffsB[2]
- mac.l %d5, %a1, %acc1 | %acc1 += p->buf[XDELAYB-3] * p->XcoeffsB[3]
- mac.l %d4, %a2, %acc1 | %acc1 += p->buf[XDELAYB-4] * p->XcoeffsB[4]
-
- move.l %d3, (XDELAYB, %a5) | p->buf[XDELAYB] = %d3
-
- tst.l %d7
- beq.s 1f
- spl.b %d7
- extb.l %d7
- or.l #1, %d7
-1: | %d7 = SIGN(%d7)
- move.l %d7, (XADAPTCOEFFSB-4,%a5) | p->buf[XADAPTCOEFFSB-1] = %d7
-
- tst.l %d3
- beq.s 1f
- spl.b %d3
- extb.l %d3
- or.l #1, %d3
-1: | %d3 = SIGN(%d3)
- move.l %d3, (XADAPTCOEFFSB, %a5) | p->buf[XADAPTCOEFFSB] = %d3
-
- | %d1, %d2, %a0, %a1, %a2 contain p->XcoeffsB[0..4]
- | %d7, %d3 contain p->buf[XADAPTCOEFFSB-1] and p->buf[XADAPTCOEFFSB]
-
- move.l (%a4), %d0 | %d0 = *decoded1
- beq.s 3f
-
- movem.l (XADAPTCOEFFSB-16,%a5), %d4-%d6 | %d4 = p->buf[XADAPTCOEFFSB-4]
- | %d5 = p->buf[XADAPTCOEFFSB-3]
- | %d6 = p->buf[XADAPTCOEFFSB-2]
-
- bmi.s 1f | flags still valid here
-
- | *decoded1 > 0
-
- sub.l %d3, %d1 | %d1 = p->XcoeffsB[0] - p->buf[XADAPTCOEFFSB]
- sub.l %d7, %d2 | %d2 = p->XcoeffsB[1] - p->buf[XADAPTCOEFFSB-1]
- sub.l %d6, %a0 | %a0 = p->XcoeffsB[2] - p->buf[XADAPTCOEFFSB-2]
- sub.l %d5, %a1 | %a1 = p->XcoeffsB[3] - p->buf[XADAPTCOEFFSB-3]
- sub.l %d4, %a2 | %a2 = p->XcoeffsB[4] - p->buf[XADAPTCOEFFSB-4]
-
- movem.l %d1-%d2/%a0-%a2, (XcoeffsB,%a6) | Save p->XcoeffsB[]
-
- movem.l (XcoeffsA,%a6), %d4-%d7 | %d4 = p->XcoeffsA[0]
- | %d5 = p->XcoeffsA[1]
- | %d6 = p->XcoeffsA[2]
- | %d7 = p->XcoeffsA[3]
-
- movem.l (XADAPTCOEFFSA-12,%a5), %d2/%a0-%a2
- | %d2 = p->buf[XADAPTCOEFFSA-3]
- | %a0 = p->buf[XADAPTCOEFFSA-2]
- | %a1 = p->buf[XADAPTCOEFFSA-1]
- | %a2 = p->buf[XADAPTCOEFFSA]
-
- sub.l %a2, %d4 | %d4 = p->XcoeffsA[0] - p->buf[XADAPTCOEFFSA]
- sub.l %a1, %d5 | %d5 = p->XcoeffsA[1] - p->buf[XADAPTCOEFFSA-1]
- sub.l %a0, %d6 | %d6 = p->XcoeffsA[2] - p->buf[XADAPTCOEFFSA-2]
- sub.l %d2, %d7 | %d7 = p->XcoeffsA[3] - p->buf[XADAPTCOEFFSA-3]
-
- bra.s 2f
-
-1: | *decoded1 < 0
-
- add.l %d3, %d1 | %d1 = p->XcoeffsB[0] + p->buf[XADAPTCOEFFSB]
- add.l %d7, %d2 | %d2 = p->XcoeffsB[1] + p->buf[XADAPTCOEFFSB-1]
- add.l %d6, %a0 | %a0 = p->XcoeffsB[2] + p->buf[XADAPTCOEFFSB-2]
- add.l %d5, %a1 | %a1 = p->XcoeffsB[3] + p->buf[XADAPTCOEFFSB-3]
- add.l %d4, %a2 | %a2 = p->XcoeffsB[4] + p->buf[XADAPTCOEFFSB-4]
-
- movem.l %d1-%d2/%a0-%a2, (XcoeffsB,%a6) | Save p->XcoeffsB[]
-
- movem.l (XcoeffsA,%a6), %d4-%d7 | %d4 = p->XcoeffsA[0]
- | %d5 = p->XcoeffsA[1]
- | %d6 = p->XcoeffsA[2]
- | %d7 = p->XcoeffsA[3]
-
- movem.l (XADAPTCOEFFSA-12,%a5), %d2/%a0-%a2
- | %d2 = p->buf[XADAPTCOEFFSA-3]
- | %a0 = p->buf[XADAPTCOEFFSA-2]
- | %a1 = p->buf[XADAPTCOEFFSA-1]
- | %a2 = p->buf[XADAPTCOEFFSA]
-
- add.l %a2, %d4 | %d4 = p->XcoeffsA[0] + p->buf[XADAPTCOEFFSA]
- add.l %a1, %d5 | %d5 = p->XcoeffsA[1] + p->buf[XADAPTCOEFFSA-1]
- add.l %a0, %d6 | %d6 = p->XcoeffsA[2] + p->buf[XADAPTCOEFFSA-2]
- add.l %d2, %d7 | %d7 = p->XcoeffsA[3] + p->buf[XADAPTCOEFFSA-3]
-
-2:
- movem.l %d4-%d7, (XcoeffsA,%a6) | Save p->XcoeffsA[]
-
-3:
- | Finish Predictor X
-
- movclr.l %acc0, %d1 | %d1 = predictionA
- movclr.l %acc1, %d2 | %d2 = predictionB
- asr.l #1, %d2
- add.l %d2, %d1 | %d1 += (%d2 >> 1)
- asr.l #8, %d1
- asr.l #2, %d1 | %d1 >>= 10
- add.l %d0, %d1 | %d1 += %d0
- move.l %d1, (XlastA,%a6) | p->XlastA = %d1
-
- move.l (XfilterA,%a6), %d2 | %d2 = p->XfilterA
- move.l %d2, %d0
- lsl.l #5, %d2
- sub.l %d0, %d2 | %d2 = 31 * %d2
- asr.l #5, %d2 | %d6 >>= 2
- add.l %d1, %d2
- move.l %d2, (XfilterA,%a6) | p->XfilterA = %d2
-
- | *decoded1 stored 3 instructions down, avoiding pipeline stall
-
- | ***** COMMON *****
-
- addq.l #4, %a5 | p->buf++
- lea.l (historybuffer+PREDICTOR_HISTORY_SIZE*4,%a6), %a2
- | %a2 = &p->historybuffer[PREDICTOR_HISTORY_SIZE]
-
- move.l %d2, (%a4)+ | *(decoded1++) = %d2 (p->XfilterA)
-
- cmp.l %a2, %a5
- beq.s .move_hist | History buffer is full, we need to do a memmove
-
- subq.l #1, (%sp) | decrease loop count
- bne.w .loop
-
-.done:
- move.l %a5, (%a6) | Save value of p->buf
- movem.l (4,%sp), %d2-%d7/%a2-%a6
- lea.l (12*4,%sp), %sp
- rts
-
-.move_hist:
- lea.l (historybuffer,%a6), %a2
-
- | dest = %a2 (p->historybuffer)
- | src = %a5 (p->buf)
- | n = 200
-
- movem.l (%a5), %d0-%d7/%a0-%a1 | 40 bytes
- movem.l %d0-%d7/%a0-%a1, (%a2)
- movem.l (40,%a5), %d0-%d7/%a0-%a1 | 40 bytes
- movem.l %d0-%d7/%a0-%a1, (40,%a2)
- movem.l (80,%a5), %d0-%d7/%a0-%a1 | 40 bytes
- movem.l %d0-%d7/%a0-%a1, (80,%a2)
- movem.l (120,%a5), %d0-%d7/%a0-%a1 | 40 bytes
- movem.l %d0-%d7/%a0-%a1, (120,%a2)
- movem.l (160,%a5), %d0-%d7/%a0-%a1 | 40 bytes
- movem.l %d0-%d7/%a0-%a1, (160,%a2)
-
- move.l %a2, %a5 | p->buf = &p->historybuffer[0]
-
- subq.l #1, (%sp) | decrease loop count
- bne.w .loop
-
- bra.s .done
- .size predictor_decode_stereo, .-predictor_decode_stereo
-
-
- .global predictor_decode_mono
- .type predictor_decode_mono,@function
-
-| void predictor_decode_mono(struct predictor_t* p,
-| int32_t* decoded0,
-| int count)
-
-predictor_decode_mono:
- lea.l (-11*4,%sp), %sp
- movem.l %d2-%d7/%a2-%a6, (%sp)
-
- move.l #0, %macsr | signed integer mode
-
- move.l (11*4+4,%sp), %a6 | %a6 = p
- move.l (11*4+8,%sp), %a4 | %a4 = decoded0
- move.l (11*4+12,%sp), %d7 | %d7 = count
- move.l (%a6), %a5 | %a5 = p->buf
-
- move.l (YlastA,%a6), %d3 | %d3 = p->YlastA
-
-.loopm:
-
- | ***** PREDICTOR *****
-
- movem.l (YDELAYA-12,%a5), %d0-%d2 | %d0 = p->buf[YDELAYA-3]
- | %d1 = p->buf[YDELAYA-2]
- | %d2 = p->buf[YDELAYA-1]
-
- move.l %d3, (YDELAYA,%a5) | p->buf[YDELAYA] = %d3
-
- sub.l %d3, %d2
- neg.l %d2 | %d2 = %d3 - %d2
-
- move.l %d2, (YDELAYA-4,%a5) | p->buf[YDELAYA-1] = %d2
-
- movem.l (YcoeffsA,%a6), %a0-%a3 | %a0 = p->YcoeffsA[0]
- | %a1 = p->YcoeffsA[1]
- | %a2 = p->YcoeffsA[2]
- | %a3 = p->YcoeffsA[3]
-
- mac.l %d3, %a0, %acc0 | %acc0 = p->buf[YDELAYA] * p->YcoeffsA[0]
- mac.l %d2, %a1, %acc0 | %acc0 += p->buf[YDELAYA-1] * p->YcoeffsA[1]
- mac.l %d1, %a2, %acc0 | %acc0 += p->buf[YDELAYA-2] * p->YcoeffsA[2]
- mac.l %d0, %a3, %acc0 | %acc0 += p->buf[YDELAYA-3] * p->YcoeffsA[3]
-
- tst.l %d2
- beq.s 1f
- spl.b %d2 | pos: 0x??????ff, neg: 0x??????00
- extb.l %d2 | pos: 0xffffffff, neg: 0x00000000
- or.l #1, %d2 | pos: 0xffffffff, neg: 0x00000001
-1: | %d2 = SIGN(%d2)
- move.l %d2, (YADAPTCOEFFSA-4,%a5) | p->buf[YADAPTCOEFFSA-1] = %d2
-
- tst.l %d3
- beq.s 1f
- spl.b %d3
- extb.l %d3
- or.l #1, %d3
-1: | %d3 = SIGN(%d3)
- move.l %d3, (YADAPTCOEFFSA,%a5) | p->buf[YADAPTCOEFFSA] = %d3
-
- move.l (%a4), %d0 | %d0 = *decoded0
- beq.s 3f
-
- movem.l (YADAPTCOEFFSA-12,%a5),%d4-%d5 | %d4 = p->buf[YADAPTCOEFFSA-3]
- | %d5 = p->buf[YADAPTCOEFFSA-2]
-
- bmi.s 1f | flags still valid here
-
- | *decoded0 > 0
-
- sub.l %d3, %a0 | %a0 = p->YcoeffsA[0] - p->buf[YADAPTCOEFFSA]
- sub.l %d2, %a1 | %a1 = p->YcoeffsA[1] - p->buf[YADAPTCOEFFSA-1]
- sub.l %d5, %a2 | %a2 = p->YcoeffsA[2] - p->buf[YADAPTCOEFFSA-2]
- sub.l %d4, %a3 | %a3 = p->YcoeffsA[3] - p->buf[YADAPTCOEFFSA-3]
-
- bra.s 2f
-
-1: | *decoded0 < 0
-
- add.l %d3, %a0 | %a0 = p->YcoeffsA[0] - p->buf[YADAPTCOEFFSA]
- add.l %d2, %a1 | %a1 = p->YcoeffsA[1] - p->buf[YADAPTCOEFFSA-1]
- add.l %d5, %a2 | %a2 = p->YcoeffsA[2] - p->buf[YADAPTCOEFFSA-2]
- add.l %d4, %a3 | %a3 = p->YcoeffsA[3] - p->buf[YADAPTCOEFFSA-3]
-
-2:
- movem.l %a0-%a3, (YcoeffsA,%a6) | save p->YcoeffsA[]
-
-3:
- | Finish Predictor
-
- movclr.l %acc0, %d3 | %d3 = predictionA
- asr.l #8, %d3
- asr.l #2, %d3 | %d3 >>= 10
- add.l %d0, %d3 | %d3 += %d0
-
- move.l (YfilterA,%a6), %d2 | %d2 = p->YfilterA
- move.l %d2, %d0
- lsl.l #5, %d2
- sub.l %d0, %d2 | %d2 = 31 * %d2
- asr.l #5, %d2 | %d2 >>= 5
- add.l %d3, %d2
- move.l %d2, (YfilterA,%a6) | p->YfilterA = %d2
-
- | *decoded0 stored 3 instructions down, avoiding pipeline stall
-
- | ***** COMMON *****
-
- addq.l #4, %a5 | p->buf++
- lea.l (historybuffer+PREDICTOR_HISTORY_SIZE*4,%a6), %a3
- | %a3 = &p->historybuffer[PREDICTOR_HISTORY_SIZE]
-
- move.l %d2, (%a4)+ | *(decoded0++) = %d2 (p->YfilterA)
-
- cmp.l %a3, %a5
- beq.s .move_histm | History buffer is full, we need to do a memmove
-
- subq.l #1, %d7 | decrease loop count
- bne.w .loopm
-
- move.l %d3, (YlastA,%a6) | %d3 = p->YlastA
-
-.donem:
- move.l %a5, (%a6) | Save value of p->buf
- movem.l (%sp), %d2-%d7/%a2-%a6
- lea.l (11*4,%sp), %sp
- rts
-
-.move_histm:
- move.l %d3, (YlastA,%a6) | %d3 = p->YlastA
-
- lea.l (historybuffer,%a6), %a3
-
- | dest = %a3 (p->historybuffer)
- | src = %a5 (p->buf)
- | n = 200
-
- movem.l (%a5), %d0-%d6/%a0-%a2 | 40 bytes
- movem.l %d0-%d6/%a0-%a2, (%a3)
- movem.l (40,%a5), %d0-%d6/%a0-%a2 | 40 bytes
- movem.l %d0-%d6/%a0-%a2, (40,%a3)
- movem.l (80,%a5), %d0-%d6/%a0-%a2 | 40 bytes
- movem.l %d0-%d6/%a0-%a2, (80,%a3)
- movem.l (120,%a5), %d0-%d6/%a0-%a2 | 40 bytes
- movem.l %d0-%d6/%a0-%a2, (120,%a3)
- movem.l (160,%a5), %d0-%d6/%a0-%a2 | 40 bytes
- movem.l %d0-%d6/%a0-%a2, (160,%a3)
-
- move.l %a3, %a5 | p->buf = &p->historybuffer[0]
-
- move.l (YlastA,%a6), %d3 | %d3 = p->YlastA
-
- subq.l #1, %d7 | decrease loop count
- bne.w .loopm
-
- bra.s .donem
- .size predictor_decode_mono, .-predictor_decode_mono
diff --git a/plugins/demac/libdemac/predictor.c b/plugins/demac/libdemac/predictor.c
deleted file mode 100644
index 7d914b5f..00000000
--- a/plugins/demac/libdemac/predictor.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: predictor.c 19375 2008-12-09 23:20:59Z amiconn $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-#include <inttypes.h>
-#include <string.h>
-
-#include "parser.h"
-#include "predictor.h"
-#include "demac_config.h"
-
-/* Return 0 if x is zero, -1 if x is positive, 1 if x is negative */
-#define SIGN(x) (x) ? (((x) > 0) ? -1 : 1) : 0
-
-static const int32_t initial_coeffs[4] = {
- 360, 317, -109, 98
-};
-
-#define YDELAYA (18 + PREDICTOR_ORDER*4)
-#define YDELAYB (18 + PREDICTOR_ORDER*3)
-#define XDELAYA (18 + PREDICTOR_ORDER*2)
-#define XDELAYB (18 + PREDICTOR_ORDER)
-
-#define YADAPTCOEFFSA (18)
-#define XADAPTCOEFFSA (14)
-#define YADAPTCOEFFSB (10)
-#define XADAPTCOEFFSB (5)
-
-void init_predictor_decoder(struct predictor_t* p)
-{
- /* Zero the history buffers */
- memset(p->historybuffer, 0, PREDICTOR_SIZE * sizeof(int32_t));
- p->buf = p->historybuffer;
-
- /* Initialise and zero the co-efficients */
- memcpy(p->YcoeffsA, initial_coeffs, sizeof(initial_coeffs));
- memcpy(p->XcoeffsA, initial_coeffs, sizeof(initial_coeffs));
- memset(p->YcoeffsB, 0, sizeof(p->YcoeffsB));
- memset(p->XcoeffsB, 0, sizeof(p->XcoeffsB));
-
- p->YfilterA = 0;
- p->YfilterB = 0;
- p->YlastA = 0;
-
- p->XfilterA = 0;
- p->XfilterB = 0;
- p->XlastA = 0;
-}
-
-#if !defined(CPU_ARM) && !defined(CPU_COLDFIRE)
-void ICODE_ATTR_DEMAC predictor_decode_stereo(struct predictor_t* p,
- int32_t* decoded0,
- int32_t* decoded1,
- int count)
-{
- int32_t predictionA, predictionB;
-
- while (LIKELY(count--))
- {
- /* Predictor Y */
- p->buf[YDELAYA] = p->YlastA;
- p->buf[YADAPTCOEFFSA] = SIGN(p->buf[YDELAYA]);
-
- p->buf[YDELAYA-1] = p->buf[YDELAYA] - p->buf[YDELAYA-1];
- p->buf[YADAPTCOEFFSA-1] = SIGN(p->buf[YDELAYA-1]);
-
- predictionA = (p->buf[YDELAYA] * p->YcoeffsA[0]) +
- (p->buf[YDELAYA-1] * p->YcoeffsA[1]) +
- (p->buf[YDELAYA-2] * p->YcoeffsA[2]) +
- (p->buf[YDELAYA-3] * p->YcoeffsA[3]);
-
- /* Apply a scaled first-order filter compression */
- p->buf[YDELAYB] = p->XfilterA - ((p->YfilterB * 31) >> 5);
- p->buf[YADAPTCOEFFSB] = SIGN(p->buf[YDELAYB]);
- p->YfilterB = p->XfilterA;
-
- p->buf[YDELAYB-1] = p->buf[YDELAYB] - p->buf[YDELAYB-1];
- p->buf[YADAPTCOEFFSB-1] = SIGN(p->buf[YDELAYB-1]);
-
- predictionB = (p->buf[YDELAYB] * p->YcoeffsB[0]) +
- (p->buf[YDELAYB-1] * p->YcoeffsB[1]) +
- (p->buf[YDELAYB-2] * p->YcoeffsB[2]) +
- (p->buf[YDELAYB-3] * p->YcoeffsB[3]) +
- (p->buf[YDELAYB-4] * p->YcoeffsB[4]);
-
- p->YlastA = *decoded0 + ((predictionA + (predictionB >> 1)) >> 10);
- p->YfilterA = p->YlastA + ((p->YfilterA * 31) >> 5);
-
- /* Predictor X */
-
- p->buf[XDELAYA] = p->XlastA;
- p->buf[XADAPTCOEFFSA] = SIGN(p->buf[XDELAYA]);
- p->buf[XDELAYA-1] = p->buf[XDELAYA] - p->buf[XDELAYA-1];
- p->buf[XADAPTCOEFFSA-1] = SIGN(p->buf[XDELAYA-1]);
-
- predictionA = (p->buf[XDELAYA] * p->XcoeffsA[0]) +
- (p->buf[XDELAYA-1] * p->XcoeffsA[1]) +
- (p->buf[XDELAYA-2] * p->XcoeffsA[2]) +
- (p->buf[XDELAYA-3] * p->XcoeffsA[3]);
-
- /* Apply a scaled first-order filter compression */
- p->buf[XDELAYB] = p->YfilterA - ((p->XfilterB * 31) >> 5);
- p->buf[XADAPTCOEFFSB] = SIGN(p->buf[XDELAYB]);
- p->XfilterB = p->YfilterA;
- p->buf[XDELAYB-1] = p->buf[XDELAYB] - p->buf[XDELAYB-1];
- p->buf[XADAPTCOEFFSB-1] = SIGN(p->buf[XDELAYB-1]);
-
- predictionB = (p->buf[XDELAYB] * p->XcoeffsB[0]) +
- (p->buf[XDELAYB-1] * p->XcoeffsB[1]) +
- (p->buf[XDELAYB-2] * p->XcoeffsB[2]) +
- (p->buf[XDELAYB-3] * p->XcoeffsB[3]) +
- (p->buf[XDELAYB-4] * p->XcoeffsB[4]);
-
- p->XlastA = *decoded1 + ((predictionA + (predictionB >> 1)) >> 10);
- p->XfilterA = p->XlastA + ((p->XfilterA * 31) >> 5);
-
- if (LIKELY(*decoded0 != 0))
- {
- if (*decoded0 > 0)
- {
- p->YcoeffsA[0] -= p->buf[YADAPTCOEFFSA];
- p->YcoeffsA[1] -= p->buf[YADAPTCOEFFSA-1];
- p->YcoeffsA[2] -= p->buf[YADAPTCOEFFSA-2];
- p->YcoeffsA[3] -= p->buf[YADAPTCOEFFSA-3];
-
- p->YcoeffsB[0] -= p->buf[YADAPTCOEFFSB];
- p->YcoeffsB[1] -= p->buf[YADAPTCOEFFSB-1];
- p->YcoeffsB[2] -= p->buf[YADAPTCOEFFSB-2];
- p->YcoeffsB[3] -= p->buf[YADAPTCOEFFSB-3];
- p->YcoeffsB[4] -= p->buf[YADAPTCOEFFSB-4];
- }
- else
- {
- p->YcoeffsA[0] += p->buf[YADAPTCOEFFSA];
- p->YcoeffsA[1] += p->buf[YADAPTCOEFFSA-1];
- p->YcoeffsA[2] += p->buf[YADAPTCOEFFSA-2];
- p->YcoeffsA[3] += p->buf[YADAPTCOEFFSA-3];
-
- p->YcoeffsB[0] += p->buf[YADAPTCOEFFSB];
- p->YcoeffsB[1] += p->buf[YADAPTCOEFFSB-1];
- p->YcoeffsB[2] += p->buf[YADAPTCOEFFSB-2];
- p->YcoeffsB[3] += p->buf[YADAPTCOEFFSB-3];
- p->YcoeffsB[4] += p->buf[YADAPTCOEFFSB-4];
- }
- }
-
- *(decoded0++) = p->YfilterA;
-
- if (LIKELY(*decoded1 != 0))
- {
- if (*decoded1 > 0)
- {
- p->XcoeffsA[0] -= p->buf[XADAPTCOEFFSA];
- p->XcoeffsA[1] -= p->buf[XADAPTCOEFFSA-1];
- p->XcoeffsA[2] -= p->buf[XADAPTCOEFFSA-2];
- p->XcoeffsA[3] -= p->buf[XADAPTCOEFFSA-3];
-
- p->XcoeffsB[0] -= p->buf[XADAPTCOEFFSB];
- p->XcoeffsB[1] -= p->buf[XADAPTCOEFFSB-1];
- p->XcoeffsB[2] -= p->buf[XADAPTCOEFFSB-2];
- p->XcoeffsB[3] -= p->buf[XADAPTCOEFFSB-3];
- p->XcoeffsB[4] -= p->buf[XADAPTCOEFFSB-4];
- }
- else
- {
- p->XcoeffsA[0] += p->buf[XADAPTCOEFFSA];
- p->XcoeffsA[1] += p->buf[XADAPTCOEFFSA-1];
- p->XcoeffsA[2] += p->buf[XADAPTCOEFFSA-2];
- p->XcoeffsA[3] += p->buf[XADAPTCOEFFSA-3];
-
- p->XcoeffsB[0] += p->buf[XADAPTCOEFFSB];
- p->XcoeffsB[1] += p->buf[XADAPTCOEFFSB-1];
- p->XcoeffsB[2] += p->buf[XADAPTCOEFFSB-2];
- p->XcoeffsB[3] += p->buf[XADAPTCOEFFSB-3];
- p->XcoeffsB[4] += p->buf[XADAPTCOEFFSB-4];
- }
- }
-
- *(decoded1++) = p->XfilterA;
-
- /* Combined */
- p->buf++;
-
- /* Have we filled the history buffer? */
- if (UNLIKELY(p->buf == p->historybuffer + PREDICTOR_HISTORY_SIZE)) {
- memmove(p->historybuffer, p->buf,
- PREDICTOR_SIZE * sizeof(int32_t));
- p->buf = p->historybuffer;
- }
- }
-}
-
-void ICODE_ATTR_DEMAC predictor_decode_mono(struct predictor_t* p,
- int32_t* decoded0,
- int count)
-{
- int32_t predictionA, currentA, A;
-
- currentA = p->YlastA;
-
- while (LIKELY(count--))
- {
- A = *decoded0;
-
- p->buf[YDELAYA] = currentA;
- p->buf[YDELAYA-1] = p->buf[YDELAYA] - p->buf[YDELAYA-1];
-
- predictionA = (p->buf[YDELAYA] * p->YcoeffsA[0]) +
- (p->buf[YDELAYA-1] * p->YcoeffsA[1]) +
- (p->buf[YDELAYA-2] * p->YcoeffsA[2]) +
- (p->buf[YDELAYA-3] * p->YcoeffsA[3]);
-
- currentA = A + (predictionA >> 10);
-
- p->buf[YADAPTCOEFFSA] = SIGN(p->buf[YDELAYA]);
- p->buf[YADAPTCOEFFSA-1] = SIGN(p->buf[YDELAYA-1]);
-
- if (LIKELY(A != 0))
- {
- if (A > 0)
- {
- p->YcoeffsA[0] -= p->buf[YADAPTCOEFFSA];
- p->YcoeffsA[1] -= p->buf[YADAPTCOEFFSA-1];
- p->YcoeffsA[2] -= p->buf[YADAPTCOEFFSA-2];
- p->YcoeffsA[3] -= p->buf[YADAPTCOEFFSA-3];
- }
- else
- {
- p->YcoeffsA[0] += p->buf[YADAPTCOEFFSA];
- p->YcoeffsA[1] += p->buf[YADAPTCOEFFSA-1];
- p->YcoeffsA[2] += p->buf[YADAPTCOEFFSA-2];
- p->YcoeffsA[3] += p->buf[YADAPTCOEFFSA-3];
- }
- }
-
- p->buf++;
-
- /* Have we filled the history buffer? */
- if (UNLIKELY(p->buf == p->historybuffer + PREDICTOR_HISTORY_SIZE)) {
- memmove(p->historybuffer, p->buf,
- PREDICTOR_SIZE * sizeof(int32_t));
- p->buf = p->historybuffer;
- }
-
- p->YfilterA = currentA + ((p->YfilterA * 31) >> 5);
- *(decoded0++) = p->YfilterA;
- }
-
- p->YlastA = currentA;
-}
-#endif
diff --git a/plugins/demac/libdemac/predictor.h b/plugins/demac/libdemac/predictor.h
deleted file mode 100644
index ccf2b39b..00000000
--- a/plugins/demac/libdemac/predictor.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: predictor.h 19236 2008-11-26 18:01:18Z amiconn $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-#ifndef _APE_PREDICTOR_H
-#define _APE_PREDICTOR_H
-
-#include <inttypes.h>
-#include "parser.h"
-#include "filter.h"
-
-void init_predictor_decoder(struct predictor_t* p);
-void predictor_decode_stereo(struct predictor_t* p, int32_t* decoded0,
- int32_t* decoded1, int count);
-void predictor_decode_mono(struct predictor_t* p, int32_t* decoded0,
- int count);
-
-#endif
diff --git a/plugins/demac/libdemac/vector_math16_armv5te.h b/plugins/demac/libdemac/vector_math16_armv5te.h
deleted file mode 100644
index 81a5cb6e..00000000
--- a/plugins/demac/libdemac/vector_math16_armv5te.h
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: vector_math16_armv5te.h 19260 2008-11-28 23:50:22Z amiconn $
-
-Copyright (C) Dave Chapman 2007
-
-ARMv5te vector math copyright (C) 2008 Jens Arnold
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-/* This version fetches data as 32 bit words, and *requires* v1 to be
- * 32 bit aligned, otherwise it will result either in a data abort, or
- * incorrect results (if ARM aligncheck is disabled). */
-static inline void vector_add(int16_t* v1, int16_t* v2)
-{
-#if ORDER > 16
- int cnt = ORDER>>4;
-#endif
-
-#define ADDHALFREGS(sum, s1) /* Adds register */ \
- "mov " #s1 ", " #s1 ", ror #16 \n" /* halves straight. */ \
- "add r8 , " #s1 ", " #sum ", lsl #16 \n" /* Clobbers 's1' */ \
- "add " #sum ", " #s1 ", " #sum ", lsr #16 \n" /* and r8. */ \
- "mov " #sum ", " #sum ", lsl #16 \n" \
- "orr " #sum ", " #sum ", r8 , lsr #16 \n"
-
-#define ADDHALFXREGS(sum, s1, s2) /* Adds register */ \
- "add " #s1 ", " #s1 ", " #sum ", lsl #16 \n" /* halves across. */ \
- "add " #sum ", " #s2 ", " #sum ", lsr #16 \n" /* Clobbers 's1'. */ \
- "mov " #sum ", " #sum ", lsl #16 \n" \
- "orr " #sum ", " #sum ", " #s1 ", lsr #16 \n"
-
- asm volatile (
- "tst %[v2], #2 \n"
- "beq 20f \n"
-
- "10: \n"
- "ldrh r4, [%[v2]], #2 \n"
- "mov r4, r4, lsl #16 \n"
- "1: \n"
- "ldmia %[v1], {r0-r3} \n"
- "ldmia %[v2]!, {r5-r8} \n"
- ADDHALFXREGS(r0, r4, r5)
- ADDHALFXREGS(r1, r5, r6)
- ADDHALFXREGS(r2, r6, r7)
- ADDHALFXREGS(r3, r7, r8)
- "stmia %[v1]!, {r0-r3} \n"
- "mov r4, r8 \n"
- "ldmia %[v1], {r0-r3} \n"
- "ldmia %[v2]!, {r5-r8} \n"
- ADDHALFXREGS(r0, r4, r5)
- ADDHALFXREGS(r1, r5, r6)
- ADDHALFXREGS(r2, r6, r7)
- ADDHALFXREGS(r3, r7, r8)
- "stmia %[v1]!, {r0-r3} \n"
-#if ORDER > 16
- "mov r4, r8 \n"
- "subs %[cnt], %[cnt], #1 \n"
- "bne 1b \n"
-#endif
- "b 99f \n"
-
- "20: \n"
- "1: \n"
- "ldmia %[v1], {r0-r3} \n"
- "ldmia %[v2]!, {r4-r7} \n"
- ADDHALFREGS(r0, r4)
- ADDHALFREGS(r1, r5)
- ADDHALFREGS(r2, r6)
- ADDHALFREGS(r3, r7)
- "stmia %[v1]!, {r0-r3} \n"
- "ldmia %[v1], {r0-r3} \n"
- "ldmia %[v2]!, {r4-r7} \n"
- ADDHALFREGS(r0, r4)
- ADDHALFREGS(r1, r5)
- ADDHALFREGS(r2, r6)
- ADDHALFREGS(r3, r7)
- "stmia %[v1]!, {r0-r3} \n"
-#if ORDER > 16
- "subs %[cnt], %[cnt], #1 \n"
- "bne 1b \n"
-#endif
-
- "99: \n"
- : /* outputs */
-#if ORDER > 16
- [cnt]"+r"(cnt),
-#endif
- [v1] "+r"(v1),
- [v2] "+r"(v2)
- : /* inputs */
- : /* clobbers */
- "r0", "r1", "r2", "r3", "r4",
- "r5", "r6", "r7", "r8", "memory"
- );
-}
-
-/* This version fetches data as 32 bit words, and *requires* v1 to be
- * 32 bit aligned, otherwise it will result either in a data abort, or
- * incorrect results (if ARM aligncheck is disabled). */
-static inline void vector_sub(int16_t* v1, int16_t* v2)
-{
-#if ORDER > 16
- int cnt = ORDER>>4;
-#endif
-
-#define SUBHALFREGS(dif, s1) /* Subtracts register */ \
- "sub r8 , " #dif ", " #s1 "\n" /* halves straight. */ \
- "and r8 , r8 , r9 \n" /* Needs r9 = 0x0000ffff, */ \
- "mov " #dif ", " #dif ", lsr #16 \n" /* clobbers r8. */ \
- "sub " #dif ", " #dif ", " #s1 ", lsr #16 \n" \
- "orr " #dif ", r8 , " #dif ", lsl #16 \n"
-
-#define SUBHALFXREGS(dif, s1, s2) /* Subtracts register */ \
- "sub " #s1 ", " #dif ", " #s1 ", lsr #16 \n" /* halves across. */ \
- "and " #s1 ", " #s1 ", r9 \n" /* Needs r9 = 0x0000ffff, */ \
- "rsb " #dif ", " #s2 ", " #dif ", lsr #16 \n" /* clobbers 's1'. */ \
- "orr " #dif ", " #s1 ", " #dif ", lsl #16 \n"
-
- asm volatile (
- "mov r9, #0xff \n"
- "orr r9, r9, #0xff00 \n"
- "tst %[v2], #2 \n"
- "beq 20f \n"
-
- "10: \n"
- "ldrh r4, [%[v2]], #2 \n"
- "mov r4, r4, lsl #16 \n"
- "1: \n"
- "ldmia %[v1], {r0-r3} \n"
- "ldmia %[v2]!, {r5-r8} \n"
- SUBHALFXREGS(r0, r4, r5)
- SUBHALFXREGS(r1, r5, r6)
- SUBHALFXREGS(r2, r6, r7)
- SUBHALFXREGS(r3, r7, r8)
- "stmia %[v1]!, {r0-r3} \n"
- "mov r4, r8 \n"
- "ldmia %[v1], {r0-r3} \n"
- "ldmia %[v2]!, {r5-r8} \n"
- SUBHALFXREGS(r0, r4, r5)
- SUBHALFXREGS(r1, r5, r6)
- SUBHALFXREGS(r2, r6, r7)
- SUBHALFXREGS(r3, r7, r8)
- "stmia %[v1]!, {r0-r3} \n"
-#if ORDER > 16
- "mov r4, r8 \n"
- "subs %[cnt], %[cnt], #1 \n"
- "bne 1b \n"
-#endif
- "b 99f \n"
-
- "20: \n"
- "1: \n"
- "ldmia %[v1], {r0-r3} \n"
- "ldmia %[v2]!, {r4-r7} \n"
- SUBHALFREGS(r0, r4)
- SUBHALFREGS(r1, r5)
- SUBHALFREGS(r2, r6)
- SUBHALFREGS(r3, r7)
- "stmia %[v1]!, {r0-r3} \n"
- "ldmia %[v1], {r0-r3} \n"
- "ldmia %[v2]!, {r4-r7} \n"
- SUBHALFREGS(r0, r4)
- SUBHALFREGS(r1, r5)
- SUBHALFREGS(r2, r6)
- SUBHALFREGS(r3, r7)
- "stmia %[v1]!, {r0-r3} \n"
-#if ORDER > 16
- "subs %[cnt], %[cnt], #1 \n"
- "bne 1b \n"
-#endif
-
- "99: \n"
- : /* outputs */
-#if ORDER > 16
- [cnt]"+r"(cnt),
-#endif
- [v1] "+r"(v1),
- [v2] "+r"(v2)
- : /* inputs */
- : /* clobbers */
- "r0", "r1", "r2", "r3", "r4", "r5",
- "r6", "r7", "r8", "r9", "memory"
- );
-}
-
-/* This version fetches data as 32 bit words, and *requires* v1 to be
- * 32 bit aligned, otherwise it will result either in a data abort, or
- * incorrect results (if ARM aligncheck is disabled). */
-static inline int32_t scalarproduct(int16_t* v1, int16_t* v2)
-{
- int res;
-#if ORDER > 32
- int cnt = ORDER>>5;
-#endif
-
-#if ORDER > 16
-#define MLA_BLOCKS "3"
-#else
-#define MLA_BLOCKS "1"
-#endif
-
- asm volatile (
-#if ORDER > 32
- "mov %[res], #0 \n"
-#endif
- "tst %[v2], #2 \n"
- "beq 20f \n"
-
- "10: \n"
- "ldrh r7, [%[v2]], #2 \n"
-#if ORDER > 32
- "mov r7, r7, lsl #16 \n"
- "1: \n"
- "ldmia %[v1]!, {r0-r3} \n"
- "smlabt %[res], r0, r7, %[res] \n"
-#else
- "ldmia %[v1]!, {r0-r3} \n"
- "smulbb %[res], r0, r7 \n"
-#endif
- "ldmia %[v2]!, {r4-r7} \n"
- "smlatb %[res], r0, r4, %[res] \n"
- "smlabt %[res], r1, r4, %[res] \n"
- "smlatb %[res], r1, r5, %[res] \n"
- "smlabt %[res], r2, r5, %[res] \n"
- "smlatb %[res], r2, r6, %[res] \n"
- "smlabt %[res], r3, r6, %[res] \n"
- "smlatb %[res], r3, r7, %[res] \n"
-
- ".rept " MLA_BLOCKS "\n"
- "ldmia %[v1]!, {r0-r3} \n"
- "smlabt %[res], r0, r7, %[res] \n"
- "ldmia %[v2]!, {r4-r7} \n"
- "smlatb %[res], r0, r4, %[res] \n"
- "smlabt %[res], r1, r4, %[res] \n"
- "smlatb %[res], r1, r5, %[res] \n"
- "smlabt %[res], r2, r5, %[res] \n"
- "smlatb %[res], r2, r6, %[res] \n"
- "smlabt %[res], r3, r6, %[res] \n"
- "smlatb %[res], r3, r7, %[res] \n"
- ".endr \n"
-#if ORDER > 32
- "subs %[cnt], %[cnt], #1 \n"
- "bne 1b \n"
-#endif
- "b 99f \n"
-
- "20: \n"
- "1: \n"
- "ldmia %[v1]!, {r0-r3} \n"
- "ldmia %[v2]!, {r4-r7} \n"
-#if ORDER > 32
- "smlabb %[res], r0, r4, %[res] \n"
-#else
- "smulbb %[res], r0, r4 \n"
-#endif
- "smlatt %[res], r0, r4, %[res] \n"
- "smlabb %[res], r1, r5, %[res] \n"
- "smlatt %[res], r1, r5, %[res] \n"
- "smlabb %[res], r2, r6, %[res] \n"
- "smlatt %[res], r2, r6, %[res] \n"
- "smlabb %[res], r3, r7, %[res] \n"
- "smlatt %[res], r3, r7, %[res] \n"
-
- ".rept " MLA_BLOCKS "\n"
- "ldmia %[v1]!, {r0-r3} \n"
- "ldmia %[v2]!, {r4-r7} \n"
- "smlabb %[res], r0, r4, %[res] \n"
- "smlatt %[res], r0, r4, %[res] \n"
- "smlabb %[res], r1, r5, %[res] \n"
- "smlatt %[res], r1, r5, %[res] \n"
- "smlabb %[res], r2, r6, %[res] \n"
- "smlatt %[res], r2, r6, %[res] \n"
- "smlabb %[res], r3, r7, %[res] \n"
- "smlatt %[res], r3, r7, %[res] \n"
- ".endr \n"
-#if ORDER > 32
- "subs %[cnt], %[cnt], #1 \n"
- "bne 1b \n"
-#endif
-
- "99: \n"
- : /* outputs */
-#if ORDER > 32
- [cnt]"+r"(cnt),
-#endif
- [v1] "+r"(v1),
- [v2] "+r"(v2),
- [res]"=r"(res)
- : /* inputs */
- : /* clobbers */
- "r0", "r1", "r2", "r3",
- "r4", "r5", "r6", "r7"
- );
- return res;
-}
diff --git a/plugins/demac/libdemac/vector_math16_armv6.h b/plugins/demac/libdemac/vector_math16_armv6.h
deleted file mode 100644
index f6505f42..00000000
--- a/plugins/demac/libdemac/vector_math16_armv6.h
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: vector_math16_armv6.h 19198 2008-11-24 18:40:43Z amiconn $
-
-Copyright (C) Dave Chapman 2007
-
-ARMv6 vector math copyright (C) 2008 Jens Arnold
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-/* This version fetches data as 32 bit words, and *requires* v1 to be
- * 32 bit aligned, otherwise it will result either in a data abort, or
- * incorrect results (if ARM aligncheck is disabled). */
-static inline void vector_add(int16_t* v1, int16_t* v2)
-{
-#if ORDER > 32
- int cnt = ORDER>>5;
-#endif
-
-#if ORDER > 16
-#define ADD_SUB_BLOCKS "4"
-#else
-#define ADD_SUB_BLOCKS "2"
-#endif
-
- asm volatile (
- "tst %[v2], #2 \n"
- "beq 20f \n"
-
- "10: \n"
- "bic %[v2], %[v2], #2 \n"
- "ldmia %[v2]!, {r4-r5} \n"
- "1: \n"
- ".rept " ADD_SUB_BLOCKS "\n"
- "ldmia %[v2]!, {r6-r7} \n"
- "ldmia %[v1], {r0-r3} \n"
- "mov r5, r5, ror #16 \n"
- "pkhtb r4, r5, r4, asr #16 \n"
- "sadd16 r0, r0, r4 \n"
- "pkhbt r5, r5, r6, lsl #16 \n"
- "sadd16 r1, r1, r5 \n"
- "ldmia %[v2]!, {r4-r5} \n"
- "mov r7, r7, ror #16 \n"
- "pkhtb r6, r7, r6, asr #16 \n"
- "sadd16 r2, r2, r6 \n"
- "pkhbt r7, r7, r4, lsl #16 \n"
- "sadd16 r3, r3, r7 \n"
- "stmia %[v1]!, {r0-r3} \n"
- ".endr \n"
-#if ORDER > 32
- "subs %[cnt], %[cnt], #1 \n"
- "bne 1b \n"
-#endif
- "b 99f \n"
-
- "20: \n"
- "1: \n"
- ".rept " ADD_SUB_BLOCKS "\n"
- "ldmia %[v2]!, {r4-r7} \n"
- "ldmia %[v1], {r0-r3} \n"
- "sadd16 r0, r0, r4 \n"
- "sadd16 r1, r1, r5 \n"
- "sadd16 r2, r2, r6 \n"
- "sadd16 r3, r3, r7 \n"
- "stmia %[v1]!, {r0-r3} \n"
- ".endr \n"
-#if ORDER > 32
- "subs %[cnt], %[cnt], #1 \n"
- "bne 1b \n"
-#endif
-
- "99: \n"
- : /* outputs */
-#if ORDER > 32
- [cnt]"+r"(cnt),
-#endif
- [v1] "+r"(v1),
- [v2] "+r"(v2)
- : /* inputs */
- : /* clobbers */
- "r0", "r1", "r2", "r3", "r4",
- "r5", "r6", "r7", "memory"
- );
-}
-
-/* This version fetches data as 32 bit words, and *requires* v1 to be
- * 32 bit aligned, otherwise it will result either in a data abort, or
- * incorrect results (if ARM aligncheck is disabled). */
-static inline void vector_sub(int16_t* v1, int16_t* v2)
-{
-#if ORDER > 32
- int cnt = ORDER>>5;
-#endif
-
- asm volatile (
- "tst %[v2], #2 \n"
- "beq 20f \n"
-
- "10: \n"
- "bic %[v2], %[v2], #2 \n"
- "ldmia %[v2]!, {r4-r5} \n"
- "1: \n"
- ".rept " ADD_SUB_BLOCKS "\n"
- "ldmia %[v2]!, {r6-r7} \n"
- "ldmia %[v1], {r0-r3} \n"
- "mov r5, r5, ror #16 \n"
- "pkhtb r4, r5, r4, asr #16 \n"
- "ssub16 r0, r0, r4 \n"
- "pkhbt r5, r5, r6, lsl #16 \n"
- "ssub16 r1, r1, r5 \n"
- "ldmia %[v2]!, {r4-r5} \n"
- "mov r7, r7, ror #16 \n"
- "pkhtb r6, r7, r6, asr #16 \n"
- "ssub16 r2, r2, r6 \n"
- "pkhbt r7, r7, r4, lsl #16 \n"
- "ssub16 r3, r3, r7 \n"
- "stmia %[v1]!, {r0-r3} \n"
- ".endr \n"
-#if ORDER > 32
- "subs %[cnt], %[cnt], #1 \n"
- "bne 1b \n"
-#endif
- "b 99f \n"
-
- "20: \n"
- "1: \n"
- ".rept " ADD_SUB_BLOCKS "\n"
- "ldmia %[v2]!, {r4-r7} \n"
- "ldmia %[v1], {r0-r3} \n"
- "ssub16 r0, r0, r4 \n"
- "ssub16 r1, r1, r5 \n"
- "ssub16 r2, r2, r6 \n"
- "ssub16 r3, r3, r7 \n"
- "stmia %[v1]!, {r0-r3} \n"
- ".endr \n"
-#if ORDER > 32
- "subs %[cnt], %[cnt], #1 \n"
- "bne 1b \n"
-#endif
-
- "99: \n"
- : /* outputs */
-#if ORDER > 32
- [cnt]"+r"(cnt),
-#endif
- [v1] "+r"(v1),
- [v2] "+r"(v2)
- : /* inputs */
- : /* clobbers */
- "r0", "r1", "r2", "r3", "r4",
- "r5", "r6", "r7", "memory"
- );
-}
-
-/* This version fetches data as 32 bit words, and *requires* v1 to be
- * 32 bit aligned, otherwise it will result either in a data abort, or
- * incorrect results (if ARM aligncheck is disabled). */
-static inline int32_t scalarproduct(int16_t* v1, int16_t* v2)
-{
- int res;
-#if ORDER > 32
- int cnt = ORDER>>5;
-#endif
-
-#if ORDER > 16
-#define MLA_BLOCKS "3"
-#else
-#define MLA_BLOCKS "1"
-#endif
-
- asm volatile (
-#if ORDER > 32
- "mov %[res], #0 \n"
-#endif
- "tst %[v2], #2 \n"
- "beq 20f \n"
-
- "10: \n"
- "bic %[v2], %[v2], #2 \n"
- "ldmia %[v2]!, {r5-r7} \n"
- "ldmia %[v1]!, {r0-r1} \n"
- "1: \n"
- "pkhbt r8, r6, r5 \n"
- "ldmia %[v2]!, {r4-r5} \n"
-#if ORDER > 32
- "smladx %[res], r0, r8, %[res] \n"
-#else
- "smuadx %[res], r0, r8 \n"
-#endif
- ".rept " MLA_BLOCKS "\n"
- "pkhbt r8, r7, r6 \n"
- "ldmia %[v1]!, {r2-r3} \n"
- "smladx %[res], r1, r8, %[res] \n"
- "pkhbt r8, r4, r7 \n"
- "ldmia %[v2]!, {r6-r7} \n"
- "smladx %[res], r2, r8, %[res] \n"
- "pkhbt r8, r5, r4 \n"
- "ldmia %[v1]!, {r0-r1} \n"
- "smladx %[res], r3, r8, %[res] \n"
- "pkhbt r8, r6, r5 \n"
- "ldmia %[v2]!, {r4-r5} \n"
- "smladx %[res], r0, r8, %[res] \n"
- ".endr \n"
-
- "pkhbt r8, r7, r6 \n"
- "ldmia %[v1]!, {r2-r3} \n"
- "smladx %[res], r1, r8, %[res] \n"
- "pkhbt r8, r4, r7 \n"
-#if ORDER > 32
- "subs %[cnt], %[cnt], #1 \n"
- "ldmneia %[v2]!, {r6-r7} \n"
- "smladx %[res], r2, r8, %[res] \n"
- "pkhbt r8, r5, r4 \n"
- "ldmneia %[v1]!, {r0-r1} \n"
- "smladx %[res], r3, r8, %[res] \n"
- "bne 1b \n"
-#else
- "pkhbt r5, r5, r4 \n"
- "smladx %[res], r2, r8, %[res] \n"
- "smladx %[res], r3, r5, %[res] \n"
-#endif
- "b 99f \n"
-
- "20: \n"
- "ldmia %[v1]!, {r0-r1} \n"
- "ldmia %[v2]!, {r5-r7} \n"
- "1: \n"
- "ldmia %[v1]!, {r2-r3} \n"
-#if ORDER > 32
- "smlad %[res], r0, r5, %[res] \n"
-#else
- "smuad %[res], r0, r5 \n"
-#endif
- ".rept " MLA_BLOCKS "\n"
- "ldmia %[v2]!, {r4-r5} \n"
- "smlad %[res], r1, r6, %[res] \n"
- "ldmia %[v1]!, {r0-r1} \n"
- "smlad %[res], r2, r7, %[res] \n"
- "ldmia %[v2]!, {r6-r7} \n"
- "smlad %[res], r3, r4, %[res] \n"
- "ldmia %[v1]!, {r2-r3} \n"
- "smlad %[res], r0, r5, %[res] \n"
- ".endr \n"
-
- "ldmia %[v2]!, {r4-r5} \n"
- "smlad %[res], r1, r6, %[res] \n"
-#if ORDER > 32
- "subs %[cnt], %[cnt], #1 \n"
- "ldmneia %[v1]!, {r0-r1} \n"
- "smlad %[res], r2, r7, %[res] \n"
- "ldmneia %[v2]!, {r6-r7} \n"
- "smlad %[res], r3, r4, %[res] \n"
- "bne 1b \n"
-#else
- "smlad %[res], r2, r7, %[res] \n"
- "smlad %[res], r3, r4, %[res] \n"
-#endif
-
- "99: \n"
- : /* outputs */
-#if ORDER > 32
- [cnt]"+r"(cnt),
-#endif
- [v1] "+r"(v1),
- [v2] "+r"(v2),
- [res]"=r"(res)
- : /* inputs */
- : /* clobbers */
- "r0", "r1", "r2", "r3", "r4",
- "r5", "r6", "r7", "r8"
- );
- return res;
-}
diff --git a/plugins/demac/libdemac/vector_math16_cf.h b/plugins/demac/libdemac/vector_math16_cf.h
deleted file mode 100644
index e51767b8..00000000
--- a/plugins/demac/libdemac/vector_math16_cf.h
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: vector_math16_cf.h 19144 2008-11-19 21:31:33Z amiconn $
-
-Copyright (C) Dave Chapman 2007
-
-Coldfire vector math copyright (C) 2007 Jens Arnold
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-/* This version fetches data as 32 bit words, and *recommends* v1 to be
- * 32 bit aligned, otherwise performance will suffer. */
-static inline void vector_add(int16_t* v1, int16_t* v2)
-{
-#if ORDER > 16
- int cnt = ORDER>>4;
-#endif
-
-#define ADDHALFREGS(s1, sum) /* Add register halves straight. */ \
- "move.l " #s1 ", %%d4 \n" /* 's1' can be an A or D reg. */ \
- "add.l " #sum ", " #s1 "\n" /* 'sum' must be a D reg. */ \
- "clr.w %%d4 \n" /* 's1' and %%d4 are clobbered! */ \
- "add.l %%d4 , " #sum "\n" \
- "move.w " #s1 ", " #sum "\n"
-
-#define ADDHALFXREGS(s1, s2, sum) /* Add register halves across. */ \
- "clr.w " #sum " \n" /* Needs 'sum' pre-swapped, swaps */ \
- "add.l " #s1 ", " #sum "\n" /* 's2', and clobbers 's1'. */ \
- "swap " #s2 " \n" /* 's1' can be an A or D reg. */ \
- "add.l " #s2 ", " #s1 "\n" /* 'sum' and 's2' must be D regs. */ \
- "move.w " #s1 ", " #sum "\n"
-
- asm volatile (
- "move.l %[v2], %%d0 \n"
- "and.l #2, %%d0 \n"
- "jeq 20f \n"
-
- "10: \n"
- "move.w (%[v2])+, %%d0 \n"
- "swap %%d0 \n"
- "1: \n"
- "movem.l (%[v1]), %%a0-%%a3 \n"
- "movem.l (%[v2]), %%d1-%%d4 \n"
- ADDHALFXREGS(%%a0, %%d1, %%d0)
- "move.l %%d0, (%[v1])+ \n"
- ADDHALFXREGS(%%a1, %%d2, %%d1)
- "move.l %%d1, (%[v1])+ \n"
- ADDHALFXREGS(%%a2, %%d3, %%d2)
- "move.l %%d2, (%[v1])+ \n"
- ADDHALFXREGS(%%a3, %%d4, %%d3)
- "move.l %%d3, (%[v1])+ \n"
- "lea.l (16, %[v2]), %[v2] \n"
- "move.l %%d4, %%d0 \n"
-
- "movem.l (%[v1]), %%a0-%%a3 \n"
- "movem.l (%[v2]), %%d1-%%d4 \n"
- ADDHALFXREGS(%%a0, %%d1, %%d0)
- "move.l %%d0, (%[v1])+ \n"
- ADDHALFXREGS(%%a1, %%d2, %%d1)
- "move.l %%d1, (%[v1])+ \n"
- ADDHALFXREGS(%%a2, %%d3, %%d2)
- "move.l %%d2, (%[v1])+ \n"
- ADDHALFXREGS(%%a3, %%d4, %%d3)
- "move.l %%d3, (%[v1])+ \n"
-#if ORDER > 16
- "lea.l (16, %[v2]), %[v2] \n"
- "move.l %%d4, %%d0 \n"
-
- "subq.l #1, %[cnt] \n"
- "jne 1b \n"
-#endif
- "jra 99f \n"
-
- "20: \n"
- "1: \n"
- "movem.l (%[v2]), %%a0-%%a3 \n"
- "movem.l (%[v1]), %%d0-%%d3 \n"
- ADDHALFREGS(%%a0, %%d0)
- "move.l %%d0, (%[v1])+ \n"
- ADDHALFREGS(%%a1, %%d1)
- "move.l %%d1, (%[v1])+ \n"
- ADDHALFREGS(%%a2, %%d2)
- "move.l %%d2, (%[v1])+ \n"
- ADDHALFREGS(%%a3, %%d3)
- "move.l %%d3, (%[v1])+ \n"
- "lea.l (16, %[v2]), %[v2] \n"
-
- "movem.l (%[v2]), %%a0-%%a3 \n"
- "movem.l (%[v1]), %%d0-%%d3 \n"
- ADDHALFREGS(%%a0, %%d0)
- "move.l %%d0, (%[v1])+ \n"
- ADDHALFREGS(%%a1, %%d1)
- "move.l %%d1, (%[v1])+ \n"
- ADDHALFREGS(%%a2, %%d2)
- "move.l %%d2, (%[v1])+ \n"
- ADDHALFREGS(%%a3, %%d3)
- "move.l %%d3, (%[v1])+ \n"
-#if ORDER > 16
- "lea.l (16, %[v2]), %[v2] \n"
-
- "subq.l #1, %[cnt] \n"
- "jne 1b \n"
-#endif
- "99: \n"
- : /* outputs */
-#if ORDER > 16
- [cnt]"+d"(cnt),
-#endif
- [v1] "+a"(v1),
- [v2] "+a"(v2)
- : /* inputs */
- : /* clobbers */
- "d0", "d1", "d2", "d3", "d4",
- "a0", "a1", "a2", "a3", "memory"
- );
-}
-
-/* This version fetches data as 32 bit words, and *recommends* v1 to be
- * 32 bit aligned, otherwise performance will suffer. */
-static inline void vector_sub(int16_t* v1, int16_t* v2)
-{
-#if ORDER > 16
- int cnt = ORDER>>4;
-#endif
-
-#define SUBHALFREGS(min, sub, dif) /* Subtract register halves straight. */ \
- "move.l " #min ", " #dif "\n" /* 'min' can be an A or D reg */ \
- "sub.l " #sub ", " #min "\n" /* 'sub' and 'dif' must be D regs */ \
- "clr.w " #sub "\n" /* 'min' and 'sub' are clobbered! */ \
- "sub.l " #sub ", " #dif "\n" \
- "move.w " #min ", " #dif "\n"
-
-#define SUBHALFXREGS(min, s2, s1d) /* Subtract register halves across. */ \
- "clr.w " #s1d "\n" /* Needs 's1d' pre-swapped, swaps */ \
- "sub.l " #s1d ", " #min "\n" /* 's2' and clobbers 'min'. */ \
- "move.l " #min ", " #s1d "\n" /* 'min' can be an A or D reg, */ \
- "swap " #s2 "\n" /* 's2' and 's1d' must be D regs. */ \
- "sub.l " #s2 ", " #min "\n" \
- "move.w " #min ", " #s1d "\n"
-
- asm volatile (
- "move.l %[v2], %%d0 \n"
- "and.l #2, %%d0 \n"
- "jeq 20f \n"
-
- "10: \n"
- "move.w (%[v2])+, %%d0 \n"
- "swap %%d0 \n"
- "1: \n"
- "movem.l (%[v2]), %%d1-%%d4 \n"
- "movem.l (%[v1]), %%a0-%%a3 \n"
- SUBHALFXREGS(%%a0, %%d1, %%d0)
- "move.l %%d0, (%[v1])+ \n"
- SUBHALFXREGS(%%a1, %%d2, %%d1)
- "move.l %%d1, (%[v1])+ \n"
- SUBHALFXREGS(%%a2, %%d3, %%d2)
- "move.l %%d2, (%[v1])+ \n"
- SUBHALFXREGS(%%a3, %%d4, %%d3)
- "move.l %%d3, (%[v1])+ \n"
- "lea.l (16, %[v2]), %[v2] \n"
- "move.l %%d4, %%d0 \n"
-
- "movem.l (%[v2]), %%d1-%%d4 \n"
- "movem.l (%[v1]), %%a0-%%a3 \n"
- SUBHALFXREGS(%%a0, %%d1, %%d0)
- "move.l %%d0, (%[v1])+ \n"
- SUBHALFXREGS(%%a1, %%d2, %%d1)
- "move.l %%d1, (%[v1])+ \n"
- SUBHALFXREGS(%%a2, %%d3, %%d2)
- "move.l %%d2, (%[v1])+ \n"
- SUBHALFXREGS(%%a3, %%d4, %%d3)
- "move.l %%d3, (%[v1])+ \n"
-#if ORDER > 16
- "lea.l (16, %[v2]), %[v2] \n"
- "move.l %%d4, %%d0 \n"
-
- "subq.l #1, %[cnt] \n"
- "bne.w 1b \n"
-#endif
- "jra 99f \n"
-
- "20: \n"
- "1: \n"
- "movem.l (%[v2]), %%d1-%%d4 \n"
- "movem.l (%[v1]), %%a0-%%a3 \n"
- SUBHALFREGS(%%a0, %%d1, %%d0)
- "move.l %%d0, (%[v1])+ \n"
- SUBHALFREGS(%%a1, %%d2, %%d1)
- "move.l %%d1, (%[v1])+ \n"
- SUBHALFREGS(%%a2, %%d3, %%d2)
- "move.l %%d2, (%[v1])+ \n"
- SUBHALFREGS(%%a3, %%d4, %%d3)
- "move.l %%d3, (%[v1])+ \n"
- "lea.l (16, %[v2]), %[v2] \n"
-
- "movem.l (%[v2]), %%d1-%%d4 \n"
- "movem.l (%[v1]), %%a0-%%a3 \n"
- SUBHALFREGS(%%a0, %%d1, %%d0)
- "move.l %%d0, (%[v1])+ \n"
- SUBHALFREGS(%%a1, %%d2, %%d1)
- "move.l %%d1, (%[v1])+ \n"
- SUBHALFREGS(%%a2, %%d3, %%d2)
- "move.l %%d2, (%[v1])+ \n"
- SUBHALFREGS(%%a3, %%d4, %%d3)
- "move.l %%d3, (%[v1])+ \n"
-#if ORDER > 16
- "lea.l (16, %[v2]), %[v2] \n"
-
- "subq.l #1, %[cnt] \n"
- "bne.w 1b \n"
-#endif
-
- "99: \n"
- : /* outputs */
-#if ORDER > 16
- [cnt]"+d"(cnt),
-#endif
- [v1] "+a"(v1),
- [v2] "+a"(v2)
- : /* inputs */
- : /* clobbers */
- "d0", "d1", "d2", "d3", "d4",
- "a0", "a1", "a2", "a3", "memory"
- );
-}
-
-#define PREPARE_SCALARPRODUCT coldfire_set_macsr(0); /* signed integer mode */
-
-/* This version fetches data as 32 bit words, and *recommends* v1 to be
- * 32 bit aligned, otherwise performance will suffer. It also needs EMAC
- * in signed integer mode - call above macro before use. */
-static inline int32_t scalarproduct(int16_t* v1, int16_t* v2)
-{
- int res;
-#if ORDER > 32
- int cnt = ORDER>>5;
-#endif
-
-#if ORDER > 16
-#define MAC_BLOCKS "7"
-#else
-#define MAC_BLOCKS "3"
-#endif
-
- asm volatile (
- "move.l %[v2], %%d0 \n"
- "and.l #2, %%d0 \n"
- "jeq 20f \n"
-
- "10: \n"
- "move.l (%[v1])+, %%d0 \n"
- "move.w (%[v2])+, %%d1 \n"
- "1: \n"
- ".rept " MAC_BLOCKS "\n"
- "mac.w %%d0u, %%d1l, (%[v2])+, %%d1, %%acc0\n"
- "mac.w %%d0l, %%d1u, (%[v1])+, %%d0, %%acc0\n"
- "mac.w %%d0u, %%d1l, (%[v2])+, %%d1, %%acc0\n"
- "mac.w %%d0l, %%d1u, (%[v1])+, %%d0, %%acc0\n"
- ".endr \n"
-
- "mac.w %%d0u, %%d1l, (%[v2])+, %%d1, %%acc0\n"
- "mac.w %%d0l, %%d1u, (%[v1])+, %%d0, %%acc0\n"
- "mac.w %%d0u, %%d1l, (%[v2])+, %%d1, %%acc0\n"
-#if ORDER > 32
- "mac.w %%d0l, %%d1u, (%[v1])+, %%d0, %%acc0\n"
- "subq.l #1, %[res] \n"
- "bne.w 1b \n"
-#else
- "mac.w %%d0l, %%d1u, %%acc0 \n"
-#endif
- "jra 99f \n"
-
- "20: \n"
- "move.l (%[v1])+, %%d0 \n"
- "move.l (%[v2])+, %%d1 \n"
- "1: \n"
- ".rept " MAC_BLOCKS "\n"
- "mac.w %%d0u, %%d1u, (%[v1])+, %%d2, %%acc0\n"
- "mac.w %%d0l, %%d1l, (%[v2])+, %%d1, %%acc0\n"
- "mac.w %%d2u, %%d1u, (%[v1])+, %%d0, %%acc0\n"
- "mac.w %%d2l, %%d1l, (%[v2])+, %%d1, %%acc0\n"
- ".endr \n"
-
- "mac.w %%d0u, %%d1u, (%[v1])+, %%d2, %%acc0\n"
- "mac.w %%d0l, %%d1l, (%[v2])+, %%d1, %%acc0\n"
-#if ORDER > 32
- "mac.w %%d2u, %%d1u, (%[v1])+, %%d0, %%acc0\n"
- "mac.w %%d2l, %%d1l, (%[v2])+, %%d1, %%acc0\n"
- "subq.l #1, %[res] \n"
- "bne.w 1b \n"
-#else
- "mac.w %%d2u, %%d1u, %%acc0 \n"
- "mac.w %%d2l, %%d1l, %%acc0 \n"
-#endif
-
- "99: \n"
- "movclr.l %%acc0, %[res] \n"
- : /* outputs */
- [v1]"+a"(v1),
- [v2]"+a"(v2),
- [res]"=d"(res)
- : /* inputs */
-#if ORDER > 32
- [cnt]"[res]"(cnt)
-#endif
- : /* clobbers */
- "d0", "d1", "d2"
- );
- return res;
-}
diff --git a/plugins/demac/libdemac/vector_math32_armv4.h b/plugins/demac/libdemac/vector_math32_armv4.h
deleted file mode 100644
index 47bc5e94..00000000
--- a/plugins/demac/libdemac/vector_math32_armv4.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: vector_math32_armv4.h 19144 2008-11-19 21:31:33Z amiconn $
-
-Copyright (C) Dave Chapman 2007
-
-ARMv4 vector math copyright (C) 2008 Jens Arnold
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-static inline void vector_add(int32_t* v1, int32_t* v2)
-{
-#if ORDER > 32
- int cnt = ORDER>>5;
-#endif
-
-#if ORDER > 16
-#define ADD_SUB_BLOCKS "8"
-#else
-#define ADD_SUB_BLOCKS "4"
-#endif
-
- asm volatile (
- "1: \n"
- ".rept " ADD_SUB_BLOCKS "\n"
- "ldmia %[v1], {r0-r3} \n"
- "ldmia %[v2]!, {r4-r7} \n"
- "add r0, r0, r4 \n"
- "add r1, r1, r5 \n"
- "add r2, r2, r6 \n"
- "add r3, r3, r7 \n"
- "stmia %[v1]!, {r0-r3} \n"
- ".endr \n"
-#if ORDER > 32
- "subs %[cnt], %[cnt], #1 \n"
- "bne 1b \n"
-#endif
- : /* outputs */
-#if ORDER > 32
- [cnt]"+r"(cnt),
-#endif
- [v1] "+r"(v1),
- [v2] "+r"(v2)
- : /* inputs */
- : /* clobbers */
- "r0", "r1", "r2", "r3", "r4",
- "r5", "r6", "r7", "memory"
- );
-}
-
-static inline void vector_sub(int32_t* v1, int32_t* v2)
-{
-#if ORDER > 32
- int cnt = ORDER>>5;
-#endif
-
- asm volatile (
- "1: \n"
- ".rept " ADD_SUB_BLOCKS "\n"
- "ldmia %[v1], {r0-r3} \n"
- "ldmia %[v2]!, {r4-r7} \n"
- "sub r0, r0, r4 \n"
- "sub r1, r1, r5 \n"
- "sub r2, r2, r6 \n"
- "sub r3, r3, r7 \n"
- "stmia %[v1]!, {r0-r3} \n"
- ".endr \n"
-#if ORDER > 32
- "subs %[cnt], %[cnt], #1 \n"
- "bne 1b \n"
-#endif
- : /* outputs */
-#if ORDER > 32
- [cnt]"+r"(cnt),
-#endif
- [v1] "+r"(v1),
- [v2] "+r"(v2)
- : /* inputs */
- : /* clobbers */
- "r0", "r1", "r2", "r3", "r4",
- "r5", "r6", "r7", "memory"
- );
-}
-
-static inline int32_t scalarproduct(int32_t* v1, int32_t* v2)
-{
- int res;
-#if ORDER > 32
- int cnt = ORDER>>5;
-#endif
-
- asm volatile (
-#if ORDER > 16
-#if ORDER > 32
- "mov %[res], #0 \n"
-#endif
- "ldmia %[v2]!, {r6-r7} \n"
- "1: \n"
- "ldmia %[v1]!, {r0,r1,r3-r5} \n"
-#if ORDER > 32
- "mla %[res], r6, r0, %[res] \n"
-#else
- "mul %[res], r6, r0 \n"
-#endif
- "mla %[res], r7, r1, %[res] \n"
- "ldmia %[v2]!, {r0-r2,r6-r8} \n"
- "mla %[res], r0, r3, %[res] \n"
- "mla %[res], r1, r4, %[res] \n"
- "mla %[res], r2, r5, %[res] \n"
- "ldmia %[v1]!, {r0-r4} \n"
- "mla %[res], r6, r0, %[res] \n"
- "mla %[res], r7, r1, %[res] \n"
- "mla %[res], r8, r2, %[res] \n"
- "ldmia %[v2]!, {r0,r1,r6-r8} \n"
- "mla %[res], r0, r3, %[res] \n"
- "mla %[res], r1, r4, %[res] \n"
- "ldmia %[v1]!, {r0-r5} \n"
- "mla %[res], r6, r0, %[res] \n"
- "mla %[res], r7, r1, %[res] \n"
- "mla %[res], r8, r2, %[res] \n"
- "ldmia %[v2]!, {r0-r2,r6,r7} \n"
- "mla %[res], r0, r3, %[res] \n"
- "mla %[res], r1, r4, %[res] \n"
- "mla %[res], r2, r5, %[res] \n"
- "ldmia %[v1]!, {r0,r1,r3-r5} \n"
- "mla %[res], r6, r0, %[res] \n"
- "mla %[res], r7, r1, %[res] \n"
- "ldmia %[v2]!, {r0-r2,r6-r8} \n"
- "mla %[res], r0, r3, %[res] \n"
- "mla %[res], r1, r4, %[res] \n"
- "mla %[res], r2, r5, %[res] \n"
- "ldmia %[v1]!, {r0-r4} \n"
- "mla %[res], r6, r0, %[res] \n"
- "mla %[res], r7, r1, %[res] \n"
- "mla %[res], r8, r2, %[res] \n"
- "ldmia %[v2]!, {r0,r1,r6-r8} \n"
- "mla %[res], r0, r3, %[res] \n"
- "mla %[res], r1, r4, %[res] \n"
- "ldmia %[v1]!, {r0-r5} \n"
- "mla %[res], r6, r0, %[res] \n"
- "mla %[res], r7, r1, %[res] \n"
- "mla %[res], r8, r2, %[res] \n"
-#if ORDER > 32
- "ldmia %[v2]!, {r0-r2,r6,r7} \n"
-#else
- "ldmia %[v2]!, {r0-r2} \n"
-#endif
- "mla %[res], r0, r3, %[res] \n"
- "mla %[res], r1, r4, %[res] \n"
- "mla %[res], r2, r5, %[res] \n"
-#if ORDER > 32
- "subs %[cnt], %[cnt], #1 \n"
- "bne 1b \n"
-#endif
-
-#else /* ORDER <= 16 */
- "ldmia %[v1]!, {r0-r3} \n"
- "ldmia %[v2]!, {r4-r7} \n"
- "mul %[res], r4, r0 \n"
- "mla %[res], r5, r1, %[res] \n"
- "mla %[res], r6, r2, %[res] \n"
- "mla %[res], r7, r3, %[res] \n"
-
- ".rept 3 \n"
- "ldmia %[v1]!, {r0-r3} \n"
- "ldmia %[v2]!, {r4-r7} \n"
- "mla %[res], r4, r0, %[res] \n"
- "mla %[res], r5, r1, %[res] \n"
- "mla %[res], r6, r2, %[res] \n"
- "mla %[res], r7, r3, %[res] \n"
- ".endr \n"
-#endif /* ORDER <= 16 */
- : /* outputs */
-#if ORDER > 32
- [cnt]"+r"(cnt),
-#endif
- [v1] "+r"(v1),
- [v2] "+r"(v2),
- [res]"=r"(res)
- : /* inputs */
- : /* clobbers */
- "r0", "r1", "r2", "r3",
- "r4", "r5", "r6", "r7"
-#if ORDER > 16
- ,"r8"
-#endif
- );
- return res;
-}
diff --git a/plugins/demac/libdemac/vector_math_generic.h b/plugins/demac/libdemac/vector_math_generic.h
deleted file mode 100644
index b2dab1e2..00000000
--- a/plugins/demac/libdemac/vector_math_generic.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
-
-libdemac - A Monkey's Audio decoder
-
-$Id: vector_math_generic.h 19144 2008-11-19 21:31:33Z amiconn $
-
-Copyright (C) Dave Chapman 2007
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
-
-*/
-
-#include "demac_config.h"
-
-static inline void vector_add(filter_int* v1, filter_int* v2)
-{
-#if ORDER > 32
- int order = (ORDER >> 5);
- while (order--)
-#endif
- {
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
-#if ORDER > 16
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
- *v1++ += *v2++;
-#endif
- }
-}
-
-static inline void vector_sub(filter_int* v1, filter_int* v2)
-{
-#if ORDER > 32
- int order = (ORDER >> 5);
- while (order--)
-#endif
- {
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
-#if ORDER > 16
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
- *v1++ -= *v2++;
-#endif
- }
-}
-
-static inline int32_t scalarproduct(filter_int* v1, filter_int* v2)
-{
- int res = 0;
-
-#if ORDER > 32
- int order = (ORDER >> 5);
- while (order--)
-#endif
- {
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
-#if ORDER > 16
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
- res += *v1++ * *v2++;
-#endif
- }
- return res;
-}
diff --git a/plugins/ffmpeg/ffmpeg.c b/plugins/ffmpeg/ffmpeg.c
index ed690edf..289f0ae0 100644
--- a/plugins/ffmpeg/ffmpeg.c
+++ b/plugins/ffmpeg/ffmpeg.c
@@ -113,7 +113,7 @@ ffmpeg_init (DB_playItem_t *it) {
// open file
if ((ret = av_open_input_file(&info->fctx, uri, NULL, 0, NULL)) < 0) {
- trace ("info->fctx is %p, ret %d/%s", info->fctx, ret, strerror(-ret));
+ trace ("info->fctx is %p, ret %d/%s\n", info->fctx, ret, strerror(-ret));
plugin.free (_info);
return NULL;
}
diff --git a/plugins/gtkui/Makefile.am b/plugins/gtkui/Makefile.am
index aaf9c56a..146e76db 100644
--- a/plugins/gtkui/Makefile.am
+++ b/plugins/gtkui/Makefile.am
@@ -13,6 +13,6 @@ gtkui_la_SOURCES = gtkui.c gtkui.h\
gtkui_la_LDFLAGS = -module
-gtkui_la_LIBADD = $(LDADD) $(GTKUI_DEPS_LIBS)
-AM_CFLAGS = -std=c99 $(GTKUI_DEPS_CFLAGS)
+gtkui_la_LIBADD = $(LDADD) $(GTKUI_DEPS_LIBS) $(NOTIFY_DEPS_LIBS)
+AM_CFLAGS = -std=c99 $(GTKUI_DEPS_CFLAGS) $(NOTIFY_DEPS_CFLAGS)
endif
diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c
index 3e9e8538..393a1b27 100644
--- a/plugins/gtkui/callbacks.c
+++ b/plugins/gtkui/callbacks.c
@@ -881,6 +881,9 @@ void
save_playlist_as (void) {
GtkWidget *dlg = gtk_file_chooser_dialog_new ("Save Playlist As", GTK_WINDOW (mainwin), GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_OK, NULL);
+ gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dlg), TRUE);
+ gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dlg), "untitled.dbpl");
+
GtkFileFilter* flt;
flt = gtk_file_filter_new ();
gtk_file_filter_set_name (flt, "DeaDBeeF playlist files (*.dbpl)");
@@ -893,6 +896,8 @@ save_playlist_as (void) {
gtk_widget_destroy (dlg);
if (fname) {
+// the code below cannot be used, because it breaks gtk overwrite confirmation
+#if 0
// check extension and append .dbpl if none
size_t sz = strlen (fname);
char ext[] = ".dbpl";
@@ -908,6 +913,7 @@ save_playlist_as (void) {
g_free (fname);
fname = n;
}
+#endif
int res = deadbeef->pl_save (fname);
if (res >= 0 && strlen (fname) < 1024) {
strcpy (last_playlist_save_name, fname);
diff --git a/plugins/gtkui/gtkplaylist.c b/plugins/gtkui/gtkplaylist.c
index 7b0912b9..868e26a2 100644
--- a/plugins/gtkui/gtkplaylist.c
+++ b/plugins/gtkui/gtkplaylist.c
@@ -16,7 +16,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
-# include <config.h>
+# include "../../config.h"
+#endif
+#if HAVE_NOTIFY
+#include <libnotify/notify.h>
#endif
#include <gtk/gtk.h>
@@ -40,6 +43,7 @@
#include "../../session.h"
#include "../../deadbeef.h"
#include "parser.h"
+#include "gtkui.h"
#define min(x,y) ((x)<(y)?(x):(y))
#define max(x,y) ((x)>(y)?(x):(y))
@@ -349,7 +353,9 @@ gtkpl_draw_pl_row_back (gtkplaylist_t *ps, int row, DB_playItem_t *it) {
int x = -ps->hscrollpos;
int w = ps->totalwidth;
// clear area -- workaround for New Wave theme
- gdk_draw_rectangle (ps->backbuf, treeview->style->bg_gc[GTK_STATE_NORMAL], TRUE, x, row * rowheight - ps->scrollpos * rowheight, w, rowheight);
+ if (ps->playlist->style->bg_gc[GTK_STATE_NORMAL]) {
+ gdk_draw_rectangle (ps->backbuf, ps->playlist->style->bg_gc[GTK_STATE_NORMAL], TRUE, 0, row * rowheight - ps->scrollpos * rowheight, ps->playlist->allocation.width, rowheight);
+ }
gtk_paint_flat_box (treeview->style, ps->backbuf, (it && SELECTED(it)) ? GTK_STATE_SELECTED : GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, treeview, (row & 1) ? "cell_even_ruled" : "cell_odd_ruled", x, row * rowheight - ps->scrollpos * rowheight, w, rowheight);
if (row == deadbeef->pl_get_cursor (ps->iterator)) {
// not all gtk engines/themes render focus rectangle in treeviews
@@ -381,7 +387,7 @@ gtkpl_draw_pl_row (gtkplaylist_t *ps, int row, DB_playItem_t *it) {
int x = -ps->hscrollpos;
gtkpl_column_t *c;
for (c = ps->columns; c; c = c->next) {
- if (it == deadbeef->pl_getcurrent () && c->id == DB_COLUMN_PLAYING) {
+ if (it == deadbeef->streamer_get_playing_track () && c->id == DB_COLUMN_PLAYING) {
int paused = deadbeef->get_output ()->state () == OUTPUT_STATE_PAUSED;
int buffering = !deadbeef->streamer_ok_to_read (-1);
uintptr_t pixbuf;
@@ -875,7 +881,7 @@ gtkpl_songchanged (gtkplaylist_t *ps, int from, int to) {
gtk_range_set_value (GTK_RANGE (ps->scrollbar), to - ps->nvisiblerows/2);
}
}
- if (deadbeef->conf_get_int ("playlist.scroll.cursorfollowplayback", 1)) {
+ if (deadbeef->conf_get_int ("playlist.scroll.cursorfollowplayback", 0)) {
gtkpl_set_cursor (PL_MAIN, to);
}
}
@@ -1832,12 +1838,38 @@ struct fromto_t {
int to;
};
+#if HAVE_NOTIFY
+static NotifyNotification* notification;
+#endif
+
static gboolean
update_win_title_idle (gpointer data) {
struct fromto_t *ft = (struct fromto_t *)data;
int from = ft->from;
int to = ft->to;
free (ft);
+
+ // show notification
+#if HAVE_NOTIFY
+ if (to != -1 && deadbeef->conf_get_int ("gtkui.notify.enable", 0)) {
+ DB_playItem_t *track = deadbeef->pl_get_for_idx (to);
+ if (track) {
+ char cmd [1024];
+ deadbeef->pl_format_title (track, -1, cmd, sizeof (cmd), -1, deadbeef->conf_get_str ("gtkui.notify.format", NOTIFY_DEFAULT_FORMAT));
+ if (notify_is_initted ()) {
+ if (notification) {
+ notify_notification_close (notification, NULL);
+ }
+ notification = notify_notification_new ("DeaDBeeF", cmd, NULL, NULL);
+ if (notification) {
+ notify_notification_set_timeout (notification, NOTIFY_EXPIRES_DEFAULT);
+ notify_notification_show (notification, NULL);
+ }
+ }
+ }
+ }
+#endif
+
// update window title
if (from >= 0 || to >= 0) {
if (to >= 0) {
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index c05cbdad..954a7781 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -18,9 +18,16 @@
*/
#include "../../deadbeef.h"
#include <gtk/gtk.h>
+#ifdef HAVE_CONFIG_H
+#include "../../config.h"
+#endif
+#if HAVE_NOTIFY
+#include <libnotify/notify.h>
+#endif
#include <string.h>
#include <stdlib.h>
#include <math.h>
+#include <sys/time.h>
#include "gtkui.h"
#include "gtkplaylist.h"
#include "search.h"
@@ -51,6 +58,8 @@ gtkplaylist_t search_playlist;
static int sb_context_id = -1;
static char sb_text[512];
static float last_songpos = -1;
+static char sbitrate[20] = "";
+static struct timeval last_br_update;
static gboolean
update_songinfo (gpointer ctx) {
@@ -83,7 +92,6 @@ update_songinfo (gpointer ctx) {
songpos = 0;
}
else {
-// codec_lock ();
DB_fileinfo_t *c = deadbeef->streamer_get_current_decoder ();
if (c) {
float playpos = deadbeef->streamer_get_playpos ();
@@ -106,13 +114,18 @@ update_songinfo (gpointer ctx) {
strcpy (t, "-:--");
}
- char sbitrate[20] = "";
-#if 1
- int bitrate = deadbeef->streamer_get_apx_bitrate ();
- if (bitrate > 0) {
- snprintf (sbitrate, sizeof (sbitrate), "| %d kbps ", bitrate);
+ struct timeval tm;
+ gettimeofday (&tm, NULL);
+ if (tm.tv_sec - last_br_update.tv_sec + (tm.tv_usec - last_br_update.tv_usec) / 1000000.0 >= 0.3) {
+ memcpy (&last_br_update, &tm, sizeof (tm));
+ int bitrate = deadbeef->streamer_get_apx_bitrate ();
+ if (bitrate > 0) {
+ snprintf (sbitrate, sizeof (sbitrate), "| %4d kbps ", bitrate);
+ }
+ else {
+ sbitrate[0] = 0;
+ }
}
-#endif
const char *spaused = deadbeef->get_output ()->state () == OUTPUT_STATE_PAUSED ? "Paused | " : "";
snprintf (sbtext_new, sizeof (sbtext_new), "%s%s %s| %dHz | %d bit | %s | %d:%02d / %s | %d tracks | %s total playtime", spaused, track->filetype ? track->filetype:"-", sbitrate, samplerate, bitspersample, mode, minpos, secpos, t, deadbeef->pl_getcount (PL_MAIN), totaltime_str);
}
@@ -367,9 +380,17 @@ gtkui_thread (void *ctx) {
gdk_threads_init ();
gdk_threads_enter ();
gtk_set_locale ();
- int argc = 1;
- const char **argv = alloca (sizeof (char *));
+#if HAVE_NOTIFY
+ notify_init ("DeaDBeeF");
+#endif
+
+ int argc = 2;
+ const char **argv = alloca (sizeof (char *) * argc);
argv[0] = "deadbeef";
+ argv[1] = "--sync";
+ if (!deadbeef->conf_get_int ("gtkui.sync", 0)) {
+ argc = 1;
+ }
gtk_init (&argc, (char ***)&argv);
// system tray icon
@@ -441,6 +462,9 @@ gtkui_thread (void *ctx) {
gtk_widget_show (mainwin);
gtk_main ();
+#if HAVE_NOTIFY
+ notify_uninit ();
+#endif
gdk_threads_leave ();
}
@@ -497,6 +521,14 @@ gtkui_load (DB_functions_t *api) {
return DB_PLUGIN (&plugin);
}
+static const char settings_dlg[] =
+ "property \"Run gtk_init with --sync (debug mode)\" checkbox gtkui.sync 0;\n"
+#if HAVE_NOTIFY
+ "property \"Enable OSD notifications\" checkbox gtkui.notify.enable 0;\n"
+ "property \"Notification format\" entry gtkui.notify.format \"" NOTIFY_DEFAULT_FORMAT "\";\n"
+#endif
+;
+
// define plugin interface
static DB_gui_t plugin = {
DB_PLUGIN_SET_API_VERSION
@@ -510,5 +542,6 @@ static DB_gui_t plugin = {
.plugin.email = "waker@users.sourceforge.net",
.plugin.website = "http://deadbeef.sf.net",
.plugin.start = gtkui_start,
- .plugin.stop = gtkui_stop
+ .plugin.stop = gtkui_stop,
+ .plugin.configdialog = settings_dlg,
};
diff --git a/plugins/gtkui/gtkui.h b/plugins/gtkui/gtkui.h
index fd8e1166..2031b502 100644
--- a/plugins/gtkui/gtkui.h
+++ b/plugins/gtkui/gtkui.h
@@ -19,6 +19,10 @@
#ifndef __GTKUI_H
#define __GTKUI_H
+#if HAVE_NOTIFY
+#define NOTIFY_DEFAULT_FORMAT "%a - %t"
+#endif
+
extern DB_functions_t *deadbeef;
struct _GSList;
diff --git a/plugins/gtkui/pluginconf.c b/plugins/gtkui/pluginconf.c
index cc96e71b..6b96244f 100644
--- a/plugins/gtkui/pluginconf.c
+++ b/plugins/gtkui/pluginconf.c
@@ -117,12 +117,17 @@ static void apply_conf (GtkWidget *w, DB_plugin_t *p) {
deadbeef->sendmessage (M_CONFIGCHANGED, 0, 0, 0);
}
+static void
+prop_changed (GtkWidget *editable, gpointer user_data) {
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (user_data), GTK_RESPONSE_APPLY, TRUE);
+}
+
void
plugin_configure (GtkWidget *parentwin, DB_plugin_t *p) {
// create window
char title[200];
snprintf (title, sizeof (title), "Setup %s", p->name);
- GtkWidget *win = gtk_dialog_new_with_buttons (title, GTK_WINDOW (parentwin), GTK_DIALOG_MODAL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, NULL);
+ GtkWidget *win = gtk_dialog_new_with_buttons (title, GTK_WINDOW (parentwin), GTK_DIALOG_MODAL, GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
gtk_window_set_type_hint (GTK_WINDOW (win), GDK_WINDOW_TYPE_HINT_DIALOG);
gtk_container_set_border_width (GTK_CONTAINER(win), 12);
@@ -183,11 +188,13 @@ plugin_configure (GtkWidget *parentwin, DB_plugin_t *p) {
label = gtk_label_new (labeltext);
gtk_widget_show (label);
prop = gtk_entry_new ();
+ g_signal_connect (G_OBJECT (prop), "changed", G_CALLBACK (prop_changed), win);
gtk_widget_show (prop);
gtk_entry_set_text (GTK_ENTRY (prop), deadbeef->conf_get_str (key, def));
}
else if (!strcmp (type, "checkbox")) {
prop = gtk_check_button_new_with_label (labeltext);
+ g_signal_connect (G_OBJECT (prop), "toggled", G_CALLBACK (prop_changed), win);
gtk_widget_show (prop);
int val = deadbeef->conf_get_int (key, atoi (def));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prop), val);
@@ -198,6 +205,7 @@ plugin_configure (GtkWidget *parentwin, DB_plugin_t *p) {
cont = gtk_hbox_new (FALSE, 2);
gtk_widget_show (cont);
prop = gtk_entry_new ();
+ g_signal_connect (G_OBJECT (prop), "changed", G_CALLBACK (prop_changed), win);
gtk_widget_show (prop);
gtk_editable_set_editable (GTK_EDITABLE (prop), FALSE);
gtk_entry_set_text (GTK_ENTRY (prop), deadbeef->conf_get_str (key, def));
@@ -231,6 +239,7 @@ plugin_configure (GtkWidget *parentwin, DB_plugin_t *p) {
int response;
do {
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (win), GTK_RESPONSE_APPLY, FALSE);
response = gtk_dialog_run (GTK_DIALOG (win));
if (response == GTK_RESPONSE_APPLY || response == GTK_RESPONSE_OK) {
apply_conf (win, p);
diff --git a/plugins/lastfm/lastfm.c b/plugins/lastfm/lastfm.c
index 28969561..a91e016a 100644
--- a/plugins/lastfm/lastfm.c
+++ b/plugins/lastfm/lastfm.c
@@ -23,8 +23,8 @@
#include <curl/curl.h>
#include "../../deadbeef.h"
-#define trace(...) { fprintf(stderr, __VA_ARGS__); }
-//#define trace(fmt,...)
+//#define trace(...) { fprintf(stderr, __VA_ARGS__); }
+#define trace(fmt,...)
#define LFM_TESTMODE 0
#define LFM_IGNORE_RULES 0
diff --git a/plugins/notification/Makefile.am b/plugins/notification/Makefile.am
deleted file mode 100644
index 5a9f7f65..00000000
--- a/plugins/notification/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-notificationdir = $(libdir)/$(PACKAGE)
-pkglib_LTLIBRARIES = notification.la
-notification_la_SOURCES = notification.c
-notification_la_LDFLAGS = -module
-AM_CFLAGS = -std=c99
diff --git a/plugins/notification/notification.c b/plugins/notification/notification.c
deleted file mode 100644
index dc5b669f..00000000
--- a/plugins/notification/notification.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#include "../../deadbeef.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-static DB_misc_t plugin;
-static DB_functions_t *deadbeef;
-
-#define DEFAULT_COMMAND "notify-send '%t' '%a - %b'"
-
-static const char settings_dlg[] =
- "property Command entry notification.command \"" DEFAULT_COMMAND "\";\n"
-;
-
-static void
-show_notification (DB_playItem_t *track)
-{
- char cmd [1024];
- deadbeef->pl_format_title (track, -1, cmd, sizeof (cmd), -1, deadbeef->conf_get_str ("notification.command", DEFAULT_COMMAND));
- //system (cmd);
-}
-
-static int
-songchanged (DB_event_trackchange_t *ev, uintptr_t data) {
- DB_playItem_t *track = deadbeef->pl_get_for_idx (ev->to);
- if (track) {
- show_notification (track);
- }
- return 0;
-}
-
-static int
-notification_stop (void) {
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_SONGCHANGED, DB_CALLBACK (songchanged), 0);
- return 0;
-}
-
-static int
-notification_start (void) {
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_SONGCHANGED, DB_CALLBACK (songchanged), 0);
- return 0;
-}
-
-DB_plugin_t *
-notification_load (DB_functions_t *api) {
- deadbeef = api;
- return DB_PLUGIN (&plugin);
-}
-
-// define plugin interface
-static DB_misc_t plugin = {
- DB_PLUGIN_SET_API_VERSION
- .plugin.type = DB_PLUGIN_MISC,
- .plugin.name = "Current track notification",
- .plugin.descr = "Displays notification when current track is changed",
- .plugin.author = "Viktor Semykin",
- .plugin.email = "thesame.ml@gmail.com",
- .plugin.website = "http://deadbeef.sf.net",
- .plugin.start = notification_start,
- .plugin.stop = notification_stop,
- .plugin.configdialog = settings_dlg
-};
-
diff --git a/plugins/vfs_curl/vfs_curl.c b/plugins/vfs_curl/vfs_curl.c
index 972a5da9..517d55ce 100644
--- a/plugins/vfs_curl/vfs_curl.c
+++ b/plugins/vfs_curl/vfs_curl.c
@@ -24,8 +24,8 @@
#include <curl/curlver.h>
#include "../../deadbeef.h"
-#define trace(...) { fprintf(stderr, __VA_ARGS__); }
-//#define trace(fmt,...)
+//#define trace(...) { fprintf(stderr, __VA_ARGS__); }
+#define trace(fmt,...)
#define min(x,y) ((x)<(y)?(x):(y))
#define max(x,y) ((x)>(y)?(x):(y))
diff --git a/web/faq.txt b/web/faq.txt
index f53c0b6e..23e4faa8 100644
--- a/web/faq.txt
+++ b/web/faq.txt
@@ -1,6 +1,7 @@
Q: I have PulseAudio, and I have playback problems (noise, distortion, wrong speed, no sound, etc)
A: Disable PulseAudio
+A: Try to use OSS as pulseaudio backend
--
@@ -12,13 +13,7 @@ A: PulseAudio tricks applications by providing ALSA-plugin that routes sound fro
Q: Is it planned to support PulseAudio natively?
-A: No one works on that right now. You can write the output plugin yourself. Send me the patch, I'll include it in the next release.
-
---
-
-Q: I don't like your tone.
-
-A: GTFO!
+A: Yes.
--
diff --git a/web/index.html b/web/index.html
index f47a71e4..7baf9abd 100644
--- a/web/index.html
+++ b/web/index.html
@@ -42,19 +42,68 @@
</style>
<body>
<ul id='header'>
- <li><a href="#news">News</a></li>
<li><a href="#about">About</a></li>
+ <li><a href="#news">News</a></li>
<li><a id='faq' href="faq.txt">F.A.Q.</a></li>
<li><a href="#license">Copying</a></li>
<li><a href="#download">Download</a></li>
<li><a href="#bugs">Reporting Bugs</a></li>
<li><a href="#developers">Developer Information</a></li>
<li><a href="#contacts">Contacts</a></li>
- <li><a href="#screenshots">Screenshots</a></li>
+ <li><a href="screenshot03.png">Screenshot</a></li>
+</ul>
+
+<h1 id='about'>About</h1>
+<p>DeaDBeeF (as in 0xDEADBEEF) is an audio player for GNU/Linux systems with X11 (though now it also runs in plain console without X, in FreeBSD, and in OpenSolaris).</p>
+<p>Main features:</p>
+<ul>
+ <li>mp3, ogg vorbis, flac, ape, wv, wav, m4a, mpc, cd audio (and many more)</li>
+ <li>sid, nsf and lots of other popular chiptune formats</li>
+ <li>ID3v1, ID3v2.2, ID3v2.3, ID3v2.4, APEv2, xing/info tags support</li>
+ <li>character set detection for non-unicode id3 tags - supports cp1251 and iso8859-1</li>
+ <li>unicode tags are fully supported as well (both utf8 and ucs2)</li>
+ <li>cuesheet (.cue files) support, with charset detection (utf8/cp1251/iso8859-1)</li>
+ <li>tracker modules like mod, s3m, it, xm, etc</li>
+ <li>HVSC song length database support for sid</li>
+ <li>gtk2 interface with efficient custom widgets</li>
+ <li>no GNOME or KDE dependencies</li>
+ <li>minimize to tray, with scrollwheel volume control</li>
+ <li>drag and drop, both inside of playlist, and from filemanagers and such</li>
+ <li>control playback from command line</li>
+ <li>global hotkeys</li>
+ <li>plugin support; bundled with lots of plugins, such as global hotkeys and last.fm scrobbler; sdk is included</li>
+ <li>duration calculation is as precise as possible for vbr mp3 files (with and without xing/info tags)</li>
+ <li>was tested and works on x86, x86_64 and ppc64 architectures. should work on most modern platforms</li>
</ul>
<h1 id="news">News</h1>
+<h2>release 0.3.3 is out</h2>
+<div class="post">
+ <p class="date">2010/02/07</p>
+ <p>Changelog since 0.3.2</p>
+ <ul>
+ <li>fixed "unknown response" in command line</li>
+ <li>fixed winkey in global hotkeys plugin</li>
+ <li>fixed crash in id3v1 parser</li>
+ <li>fixed crash in mp3 plugin</li>
+ <li>fixed few bugs/problems in ALSA plugin (now works on wider range of soundcards)</li>
+ <li>fixed playback of multichannel FLAC files</li>
+ <li>fixed 24 bit wavpack playback</li>
+ <li>fixed duration calculation and seeking bugs in mp3 plugin</li>
+ <li>added support for older versions of ffmpeg</li>
+ <li>added OSS(3,4) support</li>
+ <li>experimental FreeBSD support</li>
+ <li>experimental OpenSolaris support</li>
+ <li>improved GUI dialogs</li>
+ <li>added new "File Number" column type</li>
+ <li>added new "File Name" custom column conversion</li>
+ <li>added option to disable nowplaying notifications in lastfm plugin</li>
+ <li>added support for icy metadata (title in shoutcast streams)</li>
+ <li>added experimental (optional) support for notifications using libnotify</li>
+ </ul>
+</div>
+
<h2>release 0.3.2 is out</h2>
<div class="post">
<p class="date">2010/01/12</p>
@@ -97,283 +146,8 @@
</ul>
</div>
-<h2>release 0.3.1 is out</h2>
-<div class="post">
- <p class="date">2009/11/29</p>
- <p><a href="#download">get it!</a></p>
- <p>Changelog since 0.3.0</p>
- <ul>
- <li>improved header widget drawing and gtkengines compatibility</li>
- <li>fixed vfs_curl to fetch content size properly again</li>
- <li>fixed rare memory leak bug in seekbar drawing</li>
- <li>fixed total playtime display</li>
- <li>changed buttons to use stock icons</li>
- <li>implemented reading of embedded cuesheets from ape and wavpack files</li>
- <li>fixed bug in filename resolving when starting from commandline</li>
- <li>added possibility to open multiple files from filemanagers</li>
- <li>fixed random locking/hanging in alsa module</li>
- <li>loading plugins from $XDG_CONFIG_HOME/.local/lib/deadbeef/ (by <a href="mailto:alexey.smirnov@gmx.com">Alexey A. Smirnov</a>)</li>
- <li>middle click on tray icon toggles pause on current track (by <a href="mailto:rotmer@gmail.com">Alex Dedul</a>)</li>
- </ul>
-</div>
-
-
-<h2>release 0.3.0 is out</h2>
-<div class="post">
- <p class="date">2009/11/08</p>
- <p><a href="#download">get it!</a></p>
- <p>Changelog since 0.2.3.2</p>
- <ul>
- <li>vfs plugins - for implementing http/ftp streaming, etc</li>
- <li>improved mpeg (libmad) plugin - eats less memory, works faster</li>
- <li>added support for icecast and shoutcast streams (mp3, ogg)</li>
- <li>added support for podcasts (basically, for any files residing on http/ftp)</li>
- <li>added support for opening pls and m3u files</li>
- <li>improved about dialog</li>
- <li>added support for Super (winkey) modifier and multimedia keys in global hotkeys plugin</li>
- <li>fixed random crash in global hotkeys plugin if key combination was used elsewhere</li>
- <li>improved cuesheet reader</li>
- <li>added cd audio support, including cddb/freedb</li>
- <li>added preferences window</li>
- <li>new unified config file for everything</li>
- <li>added total playtime display in statusbar</li>
- <li>improved plugin build system, displays list of plugins to be built</li>
- <li>custom columns (through manual config editing yet)</li>
- <li>column header drag-and-drop</li>
- <li>improved alsa compatibility</li>
- <li>player can release sound device while not playing</li>
- <li>better alsa resume after suspend support</li>
- <li>support for hardware samplerate conversion (when supported by hardware)</li>
- <li>support for alsa software resampling</li>
- <li>improved skipping through bad files</li>
- <li>fixed replaygain bugs</li>
- <li>added full file path display via tooltip (optional, disabled by default)</li>
- <li>statusbar shows info while paused</li>
- <li>added new buffering icon while streamer loads data</li>
- <li>added scrolling in playlist while dragging/selecting tracks</li>
- <li>case-insensitive file filter in gtkfilechooser dialogs</li>
- <li>added cursor sync between playlist and search windows</li>
- <li>player saves playlist/config on SIGTERM (should improve things on shutdown)</li>
- </ul>
-</div>
-
-<h2>release 0.2.3.2 is out</h2>
-<div class="post">
- <p class="date">2009/10/07</p>
- <p>0.2.3 bugfix release</p>
- <p><a href="#download">get it!</a></p>
- <p>Changelog since 0.2.3.1</p>
- <ul>
- <li>added winkey (Super) modifier support to hotkeys plugin</li>
- <li>added multimedia keys support to hotkeys plugin</li>
- <li>added hex keycodes (as reported by xev) support to hotkeys plugin</li>
- <li>fixed crashbug in playlist loader when loading playlist files from older releases</li>
- <li>fixed bug in flac decoder attempting to read past end of file</li>
- <li>added new workarounds for malformed cusheet files</li>
- </ul>
-</div>
-<h2>release 0.2.3.1 is out</h2>
-<div class="post">
- <p class="date">2009/10/03</p>
- <p>0.2.3 bugfix release</p>
- <p><a href="#download">get it!</a></p>
- <p>Changelog since 0.2.3</p>
- <ul>
- <li>disabled debug tracing in most modules, to prevent slow-downs</li>
- <li>fixed streaming bug introduced last moment before 0.2.3</li>
- <li>fixed redrawing of playing status after resume from pause</li>
- </ul>
-</div>
-<h2>release 0.2.3 is out</h2>
-<div class="post">
- <p class="date">2009/10/03</p>
- <p><a href="#download">get it!</a></p>
- <p>Changelog since 0.2.2.2</p>
- <ul>
- <li>added native gapless playback which works with most decoders</li>
- <li>added replaygain support</li>
- <li>added wavpack plugin</li>
- <li>added libsndfile plugin</li>
- <li>fixed seeking in paused and stopped states</li>
- <li>fixed reading of some id3v2 tags</li>
- <li>changed tag reading order to APEv2-&gt;ID3v2-&gt;ID3v1</li>
- <li>improved cuesheet reader</li>
- <li>fixed interlocking bug in streamer (should reduce skips)</li>
- </ul>
-</div>
-<h2>release 0.2.2.2 is out</h2>
-<div class="post">
- <p class="date">2009/09/20</p>
- <p>another 0.2.2 bugfix release</p>
- <p><a href="#download">get it!</a></p>
- <p>Changelog since 0.2.2.1</p>
- <ul>
- <li>fixed resume after suspend/hibernate</li>
- <li>fixed cue reader regression</li>
- <li>fixed another playlist drawing regression</li>
- <li>fixed stutter at the start of ape tracks</li>
- </ul>
-</div>
-
-<h2>release 0.2.2.1 is out</h2>
-<div class="post">
- <p class="date">2009/09/13</p>
- <p>there was very unfortunate regression bug in 0.2.2, so here's quick fix</p>
- <p><a href="#download">get it!</a></p>
- <p>Changelog since 0.2.2</p>
- <ul>
- <li>fixed playlist drawing regressions encountered in 0.2.2</li>
- </ul>
-</div>
-
-
-<h2>release 0.2.2 is out</h2>
-<div class="post">
- <p class="date">2009/09/13</p>
- <p><a href="#download">get it!</a></p>
- <p>Changelog since 0.2.1</p>
- <ul>
- <li>fixed several build problems reported by users</li>
- <li>added app icons, updated launcher script</li>
- <li>proper sse2 detection and usage in ape plugin</li>
- <li>reduced volumebar range to -50dB</li>
- <li>horizontal scrolling in playlist</li>
- <li>pango is now used for ellipsizing</li>
- <li>case-insensitive search using russian, danish, french and other alphabets</li>
- <li>vertical scroll is much faster now</li>
- </ul>
-</div>
-
-<h2>release 0.2.1 is out</h2>
-<div class="post">
- <p class="date">2009/09/12</p>
- <p><a href="#download">get it!</a></p>
- <p>Changelog since 0.2.0</p>
- <ul>
- <li>new ape decoder - faster, doesn't crash</li>
- <li>fixed APEv2 tag reader</li>
- <li>fixed id3 tag reader on big-endian systems</li>
- <li>player now builds without errors on big-endian systems</li>
- <li>memory for HVSC song length database is now allocated on demand</li>
- <li>fixed icons in system tray menu</li>
- <li>fixed color detection for column header text</li>
- <li>improved cuesheet reader (pregap support and better bounds checking)</li>
- </ul>
-</div>
-
-<h2>deadbeef-0.2.0 is out!</h2>
-<div class='post'>
-<p class='date'>2009/09/08</p>
-<p><a href="#download">get it!</a></p>
-<p>Changelog since 0.1.1:</p>
-<p><i>please note this changelog is what most users would notice. actual changelog is 10 times bigger, and is not worth reading. i don't want to count each of 1000 bugfixes here.</i></p>
-<ul>
- <li>plugin API - decoder and misc plugins working, other types are work in progress</li>
- <li>most decoders are in plugins now, which means that most dependencies are optional (libmad, libFLAC, etc)</li>
- <li>global hotkeys plugin</li>
- <li>last.fm scrobbler plugin</li>
- <li>added help page (under help menu)</li>
- <li>huge amount of performance tweaks (including power consumption tweaks)</li>
- <li>cuesheets embedded into FLAC's vorbis comments</li>
- <li>24 bit flac support</li>
- <li>$XDG_CONFIG_HOME env variable support</li>
- <li>APE format support through libdemac</li>
- <li>launcher (.desktop) file</li>
- <li>scroll follows playback (optional)</li>
- <li>no more "?" when no track number in tags</li>
- <li>fixed seekbar accuracy bug</li>
- <li>improved cuesheet reader</li>
- <li>cuesheet text charset detection (utf8, iso8859-1, cp1251)</li>
- <li>improved mp3 parser (better vbr duration calc, more accurate seeking, etc)</li>
- <li>fixed bug when starting files from command line using relative paths</li>
- <li>fixed order/loopmode session saving</li>
- <li>fixed id3v2.2 reader</li>
- <li>focus/deiconify window on trayicon click</li>
- <li>X button no longer minimizes to tray by default (configurable)</li>
- <li>search is now accessible from menu</li>
- <li>column sizes are now saved between sessions</li>
- <li>select multiple folders in "add folder(s)" dialog</li>
-</ul>
-</div>
+<a href="oldnews.html">News archive</a><br/>
-<h2>tag loading/recoding policy</h2>
-<div class='post'>
-<p class='date'>2009/09/06</p>
-<ul>
- <li>id3v1 loader will always try to detect cp1251.</li>
- <li>id3v2 loader will only try to detect cp1251 if encoding is not specified.</li>
- <li>vorbis comment tags (both in ogg vorbis and flac files) and APE tags
- (both in ape and mp3 files) must always be utf8, so no detection will be
- done here.</li>
- <li>id3v2 tags with encoding explicitly set to iso8859-1 will always be
- loaded as iso8859-1. period.</li>
- <li>id3v2 tags inserted into flac files will be ignored.</li>
- <li>8bit charsets other than cp1251 and iso8859-1 (like koi8-r) are not
- supported now, but might be added in the future.</li>
-</ul>
-</div>
-
-<h2>release 0.1.1 is out!</h2>
-<div class='post'>
-<p class='date'>2009/08/23</p>
-<p>changelog:</p>
-<pre>
-volume control now works on dB scale
-fixed bug in ogg vorbis decoder that was skipping songs
-flac decoder can now ignore corrupted files to some extent
-added shuffle playback mode
-removed some of the unused code from build scripts
-player no longer hangs if song change happened near the end of current song
-playlist redraw fixed for pause/unpause
-speed optimizations on playlist drawing
-changed scrollwheel step to 2 rows
-changed playlist drawing from cairo to gdk, to improve speed and use proper fonts
-fixed server part to be started earlier, to prevent multiple instances bug
-fixed several things preventing player to work on ppc64 architecture
-fixed id3v2 unsynchronized frames reading
-implemented basic session management, window size/position, volume, playmode are remembered across sessions
-</pre>
-<p><a href="#download">download</a> now!</p>
-</div>
-
-<h2>GIT repository</h2>
-<div class='post'>
-<p>i pushed my git repository to sf.net on Thu Aug 20 2009</p>
-<p>git version has several bugfixes/improvements over alpha release, so feel free to use it.</p>
-<p><pre>git clone git://deadbeef.git.sourceforge.net/gitroot/deadbeef/deadbeef</pre></p>
-</div>
-
-<h2>Alpha released</h2>
-<div class='post'>
-<p>first alpha release 0.1.0 just happened on Wed Aug 19 21:59:27 CEST 2009!</p>
-<p>there was a report from a happy user that deadbeef won't compile with gtk&lt;=2.16.</p>
-<p>fix is very easy, and will be available in next release, and in git head when i have time to prepare and push it</p>
-<p>thanks for understanding and happy hacking!</p>
-</div>
-
-<h1 id='about'>About</h1>
-<p>DeaDBeeF (as in 0xDEADBEEF) is an audio player for GNU/Linux systems with X11.</p>
-<p>Current alpha version features:</p>
-<ul>
- <li>mp3, ogg vorbis, flac, ape, wv, wav</li>
- <li>ID3v1, ID3v2.2, ID3v2.3, ID3v2.4, APEv2, xing/info tags support</li>
- <li>character set detection for non-unicode id3 tags - supports cp1251 and iso8859-1</li>
- <li>unicode tags are fully supported as well (both utf8 and ucs2)</li>
- <li>cuesheet support for mp3, ogg, flac, ape</li>
- <li>autodetection of utf8/cp1251/iso8859-1 charsets in cuesheets</li>
- <li>sid and some popular chiptune formats like nsf</li>
- <li>tracker modules like mod, s3m, it, xm, etc</li>
- <li>HVSC song length database support for sid</li>
- <li>gtk2 interface with custom highly speed/memory optimized widgets</li>
- <li>no GNOME or KDE dependencies - just gtk2 and several small libraries</li>
- <li>minimize to tray, with scrollwheel volume control</li>
- <li>drag and drop, both inside of playlist, and from filemanagers and such</li>
- <li>control playback from command line (allows global hotkeys using xbindkeys)</li>
- <li>seeking works in all supported formats</li>
- <li>plugin support; ships with several standard plugins, such as global hotkeys and last.fm scrobbler; sdk is included</li>
- <li>duration calculation is as precise as possible for vbr mp3 files (with and without xing/info tags)</li>
- <li>was tested and works on x86, x86_64 and ppc64 architectures. should work on most modern platforms</li>
-</ul>
<h1 id="license">Copying</h1>
<pre>
Copyright (C) 2009 Alexey Yakovenko
@@ -394,57 +168,17 @@ implemented basic session management, window size/position, volume, playmode are
</pre>
<h1 id="download">Download</h1>
-<h2>Latest version 0.3.2:</h2>
+<h2>Latest version 0.3.3:</h2>
<p>official Arch Linux PKGBUILD: <a href="http://aur.archlinux.org/packages.php?ID=29497">here</a></p>
<p>if you have yaourt, you can simply do yaourt -S deadbeef</p>
-<p>source code for version 0.3.2 <a href="http://sourceforge.net/projects/deadbeef/files/deadbeef-0.3.2.tar.gz/download">deadbeef-0.3.2.tar.gz</a></p>
+<p>source code for version 0.3.3 <a href="http://sourceforge.net/projects/deadbeef/files/deadbeef-0.3.3.tar.gz/download">deadbeef-0.3.3.tar.gz</a></p>
<p>or <a href="http://sourceforge.net/projects/deadbeef/files/">browse all files</a></p>
+<!--
<p><b>unsupported</b> debian packages for version 0.3.2 from <a href="mailto:alexey.smirnov@gmx.com">Alexey Smirnov</a>:</p>
<p><a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef_0.3.2-1_i386.deb/download">i386</a>, <a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef_0.3.2-1_amd64.deb/download">x86_64</a>, <a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef-plugins-dev_0.3.2-1_all.deb/download">plugin sdk</a></p>
-<h2>version 0.3.1:</h2>
-<p>source code for version 0.3.1 <a href="http://sourceforge.net/projects/deadbeef/files/deadbeef-0.3.1.tar.gz/download">deadbeef-0.3.1.tar.gz</a></p>
-<p>or <a href="http://sourceforge.net/projects/deadbeef/files/">browse all files</a></p>
-<p><b>unsupported</b> live gentoo ebuild from <a href="mailto:tonn.post@gmail.com">tonn</a>: <a href="http://sourceforge.net/projects/deadbeef/files/deadbeef-9999.ebuild/download">deadbeef-9999.ebuild</a></p>
-<h2>version 0.3.0:</h2>
-<p>source code for version 0.3.0 <a href="http://sourceforge.net/projects/deadbeef/files/deadbeef-0.3.0.tar.gz/download">deadbeef-0.3.0.tar.gz</a></p>
-<p><b>unsupported</b> debian packages for version 0.3.0 from <a href="mailto:alexey.smirnov@gmx.com">Alexey Smirnov</a>:</p>
-<p><a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef_0.3.0-1_i386.deb/download">i386</a>, <a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef_0.3.0-1_amd64.deb/download">x86_64</a>, <a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef-plugins-dev_0.3.0-1_all.deb/download">plugin sdk</a></p>
-<h2>version 0.2.3.2:</h2>
-<p>source code for version 0.2.3.2 <a href="http://sourceforge.net/projects/deadbeef/files/deadbeef-0.2.3.2.tar.gz/download">deadbeef-0.2.3.2.tar.gz</a></p>
-<p><b>unsupported</b> debian packages for version 0.2.3.2 from <a href="mailto:alexey.smirnov@gmx.com">Alexey Smirnov</a>:</p>
-<p><a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef_0.2.3.2-1_i386.deb/download">i386</a>, <a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef_0.2.3.2-1_amd64.deb/download">x86_64</a>, <a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef-plugins-dev_0.2.3.2-1_all.deb/download">plugin sdk</a></p>
-<h2>version 0.2.3.1:</h2>
-<p>source code for version 0.2.3.1 <a href="http://sourceforge.net/projects/deadbeef/files/deadbeef-0.2.3.1.tar.gz/download">deadbeef-0.2.3.1.tar.gz</a></p>
-<h2>version 0.2.3:</h2>
-<p>source code for version 0.2.3 <a href="http://sourceforge.net/projects/deadbeef/files/deadbeef-0.2.3.tar.gz/download">deadbeef-0.2.3.tar.gz</a></p>
-<h2>version 0.2.2.2:</h2>
-<p>source code for version 0.2.2.2 <a href="http://sourceforge.net/projects/deadbeef/files/deadbeef-0.2.2.2.tar.gz/download">deadbeef-0.2.2.2.tar.gz</a></p>
-<p><b>unsupported</b> debian packages for version 0.2.2.2 from <a href="mailto:alexey.smirnov@gmx.com">Alexey Smirnov</a>:</p>
-<p><a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef_0.2.2.2-1_i386.deb/download">i386</a>, <a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef_0.2.2.2-1_amd64.deb/download">x86_64</a>, <a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef-plugins-dev_0.2.2.2-1_all.deb/download">plugin sdk</a></p>
-<p>deb-src git repository is <a href="http://github.com/asv/deadbeef-debian">here</a></p>
-<h2>version 0.2.2.1</h2>
-<p>source code for version 0.2.2.1 <a href="http://sourceforge.net/projects/deadbeef/files/deadbeef-0.2.2.1.tar.gz/download">deadbeef-0.2.2.1.tar.gz</a></p>
-<p><b>unsupported</b> debian packages for version 0.2.2.1 from <a href="mailto:alexey.smirnov@gmx.com">Alexey Smirnov</a>:</p>
-<p><a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef_0.2.2.1-1_i386.deb/download">i386</a>, <a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef_0.2.2.1-1_amd64.deb/download">x86_64</a>, <a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef-plugins-dev_0.2.2.1-1_all.deb/download">plugin sdk</a></p>
-<h2>version 0.2.1:</h2>
-<p>source code for version 0.2.1 <a href="http://sourceforge.net/projects/deadbeef/files/deadbeef-0.2.1.tar.gz/download">deadbeef-0.2.1.tar.gz</a></p>
-<h2>version 0.2.0:</h2>
-<p>source code for version 0.2.0 <a href="http://sourceforge.net/projects/deadbeef/files/deadbeef-0.2.0.tar.gz/download">deadbeef-0.2.0.tar.gz</a></p>
-<p><b>unsupported</b> slackware package for version 0.2.0 from <a href="mailto:sftp.mtuci@gmail.com">sftp.mtuci@gmail.com</a>:</p>
-<p><a href="http://sourceforge.net/projects/deadbeef/files/deadbeef-0.2.0-i686-slack12.2_1.tgz/download">i686 slackware 12.2</a></p>
-<p><b>unsupported</b> debian packages for version 0.2.0 from <a href="mailto:alexey.smirnov@gmx.com">Alexey Smirnov</a>:</p>
-<p><a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef_0.2-1_i386.deb/download">i386</a>, <a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef_0.2-1_amd64.deb/download">x86_64</a>, <a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef-plugins-dev_0.2-1_all.deb/download">plugin sdk</a></p>
-<p>note: i have nothing to do with these packages, nor can i test them. use at your own risk</p>
-<h2>version 0.1.1</h2>
-<p>source code for version 0.1.1 <a href="http://sourceforge.net/projects/deadbeef/files/deadbeef-0.1.1.tar.gz/download">deadbeef-0.1.1.tar.gz</a></p>
-<p><b>unsupported</b> debian packages for version 0.1.1 from <a href="mailto:alexey.smirnov@gmx.com">Alexey Smirnov</a>:</p>
-<p><a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef_0.1.1-1_i386.deb/download">i386</a>, <a href="http://sourceforge.net/projects/deadbeef/files/debian/deadbeef_0.1.1-1_amd64.deb/download">x86_64</a></p>
-<p><b>unsupported</b> slackware packages for version 0.1.1 from <a href="mailto:sftp.mtuci@gmail.com">sftp.mtuci@gmail.com</a>:</p>
-<p><a href="http://sourceforge.net/projects/deadbeef/files/deadbeef-0.1.1-i686-slack12.1-1.tgz/download">i386 slackware 12.1</a>, <a href="http://sourceforge.net/projects/deadbeef/files/deadbeef-0.1.1-i686-slack12.2-1.tgz/download">i386 slackware 12.2</a></p>
-<p><b>unsupported</b> gentoo ebuild for version 0.1.1 from <a href="mailto:prodoomman@gmail.com">proDOOMman</a>:</p>
-<p><a href="http://sourceforge.net/projects/deadbeef/files/deadbeef-0.1.1.ebuild/download">deadbeef-0.1.1.ebuild</a></p>
<p>note: i have nothing to do with these packages, nor can i test them. use at your own risk</p>
<p>contact me <b>only</b> if you built from official source package.</p>
+-->
<h1 id='bugs'>Reporting Bugs And Requesting Features</h1>
<p>Trackers for reporting bugs, requesting features, etc are <a href="https://sourceforge.net/projects/deadbeef/support">here</a></p>
@@ -455,8 +189,6 @@ implemented basic session management, window size/position, volume, playmode are
<p>official IRC channel (for english speaking people) is: #deadbeefplayer @ freenode</p>
<p>official jabber conference for russian speaking users is here: deadbeef-ru@conference.jabber.ru</p>
<p>email: <a href="mailto:waker@users.sourceforge.net">Alexey Yakovenko</a></p>
-<h1 id='screenshots'>Screenshots</h1>
-<img src="screenshot02.png" alt="main window, version 0.1.0"/>
<hr/>
<p><a href="http://sourceforge.net/">Project Web Hosted by<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=272657&amp;type=3" alt="SourceForge.net"/></a></p>
diff --git a/web/oldnews.html b/web/oldnews.html
new file mode 100644
index 00000000..e57bffa3
--- /dev/null
+++ b/web/oldnews.html
@@ -0,0 +1,308 @@
+<html>
+<head>
+<title>DeaDBeeF - Ultimate Music Player For GNU/Linux</title>
+</head>
+<style>
+ body {
+ background-color: #eeeeee;
+ }
+ #header {
+ margin: 0;
+ padding: 0;
+ }
+ #header li {
+ display: inline;
+ margin-left: 1em;
+ }
+ h1 {
+ font-variant: small-caps;
+ }
+ .post {
+ margin-left: 2em;
+ background-color: #d7d7d7;
+ padding: 1em;
+ -moz-border-radius: 3;
+ border-radius: 3;
+ border-width: 1;
+ border-color: #cccccc;
+ }
+ .post p {
+ padding: 0;
+ margin: 0;
+ }
+ p.date {
+ font-size: 80%;
+ margin-bottom: 0.5em;
+ }
+ #faq {
+ color: #ff0000;
+ font-size: 120%;
+ font-weight: bold;
+ }
+</style>
+<body>
+<h2>release 0.3.1 is out</h2>
+<div class="post">
+ <p class="date">2009/11/29</p>
+ <p><a href="#download">get it!</a></p>
+ <p>Changelog since 0.3.0</p>
+ <ul>
+ <li>improved header widget drawing and gtkengines compatibility</li>
+ <li>fixed vfs_curl to fetch content size properly again</li>
+ <li>fixed rare memory leak bug in seekbar drawing</li>
+ <li>fixed total playtime display</li>
+ <li>changed buttons to use stock icons</li>
+ <li>implemented reading of embedded cuesheets from ape and wavpack files</li>
+ <li>fixed bug in filename resolving when starting from commandline</li>
+ <li>added possibility to open multiple files from filemanagers</li>
+ <li>fixed random locking/hanging in alsa module</li>
+ <li>loading plugins from $XDG_CONFIG_HOME/.local/lib/deadbeef/ (by <a href="mailto:alexey.smirnov@gmx.com">Alexey A. Smirnov</a>)</li>
+ <li>middle click on tray icon toggles pause on current track (by <a href="mailto:rotmer@gmail.com">Alex Dedul</a>)</li>
+ </ul>
+</div>
+
+
+<h2>release 0.3.0 is out</h2>
+<div class="post">
+ <p class="date">2009/11/08</p>
+ <p><a href="#download">get it!</a></p>
+ <p>Changelog since 0.2.3.2</p>
+ <ul>
+ <li>vfs plugins - for implementing http/ftp streaming, etc</li>
+ <li>improved mpeg (libmad) plugin - eats less memory, works faster</li>
+ <li>added support for icecast and shoutcast streams (mp3, ogg)</li>
+ <li>added support for podcasts (basically, for any files residing on http/ftp)</li>
+ <li>added support for opening pls and m3u files</li>
+ <li>improved about dialog</li>
+ <li>added support for Super (winkey) modifier and multimedia keys in global hotkeys plugin</li>
+ <li>fixed random crash in global hotkeys plugin if key combination was used elsewhere</li>
+ <li>improved cuesheet reader</li>
+ <li>added cd audio support, including cddb/freedb</li>
+ <li>added preferences window</li>
+ <li>new unified config file for everything</li>
+ <li>added total playtime display in statusbar</li>
+ <li>improved plugin build system, displays list of plugins to be built</li>
+ <li>custom columns (through manual config editing yet)</li>
+ <li>column header drag-and-drop</li>
+ <li>improved alsa compatibility</li>
+ <li>player can release sound device while not playing</li>
+ <li>better alsa resume after suspend support</li>
+ <li>support for hardware samplerate conversion (when supported by hardware)</li>
+ <li>support for alsa software resampling</li>
+ <li>improved skipping through bad files</li>
+ <li>fixed replaygain bugs</li>
+ <li>added full file path display via tooltip (optional, disabled by default)</li>
+ <li>statusbar shows info while paused</li>
+ <li>added new buffering icon while streamer loads data</li>
+ <li>added scrolling in playlist while dragging/selecting tracks</li>
+ <li>case-insensitive file filter in gtkfilechooser dialogs</li>
+ <li>added cursor sync between playlist and search windows</li>
+ <li>player saves playlist/config on SIGTERM (should improve things on shutdown)</li>
+ </ul>
+</div>
+
+<h2>release 0.2.3.2 is out</h2>
+<div class="post">
+ <p class="date">2009/10/07</p>
+ <p>0.2.3 bugfix release</p>
+ <p><a href="#download">get it!</a></p>
+ <p>Changelog since 0.2.3.1</p>
+ <ul>
+ <li>added winkey (Super) modifier support to hotkeys plugin</li>
+ <li>added multimedia keys support to hotkeys plugin</li>
+ <li>added hex keycodes (as reported by xev) support to hotkeys plugin</li>
+ <li>fixed crashbug in playlist loader when loading playlist files from older releases</li>
+ <li>fixed bug in flac decoder attempting to read past end of file</li>
+ <li>added new workarounds for malformed cusheet files</li>
+ </ul>
+</div>
+<h2>release 0.2.3.1 is out</h2>
+<div class="post">
+ <p class="date">2009/10/03</p>
+ <p>0.2.3 bugfix release</p>
+ <p><a href="#download">get it!</a></p>
+ <p>Changelog since 0.2.3</p>
+ <ul>
+ <li>disabled debug tracing in most modules, to prevent slow-downs</li>
+ <li>fixed streaming bug introduced last moment before 0.2.3</li>
+ <li>fixed redrawing of playing status after resume from pause</li>
+ </ul>
+</div>
+<h2>release 0.2.3 is out</h2>
+<div class="post">
+ <p class="date">2009/10/03</p>
+ <p><a href="#download">get it!</a></p>
+ <p>Changelog since 0.2.2.2</p>
+ <ul>
+ <li>added native gapless playback which works with most decoders</li>
+ <li>added replaygain support</li>
+ <li>added wavpack plugin</li>
+ <li>added libsndfile plugin</li>
+ <li>fixed seeking in paused and stopped states</li>
+ <li>fixed reading of some id3v2 tags</li>
+ <li>changed tag reading order to APEv2-&gt;ID3v2-&gt;ID3v1</li>
+ <li>improved cuesheet reader</li>
+ <li>fixed interlocking bug in streamer (should reduce skips)</li>
+ </ul>
+</div>
+<h2>release 0.2.2.2 is out</h2>
+<div class="post">
+ <p class="date">2009/09/20</p>
+ <p>another 0.2.2 bugfix release</p>
+ <p><a href="#download">get it!</a></p>
+ <p>Changelog since 0.2.2.1</p>
+ <ul>
+ <li>fixed resume after suspend/hibernate</li>
+ <li>fixed cue reader regression</li>
+ <li>fixed another playlist drawing regression</li>
+ <li>fixed stutter at the start of ape tracks</li>
+ </ul>
+</div>
+
+<h2>release 0.2.2.1 is out</h2>
+<div class="post">
+ <p class="date">2009/09/13</p>
+ <p>there was very unfortunate regression bug in 0.2.2, so here's quick fix</p>
+ <p><a href="#download">get it!</a></p>
+ <p>Changelog since 0.2.2</p>
+ <ul>
+ <li>fixed playlist drawing regressions encountered in 0.2.2</li>
+ </ul>
+</div>
+
+
+<h2>release 0.2.2 is out</h2>
+<div class="post">
+ <p class="date">2009/09/13</p>
+ <p><a href="#download">get it!</a></p>
+ <p>Changelog since 0.2.1</p>
+ <ul>
+ <li>fixed several build problems reported by users</li>
+ <li>added app icons, updated launcher script</li>
+ <li>proper sse2 detection and usage in ape plugin</li>
+ <li>reduced volumebar range to -50dB</li>
+ <li>horizontal scrolling in playlist</li>
+ <li>pango is now used for ellipsizing</li>
+ <li>case-insensitive search using russian, danish, french and other alphabets</li>
+ <li>vertical scroll is much faster now</li>
+ </ul>
+</div>
+
+<h2>release 0.2.1 is out</h2>
+<div class="post">
+ <p class="date">2009/09/12</p>
+ <p><a href="#download">get it!</a></p>
+ <p>Changelog since 0.2.0</p>
+ <ul>
+ <li>new ape decoder - faster, doesn't crash</li>
+ <li>fixed APEv2 tag reader</li>
+ <li>fixed id3 tag reader on big-endian systems</li>
+ <li>player now builds without errors on big-endian systems</li>
+ <li>memory for HVSC song length database is now allocated on demand</li>
+ <li>fixed icons in system tray menu</li>
+ <li>fixed color detection for column header text</li>
+ <li>improved cuesheet reader (pregap support and better bounds checking)</li>
+ </ul>
+</div>
+
+<h2>deadbeef-0.2.0 is out!</h2>
+<div class='post'>
+<p class='date'>2009/09/08</p>
+<p><a href="#download">get it!</a></p>
+<p>Changelog since 0.1.1:</p>
+<p><i>please note this changelog is what most users would notice. actual changelog is 10 times bigger, and is not worth reading. i don't want to count each of 1000 bugfixes here.</i></p>
+<ul>
+ <li>plugin API - decoder and misc plugins working, other types are work in progress</li>
+ <li>most decoders are in plugins now, which means that most dependencies are optional (libmad, libFLAC, etc)</li>
+ <li>global hotkeys plugin</li>
+ <li>last.fm scrobbler plugin</li>
+ <li>added help page (under help menu)</li>
+ <li>huge amount of performance tweaks (including power consumption tweaks)</li>
+ <li>cuesheets embedded into FLAC's vorbis comments</li>
+ <li>24 bit flac support</li>
+ <li>$XDG_CONFIG_HOME env variable support</li>
+ <li>APE format support through libdemac</li>
+ <li>launcher (.desktop) file</li>
+ <li>scroll follows playback (optional)</li>
+ <li>no more "?" when no track number in tags</li>
+ <li>fixed seekbar accuracy bug</li>
+ <li>improved cuesheet reader</li>
+ <li>cuesheet text charset detection (utf8, iso8859-1, cp1251)</li>
+ <li>improved mp3 parser (better vbr duration calc, more accurate seeking, etc)</li>
+ <li>fixed bug when starting files from command line using relative paths</li>
+ <li>fixed order/loopmode session saving</li>
+ <li>fixed id3v2.2 reader</li>
+ <li>focus/deiconify window on trayicon click</li>
+ <li>X button no longer minimizes to tray by default (configurable)</li>
+ <li>search is now accessible from menu</li>
+ <li>column sizes are now saved between sessions</li>
+ <li>select multiple folders in "add folder(s)" dialog</li>
+</ul>
+</div>
+
+<h2>tag loading/recoding policy</h2>
+<div class='post'>
+<p class='date'>2009/09/06</p>
+<ul>
+ <li>id3v1 loader will always try to detect cp1251.</li>
+ <li>id3v2 loader will only try to detect cp1251 if encoding is not specified.</li>
+ <li>vorbis comment tags (both in ogg vorbis and flac files) and APE tags
+ (both in ape and mp3 files) must always be utf8, so no detection will be
+ done here.</li>
+ <li>id3v2 tags with encoding explicitly set to iso8859-1 will always be
+ loaded as iso8859-1. period.</li>
+ <li>id3v2 tags inserted into flac files will be ignored.</li>
+ <li>8bit charsets other than cp1251 and iso8859-1 (like koi8-r) are not
+ supported now, but might be added in the future.</li>
+</ul>
+</div>
+
+<h2>release 0.1.1 is out!</h2>
+<div class='post'>
+<p class='date'>2009/08/23</p>
+<p>changelog:</p>
+<pre>
+volume control now works on dB scale
+fixed bug in ogg vorbis decoder that was skipping songs
+flac decoder can now ignore corrupted files to some extent
+added shuffle playback mode
+removed some of the unused code from build scripts
+player no longer hangs if song change happened near the end of current song
+playlist redraw fixed for pause/unpause
+speed optimizations on playlist drawing
+changed scrollwheel step to 2 rows
+changed playlist drawing from cairo to gdk, to improve speed and use proper fonts
+fixed server part to be started earlier, to prevent multiple instances bug
+fixed several things preventing player to work on ppc64 architecture
+fixed id3v2 unsynchronized frames reading
+implemented basic session management, window size/position, volume, playmode are remembered across sessions
+</pre>
+<p><a href="#download">download</a> now!</p>
+</div>
+
+<h2>GIT repository</h2>
+<div class='post'>
+<p>i pushed my git repository to sf.net on Thu Aug 20 2009</p>
+<p>git version has several bugfixes/improvements over alpha release, so feel free to use it.</p>
+<p><pre>git clone git://deadbeef.git.sourceforge.net/gitroot/deadbeef/deadbeef</pre></p>
+</div>
+
+<h2>Alpha released</h2>
+<div class='post'>
+<p>first alpha release 0.1.0 just happened on Wed Aug 19 21:59:27 CEST 2009!</p>
+<p>there was a report from a happy user that deadbeef won't compile with gtk&lt;=2.16.</p>
+<p>fix is very easy, and will be available in next release, and in git head when i have time to prepare and push it</p>
+<p>thanks for understanding and happy hacking!</p>
+</div>
+<hr/>
+<p><a href="http://sourceforge.net/">Project Web Hosted by<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=272657&amp;type=3" alt="SourceForge.net"/></a></p>
+<script type="text/javascript">
+var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+</script>
+<script type="text/javascript">
+try {
+var pageTracker = _gat._getTracker("UA-3180744-2");
+pageTracker._trackPageview();
+} catch(err) {}</script>
+</body>