From 33a97af4c0e599bb65035bd19010574fcf5f5cc4 Mon Sep 17 00:00:00 2001 From: mru Date: Sun, 26 Jul 2009 12:20:04 +0000 Subject: [PATCH] Replace WORDS_BIGENDIAN with HAVE_BIGENDIAN git-svn-id: file:///var/local/repositories/ffmpeg/trunk@19508 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b --- configure | 5 ----- libavcodec/8bps.c | 2 +- libavcodec/cscd.c | 2 +- libavcodec/flacenc.c | 2 +- libavcodec/flicvideo.c | 2 +- libavcodec/h264.c | 2 +- libavcodec/huffyuv.c | 2 +- libavcodec/imgconvert.c | 2 +- libavcodec/indeo3.c | 2 +- libavcodec/pcm.c | 8 ++++---- libavcodec/ptx.c | 2 +- libavcodec/simple_idct.c | 2 +- libavcodec/targa.c | 2 +- libavcodec/tiffenc.c | 2 +- libavcodec/truemotion1.c | 12 ++++++------ libavdevice/alsa-audio.h | 2 +- libavdevice/beosaudio.cpp | 2 +- libavdevice/jack_audio.c | 2 +- libavdevice/oss_audio.c | 4 ++-- libavformat/asfdec.c | 2 +- libavformat/avidec.c | 2 +- libavformat/flvdec.c | 2 +- libavformat/mtv.c | 4 ++-- libavformat/raw.c | 4 ++-- libavutil/bswap.h | 2 +- libavutil/intreadwrite.h | 4 ++-- libavutil/md5.c | 2 +- libavutil/pixfmt.h | 2 +- 28 files changed, 39 insertions(+), 44 deletions(-) diff --git a/configure b/configure index 4ea7bd37a..2236c00c3 100755 --- a/configure +++ b/configure @@ -2591,11 +2591,6 @@ echo "HOSTLIBS=$host_libs" >> config.mak echo "TARGET_EXEC=$target_exec" >> config.mak echo "TARGET_PATH=$target_path" >> config.mak -if enabled bigendian; then - echo "WORDS_BIGENDIAN=yes" >> config.mak - echo "#define WORDS_BIGENDIAN 1" >> $TMPH -fi - if enabled sdl; then echo "SDL_LIBS=$("${SDL_CONFIG}" --libs)" >> config.mak echo "SDL_CFLAGS=$("${SDL_CONFIG}" --cflags)" >> config.mak diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c index 47c90c9fe..28187b036 100644 --- a/libavcodec/8bps.c +++ b/libavcodec/8bps.c @@ -183,7 +183,7 @@ static av_cold int decode_init(AVCodecContext *avctx) case 32: avctx->pix_fmt = PIX_FMT_RGB32; c->planes = 4; -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN c->planemap[0] = 1; // 1st plane is red c->planemap[1] = 2; // 2nd plane is green c->planemap[2] = 3; // 3rd plane is blue diff --git a/libavcodec/cscd.c b/libavcodec/cscd.c index 5fe097712..e58cf7861 100644 --- a/libavcodec/cscd.c +++ b/libavcodec/cscd.c @@ -59,7 +59,7 @@ static void add_frame_default(AVFrame *f, const uint8_t *src, } } -#ifndef WORDS_BIGENDIAN +#if !HAVE_BIGENDIAN #define copy_frame_16 copy_frame_default #define copy_frame_32 copy_frame_default #define add_frame_16 add_frame_default diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index 66e5bfafc..164e0c032 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -1224,7 +1224,7 @@ static void output_frame_footer(FlacEncodeContext *s) static void update_md5_sum(FlacEncodeContext *s, int16_t *samples) { -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN int i; for(i = 0; i < s->frame.blocksize*s->channels; i++) { int16_t smp = le2me_16(samples[i]); diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c index 9a3ac9f12..2ee7837f6 100644 --- a/libavcodec/flicvideo.c +++ b/libavcodec/flicvideo.c @@ -585,7 +585,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, * during decompression. So if it is required (i.e., this is not a LE target, we do * a second pass over the line here, swapping the bytes. */ -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN pixel_ptr = y_ptr; pixel_countdown = s->avctx->width; while (pixel_countdown > 0) { diff --git a/libavcodec/h264.c b/libavcodec/h264.c index f6788cded..bc770fc5f 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -82,7 +82,7 @@ static void filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, static Picture * remove_long(H264Context *h, int i, int ref_mask); static av_always_inline uint32_t pack16to32(int a, int b){ -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN return (b&0xFFFF) + (a<<16); #else return (a&0xFFFF) + (b<<16); diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index 40d980da4..53142c074 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -35,7 +35,7 @@ #define VLC_BITS 11 -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN #define B 3 #define G 2 #define R 1 diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index a2db47122..ade803f69 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -548,7 +548,7 @@ static enum PixelFormat avcodec_get_pix_fmt_internal(const char *name) return PIX_FMT_NONE; } -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN # define X_NE(be, le) be #else # define X_NE(be, le) le diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c index ba045bd7c..05f79258b 100644 --- a/libavcodec/indeo3.c +++ b/libavcodec/indeo3.c @@ -576,7 +576,7 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s, lv1 = ref_lp[0]; lv2 = ref_lp[1]; if(lp2 == 0 && flag1 != 0) { -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN lv1 = lv1 & 0xFF00FF00; lv1 = (lv1 >> 8) | lv1; lv2 = lv2 & 0xFF00FF00; diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 95e33fd60..8530cd689 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -214,7 +214,7 @@ static int pcm_encode_frame(AVCodecContext *avctx, *dst++ = v - 128; } break; -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN case CODEC_ID_PCM_F64LE: ENCODE(int64_t, le64, samples, dst, n, 0, 0) break; @@ -244,7 +244,7 @@ static int pcm_encode_frame(AVCodecContext *avctx, case CODEC_ID_PCM_F32LE: case CODEC_ID_PCM_S32LE: case CODEC_ID_PCM_S16LE: -#endif /* WORDS_BIGENDIAN */ +#endif /* HAVE_BIGENDIAN */ case CODEC_ID_PCM_U8: memcpy(dst, samples, n*sample_size); dst += n*sample_size; @@ -422,7 +422,7 @@ static int pcm_decode_frame(AVCodecContext *avctx, } samples= (short*)dstu8; break; -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN case CODEC_ID_PCM_F64LE: DECODE(int64_t, le64, src, samples, n, 0, 0) break; @@ -452,7 +452,7 @@ static int pcm_decode_frame(AVCodecContext *avctx, case CODEC_ID_PCM_F32LE: case CODEC_ID_PCM_S32LE: case CODEC_ID_PCM_S16LE: -#endif /* WORDS_BIGENDIAN */ +#endif /* HAVE_BIGENDIAN */ case CODEC_ID_PCM_U8: memcpy(samples, src, n*sample_size); src += n*sample_size; diff --git a/libavcodec/ptx.c b/libavcodec/ptx.c index f8bbca718..f5aa601cd 100644 --- a/libavcodec/ptx.c +++ b/libavcodec/ptx.c @@ -79,7 +79,7 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size, stride = p->linesize[0]; for (y=0; ywidth, avctx->height, stride, bpp); else{ for(y = 0; y < s->height; y++){ -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN if((s->bpp + 1) >> 3 == 2){ uint16_t *dst16 = (uint16_t*)dst; for(x = 0; x < s->width; x++) diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c index 1bc3c82c7..3d0619620 100644 --- a/libavcodec/tiffenc.c +++ b/libavcodec/tiffenc.c @@ -91,7 +91,7 @@ static void tnput(uint8_t ** p, int n, const uint8_t * val, enum TiffTypes type, int flip) { int i; -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN flip ^= ((int[]) {0, 0, 0, 1, 3, 3})[type]; #endif for (i = 0; i < n * type_sizes2[type]; i++) diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c index 891a04233..ae08bfe0b 100644 --- a/libavcodec/truemotion1.c +++ b/libavcodec/truemotion1.c @@ -163,7 +163,7 @@ static void select_delta_tables(TrueMotion1Context *s, int delta_table_index) } } -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN static int make_ydt15_entry(int p2, int p1, int16_t *ydt) #else static int make_ydt15_entry(int p1, int p2, int16_t *ydt) @@ -178,7 +178,7 @@ static int make_ydt15_entry(int p1, int p2, int16_t *ydt) return (lo + (hi << 16)) << 1; } -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN static int make_cdt15_entry(int p2, int p1, int16_t *cdt) #else static int make_cdt15_entry(int p1, int p2, int16_t *cdt) @@ -192,7 +192,7 @@ static int make_cdt15_entry(int p1, int p2, int16_t *cdt) return (lo + (lo << 16)) << 1; } -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN static int make_ydt16_entry(int p2, int p1, int16_t *ydt) #else static int make_ydt16_entry(int p1, int p2, int16_t *ydt) @@ -207,7 +207,7 @@ static int make_ydt16_entry(int p1, int p2, int16_t *ydt) return (lo + (hi << 16)) << 1; } -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN static int make_cdt16_entry(int p2, int p1, int16_t *cdt) #else static int make_cdt16_entry(int p1, int p2, int16_t *cdt) @@ -221,7 +221,7 @@ static int make_cdt16_entry(int p1, int p2, int16_t *cdt) return (lo + (lo << 16)) << 1; } -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN static int make_ydt24_entry(int p2, int p1, int16_t *ydt) #else static int make_ydt24_entry(int p1, int p2, int16_t *ydt) @@ -234,7 +234,7 @@ static int make_ydt24_entry(int p1, int p2, int16_t *ydt) return (lo + (hi << 8) + (hi << 16)) << 1; } -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN static int make_cdt24_entry(int p2, int p1, int16_t *cdt) #else static int make_cdt24_entry(int p1, int p2, int16_t *cdt) diff --git a/libavdevice/alsa-audio.h b/libavdevice/alsa-audio.h index e49e2ebde..6adde772d 100644 --- a/libavdevice/alsa-audio.h +++ b/libavdevice/alsa-audio.h @@ -37,7 +37,7 @@ /* XXX: we make the assumption that the soundcard accepts this format */ /* XXX: find better solution with "preinit" method, needed also in other formats */ -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN #define DEFAULT_CODEC_ID CODEC_ID_PCM_S16BE #else #define DEFAULT_CODEC_ID CODEC_ID_PCM_S16LE diff --git a/libavdevice/beosaudio.cpp b/libavdevice/beosaudio.cpp index 53edefe11..c98a2398c 100644 --- a/libavdevice/beosaudio.cpp +++ b/libavdevice/beosaudio.cpp @@ -439,7 +439,7 @@ AVOutputFormat audio_beos_muxer = { "", "", sizeof(AudioData), -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN CODEC_ID_PCM_S16BE, #else CODEC_ID_PCM_S16LE, diff --git a/libavdevice/jack_audio.c b/libavdevice/jack_audio.c index 579cf0e1e..fa1fba13c 100644 --- a/libavdevice/jack_audio.c +++ b/libavdevice/jack_audio.c @@ -238,7 +238,7 @@ static int audio_read_header(AVFormatContext *context, AVFormatParameters *param } stream->codec->codec_type = CODEC_TYPE_AUDIO; -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN stream->codec->codec_id = CODEC_ID_PCM_F32BE; #else stream->codec->codec_id = CODEC_ID_PCM_F32LE; diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c index a89c39ac0..5b0d02a2f 100644 --- a/libavdevice/oss_audio.c +++ b/libavdevice/oss_audio.c @@ -89,7 +89,7 @@ static int audio_open(AVFormatContext *s1, int is_output, const char *audio_devi /* select format : favour native format */ err = ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &tmp); -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN if (tmp & AFMT_S16_BE) { tmp = AFMT_S16_BE; } else if (tmp & AFMT_S16_LE) { @@ -335,7 +335,7 @@ AVOutputFormat oss_muxer = { /* XXX: we make the assumption that the soundcard accepts this format */ /* XXX: find better solution with "preinit" method, needed also in other formats */ -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN CODEC_ID_PCM_S16BE, #else CODEC_ID_PCM_S16LE, diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 9f445ecc4..df39bb985 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -364,7 +364,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) /* This is true for all paletted codecs implemented in ffmpeg */ if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl)); -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) st->codec->palctrl->palette[i] = bswap_32(((uint32_t*)st->codec->extradata)[i]); #else diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 56b6204e0..cd8c613ed 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -498,7 +498,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) /* This is true for all paletted codecs implemented in FFmpeg. */ if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl)); -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) st->codec->palctrl->palette[i] = bswap_32(((uint32_t*)st->codec->extradata)[i]); #else diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 9505487aa..a34041e74 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -77,7 +77,7 @@ static void flv_set_audio_codec(AVFormatContext *s, AVStream *astream, int flv_c //no distinction between S16 and S8 PCM codec flags case FLV_CODECID_PCM: acodec->codec_id = acodec->bits_per_coded_sample == 8 ? CODEC_ID_PCM_S8 : -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN CODEC_ID_PCM_S16BE; #else CODEC_ID_PCM_S16LE; diff --git a/libavformat/mtv.c b/libavformat/mtv.c index 564cb4476..1ebeaee8a 100644 --- a/libavformat/mtv.c +++ b/libavformat/mtv.c @@ -129,7 +129,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) MTVDemuxContext *mtv = s->priv_data; ByteIOContext *pb = s->pb; int ret; -#ifndef WORDS_BIGENDIAN +#if !HAVE_BIGENDIAN int i; #endif @@ -150,7 +150,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) if(ret != mtv->img_segment_size) return AVERROR(EIO); -#ifndef WORDS_BIGENDIAN +#if !HAVE_BIGENDIAN /* pkt->data is GGGRRRR BBBBBGGG * and we need RRRRRGGG GGGBBBBB diff --git a/libavformat/raw.c b/libavformat/raw.c index 7cd62ffc3..c52235f47 100644 --- a/libavformat/raw.c +++ b/libavformat/raw.c @@ -1103,7 +1103,7 @@ AVOutputFormat null_muxer = { NULL, NULL, 0, -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN CODEC_ID_PCM_S16BE, #else CODEC_ID_PCM_S16LE, @@ -1232,7 +1232,7 @@ AVOutputFormat pcm_ ## name ## _muxer = {\ #define PCMDEF(name, long_name, ext, codec) #endif -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN #define BE_DEF(s) s #define LE_DEF(s) NULL #else diff --git a/libavutil/bswap.h b/libavutil/bswap.h index cf68c43c7..8c7514df1 100644 --- a/libavutil/bswap.h +++ b/libavutil/bswap.h @@ -80,7 +80,7 @@ static inline uint64_t av_const bswap_64(uint64_t x) // be2me ... big-endian to machine-endian // le2me ... little-endian to machine-endian -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN #define be2me_16(x) (x) #define be2me_32(x) (x) #define be2me_64(x) (x) diff --git a/libavutil/intreadwrite.h b/libavutil/intreadwrite.h index d46595eea..18a2b6de4 100644 --- a/libavutil/intreadwrite.h +++ b/libavutil/intreadwrite.h @@ -155,7 +155,7 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed)); ((uint8_t*)(p))[7] = (d)>>56; } while(0) #endif -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN # define AV_RN(s, p) AV_RB##s(p) # define AV_WN(s, p, v) AV_WB##s(p, v) #else @@ -189,7 +189,7 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed)); # define AV_WN64(p, v) AV_WN(64, p, v) #endif -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN # define AV_RB(s, p) AV_RN(s, p) # define AV_WB(s, p, v) AV_WN(s, p, v) # define AV_RL(s, p) bswap_##s(AV_RN(s, p)) diff --git a/libavutil/md5.c b/libavutil/md5.c index 26d1fb387..d3e3e9816 100644 --- a/libavutil/md5.c +++ b/libavutil/md5.c @@ -93,7 +93,7 @@ static void body(uint32_t ABCD[4], uint32_t X[16]){ unsigned int c= ABCD[1]; unsigned int d= ABCD[0]; -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN for(i=0; i<16; i++) X[i]= bswap_32(X[i]); #endif diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 4995a4da1..421bd4b3a 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -126,7 +126,7 @@ enum PixelFormat { PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions }; -#ifdef WORDS_BIGENDIAN +#if HAVE_BIGENDIAN # define PIX_FMT_NE(be, le) PIX_FMT_##be #else # define PIX_FMT_NE(be, le) PIX_FMT_##le -- 2.39.2