From 25ffa8b198a313757541d0591b20594abdccc5aa Mon Sep 17 00:00:00 2001 From: Andree Buschmann Date: Sat, 28 Jun 2008 12:55:34 +0000 Subject: Solve possible glitch after seeking in mpc files. Documented the special treatment after seek. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17829 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libmusepack/decoder.h | 8 ++++++++ apps/codecs/libmusepack/mpc_decoder.c | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'apps') diff --git a/apps/codecs/libmusepack/decoder.h b/apps/codecs/libmusepack/decoder.h index 499cd53137..9031bf29e7 100644 --- a/apps/codecs/libmusepack/decoder.h +++ b/apps/codecs/libmusepack/decoder.h @@ -43,7 +43,15 @@ #include "reader.h" #include "streaminfo.h" +// define this to enable/disable support for streamversion SV4-6 //#define MPC_SUPPORT_SV456 + +// SCF_HACK is used to avoid possible distortion after seeking with mpc files +// background: scf's are coded differential in time domain. if you seek to the +// desired postion it might happen that the baseline is missed and the resulting +// scf is much too high (hissing noise). this hack uses the lowest scaling until +// a non-differential scf could be decoded after seek. through this hack subbands +// are faded out until there was at least a single non-differential scf found. #define SCF_HACK enum { diff --git a/apps/codecs/libmusepack/mpc_decoder.c b/apps/codecs/libmusepack/mpc_decoder.c index e63d1efaec..d211980782 100644 --- a/apps/codecs/libmusepack/mpc_decoder.c +++ b/apps/codecs/libmusepack/mpc_decoder.c @@ -65,7 +65,7 @@ extern const HuffmanTyp mpc_table_Region_C [ 4]; #endif #ifdef SCF_HACK -#define SCF_DIFF(SCF, D) (SCF == -128 ? -128 : SCF + D) +#define SCF_DIFF(SCF, D) (SCF == 127 ? 127 : SCF + D) #else #define SCF_DIFF(SCF, D) SCF + D #endif @@ -1565,8 +1565,8 @@ void mpc_decoder_reset_state(mpc_decoder *d) { memset(d->Y_L , 0, sizeof Y_L ); memset(d->Y_R , 0, sizeof Y_R ); #ifdef SCF_HACK - memset(d->SCF_Index_L , -128, sizeof d->SCF_Index_L ); - memset(d->SCF_Index_R , -128, sizeof d->SCF_Index_R ); + memset(d->SCF_Index_L , 127, sizeof d->SCF_Index_L ); + memset(d->SCF_Index_R , 127, sizeof d->SCF_Index_R ); #else memset(d->SCF_Index_L , 0, sizeof d->SCF_Index_L ); memset(d->SCF_Index_R , 0, sizeof d->SCF_Index_R ); -- cgit v1.2.3