diff options
author | Michael Roitzsch <mroi@users.sourceforge.net> | 2003-11-01 18:12:53 +0000 |
---|---|---|
committer | Michael Roitzsch <mroi@users.sourceforge.net> | 2003-11-01 18:12:53 +0000 |
commit | ad86ea038a0b4803c7e3f1a82a293e2ee538e345 (patch) | |
tree | 24aa3f8a8900028189d268d75854049dfa386794 /src/libffmpeg/libavcodec | |
parent | 72ae3e51758986775949a7ba2002a526d359389f (diff) | |
download | xine-lib-ad86ea038a0b4803c7e3f1a82a293e2ee538e345.tar.gz xine-lib-ad86ea038a0b4803c7e3f1a82a293e2ee538e345.tar.bz2 |
big ffmpeg patch
* do not define CONFIG_ENCODERS any more, use a stripped down XINE_MPEG_ENCODER,
which will only compile an I-frame-only MPEG1 encoder (speeds up compile time)
* fix a lot of warnings in ffmpeg (a good deal of which have already been
submitted to the ffmpeg project by Mike)
* simplify some Makefiles
CVS patchset: 5667
CVS date: 2003/11/01 18:12:53
Diffstat (limited to 'src/libffmpeg/libavcodec')
33 files changed, 151 insertions, 90 deletions
diff --git a/src/libffmpeg/libavcodec/Makefile.am b/src/libffmpeg/libavcodec/Makefile.am index 87d234a17..3f477ded2 100644 --- a/src/libffmpeg/libavcodec/Makefile.am +++ b/src/libffmpeg/libavcodec/Makefile.am @@ -1,14 +1,9 @@ include $(top_srcdir)/misc/Makefile.common -SUBDIRS = armv4l i386 mlib alpha libpostproc +SUBDIRS = armv4l i386 mlib alpha ppc libpostproc -## we include ppc/* files since auto* doesn't dive into. -## we also include imgresample.c motion_est.c which are unused +## we include some unused files EXTRA_DIST = fdctref.c motion_est_template.c svq3.c wmv2.c \ - ppc/dsputil_ppc.c ppc/libavcodec_ppc_dummy.c ppc/mpegvideo_altivec.c \ - ppc/dsputil_altivec.c ppc/fft_altivec.c ppc/Makefile.am \ - ppc/mpegvideo_ppc.c ppc/dsputil_altivec.h ppc/idct_altivec.c \ - ppc/dsputil_ppc.h ppc/gcc_fixes.h ppc/gmc_altivec.c \ imgresample.c motion_est.c AM_CFLAGS = $(LIBFFMPEG_CFLAGS) @@ -74,6 +69,7 @@ libavcodec_la_LDFLAGS = \ $(top_builddir)/src/libffmpeg/libavcodec/armv4l/libavcodec_armv4l.la \ $(top_builddir)/src/libffmpeg/libavcodec/i386/libavcodec_mmx.la \ $(top_builddir)/src/libffmpeg/libavcodec/mlib/libavcodec_mlib.la \ + $(top_builddir)/src/libffmpeg/libavcodec/ppc/libavcodec_ppc.la \ -avoid-version -module @@ -105,6 +101,3 @@ noinst_HEADERS = \ svq1_vlc.h \ vp3data.h \ wmadata.h - -.s.lo: - $(ASCOMPILE) -o $@ `test -f $< || echo '$(srcdir)/'`$< diff --git a/src/libffmpeg/libavcodec/armv4l/Makefile.am b/src/libffmpeg/libavcodec/armv4l/Makefile.am index 8d3b87ce5..123978087 100644 --- a/src/libffmpeg/libavcodec/armv4l/Makefile.am +++ b/src/libffmpeg/libavcodec/armv4l/Makefile.am @@ -15,8 +15,3 @@ EXTRA_DIST = $(libavcodec_armv4l_src) $(libavcodec_armv4l_dummy) armv4l_modules = libavcodec_armv4l_la_SOURCES = $(armv4l_modules) $(libavcodec_armv4l_dummy) - -noinst_HEADERS = - -.s.lo: - $(ASCOMPILE) -o $@ `test -f $< || echo '$(srcdir)/'`$< diff --git a/src/libffmpeg/libavcodec/asv1.c b/src/libffmpeg/libavcodec/asv1.c index 2e6f785fb..bff0fe37a 100644 --- a/src/libffmpeg/libavcodec/asv1.c +++ b/src/libffmpeg/libavcodec/asv1.c @@ -481,6 +481,8 @@ for(i=0; i<s->avctx->extradata_size; i++){ return (get_bits_count(&a->gb)+31)/32*4; } +#ifdef CONFIG_ENCODERS + static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ ASV1Context * const a = avctx->priv_data; AVFrame *pict = data; @@ -535,6 +537,8 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, return size*4; } +#endif + static void common_init(AVCodecContext *avctx){ ASV1Context * const a = avctx->priv_data; @@ -582,6 +586,8 @@ static int decode_init(AVCodecContext *avctx){ return 0; } +#ifdef CONFIG_ENCODERS + static int encode_init(AVCodecContext *avctx){ ASV1Context * const a = avctx->priv_data; int i; @@ -606,6 +612,8 @@ static int encode_init(AVCodecContext *avctx){ return 0; } +#endif + static int decode_end(AVCodecContext *avctx){ ASV1Context * const a = avctx->priv_data; diff --git a/src/libffmpeg/libavcodec/avcodec.h b/src/libffmpeg/libavcodec/avcodec.h index 90b20f425..3293411be 100644 --- a/src/libffmpeg/libavcodec/avcodec.h +++ b/src/libffmpeg/libavcodec/avcodec.h @@ -14,6 +14,13 @@ extern "C" { #include "common.h" #include "rational.h" +/* FIXME: We cannot use ffmpeg's XvMC capabilities, since that would require + * linking the ffmpeg plugin against XvMC libraries, which is a bad thing, + * since they are output dependend. + * The correct fix would be to reimplement the XvMC functions libavcodec uses + * and do the necessary talking with our XvMC output plugin there. */ +#undef HAVE_XVMC + #define FFMPEG_VERSION_INT 0x000408 #define FFMPEG_VERSION "0.4.8" #define LIBAVCODEC_BUILD 4688 diff --git a/src/libffmpeg/libavcodec/cinepak.c b/src/libffmpeg/libavcodec/cinepak.c index af168d07b..56c4990be 100644 --- a/src/libffmpeg/libavcodec/cinepak.c +++ b/src/libffmpeg/libavcodec/cinepak.c @@ -37,6 +37,9 @@ #define PALETTE_COUNT 256 +#undef BE_16 +#undef BE_32 + #define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) #define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ (((uint8_t*)(x))[1] << 16) | \ diff --git a/src/libffmpeg/libavcodec/common.c b/src/libffmpeg/libavcodec/common.c index f37c2c9eb..673ce7083 100644 --- a/src/libffmpeg/libavcodec/common.c +++ b/src/libffmpeg/libavcodec/common.c @@ -60,7 +60,7 @@ void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size) #endif } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) /* return the number of bits output */ int64_t get_bit_count(PutBitContext *s) @@ -101,7 +101,7 @@ void flush_put_bits(PutBitContext *s) #endif } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) void put_string(PutBitContext * pbc, char *s) { diff --git a/src/libffmpeg/libavcodec/dpcm.c b/src/libffmpeg/libavcodec/dpcm.c index ef4ccf886..aed892c53 100644 --- a/src/libffmpeg/libavcodec/dpcm.c +++ b/src/libffmpeg/libavcodec/dpcm.c @@ -44,6 +44,10 @@ typedef struct DPCMContext { #define SATURATE_S16(x) if (x < -32768) x = -32768; \ else if (x > 32767) x = 32767; #define SE_16BIT(x) if (x & 0x8000) x -= 0x10000; + +#undef LE_16 +#undef LE_32 + #define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) #define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ (((uint8_t*)(x))[2] << 16) | \ diff --git a/src/libffmpeg/libavcodec/h263.c b/src/libffmpeg/libavcodec/h263.c index 0b09dc731..018300aa6 100644 --- a/src/libffmpeg/libavcodec/h263.c +++ b/src/libffmpeg/libavcodec/h263.c @@ -2377,6 +2377,7 @@ static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n #endif } +#if 0 static inline int mpeg4_get_block_length(MpegEncContext * s, DCTELEM * block, int n, int intra_dc, uint8_t *scan_table) { @@ -2430,6 +2431,7 @@ static inline int mpeg4_get_block_length(MpegEncContext * s, DCTELEM * block, in return len; } +#endif #endif @@ -2593,12 +2595,14 @@ static int h263_decode_gob_header(MpegEncContext *s) return 0; } +#if 0 static inline void memsetw(short *tab, int val, int n) { int i; for(i=0;i<n;i++) tab[i] = val; } +#endif #ifdef CONFIG_ENCODERS diff --git a/src/libffmpeg/libavcodec/h264.c b/src/libffmpeg/libavcodec/h264.c index 97589ce82..26aeb8296 100644 --- a/src/libffmpeg/libavcodec/h264.c +++ b/src/libffmpeg/libavcodec/h264.c @@ -2919,9 +2919,11 @@ static int decode_slice_header(H264Context *h){ h->max_pic_num= 1<<(h->sps.log2_max_frame_num + 1); } +#if 0 if(h->nal_unit_type == NAL_IDR_SLICE){ get_ue_golomb(&s->gb); /* idr_pic_id */ } +#endif if(h->sps.poc_type==0){ h->poc_lsb= get_bits(&s->gb, h->sps.log2_max_poc_lsb); @@ -2982,12 +2984,14 @@ static int decode_slice_header(H264Context *h){ s->qscale = h->pps.init_qp + get_se_golomb(&s->gb); //slice_qp_delta //FIXME qscale / qp ... stuff +#if 0 if(h->slice_type == SP_TYPE){ get_bits1(&s->gb); /* sp_for_switch_flag */ } if(h->slice_type==SP_TYPE || h->slice_type == SI_TYPE){ get_se_golomb(&s->gb); /* slice_qs_delta */ } +#endif if( h->pps.deblocking_filter_parameters_present ) { h->disable_deblocking_filter_idc= get_ue_golomb(&s->gb); diff --git a/src/libffmpeg/libavcodec/i386/Makefile.am b/src/libffmpeg/libavcodec/i386/Makefile.am index 34fc82988..c9d90d951 100644 --- a/src/libffmpeg/libavcodec/i386/Makefile.am +++ b/src/libffmpeg/libavcodec/i386/Makefile.am @@ -34,6 +34,3 @@ endif libavcodec_mmx_la_SOURCES = $(mmx_modules) $(libavcodec_mmx_dummy) noinst_HEADERS = dsputil_mmx_avg.h dsputil_mmx_rnd.h mmx.h - -.s.lo: - $(ASCOMPILE) -o $@ `test -f $< || echo '$(srcdir)/'`$< diff --git a/src/libffmpeg/libavcodec/i386/dsputil_mmx.c b/src/libffmpeg/libavcodec/i386/dsputil_mmx.c index c523be74a..a1e1642d5 100644 --- a/src/libffmpeg/libavcodec/i386/dsputil_mmx.c +++ b/src/libffmpeg/libavcodec/i386/dsputil_mmx.c @@ -588,6 +588,7 @@ static void diff_bytes_mmx(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){ for(; i<w; i++) dst[i+0] = src1[i+0]-src2[i+0]; } +#endif static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w, int *left, int *left_top){ int i=0; @@ -625,6 +626,8 @@ static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, uint8_t *src1, uint8_t *left = src2[w-1]; } +#ifdef CONFIG_ENCODERS + #define LBUTTERFLY2(a1,b1,a2,b2)\ "paddw " #b1 ", " #a1 " \n\t"\ "paddw " #b2 ", " #a2 " \n\t"\ @@ -1599,10 +1602,10 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) #endif if (mm_flags & MM_MMX) { - const int dct_algo = avctx->dct_algo; const int idct_algo= avctx->idct_algo; - #ifdef CONFIG_ENCODERS + const int dct_algo = avctx->dct_algo; + if(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX) c->fdct = ff_fdct_mmx; #endif //CONFIG_ENCODERS diff --git a/src/libffmpeg/libavcodec/i386/fdct_mmx.c b/src/libffmpeg/libavcodec/i386/fdct_mmx.c index 8d3552d2a..a2402c95d 100644 --- a/src/libffmpeg/libavcodec/i386/fdct_mmx.c +++ b/src/libffmpeg/libavcodec/i386/fdct_mmx.c @@ -7,9 +7,10 @@ * Intel Application Note AP-922 - fast, precise implementation of DCT * http://developer.intel.com/vtune/cbts/appnotes.htm */ -#include "../common.h" +#include "../dsputil.h" #include "mmx.h" +#undef ATTR_ALIGN #define ATTR_ALIGN(align) __attribute__ ((__aligned__ (align))) ////////////////////////////////////////////////////////////////////// diff --git a/src/libffmpeg/libavcodec/i386/idct_mmx.c b/src/libffmpeg/libavcodec/i386/idct_mmx.c index 298c8a8b0..654792e5e 100644 --- a/src/libffmpeg/libavcodec/i386/idct_mmx.c +++ b/src/libffmpeg/libavcodec/i386/idct_mmx.c @@ -22,10 +22,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common.h" +#include "../dsputil.h" #include "mmx.h" +#undef ATTR_ALIGN #define ATTR_ALIGN(align) __attribute__ ((__aligned__ (align))) #define ROW_SHIFT 11 @@ -554,6 +555,10 @@ static int32_t rounder5[] ATTR_ALIGN(8) = #undef COL_SHIFT #undef ROW_SHIFT +/* the macro below will generate these */ +void ff_mmx_idct(DCTELEM *block); +void ff_mmxext_idct(DCTELEM *block); + #define declare_idct(idct,table,idct_row_head,idct_row,idct_row_tail,idct_row_mid) \ void idct (int16_t * block) \ { \ diff --git a/src/libffmpeg/libavcodec/i386/motion_est_mmx.c b/src/libffmpeg/libavcodec/i386/motion_est_mmx.c index aa22f0649..950100e63 100644 --- a/src/libffmpeg/libavcodec/i386/motion_est_mmx.c +++ b/src/libffmpeg/libavcodec/i386/motion_est_mmx.c @@ -21,9 +21,9 @@ #include "../dsputil.h" static const __attribute__ ((aligned(8))) uint64_t round_tab[3]={ -0x0000000000000000, -0x0001000100010001, -0x0002000200020002, +0x0000000000000000ULL, +0x0001000100010001ULL, +0x0002000200020002ULL, }; static const __attribute__ ((aligned(8), unused)) uint64_t bone= 0x0101010101010101LL; diff --git a/src/libffmpeg/libavcodec/i386/simple_idct_mmx.c b/src/libffmpeg/libavcodec/i386/simple_idct_mmx.c index 626c1f565..1ee88b634 100644 --- a/src/libffmpeg/libavcodec/i386/simple_idct_mmx.c +++ b/src/libffmpeg/libavcodec/i386/simple_idct_mmx.c @@ -18,6 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../dsputil.h" +#include "../simple_idct.h" /* 23170.475006 diff --git a/src/libffmpeg/libavcodec/imgconvert.c b/src/libffmpeg/libavcodec/imgconvert.c index f154e4437..93e19ff59 100644 --- a/src/libffmpeg/libavcodec/imgconvert.c +++ b/src/libffmpeg/libavcodec/imgconvert.c @@ -535,7 +535,7 @@ static void img_copy_plane(uint8_t *dst, int dst_wrap, /** * Copy image 'src' to 'dst'. */ -void img_copy(AVPicture *dst, const AVPicture *src, +static void img_copy(AVPicture *dst, const AVPicture *src, int pix_fmt, int width, int height) { int bwidth, bits, i; diff --git a/src/libffmpeg/libavcodec/libpostproc/Makefile.am b/src/libffmpeg/libavcodec/libpostproc/Makefile.am index 60aa5f9a3..26631d570 100644 --- a/src/libffmpeg/libavcodec/libpostproc/Makefile.am +++ b/src/libffmpeg/libavcodec/libpostproc/Makefile.am @@ -10,6 +10,3 @@ EXTRA_DIST = postprocess_template.c libpostprocess_la_SOURCES = postprocess.c noinst_HEADERS = mangle.h postprocess.h postprocess_internal.h - -.s.lo: - $(ASCOMPILE) -o $@ `test -f $< || echo '$(srcdir)/'`$< diff --git a/src/libffmpeg/libavcodec/libpostproc/postprocess.c b/src/libffmpeg/libavcodec/libpostproc/postprocess.c index 0db5341e3..11267b666 100644 --- a/src/libffmpeg/libavcodec/libpostproc/postprocess.c +++ b/src/libffmpeg/libavcodec/libpostproc/postprocess.c @@ -105,13 +105,13 @@ try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks //#define NUM_BLOCKS_AT_ONCE 16 //not used yet #ifdef ARCH_X86 -static const uint64_t __attribute__((aligned(8))) w05= 0x0005000500050005LL; -static const uint64_t __attribute__((aligned(8))) w20= 0x0020002000200020LL; - uint64_t __attribute__((aligned(8))) b00= 0x0000000000000000LL; -static const uint64_t __attribute__((aligned(8))) b01= 0x0101010101010101LL; -static const uint64_t __attribute__((aligned(8))) b02= 0x0202020202020202LL; -static const uint64_t __attribute__((aligned(8))) b08= 0x0808080808080808LL; -static const uint64_t __attribute__((aligned(8))) b80= 0x8080808080808080LL; +static const uint64_t __attribute__((aligned(8))) w05= 0x0005000500050005ULL; +static const uint64_t __attribute__((aligned(8))) w20= 0x0020002000200020ULL; +static const uint64_t __attribute__((aligned(8))) b00= 0x0000000000000000ULL; +static const uint64_t __attribute__((aligned(8))) b01= 0x0101010101010101ULL; +static const uint64_t __attribute__((aligned(8))) b02= 0x0202020202020202ULL; +static const uint64_t __attribute__((aligned(8))) b08= 0x0808080808080808ULL; +static const uint64_t __attribute__((aligned(8))) b80= 0x8080808080808080ULL; #endif @@ -153,13 +153,6 @@ static char *replaceTable[]= NULL //End Marker }; -#ifdef ARCH_X86 -static inline void unusedVariableWarningFixer() -{ - if(w05 + w20 + b00 + b01 + b02 + b08 + b80 == 0) b00=0; -} -#endif - // The horizontal Functions exist only in C cuz the MMX code is faster with vertical filters and transposing /** diff --git a/src/libffmpeg/libavcodec/libpostproc/postprocess_template.c b/src/libffmpeg/libavcodec/libpostproc/postprocess_template.c index 582ad28f2..636212959 100644 --- a/src/libffmpeg/libavcodec/libpostproc/postprocess_template.c +++ b/src/libffmpeg/libavcodec/libpostproc/postprocess_template.c @@ -2788,7 +2788,6 @@ static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int uint64_t * const yHistogram= c.yHistogram; uint8_t * const tempSrc= c.tempSrc; uint8_t * const tempDst= c.tempDst; - const int mbWidth= isColor ? (width+7)>>3 : (width+15)>>4; #ifdef HAVE_MMX for(i=0; i<32; i++){ diff --git a/src/libffmpeg/libavcodec/mlib/Makefile.am b/src/libffmpeg/libavcodec/mlib/Makefile.am index 73f2495d6..69e9ed245 100644 --- a/src/libffmpeg/libavcodec/mlib/Makefile.am +++ b/src/libffmpeg/libavcodec/mlib/Makefile.am @@ -15,8 +15,3 @@ mlib_modules = $(libavcodec_mlib_src) endif libavcodec_mlib_la_SOURCES = $(mlib_modules) $(libavcodec_mlib_dummy) - -noinst_HEADERS = - -.s.lo: - $(ASCOMPILE) -o $@ `test -f $< || echo '$(srcdir)/'`$< diff --git a/src/libffmpeg/libavcodec/mpeg12.c b/src/libffmpeg/libavcodec/mpeg12.c index cd3a725ae..7cf6a21df 100644 --- a/src/libffmpeg/libavcodec/mpeg12.c +++ b/src/libffmpeg/libavcodec/mpeg12.c @@ -48,7 +48,7 @@ #define MB_BTYPE_VLC_BITS 6 #define TEX_VLC_BITS 9 -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) static void mpeg1_encode_block(MpegEncContext *s, DCTELEM *block, int component); @@ -74,7 +74,7 @@ extern int XVMC_field_start(MpegEncContext *s, AVCodecContext *avctx); extern int XVMC_field_end(MpegEncContext *s); #endif -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) static uint8_t (*mv_penalty)[MAX_MV*2+1]= NULL; static uint8_t fcode_tab[MAX_MV*2+1]; @@ -128,7 +128,7 @@ static void init_2d_vlc_rl(RLTable *rl) } } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) static void init_uni_ac_vlc(RLTable *rl, uint32_t *uni_ac_vlc_bits, uint8_t *uni_ac_vlc_len){ int i; @@ -383,7 +383,7 @@ void ff_mpeg1_clean_buffers(MpegEncContext *s){ memset(s->last_mv, 0, sizeof(s->last_mv)); } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) void ff_mpeg1_encode_slice_header(MpegEncContext *s){ put_header(s, SLICE_MIN_START_CODE + s->mb_y); diff --git a/src/libffmpeg/libavcodec/mpegaudiodec.c b/src/libffmpeg/libavcodec/mpegaudiodec.c index 51c8ef130..b08f83757 100644 --- a/src/libffmpeg/libavcodec/mpegaudiodec.c +++ b/src/libffmpeg/libavcodec/mpegaudiodec.c @@ -1206,6 +1206,7 @@ static int decode_header(MPADecodeContext *s, uint32_t header) return 0; } +#if 0 /* useful helper to get mpeg audio stream infos. Return -1 if error in header */ int mp_decode_header(int *sample_rate_ptr, @@ -1246,6 +1247,7 @@ int mp_decode_header(int *sample_rate_ptr, *decoded_frame_size_ptr = decoded_frame_size * 2 * s->nb_channels; return 0; } +#endif /* return the number of decoded frames */ static int mp_decode_layer1(MPADecodeContext *s) diff --git a/src/libffmpeg/libavcodec/mpegvideo.c b/src/libffmpeg/libavcodec/mpegvideo.c index 0e04301a4..0dd59d62e 100644 --- a/src/libffmpeg/libavcodec/mpegvideo.c +++ b/src/libffmpeg/libavcodec/mpegvideo.c @@ -36,7 +36,7 @@ //#undef NDEBUG //#include <assert.h> -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) static void encode_picture(MpegEncContext *s, int picture_number); #endif //CONFIG_ENCODERS static void dct_unquantize_mpeg1_c(MpegEncContext *s, @@ -46,7 +46,7 @@ static void dct_unquantize_mpeg2_c(MpegEncContext *s, static void dct_unquantize_h263_c(MpegEncContext *s, DCTELEM *block, int n, int qscale); static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w); -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) static int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow); static int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow); static int sse_mb(MpegEncContext *s); @@ -87,7 +87,7 @@ static const uint8_t h263_chroma_roundtab[16] = { 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, }; -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) static uint8_t (*default_mv_penalty)[MAX_MV*2+1]=NULL; static uint8_t default_fcode_tab[MAX_MV*2+1]; @@ -173,7 +173,7 @@ void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_s } } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) void ff_write_quant_matrix(PutBitContext *pb, int16_t *matrix){ int i; @@ -194,7 +194,7 @@ int DCT_common_init(MpegEncContext *s) s->dct_unquantize_mpeg1 = dct_unquantize_mpeg1_c; s->dct_unquantize_mpeg2 = dct_unquantize_mpeg2_c; -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) s->dct_quantize= dct_quantize_c; #endif @@ -217,7 +217,7 @@ int DCT_common_init(MpegEncContext *s) MPV_common_init_ppc(s); #endif -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) s->fast_dct_quantize= s->dct_quantize; if(s->flags&CODEC_FLAG_TRELLIS_QUANT){ @@ -569,7 +569,7 @@ void MPV_common_end(MpegEncContext *s) s->current_picture_ptr= NULL; } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) /* init video encoder */ int MPV_encode_init(AVCodecContext *avctx) @@ -686,6 +686,7 @@ int MPV_encode_init(AVCodecContext *avctx) s->low_delay= 0; //s->max_b_frames ? 0 : 1; avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); break; +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) case CODEC_ID_MPEG2VIDEO: s->out_format = FMT_MPEG1; s->low_delay= 0; //s->max_b_frames ? 0 : 1; @@ -802,6 +803,7 @@ int MPV_encode_init(AVCodecContext *avctx) s->low_delay=1; break; #endif +#endif default: return -1; } @@ -836,24 +838,25 @@ int MPV_encode_init(AVCodecContext *avctx) if (MPV_common_init(s) < 0) return -1; -#ifdef CONFIG_ENCODERS_FULL +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) ff_init_me(s); #endif -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY if (s->out_format == FMT_H263) h263_encode_init(s); if(s->msmpeg4_version) ff_msmpeg4_encode_init(s); #endif +#endif if (s->out_format == FMT_MPEG1) ff_mpeg1_encode_init(s); -#endif /* init default q matrix */ for(i=0;i<64;i++) { int j= s->dsp.idct_permutation[i]; +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY if(s->codec_id==CODEC_ID_MPEG4 && s->mpeg_quant){ s->intra_matrix[j] = ff_mpeg4_default_intra_matrix[i]; @@ -863,6 +866,7 @@ int MPV_encode_init(AVCodecContext *avctx) s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i]; }else #endif +#endif { /* mpeg1/2 */ s->intra_matrix[j] = ff_mpeg1_default_intra_matrix[i]; s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i]; @@ -906,8 +910,10 @@ int MPV_encode_end(AVCodecContext *avctx) ff_rate_control_uninit(s); MPV_common_end(s); +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) if (s->out_format == FMT_MJPEG) mjpeg_close(s); +#endif av_freep(&avctx->extradata); @@ -1343,7 +1349,7 @@ void ff_print_debug_info(MpegEncContext *s, Picture *pict){ } } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) static int get_sae(uint8_t *src, int ref, int stride){ int x,y; @@ -1636,10 +1642,10 @@ int MPV_encode_picture(AVCodecContext *avctx, MPV_frame_end(s); +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) if (s->out_format == FMT_MJPEG) mjpeg_picture_trailer(s); -#ifdef CONFIG_ENCODERS_FULL if(s->flags&CODEC_FLAG_PASS1) ff_write_pass1_stats(s); #endif @@ -2611,7 +2617,7 @@ void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) } } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) static inline void dct_single_coeff_elimination(MpegEncContext *s, int n, int threshold) { @@ -2816,7 +2822,7 @@ void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename } } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) static void encode_mb(MpegEncContext *s, int motion_x, int motion_y) { @@ -3055,6 +3061,7 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y) case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: mpeg1_encode_mb(s, s->block, motion_x, motion_y); break; +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY case CODEC_ID_MPEG4: mpeg4_encode_mb(s, s->block, motion_x, motion_y); break; @@ -3072,6 +3079,7 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y) #endif case CODEC_ID_MJPEG: mjpeg_encode_mb(s, s->block); break; +#endif default: assert(0); } @@ -3156,7 +3164,7 @@ void ff_mpeg_flush(AVCodecContext *avctx){ s->parse_context.last_index= 0; } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length) { int bytes= length>>4; @@ -3344,12 +3352,14 @@ static void encode_picture(MpegEncContext *s, int picture_number) s->current_picture.mb_var_sum = 0; s->current_picture.mc_mb_var_sum = 0; +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY /* we need to initialize some time vars before we can encode b-frames */ // RAL: Condition added for MPEG1VIDEO if (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO || (s->h263_pred && !s->h263_msmpeg4)) ff_set_mpeg4_time(s, s->picture_number); #endif +#endif s->scene_change_score=0; @@ -3366,7 +3376,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) /* Estimate motion for every MB */ s->mb_intra=0; //for the rate distoration & bit compare functions if(s->pict_type != I_TYPE){ -#ifdef CONFIG_ENCODERS_FULL +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) if(s->pict_type != B_TYPE){ if((s->avctx->pre_me && s->last_non_b_pict_type==I_TYPE) || s->avctx->pre_me==2){ s->me.pre_pass=1; @@ -3439,7 +3449,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) //printf("Scene change detected, encoding as I Frame %d %d\n", s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum); } -#ifdef CONFIG_ENCODERS_FULL +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) if(!s->umvplus){ if(s->pict_type==P_TYPE || s->pict_type==S_TYPE) { s->f_code= ff_get_best_fcode(s, s->p_mv_table, MB_TYPE_INTER); @@ -3470,6 +3480,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) s->current_picture.quality = ff_rate_estimate_qscale(s); if(s->adaptive_quant){ +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY switch(s->codec_id){ case CODEC_ID_MPEG4: @@ -3482,6 +3493,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) break; } #endif +#endif s->lambda= s->lambda_table[0]; //FIXME broken @@ -3514,6 +3526,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) s->last_bits= get_bit_count(&s->pb); switch(s->out_format) { +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) case FMT_MJPEG: mjpeg_picture_header(s); break; @@ -3532,6 +3545,15 @@ static void encode_picture(MpegEncContext *s, int picture_number) else h263_encode_picture_header(s, picture_number); break; +#else + case FMT_H263: + break; +#endif +#else + case FMT_MJPEG: + break; + case FMT_H263: + break; #endif case FMT_MPEG1: mpeg1_encode_picture_header(s, picture_number); @@ -3566,6 +3588,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) s->last_mv_dir = 0; +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY switch(s->codec_id){ case CODEC_ID_H263: @@ -3579,6 +3602,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) break; } #endif +#endif s->resync_mb_x=0; s->resync_mb_y=0; @@ -3602,6 +3626,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) ff_update_block_index(s); /* write gob / video packet header */ +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY if(s->rtp_mode && mb_y + mb_x>0){ int current_packet_size, is_gob_start; @@ -3657,6 +3682,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) } } #endif +#endif if( (s->resync_mb_x == s->mb_x) && s->resync_mb_y+1 == s->mb_y){ @@ -3742,9 +3768,11 @@ static void encode_picture(MpegEncContext *s, int picture_number) s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; s->mb_intra= 0; +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY ff_mpeg4_set_direct_mv(s, mx, my); #endif +#endif encode_mb_hq(s, &backup_s, &best_s, MB_TYPE_DIRECT, pb, pb2, tex_pb, &dmin, &next_block, mx, my); } @@ -3913,9 +3941,11 @@ static void encode_picture(MpegEncContext *s, int picture_number) s->mb_intra= 0; motion_x=s->b_direct_mv_table[xy][0]; motion_y=s->b_direct_mv_table[xy][1]; +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY ff_mpeg4_set_direct_mv(s, motion_x, motion_y); #endif +#endif break; case MB_TYPE_BIDIR: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; @@ -3986,6 +4016,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) } emms_c(); +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY if(s->codec_id==CODEC_ID_MPEG4 && s->partitioned_frame) ff_mpeg4_merge_partitions(s); @@ -3996,6 +4027,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) if(s->codec_id==CODEC_ID_MPEG4) ff_mpeg4_stuffing(&s->pb); #endif +#endif //if (s->gob_number) // fprintf(stderr,"\nNumber of GOB: %d", s->gob_number); @@ -4634,7 +4666,7 @@ static const AVOption mpeg4_options[] = AVOPTION_END() }; -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) AVCodec mpeg1video_encoder = { "mpeg1video", @@ -4646,6 +4678,7 @@ AVCodec mpeg1video_encoder = { MPV_encode_end, }; +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY AVCodec mpeg2video_encoder = { @@ -4765,5 +4798,7 @@ AVCodec mjpeg_encoder = { MPV_encode_end, }; +#endif + #endif //CONFIG_ENCODERS diff --git a/src/libffmpeg/libavcodec/msvideo1.c b/src/libffmpeg/libavcodec/msvideo1.c index 71d8af987..6e1d0a8d4 100644 --- a/src/libffmpeg/libavcodec/msvideo1.c +++ b/src/libffmpeg/libavcodec/msvideo1.c @@ -38,6 +38,8 @@ #include "avcodec.h" #include "dsputil.h" +#undef LE_16 + #define PALETTE_COUNT 256 #define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) #define CHECK_STREAM_PTR(n) \ diff --git a/src/libffmpeg/libavcodec/ppc/Makefile.am b/src/libffmpeg/libavcodec/ppc/Makefile.am index 8d3b6cea8..fbd734c29 100644 --- a/src/libffmpeg/libavcodec/ppc/Makefile.am +++ b/src/libffmpeg/libavcodec/ppc/Makefile.am @@ -1,8 +1,9 @@ include $(top_srcdir)/misc/Makefile.common -# we must not use CFLAGS here, gcc optimizations produce -# bad code if we do so. AM_CFLAGS = $(LIBFFMPEG_CFLAGS) +# CFLAGS is here to filter out -funroll-loops because it causes bad +# behavior of libavcodec +CFLAGS = `echo @CFLAGS@ | sed -e 's/-funroll-loops//g'` ASFLAGS = @@ -19,14 +20,11 @@ libavcodec_ppc_dummy = libavcodec_ppc_dummy.c EXTRA_DIST = $(libavcodec_ppc_src) $(libavcodec_ppc_dummy) -if ARCH_POWERPC -ppc_modules = $(libavcodec_ppc_src) -endif +#if PPC_ARCH +#ppc_modules = $(libavcodec_ppc_src) +#endif libavcodec_ppc_la_SOURCES = $(ppc_modules) $(libavcodec_ppc_dummy) noinst_HEADERS = dsputil_altivec.h dsputil_ppc.h gcc_fixes.h - -.s.lo: - $(ASCOMPILE) -o $@ `test -f $< || echo '$(srcdir)/'`$< diff --git a/src/libffmpeg/libavcodec/ra144.c b/src/libffmpeg/libavcodec/ra144.c index 2d882f744..fbc145af1 100644 --- a/src/libffmpeg/libavcodec/ra144.c +++ b/src/libffmpeg/libavcodec/ra144.c @@ -495,7 +495,7 @@ static int ra144_decode_frame(AVCodecContext * avctx, temp=glob->swapbuf2alt; glob->swapbuf2alt=glob->swapbuf2; glob->swapbuf2=temp; - *data_size=data-datao; + *data_size=(char *)data-(char *)datao; return 20; } diff --git a/src/libffmpeg/libavcodec/ra288.c b/src/libffmpeg/libavcodec/ra288.c index b59074822..979be2e7c 100644 --- a/src/libffmpeg/libavcodec/ra288.c +++ b/src/libffmpeg/libavcodec/ra288.c @@ -206,7 +206,7 @@ static void prodsum(float *tgt, float *src, int len, int n) } } -void * decode_block(AVCodecContext * avctx, unsigned char *in, signed short int *out,unsigned len) +static void * decode_block(AVCodecContext * avctx, unsigned char *in, signed short int *out,unsigned len) { int x,y; Real288_internal *glob=avctx->priv_data; @@ -255,7 +255,7 @@ static int ra288_decode_frame(AVCodecContext * avctx, data=decode_block(avctx,&buf[j*cfs+cfs*i*h/2],(signed short *)data,cfs); bret += cfs; } - *data_size = data - datao; + *data_size = (char *)data - (char *)datao; return bret; } else diff --git a/src/libffmpeg/libavcodec/rpza.c b/src/libffmpeg/libavcodec/rpza.c index 675d7f34c..e002c14dd 100644 --- a/src/libffmpeg/libavcodec/rpza.c +++ b/src/libffmpeg/libavcodec/rpza.c @@ -54,6 +54,9 @@ typedef struct RpzaContext { } RpzaContext; +#undef BE_16 +#undef BE_32 + #define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) #define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ (((uint8_t*)(x))[1] << 16) | \ diff --git a/src/libffmpeg/libavcodec/rv10.c b/src/libffmpeg/libavcodec/rv10.c index c19c36ec5..b057ae602 100644 --- a/src/libffmpeg/libavcodec/rv10.c +++ b/src/libffmpeg/libavcodec/rv10.c @@ -257,6 +257,7 @@ void rv10_encode_picture_header(MpegEncContext *s, int picture_number) put_bits(&s->pb, 3, 0); /* ignored */ } +#if 0 static int get_num(GetBitContext *gb) { int n, n1; @@ -269,6 +270,7 @@ static int get_num(GetBitContext *gb) return (n << 16) | n1; } } +#endif #endif //CONFIG_ENCODERS diff --git a/src/libffmpeg/libavcodec/utils.c b/src/libffmpeg/libavcodec/utils.c index ace54ef11..2334de8e6 100644 --- a/src/libffmpeg/libavcodec/utils.c +++ b/src/libffmpeg/libavcodec/utils.c @@ -129,7 +129,7 @@ typedef struct InternalBuffer{ #define ALIGN(x, a) (((x)+(a)-1)&~((a)-1)) -void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){ +static void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){ int w_align= 1; int h_align= 1; @@ -283,7 +283,7 @@ void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){ //printf("R%X\n", pic->opaque); } -enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, enum PixelFormat * fmt){ +static enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, enum PixelFormat * fmt){ return fmt[0]; } @@ -491,7 +491,7 @@ AVCodec *avcodec_find_decoder_by_name(const char *name) return NULL; } -AVCodec *avcodec_find(enum CodecID id) +static AVCodec *avcodec_find(enum CodecID id) { AVCodec *p; p = first_avcodec; diff --git a/src/libffmpeg/libavcodec/vp3.c b/src/libffmpeg/libavcodec/vp3.c index c72c7fc16..430212ad8 100644 --- a/src/libffmpeg/libavcodec/vp3.c +++ b/src/libffmpeg/libavcodec/vp3.c @@ -314,7 +314,7 @@ typedef struct Vp3DecodeContext { #define xC6S2 25080 #define xC7S1 12785 -void vp3_idct_c(int16_t *input_data, int16_t *dequant_matrix, +static void vp3_idct_c(int16_t *input_data, int16_t *dequant_matrix, int16_t *output_data) { int32_t intermediate_data[64]; @@ -548,7 +548,7 @@ void vp3_idct_c(int16_t *input_data, int16_t *dequant_matrix, } } -void vp3_idct_put(int16_t *input_data, int16_t *dequant_matrix, +static void vp3_idct_put(int16_t *input_data, int16_t *dequant_matrix, uint8_t *dest, int stride) { int16_t transformed_data[64]; @@ -574,7 +574,7 @@ void vp3_idct_put(int16_t *input_data, int16_t *dequant_matrix, } } -void vp3_idct_add(int16_t *input_data, int16_t *dequant_matrix, +static void vp3_idct_add(int16_t *input_data, int16_t *dequant_matrix, uint8_t *dest, int stride) { int16_t transformed_data[64]; diff --git a/src/libffmpeg/libavcodec/vqavideo.c b/src/libffmpeg/libavcodec/vqavideo.c index 8f4ac173f..b3b310b64 100644 --- a/src/libffmpeg/libavcodec/vqavideo.c +++ b/src/libffmpeg/libavcodec/vqavideo.c @@ -82,6 +82,10 @@ #define MAX_VECTORS (MAX_CODEBOOK_VECTORS + SOLID_PIXEL_VECTORS) #define MAX_CODEBOOK_SIZE (MAX_VECTORS * 4 * 4) +#undef LE_16 +#undef BE_16 +#undef BE_32 + #define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) #define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) #define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ diff --git a/src/libffmpeg/libavcodec/xan.c b/src/libffmpeg/libavcodec/xan.c index 49e207677..742bd3705 100644 --- a/src/libffmpeg/libavcodec/xan.c +++ b/src/libffmpeg/libavcodec/xan.c @@ -58,6 +58,10 @@ typedef struct XanContext { } XanContext; +#undef BE_16 +#undef LE_16 +#undef LE_32 + #define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) #define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) #define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ @@ -69,6 +73,8 @@ typedef struct XanContext { #define SCALEFACTOR 65536 #define CENTERSAMPLE 128 +#undef COMPUTE_Y + #define COMPUTE_Y(r, g, b) \ (unsigned char) \ ((y_r_table[r] + y_g_table[g] + y_b_table[b]) / SCALEFACTOR) |