summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Roitzsch <mroi@users.sourceforge.net>2003-08-25 14:32:37 +0000
committerMichael Roitzsch <mroi@users.sourceforge.net>2003-08-25 14:32:37 +0000
commit92939d3b6df9165df0d7a25c4214c32401d9131d (patch)
tree278e8acebbe8f843693d5227906ac6d94dd635ba /src
parent8fdcd5444ac7ecd39f7b2323f8afb1440c3b6439 (diff)
downloadxine-lib-92939d3b6df9165df0d7a25c4214c32401d9131d.tar.gz
xine-lib-92939d3b6df9165df0d7a25c4214c32401d9131d.tar.bz2
AMD64 support patch by Adrian Schroeter
CVS patchset: 5308 CVS date: 2003/08/25 14:32:37
Diffstat (limited to 'src')
-rw-r--r--src/input/libdvdnav/dvd_reader.c6
-rw-r--r--src/input/libdvdnav/dvd_udf.c14
-rw-r--r--src/input/libdvdnav/read_cache.c6
-rw-r--r--src/libmpeg2/motion_comp_mmx.c2
-rw-r--r--src/video_out/deinterlace.c12
-rw-r--r--src/video_out/yuv2rgb.c8
-rw-r--r--src/video_out/yuv2rgb_mmx.c2
-rw-r--r--src/xine-utils/color.c12
-rw-r--r--src/xine-utils/cpu_accel.c16
-rw-r--r--src/xine-utils/memcpy.c2
-rw-r--r--src/xine-utils/monitor.c12
-rw-r--r--src/xine-utils/xine_check.c2
-rw-r--r--src/xine-utils/xineutils.h4
13 files changed, 55 insertions, 43 deletions
diff --git a/src/input/libdvdnav/dvd_reader.c b/src/input/libdvdnav/dvd_reader.c
index 63076ac97..40bed7ea6 100644
--- a/src/input/libdvdnav/dvd_reader.c
+++ b/src/input/libdvdnav/dvd_reader.c
@@ -1001,7 +1001,7 @@ ssize_t DVDReadBytes( dvd_file_t *dvd_file, void *data, size_t byte_size )
( ( ( seek_byte + byte_size ) % DVD_VIDEO_LB_LEN ) ? 1 : 0 );
secbuf_base = (unsigned char *) malloc( numsec * DVD_VIDEO_LB_LEN + 2048 );
- secbuf = (unsigned char *)(((int)secbuf_base & ~2047) + 2048);
+ secbuf = (unsigned char *)(((uintptr_t)secbuf_base & ~2047) + 2048);
if( !secbuf_base ) {
fprintf( stderr, "libdvdread: Can't allocate memory "
"for file read!\n" );
@@ -1055,7 +1055,7 @@ int DVDDiscID( dvd_reader_t *dvd, unsigned char *discid )
ssize_t bytes_read;
size_t file_size = dvd_file->filesize * DVD_VIDEO_LB_LEN;
char *buffer_base = malloc( file_size + 2048 );
- char *buffer = (unsigned char *)(((int)buffer_base & ~2047) + 2048);
+ char *buffer = (unsigned char *)(((uintptr_t)buffer_base & ~2047) + 2048);
if( buffer_base == NULL ) {
fprintf( stderr, "libdvdread: DVDDiscId, failed to "
@@ -1100,7 +1100,7 @@ int DVDISOVolumeInfo( dvd_reader_t *dvd,
}
buffer_base = malloc( DVD_VIDEO_LB_LEN + 2048 );
- buffer = (unsigned char *)(((int)buffer_base & ~2047) + 2048);
+ buffer = (unsigned char *)(((uintptr_t)buffer_base & ~2047) + 2048);
if( buffer_base == NULL ) {
fprintf( stderr, "libdvdread: DVDISOVolumeInfo, failed to "
diff --git a/src/input/libdvdnav/dvd_udf.c b/src/input/libdvdnav/dvd_udf.c
index b65d7e659..a834cc8ac 100644
--- a/src/input/libdvdnav/dvd_udf.c
+++ b/src/input/libdvdnav/dvd_udf.c
@@ -492,7 +492,7 @@ static int UDFMapICB( dvd_reader_t *device, struct AD ICB, uint8_t *FileType,
struct Partition *partition, struct AD *File )
{
uint8_t LogBlock_base[DVD_VIDEO_LB_LEN + 2048];
- uint8_t *LogBlock = (uint8_t *)(((int)LogBlock_base & ~2047) + 2048);
+ uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~2047) + 2048);
uint32_t lbnum;
uint16_t TagID;
struct icbmap tmpmap;
@@ -537,7 +537,7 @@ static int UDFScanDir( dvd_reader_t *device, struct AD Dir, char *FileName,
{
char filename[ MAX_UDF_FILE_NAME_LEN ];
uint8_t directory_base[ 2 * DVD_VIDEO_LB_LEN + 2048];
- uint8_t *directory = (uint8_t *)(((int)directory_base & ~2047) + 2048);
+ uint8_t *directory = (uint8_t *)(((uintptr_t)directory_base & ~2047) + 2048);
uint32_t lbnum;
uint16_t TagID;
uint8_t filechar;
@@ -559,7 +559,7 @@ static int UDFScanDir( dvd_reader_t *device, struct AD Dir, char *FileName,
if((cached_dir_base = malloc(dir_lba * DVD_VIDEO_LB_LEN + 2048)) == NULL) {
return 0;
}
- cached_dir = (uint8_t *)(((int)cached_dir_base & ~2047) + 2048);
+ cached_dir = (uint8_t *)(((uintptr_t)cached_dir_base & ~2047) + 2048);
if( DVDReadLBUDF( device, lbnum, dir_lba, cached_dir, 0) <= 0 ) {
free(cached_dir_base);
cached_dir = NULL;
@@ -650,7 +650,7 @@ static int UDFGetAVDP( dvd_reader_t *device,
struct avdp_t *avdp)
{
uint8_t Anchor_base[ DVD_VIDEO_LB_LEN + 2048 ];
- uint8_t *Anchor = (uint8_t *)(((int)Anchor_base & ~2047) + 2048);
+ uint8_t *Anchor = (uint8_t *)(((uintptr_t)Anchor_base & ~2047) + 2048);
uint32_t lbnum, MVDS_location, MVDS_length;
uint16_t TagID;
uint32_t lastsector;
@@ -722,7 +722,7 @@ static int UDFFindPartition( dvd_reader_t *device, int partnum,
struct Partition *part )
{
uint8_t LogBlock_base[ DVD_VIDEO_LB_LEN + 2048 ];
- uint8_t *LogBlock = (uint8_t *)(((int)LogBlock_base & ~2047) + 2048);
+ uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~2047) + 2048);
uint32_t lbnum, MVDS_location, MVDS_length;
uint16_t TagID;
int i, volvalid;
@@ -785,7 +785,7 @@ uint32_t UDFFindFile( dvd_reader_t *device, char *filename,
uint32_t *filesize )
{
uint8_t LogBlock_base[ DVD_VIDEO_LB_LEN + 2048 ];
- uint8_t *LogBlock = (uint8_t *)(((int)LogBlock_base & ~2047) + 2048);
+ uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~2047) + 2048);
uint32_t lbnum;
uint16_t TagID;
struct Partition partition;
@@ -930,7 +930,7 @@ static int UDFGetDescriptor( dvd_reader_t *device, int id,
static int UDFGetPVD(dvd_reader_t *device, struct pvd_t *pvd)
{
uint8_t pvd_buf_base[DVD_VIDEO_LB_LEN + 2048];
- uint8_t *pvd_buf = (uint8_t *)(((int)pvd_buf_base & ~2047) + 2048);
+ uint8_t *pvd_buf = (uint8_t *)(((uintptr_t)pvd_buf_base & ~2047) + 2048);
if(GetUDFCache(device, PVDCache, 0, pvd)) {
return 1;
diff --git a/src/input/libdvdnav/read_cache.c b/src/input/libdvdnav/read_cache.c
index 0e9ac568b..70685e2bd 100644
--- a/src/input/libdvdnav/read_cache.c
+++ b/src/input/libdvdnav/read_cache.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: read_cache.c,v 1.9 2003/04/29 21:55:52 jcdutton Exp $
+ * $Id: read_cache.c,v 1.10 2003/08/25 14:32:37 mroi Exp $
*
*/
@@ -448,7 +448,7 @@ void dvdnav_pre_cache_blocks(read_cache_t *self, int sector, size_t block_count)
self->chunk[use].cache_buffer_base = realloc(self->chunk[use].cache_buffer_base,
block_count * DVD_VIDEO_LB_LEN + ALIGNMENT);
self->chunk[use].cache_buffer =
- (uint8_t *)(((int)self->chunk[use].cache_buffer_base & ~(ALIGNMENT - 1)) + ALIGNMENT);
+ (uint8_t *)(((uintptr_t)self->chunk[use].cache_buffer_base & ~(ALIGNMENT - 1)) + ALIGNMENT);
dprintf("pre_cache DVD read realloc happened\n");
self->chunk[use].cache_malloc_size = block_count;
} else {
@@ -466,7 +466,7 @@ void dvdnav_pre_cache_blocks(read_cache_t *self, int sector, size_t block_count)
self->chunk[i].cache_buffer_base =
malloc((block_count > 500 ? block_count : 500) * DVD_VIDEO_LB_LEN + ALIGNMENT);
self->chunk[i].cache_buffer =
- (uint8_t *)(((int)self->chunk[i].cache_buffer_base & ~(ALIGNMENT - 1)) + ALIGNMENT);
+ (uint8_t *)(((uintptr_t)self->chunk[i].cache_buffer_base & ~(ALIGNMENT - 1)) + ALIGNMENT);
self->chunk[i].cache_malloc_size = block_count > 500 ? block_count : 500;
dprintf("pre_cache DVD read malloc %d blocks\n",
(block_count > 500 ? block_count : 500 ));
diff --git a/src/libmpeg2/motion_comp_mmx.c b/src/libmpeg2/motion_comp_mmx.c
index a1a5d3b54..80a53685a 100644
--- a/src/libmpeg2/motion_comp_mmx.c
+++ b/src/libmpeg2/motion_comp_mmx.c
@@ -23,7 +23,7 @@
#include "config.h"
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
#include <inttypes.h>
diff --git a/src/video_out/deinterlace.c b/src/video_out/deinterlace.c
index f9f46b675..fe75cee5c 100644
--- a/src/video_out/deinterlace.c
+++ b/src/video_out/deinterlace.c
@@ -46,7 +46,7 @@
static void deinterlace_bob_yuv_mmx( uint8_t *pdst, uint8_t *psrc[],
int width, int height )
{
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
int Line;
uint64_t *YVal1;
uint64_t *YVal2;
@@ -190,7 +190,7 @@ static void deinterlace_bob_yuv_mmx( uint8_t *pdst, uint8_t *psrc[],
static int deinterlace_weave_yuv_mmx( uint8_t *pdst, uint8_t *psrc[],
int width, int height )
{
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
int Line;
uint64_t *YVal1;
@@ -389,7 +389,7 @@ static int deinterlace_weave_yuv_mmx( uint8_t *pdst, uint8_t *psrc[],
static int deinterlace_greedy_yuv_mmx( uint8_t *pdst, uint8_t *psrc[],
int width, int height )
{
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
int Line;
int LoopCtr;
uint64_t *L1; // ptr to Line1, of 3
@@ -552,7 +552,7 @@ static int deinterlace_greedy_yuv_mmx( uint8_t *pdst, uint8_t *psrc[],
static void deinterlace_onefield_yuv_mmx( uint8_t *pdst, uint8_t *psrc[],
int width, int height )
{
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
int Line;
uint64_t *YVal1;
uint64_t *YVal3;
@@ -633,7 +633,7 @@ static void deinterlace_onefield_yuv_mmx( uint8_t *pdst, uint8_t *psrc[],
static void deinterlace_linearblend_yuv_mmx( uint8_t *pdst, uint8_t *psrc[],
int width, int height )
{
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
int Line;
uint64_t *YVal1;
uint64_t *YVal2;
@@ -753,7 +753,7 @@ static void deinterlace_linearblend_yuv( uint8_t *pdst, uint8_t *psrc[],
static int check_for_mmx(void)
{
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
static int config_flags = -1;
if ( config_flags == -1 )
diff --git a/src/video_out/yuv2rgb.c b/src/video_out/yuv2rgb.c
index ebd18b528..40344d2d7 100644
--- a/src/video_out/yuv2rgb.c
+++ b/src/video_out/yuv2rgb.c
@@ -23,7 +23,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id: yuv2rgb.c,v 1.42 2003/04/23 00:28:04 tchamp Exp $
+ * $Id: yuv2rgb.c,v 1.43 2003/08/25 14:32:37 mroi Exp $
*/
#include "config.h"
@@ -2408,7 +2408,7 @@ static void yuv2rgb_set_csc_levels (yuv2rgb_factory_t *this,
entry_size * div_round (cbu * (i-128), 76309));
}
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
mmx_yuv2rgb_set_csc_levels (this, brightness, contrast, saturation);
#endif
}
@@ -3157,7 +3157,7 @@ yuv2rgb_factory_t* yuv2rgb_factory_init (int mode, int swapped,
yuv2rgb_factory_t *this;
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
uint32_t mm = xine_mm_accel();
#endif
@@ -3182,7 +3182,7 @@ yuv2rgb_factory_t* yuv2rgb_factory_init (int mode, int swapped,
*/
this->yuv2rgb_fun = NULL;
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
if ((this->yuv2rgb_fun == NULL) && (mm & MM_ACCEL_X86_MMXEXT)) {
yuv2rgb_init_mmxext (this);
diff --git a/src/video_out/yuv2rgb_mmx.c b/src/video_out/yuv2rgb_mmx.c
index d8a9506e4..76992ece6 100644
--- a/src/video_out/yuv2rgb_mmx.c
+++ b/src/video_out/yuv2rgb_mmx.c
@@ -24,7 +24,7 @@
#include "config.h"
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
#include <stdio.h>
#include <stdlib.h>
diff --git a/src/xine-utils/color.c b/src/xine-utils/color.c
index b44507091..65e375e88 100644
--- a/src/xine-utils/color.c
+++ b/src/xine-utils/color.c
@@ -61,7 +61,7 @@
* instructions), these macros will automatically map to those special
* instructions.
*
- * $Id: color.c,v 1.21 2003/07/27 12:47:23 hadess Exp $
+ * $Id: color.c,v 1.22 2003/08/25 14:32:37 mroi Exp $
*/
#include "xine_internal.h"
@@ -318,7 +318,7 @@ static void yuv444_to_yuy2_c(yuv_planes_t *yuv_planes, unsigned char *yuy2_map,
*/
static void yuv444_to_yuy2_mmx(yuv_planes_t *yuv_planes, unsigned char *yuy2_map,
int pitch) {
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
int h, i, j, k;
int width_div_8 = yuv_planes->row_width / 8;
int width_mod_8 = yuv_planes->row_width % 8;
@@ -796,7 +796,7 @@ static void yv12_to_yuy2_c
}
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
#define MMXEXT_YUV420_YUYV( ) \
do { \
@@ -840,7 +840,7 @@ static void yv12_to_yuy2_mmxext
unsigned char *v_src, int v_src_pitch,
unsigned char *yuy2_map, int yuy2_pitch,
int width, int height, int progressive ) {
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
uint8_t *p_line1, *p_line2 = yuy2_map;
uint8_t *p_y1, *p_y2 = y_src;
uint8_t *p_u = u_src;
@@ -1004,7 +1004,7 @@ static void yuy2_to_yv12_c
}
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
/* yuy2->yv12 with subsampling (some ideas from mplayer's yuy2toyv12) */
#define MMXEXT_YUYV_YUV420( ) \
@@ -1059,7 +1059,7 @@ static void yuy2_to_yv12_mmxext
unsigned char *u_dst, int u_dst_pitch,
unsigned char *v_dst, int v_dst_pitch,
int width, int height) {
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
uint8_t *p_line1, *p_line2 = yuy2_map;
uint8_t *p_y1, *p_y2 = y_dst;
uint8_t *p_u = u_dst;
diff --git a/src/xine-utils/cpu_accel.c b/src/xine-utils/cpu_accel.c
index bd207fd91..f4f083f70 100644
--- a/src/xine-utils/cpu_accel.c
+++ b/src/xine-utils/cpu_accel.c
@@ -34,7 +34,18 @@
#define LOG
*/
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if defined __x86_64__
+static uint32_t arch_accel (void)
+{
+ uint32_t caps;
+ /* No need to test for this on AMD64, we know what the
+ platform has. */
+ caps = MM_ACCEL_X86_MMX | MM_ACCEL_X86_SSE | MM_ACCEL_X86_MMXEXT | MM_ACCEL_X86_SSE2;
+
+ return caps;
+}
+#else
static uint32_t arch_accel (void)
{
#ifndef _MSC_VER
@@ -118,6 +129,7 @@ static uint32_t arch_accel (void)
return 0;
#endif
}
+#endif /* x86_64 */
static jmp_buf sigill_return;
@@ -170,7 +182,7 @@ uint32_t xine_mm_accel (void)
if (!initialized) {
accel = arch_accel ();
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
#ifndef _MSC_VER
/* test OS support for SSE */
diff --git a/src/xine-utils/memcpy.c b/src/xine-utils/memcpy.c
index b6326a696..945cd33f0 100644
--- a/src/xine-utils/memcpy.c
+++ b/src/xine-utils/memcpy.c
@@ -112,7 +112,7 @@ quote of the day:
*/
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
#ifndef _MSC_VER
/* for small memory blocks (<256 bytes) this version is faster */
diff --git a/src/xine-utils/monitor.c b/src/xine-utils/monitor.c
index 3d5aabec8..c9def23e1 100644
--- a/src/xine-utils/monitor.c
+++ b/src/xine-utils/monitor.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: monitor.c,v 1.5 2002/06/09 22:26:01 f1rmb Exp $
+ * $Id: monitor.c,v 1.6 2003/08/25 14:32:37 mroi Exp $
*
* debug print and profiling functions - implementation
*
@@ -64,7 +64,7 @@ int xine_profiler_allocate_slot (char *label) {
}
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
__inline__ unsigned long long int rdtsc()
{
unsigned long long int x;
@@ -77,7 +77,7 @@ void xine_profiler_start_count (int id) {
if ((unsigned)id >= MAX_ID) return;
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
profiler_start[id] = rdtsc();
#endif
}
@@ -86,7 +86,7 @@ void xine_profiler_stop_count (int id) {
if ((unsigned)id >= MAX_ID) return;
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
profiler_times[id] += rdtsc() - profiler_start[id];
#endif
profiler_calls[id]++;
@@ -95,7 +95,7 @@ void xine_profiler_stop_count (int id) {
void xine_profiler_print_results () {
int i;
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
static long long int cpu_speed; /* cpu cyles/usec */
if (!cpu_speed) {
long long int tsc_start, tsc_end;
@@ -125,7 +125,7 @@ void xine_profiler_print_results () {
i, profiler_label[i], profiler_times[i], profiler_calls[i]);
if (profiler_calls[i]) {
printf(" %12lld", profiler_times[i] / profiler_calls[i]);
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
printf(" %9lld", profiler_times[i] / (cpu_speed * profiler_calls[i]));
#endif
}
diff --git a/src/xine-utils/xine_check.c b/src/xine-utils/xine_check.c
index b87f2f0f0..a018138f6 100644
--- a/src/xine-utils/xine_check.c
+++ b/src/xine-utils/xine_check.c
@@ -166,7 +166,7 @@ xine_health_check_t* xine_health_check_kernel (xine_health_check_t* hc) {
return hc;
}
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
xine_health_check_t* xine_health_check_mtrr (xine_health_check_t* hc) {
char *file = "/proc/mtrr";
FILE *fd;
diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h
index 67daaba84..91ae9655b 100644
--- a/src/xine-utils/xineutils.h
+++ b/src/xine-utils/xineutils.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xineutils.h,v 1.58 2003/07/19 11:50:33 mroi Exp $
+ * $Id: xineutils.h,v 1.59 2003/08/25 14:32:37 mroi Exp $
*
*/
#ifndef XINEUTILS_H
@@ -103,7 +103,7 @@ extern "C" {
uint32_t xine_mm_accel (void);
/* uint32_t xine_mm_support (void) ; */
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
typedef union {
#ifdef _MSC_VER