summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-07-29 17:20:57 +0200
committerwm4 <wm4@nowhere>2012-07-30 01:37:28 +0200
commit74df1d8e05aa226c7e82a6d84f43c873ee234561 (patch)
treec75185bd2d82e06564c03c41577475f425e44edf /libmpcodecs
parenta4bab723b30fe6190fb137b67bba521e55276cf6 (diff)
downloadmpv-74df1d8e05aa226c7e82a6d84f43c873ee234561.tar.bz2
mpv-74df1d8e05aa226c7e82a6d84f43c873ee234561.tar.xz
Remove compile time/runtime CPU detection, and drop some platforms
mplayer had three ways of enabling CPU specific assembler routines: a) Enable them at compile time; crash if the CPU can't handle it. b) Enable them at compile time, but let the configure script detect your CPU. Your binary will only crash if you try to run it on a different system that has less features than yours. This was the default, I think. c) Runtime detection. The implementation of b) and c) suck. a) is not really feasible (it sucks for users). Remove all code related to this, and use libav's CPU detection instead. Now the configure script will always enable CPU specific features, and disable them at runtime if libav reports them not as available. One implication is that now the compiler is always expected to handle SSE (etc.) inline assembly at runtime, unless it's explicitly disabled. Only checks for x86 CPU specific features are kept, the rest is either unused or barely used. Get rid of all the dump -mpcu, -march etc. flags. Trust the compiler to select decent settings. Get rid of support for the following operating systems: - BSD/OS (some ancient BSD fork) - QNX (don't care) - BeOS (dead, Haiku support is still welcome) - AIX (don't care) - HP-UX (don't care) - OS/2 (dead, actual support has been removed a while ago) Remove the configure code for detecting the endianness. Instead, use the standard header <endian.h>, which can be used if _GNU_SOURCE or _BSD_SOURCE is defined. (Maybe these changes should have been in a separate commit.) Since this is a quite violent code removal orgy, and I'm testing only on x86 32 bit Linux, expect regressions.
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/ad_hwac3.c4
-rw-r--r--libmpcodecs/ad_liba52.c4
-rw-r--r--libmpcodecs/img_format.h5
-rw-r--r--libmpcodecs/vd_ffmpeg.c3
-rw-r--r--libmpcodecs/vf.c3
-rw-r--r--libmpcodecs/vf_scale.c6
6 files changed, 14 insertions, 11 deletions
diff --git a/libmpcodecs/ad_hwac3.c b/libmpcodecs/ad_hwac3.c
index a11c2c90e7..13bf1da704 100644
--- a/libmpcodecs/ad_hwac3.c
+++ b/libmpcodecs/ad_hwac3.c
@@ -20,11 +20,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#define _GNU_SOURCE
#define _XOPEN_SOURCE 600
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <endian.h>
#include <libavutil/intreadwrite.h>
#include <libavutil/common.h>
@@ -551,7 +553,7 @@ static int decode_audio_dts(unsigned char *indata_ptr, int len, unsigned char *b
buf16[3] = fsize << 3;
if (!convert_16bits) {
-#if HAVE_BIGENDIAN
+#ifdef BIG_ENDIAN
/* BE stream */
if (indata_ptr[0] == 0x1f || indata_ptr[0] == 0x7f)
#else
diff --git a/libmpcodecs/ad_liba52.c b/libmpcodecs/ad_liba52.c
index dd277fd20a..e6f0a7e7f7 100644
--- a/libmpcodecs/ad_liba52.c
+++ b/libmpcodecs/ad_liba52.c
@@ -16,6 +16,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#define _GNU_SOURCE
#define _XOPEN_SOURCE 600
#include <stdio.h>
#include <stdlib.h>
@@ -192,9 +193,6 @@ static int init(sh_audio_t *sh_audio)
#ifdef MM_ACCEL_X86_3DNOWEXT
if(gCpuCaps.has3DNowExt) a52_accel|=MM_ACCEL_X86_3DNOWEXT;
#endif
-#ifdef MM_ACCEL_PPC_ALTIVEC
- if(gCpuCaps.hasAltiVec) a52_accel|=MM_ACCEL_PPC_ALTIVEC;
-#endif
a52_state=a52_init (a52_accel);
if (a52_state == NULL) {
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"A52 init failed\n");
diff --git a/libmpcodecs/img_format.h b/libmpcodecs/img_format.h
index 4200282f98..a0a1c453c7 100644
--- a/libmpcodecs/img_format.h
+++ b/libmpcodecs/img_format.h
@@ -19,6 +19,7 @@
#ifndef MPLAYER_IMG_FORMAT_H
#define MPLAYER_IMG_FORMAT_H
+#include <endian.h>
#include "config.h"
/* RGB/BGR Formats */
@@ -51,7 +52,7 @@
#define IMGFMT_GBRP (('G'<<24)|('B'<<16)|('R'<<8)|24)
-#if HAVE_BIGENDIAN
+#if BYTE_ORDER == BIG_ENDIAN
#define IMGFMT_ABGR IMGFMT_RGB32
#define IMGFMT_BGRA (IMGFMT_RGB32|64)
#define IMGFMT_ARGB IMGFMT_BGR32
@@ -139,7 +140,7 @@
#define IMGFMT_420P10_BE 0x34323052
#define IMGFMT_420P9_LE 0x53303234
#define IMGFMT_420P9_BE 0x34323053
-#if HAVE_BIGENDIAN
+#if BYTE_ORDER == BIG_ENDIAN
#define IMGFMT_444P16 IMGFMT_444P16_BE
#define IMGFMT_444P10 IMGFMT_444P10_BE
#define IMGFMT_444P9 IMGFMT_444P9_BE
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index b49b3c6975..f51fdb4601 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -21,6 +21,7 @@
#include <assert.h>
#include <time.h>
#include <stdbool.h>
+#include <endian.h>
#include <libavutil/common.h>
#include <libavutil/opt.h>
@@ -773,7 +774,7 @@ static struct mp_image *decode(struct sh_video *sh, struct demux_packet *packet,
mpi->stride[2] *= 2;
}
-#if HAVE_BIGENDIAN
+#if BYTE_ORDER == BIG_ENDIAN
// FIXME: this might cause problems for buffers with FF_BUFFER_HINTS_PRESERVE
if (mpi->bpp == 8)
swap_palette(mpi->planes[1]);
diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c
index 7a774be741..10e6f4d177 100644
--- a/libmpcodecs/vf.c
+++ b/libmpcodecs/vf.c
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
+#include <endian.h>
#include "config.h"
#if HAVE_MALLOC_H
@@ -254,7 +255,7 @@ void vf_mpi_clear(mp_image_t *mpi, int x0, int y0, int w, int h)
unsigned int *p = (unsigned int *) dst;
int size = (mpi->bpp >> 3) * w / 4;
int i;
-#if HAVE_BIGENDIAN
+#ifdef BIG_ENDIAN
#define CLEAR_PACKEDYUV_PATTERN 0x00800080
#define CLEAR_PACKEDYUV_PATTERN_SWAPPED 0x80008000
#else
diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c
index 4ccef63054..2d56840fd5 100644
--- a/libmpcodecs/vf_scale.c
+++ b/libmpcodecs/vf_scale.c
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
+#include <endian.h>
#include "config.h"
#include "mp_msg.h"
@@ -405,7 +406,7 @@ static void start_slice(struct vf_instance *vf, mp_image_t *mpi){
static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src[MP_MAX_PLANES], int src_stride[MP_MAX_PLANES],
int y, int h, uint8_t *dst[MP_MAX_PLANES], int dst_stride[MP_MAX_PLANES], int interlaced){
const uint8_t *src2[MP_MAX_PLANES]={src[0], src[1], src[2], src[3]};
-#if HAVE_BIGENDIAN
+#if BYTE_ORDER == BIG_ENDIAN
uint32_t pal2[256];
if (src[1] && !src[2]){
int i;
@@ -661,8 +662,7 @@ int get_sws_cpuflags(void){
return
(gCpuCaps.hasMMX ? SWS_CPU_CAPS_MMX : 0)
| (gCpuCaps.hasMMX2 ? SWS_CPU_CAPS_MMX2 : 0)
- | (gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0)
- | (gCpuCaps.hasAltiVec ? SWS_CPU_CAPS_ALTIVEC : 0);
+ | (gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0);
}
void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam)