From 4afedc13b9eadd60c1b5c542ba14ee73efc5a4d5 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 2 Apr 2007 17:16:54 +0200 Subject: [PATCH] Revert "fix compress filter for big endian machines" This reverts commit 85225bb1292d1885e0261fb5109d18ecd584c267. because it broke little endian (x86) machines. The issue needs further investigation... --- aacdec.c | 4 ++-- configure.ac | 2 -- filter.h | 16 ---------------- mp3dec.c | 9 +++++---- oggdec.c | 4 ---- osx_write.c | 8 +++++++- 6 files changed, 14 insertions(+), 29 deletions(-) diff --git a/aacdec.c b/aacdec.c index c860a3b7..9ed12012 100644 --- a/aacdec.c +++ b/aacdec.c @@ -154,8 +154,8 @@ static ssize_t aacdec(char *input_buffer, size_t len, struct filter_node *fn) goto out; for (i = 0; i < padd->frame_info.samples; i++) { short *s = (short *)outbuffer; - write_int16_host_endian(fn->buf + fn->loaded, s); - fn->loaded += 2; + fn->buf[fn->loaded++] = s[i] & 0xff; + fn->buf[fn->loaded++] = (s[i] >> 8) & 0xff; } success: ret = consumed; diff --git a/configure.ac b/configure.ac index 316f95c7..aeb6f8d4 100644 --- a/configure.ac +++ b/configure.ac @@ -15,8 +15,6 @@ AC_MSG_CHECKING(os type) OSTYPE="`$UNAMEPATH -s`" AC_MSG_RESULT("$OSTYPE") -AC_C_BIGENDIAN() - AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL diff --git a/filter.h b/filter.h index 06d727f5..321d763c 100644 --- a/filter.h +++ b/filter.h @@ -299,20 +299,6 @@ void (*print_help)(void); */ void *(*parse_config)(int argc, char **argv); }; - - -static inline void write_int16_host_endian(char *buf, int16_t val) -{ -#ifndef BIGENDIAN - *buf = val >> 8; - *(buf + 1) = val & 0xff; -#else - *buf = val & 0xff; - *(buf + 1) = val >> 8; -#endif -} - - /** \cond */ extern struct filter filters[]; #define DECLARE_EXTERN_FILTER_INIT(name) \ @@ -362,5 +348,3 @@ DECLARE_EXTERN_FILTER_INIT(oggdec); AACDEC_FILTER \ OGGDEC_FILTER \ { .name = NULL } }; - - diff --git a/mp3dec.c b/mp3dec.c index a1374b73..401a03c5 100644 --- a/mp3dec.c +++ b/mp3dec.c @@ -74,13 +74,14 @@ next_frame: mad_synth_frame(&pmd->synth, &pmd->frame); for (i = 0; i < pmd->synth.pcm.length; i++) { + /* output format: unsigned 16 bit little endian */ signed short s = MAD_TO_SHORT(pmd->synth.pcm.samples[0][i]); - write_int16_host_endian(fn->buf + fn->loaded, s); - fn->loaded += 2; + fn->buf[fn->loaded++] = s & 0xff; + fn->buf[fn->loaded++] = s >> 8; if (MAD_NCHANNELS(&pmd->frame.header) == 2) { /* stereo */ s = MAD_TO_SHORT(pmd->synth.pcm.samples[1][i]); - write_int16_host_endian(fn->buf + fn->loaded, s); - fn->loaded += 2; + fn->buf[fn->loaded++] = s & 0xff; + fn->buf[fn->loaded++] = s >> 8; } if (fn->loaded != fn->bufsize) /* output buffer not full */ continue; diff --git a/oggdec.c b/oggdec.c index 2ec13d8d..929e2ecc 100644 --- a/oggdec.c +++ b/oggdec.c @@ -31,11 +31,7 @@ /** \cond some internal constants */ #define BITS 16 -#ifdef BIGENDIAN #define ENDIAN 0 -#else -#define ENDIAN 1 -#endif #define SIGN 1 /** \endcond */ diff --git a/osx_write.c b/osx_write.c index f13ec6e1..107746c7 100644 --- a/osx_write.c +++ b/osx_write.c @@ -111,8 +111,14 @@ static void fill_buffer(struct osx_buffer *b, short *source, long size) b->size = size; } dest = b->buffer; - while (size--) + while (size--) { + char *tmp = (char *)source; + char c = *tmp; + *tmp = *(tmp + 1); + *(tmp + 1) = c; + /* *dest++ = ((*source++) + 32768) / 65536.0; */ *dest++ = (*source++) / 32768.0; + } b->ptr = b->buffer; b->remaining = b->size; } -- 2.39.5