diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2002-07-01 13:32:38 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2002-07-01 13:32:38 +0000 |
commit | c89b49e764fb121ad068be09bf341ceccb05baf3 (patch) | |
tree | 5f7c96023eadd6c43b4496907f699d50bea016be | |
parent | f4abc8f19216da9d1762920191c05481d5c86430 (diff) | |
download | xine-lib-c89b49e764fb121ad068be09bf341ceccb05baf3.tar.gz xine-lib-c89b49e764fb121ad068be09bf341ceccb05baf3.tar.bz2 |
- ffmpeg sync
- skip decoding b-frames when late
CVS patchset: 2185
CVS date: 2002/07/01 13:32:38
-rw-r--r-- | src/libffmpeg/libavcodec/Makefile.am | 8 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/alpha/asm.h | 181 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/alpha/dsputil_alpha.c | 113 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/alpha/mpegvideo_alpha.c | 3 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/h263.c | 5 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/mjpeg.c | 2 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/motion_est.c | 4 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/mpegvideo.c | 4 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/simple_idct.c | 73 | ||||
-rw-r--r-- | src/libffmpeg/libavcodec/utils.c | 82 | ||||
-rw-r--r-- | src/libffmpeg/xine_decoder.c | 28 |
11 files changed, 268 insertions, 235 deletions
diff --git a/src/libffmpeg/libavcodec/Makefile.am b/src/libffmpeg/libavcodec/Makefile.am index 8e6a86555..3a8764eaf 100644 --- a/src/libffmpeg/libavcodec/Makefile.am +++ b/src/libffmpeg/libavcodec/Makefile.am @@ -6,9 +6,9 @@ SUBDIRS = armv4l i386 mlib alpha EXTRA_DIST = fdctref.c imgresample.c -#CFLAGS = -D_FILE_OFFSET_BITS=64 @CFLAGS@ -DCONFIG_DECODERS -DHAVE_AV_CONFIG_H +#CFLAGS = -D_FILE_OFFSET_BITS=64 @CFLAGS@ -DHAVE_AV_CONFIG_H -CFLAGS = @CFLAGS@ $(LIBFFMPEG_CFLAGS) -DCONFIG_DECODERS -DHAVE_AV_CONFIG_H +CFLAGS = @CFLAGS@ $(LIBFFMPEG_CFLAGS) -DHAVE_AV_CONFIG_H ASFLAGS = LIBTOOL = $(SHELL) $(top_builddir)/libtool-nofpic @@ -19,7 +19,7 @@ libavcodec_la_SOURCES = common.c utils.c mpegvideo.c h263.c jrevdct.c jfdctfst.c mjpeg.c dsputil.c \ motion_est.c imgconvert.c msmpeg4.c \ mpeg12.c h263dec.c rv10.c simple_idct.c \ - ratecontrol.c + ratecontrol.c mem.c #imgresample.c libavcodec_la_LDFLAGS = \ @@ -37,7 +37,7 @@ noinst_HEADERS = avcodec.h dsputil.h mpegvideo.h \ $(ASCOMPILE) -o $@ `test -f $< || echo '$(srcdir)/'`$< debug: - @$(MAKE) CFLAGS="$(DEBUG_CFLAGS) $(LIBFFMPEG_CFLAGS) -DCONFIG_DECODERS -DHAVE_AV_CONFIG_H" + @$(MAKE) CFLAGS="$(DEBUG_CFLAGS) $(LIBFFMPEG_CFLAGS) -DHAVE_AV_CONFIG_H" install-debug: debug @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am diff --git a/src/libffmpeg/libavcodec/alpha/asm.h b/src/libffmpeg/libavcodec/alpha/asm.h index 0f4685f11..ceaf0be4a 100644 --- a/src/libffmpeg/libavcodec/alpha/asm.h +++ b/src/libffmpeg/libavcodec/alpha/asm.h @@ -20,122 +20,115 @@ #ifndef LIBAVCODEC_ALPHA_ASM_H #define LIBAVCODEC_ALPHA_ASM_H -#include <stdint.h> +#include <inttypes.h> #define AMASK_BWX (1 << 0) #define AMASK_FIX (1 << 1) +#define AMASK_CIX (1 << 2) #define AMASK_MVI (1 << 8) -static inline uint64_t BYTE_VEC(uint64_t x) +inline static uint64_t BYTE_VEC(uint64_t x) { x |= x << 8; x |= x << 16; x |= x << 32; return x; } -static inline uint64_t WORD_VEC(uint64_t x) +inline static uint64_t WORD_VEC(uint64_t x) { x |= x << 16; x |= x << 32; return x; } -static inline int32_t ldl(const void* p) -{ - return *(const int32_t*) p; -} -static inline uint64_t ldq(const void* p) -{ - return *(const uint64_t*) p; -} -/* FIXME ccc doesn't seem to get it? Use inline asm? */ -static inline uint64_t ldq_u(const void* p) -{ - return *(const uint64_t*) ((uintptr_t) p & ~7ul); -} -static inline void stl(uint32_t l, void* p) -{ - *(uint32_t*) p = l; -} -static inline void stq(uint64_t l, void* p) -{ - *(uint64_t*) p = l; -} +#define ldq(p) (*(const uint64_t *) (p)) +#define ldl(p) (*(const int32_t *) (p)) +#define stl(l, p) do { *(uint32_t *) (p) = (l); } while (0) +#define stq(l, p) do { *(uint64_t *) (p) = (l); } while (0) #ifdef __GNUC__ -#define OPCODE1(name) \ -static inline uint64_t name(uint64_t l) \ -{ \ - uint64_t r; \ - asm (#name " %1, %0" : "=r" (r) : "r" (l)); \ - return r; \ -} - -#define OPCODE2(name) \ -static inline uint64_t name(uint64_t l1, uint64_t l2) \ -{ \ - uint64_t r; \ - asm (#name " %1, %2, %0" : "=r" (r) : "r" (l1), "rI" (l2)); \ - return r; \ -} - -/* We don't want gcc to move this around or combine it with another - rpcc, so mark it volatile. */ -static inline uint64_t rpcc(void) -{ - uint64_t r; - asm volatile ("rpcc %0" : "=r" (r)); - return r; -} - -static inline uint64_t uldq(const void* v) -{ - struct foo { - unsigned long l; - } __attribute__((packed)); - - return ((const struct foo*) v)->l; -} +#define ASM_ACCEPT_MVI asm (".arch pca56") +struct unaligned_long { uint64_t l; } __attribute__((packed)); +#define ldq_u(p) (*(const uint64_t *) (((uint64_t) (p)) & ~7ul)) +#define uldq(a) (((const struct unaligned_long *) (a))->l) + +#if __GNUC__ >= 3 && __GNUC_MINOR__ >= 2 +#define cmpbge __builtin_alpha_cmpbge +/* Avoid warnings. */ +#define extql(a, b) __builtin_alpha_extql(a, (uint64_t) (b)) +#define extqh(a, b) __builtin_alpha_extqh(a, (uint64_t) (b)) +#define zap __builtin_alpha_zap +#define zapnot __builtin_alpha_zapnot +#define amask __builtin_alpha_amask +#define implver __builtin_alpha_implver +#define rpcc __builtin_alpha_rpcc +#define minub8 __builtin_alpha_minub8 +#define minsb8 __builtin_alpha_minsb8 +#define minuw4 __builtin_alpha_minuw4 +#define minsw4 __builtin_alpha_minsw4 +#define maxub8 __builtin_alpha_maxub8 +#define maxsb8 __builtin_alpha_maxsb8 +#define maxuw4 __builtin_alpha_maxuw4 +#define maxsw4 __builtin_alpha_maxsw4 +#define perr __builtin_alpha_perr +#define pklb __builtin_alpha_pklb +#define pkwb __builtin_alpha_pkwb +#define unpkbl __builtin_alpha_unpkbl +#define unpkbw __builtin_alpha_unpkbw +#else +#define cmpbge(a, b) ({ uint64_t __r; asm ("cmpbge %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; }) +#define extql(a, b) ({ uint64_t __r; asm ("extql %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; }) +#define extqh(a, b) ({ uint64_t __r; asm ("extqh %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; }) +#define zap(a, b) ({ uint64_t __r; asm ("zap %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; }) +#define zapnot(a, b) ({ uint64_t __r; asm ("zapnot %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; }) +#define amask(a) ({ uint64_t __r; asm ("amask %1,%0" : "=r" (__r) : "rI" (a)); __r; }) +#define implver() ({ uint64_t __r; asm ("implver %0" : "=r" (__r)); __r; }) +#define rpcc() ({ uint64_t __r; asm volatile ("rpcc %0" : "=r" (__r)); __r; }) +#define minub8(a, b) ({ uint64_t __r; asm ("minub8 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; }) +#define minsb8(a, b) ({ uint64_t __r; asm ("minsb8 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; }) +#define minuw4(a, b) ({ uint64_t __r; asm ("minuw4 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; }) +#define minsw4(a, b) ({ uint64_t __r; asm ("minsw4 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; }) +#define maxub8(a, b) ({ uint64_t __r; asm ("maxub8 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; }) +#define maxsb8(a, b) ({ uint64_t __r; asm ("maxsb8 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; }) +#define maxuw4(a, b) ({ uint64_t __r; asm ("maxuw4 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; }) +#define maxsw4(a, b) ({ uint64_t __r; asm ("maxsw4 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; }) +#define perr(a, b) ({ uint64_t __r; asm ("perr %r1,%r2,%0" : "=r" (__r) : "%rJ" (a), "rJ" (b)); __r; }) +#define pklb(a) ({ uint64_t __r; asm ("pklb %r1,%0" : "=r" (__r) : "rJ" (a)); __r; }) +#define pkwb(a) ({ uint64_t __r; asm ("pkwb %r1,%0" : "=r" (__r) : "rJ" (a)); __r; }) +#define unpkbl(a) ({ uint64_t __r; asm ("unpkbl %r1,%0" : "=r" (__r) : "rJ" (a)); __r; }) +#define unpkbw(a) ({ uint64_t __r; asm ("unpkbw %r1,%0" : "=r" (__r) : "rJ" (a)); __r; }) +#endif -#elif defined(__DECC) /* Compaq "ccc" compiler */ +#elif defined(__DECC) /* Digital/Compaq "ccc" compiler */ #include <c_asm.h> -#define OPCODE1(name) \ -static inline uint64_t name(uint64_t l) \ -{ \ - return asm (#name " %a0, %v0", l); \ -} - -#define OPCODE2(name) \ -static inline uint64_t name(uint64_t l1, uint64_t l2) \ -{ \ - return asm (#name " %a0, %a1, %v0", l1, l2); \ -} - -static inline uint64_t rpcc(void) -{ - return asm ("rpcc %v0"); -} - -static inline uint64_t uldq(const void* v) -{ - return *(const __unaligned uint64_t *) v; -} - +#define ASM_ACCEPT_MVI +#define ldq_u(a) asm ("ldq_u %v0,0(%a0)", a) +#define uldq(a) (*(const __unaligned uint64_t *) (a)) +#define cmpbge(a, b) asm ("cmpbge %a0,%a1,%v0", a, b) +#define extql(a, b) asm ("extql %a0,%a1,%v0", a, b) +#define extqh(a, b) asm ("extqh %a0,%a1,%v0", a, b) +#define zap(a, b) asm ("zap %a0,%a1,%v0", a, b) +#define zapnot(a, b) asm ("zapnot %a0,%a1,%v0", a, b) +#define amask(a) asm ("amask %a0,%v0", a) +#define implver() asm ("implver %v0") +#define rpcc() asm ("rpcc %v0") +#define minub8(a, b) asm ("minub8 %a0,%a1,%v0", a, b) +#define minsb8(a, b) asm ("minsb8 %a0,%a1,%v0", a, b) +#define minuw4(a, b) asm ("minuw4 %a0,%a1,%v0", a, b) +#define minsw4(a, b) asm ("minsw4 %a0,%a1,%v0", a, b) +#define maxub8(a, b) asm ("maxub8 %a0,%a1,%v0", a, b) +#define maxsb8(a, b) asm ("maxsb8 %a0,%a1,%v0", a, b) +#define maxuw4(a, b) asm ("maxuw4 %a0,%a1,%v0", a, b) +#define maxsw4(a, b) asm ("maxsw4 %a0,%a1,%v0", a, b) +#define perr(a, b) asm ("perr %a0,%a1,%v0", a, b) +#define pklb(a) asm ("pklb %a0,%v0", a) +#define pkwb(a) asm ("pkwb %a0,%v0", a) +#define unpkbl(a) asm ("unpkbl %a0,%v0", a) +#define unpkbw(a) asm ("unpkbw %a0,%v0", a) + +#else +#error "Unknown compiler!" #endif -OPCODE1(amask); -OPCODE1(unpkbw); -OPCODE1(pkwb); -OPCODE2(extql); -OPCODE2(extqh); -OPCODE2(zap); -OPCODE2(cmpbge); -OPCODE2(minsw4); -OPCODE2(minuw4); -OPCODE2(minub8); -OPCODE2(maxsw4); -OPCODE2(maxuw4); -OPCODE2(perr); - #endif /* LIBAVCODEC_ALPHA_ASM_H */ diff --git a/src/libffmpeg/libavcodec/alpha/dsputil_alpha.c b/src/libffmpeg/libavcodec/alpha/dsputil_alpha.c index 3a54904f4..5e1aa2093 100644 --- a/src/libffmpeg/libavcodec/alpha/dsputil_alpha.c +++ b/src/libffmpeg/libavcodec/alpha/dsputil_alpha.c @@ -22,58 +22,86 @@ void simple_idct_axp(DCTELEM *block); -static void put_pixels_clamped_axp(const DCTELEM *block, UINT8 *pixels, - int line_size) +void put_pixels_clamped_mvi_asm(const DCTELEM *block, uint8_t *pixels, + int line_size); +void add_pixels_clamped_mvi_asm(const DCTELEM *block, uint8_t *pixels, + int line_size); + +#if 0 +/* These functions were the base for the optimized assembler routines, + and remain here for documentation purposes. */ +static void put_pixels_clamped_mvi(const DCTELEM *block, uint8_t *pixels, + int line_size) { int i = 8; + uint64_t clampmask = zap(-1, 0xaa); /* 0x00ff00ff00ff00ff */ + + ASM_ACCEPT_MVI; + do { - UINT64 shorts; + uint64_t shorts0, shorts1; - shorts = ldq(block); - shorts = maxsw4(shorts, 0); - shorts = minsw4(shorts, WORD_VEC(0x00ff)); - stl(pkwb(shorts), pixels); + shorts0 = ldq(block); + shorts0 = maxsw4(shorts0, 0); + shorts0 = minsw4(shorts0, clampmask); + stl(pkwb(shorts0), pixels); - shorts = ldq(block + 4); - shorts = maxsw4(shorts, 0); - shorts = minsw4(shorts, WORD_VEC(0x00ff)); - stl(pkwb(shorts), pixels + 4); + shorts1 = ldq(block + 4); + shorts1 = maxsw4(shorts1, 0); + shorts1 = minsw4(shorts1, clampmask); + stl(pkwb(shorts1), pixels + 4); - pixels += line_size; - block += 8; + pixels += line_size; + block += 8; } while (--i); } -static void add_pixels_clamped_axp(const DCTELEM *block, UINT8 *pixels, - int line_size) +void add_pixels_clamped_mvi(const DCTELEM *block, uint8_t *pixels, + int line_size) { - int i = 8; + int h = 8; + /* Keep this function a leaf function by generating the constants + manually (mainly for the hack value ;-). */ + uint64_t clampmask = zap(-1, 0xaa); /* 0x00ff00ff00ff00ff */ + uint64_t signmask = zap(-1, 0x33); + signmask ^= signmask >> 1; /* 0x8000800080008000 */ + + ASM_ACCEPT_MVI; + do { - UINT64 shorts; - - shorts = ldq(block); - shorts &= ~WORD_VEC(0x8000); /* clear highest bit to avoid overflow */ - shorts += unpkbw(ldl(pixels)); - shorts &= ~WORD_VEC(0x8000); /* hibit would be set for e. g. -2 + 3 */ - shorts = minuw4(shorts, WORD_VEC(0x4000)); /* set neg. to 0x4000 */ - shorts &= ~WORD_VEC(0x4000); /* ...and zap them */ - shorts = minsw4(shorts, WORD_VEC(0x00ff)); /* clamp to 255 */ - stl(pkwb(shorts), pixels); - - /* next 4 */ - shorts = ldq(block + 4); - shorts &= ~WORD_VEC(0x8000); - shorts += unpkbw(ldl(pixels + 4)); - shorts &= ~WORD_VEC(0x8000); - shorts = minuw4(shorts, WORD_VEC(0x4000)); - shorts &= ~WORD_VEC(0x4000); - shorts = minsw4(shorts, WORD_VEC(0x00ff)); - stl(pkwb(shorts), pixels + 4); - - pixels += line_size; - block += 8; - } while (--i); + uint64_t shorts0, pix0, signs0; + uint64_t shorts1, pix1, signs1; + + shorts0 = ldq(block); + shorts1 = ldq(block + 4); + + pix0 = unpkbw(ldl(pixels)); + /* Signed subword add (MMX paddw). */ + signs0 = shorts0 & signmask; + shorts0 &= ~signmask; + shorts0 += pix0; + shorts0 ^= signs0; + /* Clamp. */ + shorts0 = maxsw4(shorts0, 0); + shorts0 = minsw4(shorts0, clampmask); + + /* Next 4. */ + pix1 = unpkbw(ldl(pixels + 4)); + signs1 = shorts1 & signmask; + shorts1 &= ~signmask; + shorts1 += pix1; + shorts1 ^= signs1; + shorts1 = maxsw4(shorts1, 0); + shorts1 = minsw4(shorts1, clampmask); + + stl(pkwb(shorts0), pixels); + stl(pkwb(shorts1), pixels + 4); + + pixels += line_size; + block += 8; + } while (--h); } +#endif /* Average 8 unsigned bytes in parallel: (b1 + b2) >> 1 Since the immediate result could be greater than 255, we do the @@ -216,8 +244,7 @@ void dsputil_init_alpha(void) /* amask clears all bits that correspond to present features. */ if (amask(AMASK_MVI) == 0) { - fprintf(stderr, "MVI extension detected\n"); - put_pixels_clamped = put_pixels_clamped_axp; - add_pixels_clamped = add_pixels_clamped_axp; + put_pixels_clamped = put_pixels_clamped_mvi_asm; + add_pixels_clamped = add_pixels_clamped_mvi_asm; } } diff --git a/src/libffmpeg/libavcodec/alpha/mpegvideo_alpha.c b/src/libffmpeg/libavcodec/alpha/mpegvideo_alpha.c index d0af5e1d3..eb1997eee 100644 --- a/src/libffmpeg/libavcodec/alpha/mpegvideo_alpha.c +++ b/src/libffmpeg/libavcodec/alpha/mpegvideo_alpha.c @@ -28,6 +28,9 @@ static void dct_unquantize_h263_axp(MpegEncContext *s, { int i, level; UINT64 qmul, qadd; + + ASM_ACCEPT_MVI; + if (s->mb_intra) { if (n < 4) block[0] = block[0] * s->y_dc_scale; diff --git a/src/libffmpeg/libavcodec/h263.c b/src/libffmpeg/libavcodec/h263.c index 0b3a5347c..ae1eea7d7 100644 --- a/src/libffmpeg/libavcodec/h263.c +++ b/src/libffmpeg/libavcodec/h263.c @@ -3182,12 +3182,7 @@ static void mpeg4_decode_sprite_trajectory(MpegEncContext * s) int a= 2<<s->sprite_warping_accuracy; int rho= 3-s->sprite_warping_accuracy; int r=16/a; -#ifdef __GNUC__ const int vop_ref[4][2]= {{0,0}, {s->width,0}, {0, s->height}, {s->width, s->height}}; // only true for rectangle shapes -#else - int vop_ref[4][2]= {{0,0}, {s->width,0}, {0, s->height}, {s->width, s->height}}; // only true for rectangle shapes -#endif - int d[4][2]={{0,0}, {0,0}, {0,0}, {0,0}}; int sprite_ref[4][2]; int virtual_ref[2][2]; diff --git a/src/libffmpeg/libavcodec/mjpeg.c b/src/libffmpeg/libavcodec/mjpeg.c index 577e9d884..ccaf37e38 100644 --- a/src/libffmpeg/libavcodec/mjpeg.c +++ b/src/libffmpeg/libavcodec/mjpeg.c @@ -1023,7 +1023,7 @@ static int mjpeg_decode_dri(MJpegDecodeContext *s, if (get_bits(&s->gb, 16) != 4) return -1; s->restart_interval = get_bits(&s->gb, 16); - printf("restart interval: %d\n", s->restart_interval); + dprintf("restart interval: %d\n", s->restart_interval); return 0; } diff --git a/src/libffmpeg/libavcodec/motion_est.c b/src/libffmpeg/libavcodec/motion_est.c index 8f2ffa42e..21d1a74cb 100644 --- a/src/libffmpeg/libavcodec/motion_est.c +++ b/src/libffmpeg/libavcodec/motion_est.c @@ -1715,9 +1715,9 @@ void ff_fix_long_p_mvs(MpegEncContext * s) s->mb_type[i] |= MB_TYPE_INTRA; } } - xy+=2; - i++; } + xy+=2; + i++; } } } diff --git a/src/libffmpeg/libavcodec/mpegvideo.c b/src/libffmpeg/libavcodec/mpegvideo.c index 105fb5502..fc15b98c1 100644 --- a/src/libffmpeg/libavcodec/mpegvideo.c +++ b/src/libffmpeg/libavcodec/mpegvideo.c @@ -495,7 +495,9 @@ int MPV_encode_init(AVCodecContext *avctx) } s->mv_penalty= default_mv_penalty; s->fcode_tab= default_fcode_tab; - + s->y_dc_scale_table= + s->c_dc_scale_table= ff_mpeg1_dc_scale_table; + if (s->out_format == FMT_H263) h263_encode_init(s); else if (s->out_format == FMT_MPEG1) diff --git a/src/libffmpeg/libavcodec/simple_idct.c b/src/libffmpeg/libavcodec/simple_idct.c index 0665f667a..9edb7262a 100644 --- a/src/libffmpeg/libavcodec/simple_idct.c +++ b/src/libffmpeg/libavcodec/simple_idct.c @@ -167,6 +167,79 @@ static inline int idctRowCondDC(int16_t *row) return 2; } + +inline static void idctSparseCol(int16_t *col) +{ + int a0, a1, a2, a3, b0, b1, b2, b3; + + col[0] += (1 << (COL_SHIFT - 1)) / W4; + + a0 = W4 * col[8 * 0]; + a1 = W4 * col[8 * 0]; + a2 = W4 * col[8 * 0]; + a3 = W4 * col[8 * 0]; + + if (col[8 * 2]) { + a0 += W2 * col[8 * 2]; + a1 += W6 * col[8 * 2]; + a2 -= W6 * col[8 * 2]; + a3 -= W2 * col[8 * 2]; + } + + if (col[8 * 4]) { + a0 += W4 * col[8 * 4]; + a1 -= W4 * col[8 * 4]; + a2 -= W4 * col[8 * 4]; + a3 += W4 * col[8 * 4]; + } + + if (col[8 * 6]) { + a0 += W6 * col[8 * 6]; + a1 -= W2 * col[8 * 6]; + a2 += W2 * col[8 * 6]; + a3 -= W6 * col[8 * 6]; + } + + if (col[8 * 1]) { + b0 = W1 * col[8 * 1]; + b1 = W3 * col[8 * 1]; + b2 = W5 * col[8 * 1]; + b3 = W7 * col[8 * 1]; + } else { + b0 = b1 = b2 = b3 = 0; + } + + if (col[8 * 3]) { + b0 += W3 * col[8 * 3]; + b1 -= W7 * col[8 * 3]; + b2 -= W1 * col[8 * 3]; + b3 -= W5 * col[8 * 3]; + } + + if (col[8 * 5]) { + b0 += W5 * col[8 * 5]; + b1 -= W1 * col[8 * 5]; + b2 += W7 * col[8 * 5]; + b3 += W3 * col[8 * 5]; + } + + if (col[8 * 7]) { + b0 += W7 * col[8 * 7]; + b1 -= W5 * col[8 * 7]; + b2 += W3 * col[8 * 7]; + b3 -= W1 * col[8 * 7]; + } + + col[8 * 0] = (a0 + b0) >> COL_SHIFT; + col[8 * 7] = (a0 - b0) >> COL_SHIFT; + col[8 * 1] = (a1 + b1) >> COL_SHIFT; + col[8 * 6] = (a1 - b1) >> COL_SHIFT; + col[8 * 2] = (a2 + b2) >> COL_SHIFT; + col[8 * 5] = (a2 - b2) >> COL_SHIFT; + col[8 * 3] = (a3 + b3) >> COL_SHIFT; + col[8 * 4] = (a3 - b3) >> COL_SHIFT; +} + #else /* not ARCH_ALPHA */ static inline void idctRowCondDC (int16_t * row) diff --git a/src/libffmpeg/libavcodec/utils.c b/src/libffmpeg/libavcodec/utils.c index f6d967757..d66988253 100644 --- a/src/libffmpeg/libavcodec/utils.c +++ b/src/libffmpeg/libavcodec/utils.c @@ -19,33 +19,6 @@ #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" -#ifdef HAVE_MALLOC_H -#include <malloc.h> -#endif - -/* memory alloc */ -void *av_malloc(int size) -{ - void *ptr; -#if defined ( ARCH_X86 ) && defined ( HAVE_MEMALIGN ) - ptr = memalign(64,size); - /* Why 64? - Indeed, we should align it: - on 4 for 386 - on 16 for 486 - on 32 for 586, PPro - k6-III - on 64 for K7 (maybe for P3 too). - Because L1 and L2 caches are aligned on those values. - But I don't want to code such logic here! - */ -#else - ptr = malloc(size); -#endif - if (!ptr) - return NULL; - memset(ptr, 0, size); - return ptr; -} void *av_mallocz(int size) { @@ -57,14 +30,6 @@ void *av_mallocz(int size) return ptr; } -/* NOTE: ptr = NULL is explicetly allowed */ -void av_free(void *ptr) -{ - /* XXX: this test should not be needed on most libcs */ - if (ptr) - free(ptr); -} - /* cannot call it directly because of 'void **' casting is not automatic */ void __av_freep(void **ptr) { @@ -445,53 +410,6 @@ void avcodec_init(void) dsputil_init(); } -/* simple call to use all the codecs */ -void avcodec_register_all(void) -{ - static int inited = 0; - - if (inited != 0) - return; - inited = 1; - - /* encoders */ -#ifdef CONFIG_ENCODERS - register_avcodec(&ac3_encoder); - register_avcodec(&mp2_encoder); -#ifdef CONFIG_MP3LAME - register_avcodec(&mp3lame_encoder); -#endif - register_avcodec(&mpeg1video_encoder); - register_avcodec(&h263_encoder); - register_avcodec(&h263p_encoder); - register_avcodec(&rv10_encoder); - register_avcodec(&mjpeg_encoder); - register_avcodec(&mpeg4_encoder); - register_avcodec(&msmpeg4v1_encoder); - register_avcodec(&msmpeg4v2_encoder); - register_avcodec(&msmpeg4v3_encoder); -#endif /* CONFIG_ENCODERS */ - register_avcodec(&rawvideo_codec); - - /* decoders */ -#ifdef CONFIG_DECODERS - register_avcodec(&h263_decoder); - register_avcodec(&mpeg4_decoder); - register_avcodec(&msmpeg4v1_decoder); - register_avcodec(&msmpeg4v2_decoder); - register_avcodec(&msmpeg4v3_decoder); - register_avcodec(&wmv1_decoder); - register_avcodec(&mpeg_decoder); - register_avcodec(&h263i_decoder); - register_avcodec(&rv10_decoder); - register_avcodec(&mjpeg_decoder); -#ifdef CONFIG_AC3 - register_avcodec(&ac3_decoder); -#endif -#endif /* CONFIG_DECODERS */ - -} - /* this should be called after seeking and before trying to decode the next frame */ void avcodec_flush_buffers(AVCodecContext *avctx) { diff --git a/src/libffmpeg/xine_decoder.c b/src/libffmpeg/xine_decoder.c index a8eb4e315..63a81d595 100644 --- a/src/libffmpeg/xine_decoder.c +++ b/src/libffmpeg/xine_decoder.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: xine_decoder.c,v 1.43 2002/06/23 23:08:29 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.44 2002/07/01 13:33:12 miguelfreitas Exp $ * * xine decoder plugin using ffmpeg * @@ -202,9 +202,10 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { int got_picture, len, y; uint8_t *dy, *du, *dv, *sy, *su, *sv; - /* decoder video frame */ + /* decode video frame */ - /* this->bih.biSizeImage = this->size; */ + /* skip decoding b frames if too late */ + this->context.hurry_up = (this->skipframes > 2) ? 1:0; len = avcodec_decode_video (&this->context, &this->av_picture, &got_picture, this->buf, @@ -360,6 +361,27 @@ static char *ff_get_id(void) { return "ffmpeg video decoder"; } +void avcodec_register_all(void) +{ + static int inited = 0; + + if (inited != 0) + return; + inited = 1; + + /* decoders */ + register_avcodec(&h263_decoder); + register_avcodec(&mpeg4_decoder); + register_avcodec(&msmpeg4v1_decoder); + register_avcodec(&msmpeg4v2_decoder); + register_avcodec(&msmpeg4v3_decoder); + register_avcodec(&wmv1_decoder); + register_avcodec(&wmv2_decoder); + register_avcodec(&mpeg_decoder); + register_avcodec(&h263i_decoder); + register_avcodec(&rv10_decoder); + register_avcodec(&mjpeg_decoder); +} static void init_routine(void) { avcodec_init(); |