[Mplayer-cvslog] CVS: main/libac3 Makefile,1.12,1.13 bitstream.c,1.1.1.1,1.2 bitstream.h,1.1.1.1,1.2 bswap.h,1.2,1.3
Jürgen Keil
jkeil at mplayer.dev.hu
Thu Jul 12 17:35:54 CEST 2001
- Previous message: [Mplayer-cvslog] CVS: main bswap.h,NONE,1.1 Makefile,1.50,1.51 aviheader.c,1.15,1.16 configure,1.100,1.101 dec_audio.c,1.19,1.20 dec_video.c,1.2,1.3 demuxer.h,1.5,1.6 dll_init.c,1.21,1.22
- Next message: [Mplayer-cvslog] CVS: main/mp3lib sr1.c,1.11,1.12
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/mplayer/main/libac3
In directory mplayer:/var/tmp.root/cvs-serv21650/libac3
Modified Files:
Makefile bitstream.c bitstream.h bswap.h
Log Message:
Add some preliminary support for non-x86 architectures to mplayer
Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libac3/Makefile,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Makefile 10 Jul 2001 08:27:49 -0000 1.12
+++ Makefile 12 Jul 2001 15:35:51 -0000 1.13
@@ -8,7 +8,7 @@
# OBJS = $(SRCS:.c=.o)
CFLAGS = $(OPTFLAGS) -I. -I.. $(EXTRA_INC) -DHAVE_CONFIG_H
-ifeq ($(TARGET_ARCH_X86), yes)
+ifeq ($(TARGET_ARCH_X86),yes)
ifeq ($(TARGET_SSE),yes)
SRCS += downmix/downmix_kni.S mmx/imdct512_kni.S mmx/srfft_kni.S
OBJS += downmix/downmix_kni.o mmx/imdct512_kni.o mmx/srfft_kni.o
Index: bitstream.c
===================================================================
RCS file: /cvsroot/mplayer/main/libac3/bitstream.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- bitstream.c 24 Feb 2001 20:29:35 -0000 1.1.1.1
+++ bitstream.c 12 Jul 2001 15:35:51 -0000 1.2
@@ -36,9 +36,12 @@
uint32_t bits_left = 0;
+uint8_t *buffer_start = 0;
+#if ARCH_X86
uint64_t current_word;
-uint64_t *buffer_start = 0;
-
+#else
+uint32_t current_word;
+#endif
/**
*
@@ -46,7 +49,16 @@
static inline void bitstream_fill_current()
{
- current_word = bswap_64 (*buffer_start++);
+#if ARCH_X86
+ current_word = bswap_64 (*(uint64_t*)buffer_start);
+#else
+ current_word =
+ buffer_start[0] << 24 |
+ buffer_start[1] << 16 |
+ buffer_start[2] << 8 |
+ buffer_start[3];
+#endif
+ buffer_start += CURRENT_WORD_BITS/8;
}
/**
@@ -63,14 +75,14 @@
uint32_t result;
num_bits -= bits_left;
- result = (current_word << (64 - bits_left)) >> (64 - bits_left);
+ result = (current_word << (CURRENT_WORD_BITS - bits_left)) >> (CURRENT_WORD_BITS - bits_left);
bitstream_fill_current();
if(num_bits != 0)
- result = (result << num_bits) | (current_word >> (64 - num_bits));
+ result = (result << num_bits) | (current_word >> (CURRENT_WORD_BITS - num_bits));
- bits_left = 64 - num_bits;
+ bits_left = CURRENT_WORD_BITS - num_bits;
return result;
}
@@ -83,6 +95,6 @@
void bitstream_init (uint8_t *start)
{
//initialize the start of the buffer
- buffer_start = (uint64_t *) start;
+ buffer_start = start;
bits_left = 0;
}
Index: bitstream.h
===================================================================
RCS file: /cvsroot/mplayer/main/libac3/bitstream.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- bitstream.h 24 Feb 2001 20:29:35 -0000 1.1.1.1
+++ bitstream.h 12 Jul 2001 15:35:51 -0000 1.2
@@ -22,11 +22,20 @@
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <inttypes.h>
extern uint32_t bits_left;
+#if ARCH_X86
extern uint64_t current_word;
-extern uint64_t next_word;
+#define CURRENT_WORD_BITS 64
+#else
+extern uint32_t current_word;
+#define CURRENT_WORD_BITS 32
+#endif
+
void bitstream_init(uint8_t *start);
void bitstream_byte_align(void);
@@ -40,7 +49,7 @@
uint32_t result;
if (num_bits < bits_left) {
- result = (current_word << (64 - bits_left)) >> (64 - num_bits);
+ result = (current_word << (CURRENT_WORD_BITS - bits_left)) >> (CURRENT_WORD_BITS - num_bits);
bits_left -= num_bits;
return result;
}
Index: bswap.h
===================================================================
RCS file: /cvsroot/mplayer/main/libac3/bswap.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- bswap.h 22 May 2001 07:45:35 -0000 1.2
+++ bswap.h 12 Jul 2001 15:35:51 -0000 1.3
@@ -11,12 +11,6 @@
#include <inttypes.h>
-#ifdef WORDS_BIGENDIAN
-// FIXME these need to actually swap ;)
-#define bswap_16(x) (x)
-#define bswap_32(x) (x)
-#define bswap_64(x) (x)
-#else
#ifdef ARCH_X86
inline static unsigned short ByteSwap16(unsigned short x)
{
@@ -55,9 +49,9 @@
#define bswap_64(x) ByteSwap64(x)
#else
-// This is wrong, 'cannot take address of ...'
-#define bswap_16(x) ((((uint8_t*)&x)[2] << 8) \
- | (((uint8_t*)&x)[3]))
+
+#define bswap_16(x) (((x) & 0x00ff) << 8 | ((x) & 0xff00) >> 8)
+
// code from bits/byteswap.h (C) 1997, 1998 Free Software Foundation, Inc.
#define bswap_32(x) \
@@ -72,10 +66,9 @@
__r.__l[0] = bswap_32 (__w.__l[1]); \
__r.__l[1] = bswap_32 (__w.__l[0]); \
__r.__ll; }))
-#endif
-#endif
+#endif /* !ARCH_X86 */
-#endif
+#endif /* !HAVE_BYTESWAP_H */
// be2me ... BigEndian to MachineEndian
// le2me ... LittleEndian to MachineEndian
- Previous message: [Mplayer-cvslog] CVS: main bswap.h,NONE,1.1 Makefile,1.50,1.51 aviheader.c,1.15,1.16 configure,1.100,1.101 dec_audio.c,1.19,1.20 dec_video.c,1.2,1.3 demuxer.h,1.5,1.6 dll_init.c,1.21,1.22
- Next message: [Mplayer-cvslog] CVS: main/mp3lib sr1.c,1.11,1.12
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the MPlayer-cvslog
mailing list