diff options
author | James Courtier-Dutton <jcdutton@users.sourceforge.net> | 2004-03-23 01:47:46 +0000 |
---|---|---|
committer | James Courtier-Dutton <jcdutton@users.sourceforge.net> | 2004-03-23 01:47:46 +0000 |
commit | 6bc55e9617fc92273dd6d25b76383fb4b41da9fd (patch) | |
tree | 0040fa30be835b9070d1fe4f43aa67ca5723a99f | |
parent | 7064dda16fc2609258340503bc4ac17d911c430d (diff) | |
download | xine-lib-6bc55e9617fc92273dd6d25b76383fb4b41da9fd.tar.gz xine-lib-6bc55e9617fc92273dd6d25b76383fb4b41da9fd.tar.bz2 |
Start sync with latest libmpeg2 cvs.
include directory first.
CVS patchset: 6299
CVS date: 2004/03/23 01:47:46
-rw-r--r-- | src/libmpeg2new/include/Makefile.am | 4 | ||||
-rw-r--r-- | src/libmpeg2new/include/config.h | 161 | ||||
-rw-r--r-- | src/libmpeg2new/include/config.h.in | 160 | ||||
-rw-r--r-- | src/libmpeg2new/include/mpeg2.h | 83 | ||||
-rw-r--r-- | src/libmpeg2new/include/mpeg2convert.h (renamed from src/libmpeg2new/include/convert.h) | 50 | ||||
-rw-r--r-- | src/libmpeg2new/include/stamp-h1 | 1 | ||||
-rw-r--r-- | src/libmpeg2new/include/video_out.h | 15 | ||||
-rw-r--r-- | src/libmpeg2new/include/vis.h | 328 |
8 files changed, 420 insertions, 382 deletions
diff --git a/src/libmpeg2new/include/Makefile.am b/src/libmpeg2new/include/Makefile.am index 56c98512d..302d01cb1 100644 --- a/src/libmpeg2new/include/Makefile.am +++ b/src/libmpeg2new/include/Makefile.am @@ -1,3 +1,3 @@ -pkginclude_HEADERS = mpeg2.h convert.h +pkginclude_HEADERS = mpeg2.h mpeg2convert.h -EXTRA_DIST = video_out.h mmx.h alpha_asm.h attributes.h tendra.h +EXTRA_DIST = video_out.h mmx.h alpha_asm.h vis.h attributes.h tendra.h diff --git a/src/libmpeg2new/include/config.h b/src/libmpeg2new/include/config.h deleted file mode 100644 index 2060723d2..000000000 --- a/src/libmpeg2new/include/config.h +++ /dev/null @@ -1,161 +0,0 @@ -/* include/config.h. Generated by configure. */ -/* include/config.h.in. Generated from configure.in by autoheader. */ - -/* autodetect accelerations */ -#define ACCEL_DETECT - -/* alpha architecture */ -/* #undef ARCH_ALPHA */ - -/* ppc architecture */ -/* #undef ARCH_PPC */ - -/* x86 architecture */ -#define ARCH_X86 - -/* maximum supported data alignment */ -#define ATTRIBUTE_ALIGNED_MAX 64 - -/* debug mode configuration */ -/* #undef DEBUG */ - -/* Define to 1 if you have the <altivec.h> header file. */ -/* #undef HAVE_ALTIVEC_H */ - -/* Define if you have the `__builtin_expect' function. */ -#define HAVE_BUILTIN_EXPECT - -/* Define to 1 if you have the <ddraw.h> header file. */ -/* #undef HAVE_DDRAW_H */ - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#define HAVE_DLFCN_H 1 - -/* Define to 1 if you have the `ftime' function. */ -#define HAVE_FTIME 1 - -/* Define to 1 if you have the `gettimeofday' function. */ -#define HAVE_GETTIMEOFDAY 1 - -/* Define to 1 if you have the <inttypes.h> header file. */ -/* #undef HAVE_INTTYPES_H */ - -/* Define to 1 if you have the <io.h> header file. */ -/* #undef HAVE_IO_H */ - -/* Define to 1 if you have the `memalign' function. */ -#define HAVE_MEMALIGN 1 - -/* Define to 1 if you have the <memory.h> header file. */ -/* #undef HAVE_MEMORY_H */ - -/* Define to 1 if you have the <stdint.h> header file. */ -/* #undef HAVE_STDINT_H */ - -/* Define to 1 if you have the <stdlib.h> header file. */ -/* #undef HAVE_STDLIB_H */ - -/* Define to 1 if you have the <strings.h> header file. */ -/* #undef HAVE_STRINGS_H */ - -/* Define to 1 if you have the <string.h> header file. */ -/* #undef HAVE_STRING_H */ - -/* Define to 1 if the system has the type `struct timeval'. */ -#define HAVE_STRUCT_TIMEVAL 1 - -/* Define to 1 if you have the <sys/stat.h> header file. */ -/* #undef HAVE_SYS_STAT_H */ - -/* Define to 1 if you have the <sys/timeb.h> header file. */ -#define HAVE_SYS_TIMEB_H 1 - -/* Define to 1 if you have the <sys/time.h> header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the <sys/types.h> header file. */ -/* #undef HAVE_SYS_TYPES_H */ - -/* Define to 1 if you have the <time.h> header file. */ -#define HAVE_TIME_H 1 - -/* Define to 1 if you have the <unistd.h> header file. */ -/* #undef HAVE_UNISTD_H */ - -/* libmpeg2 mediaLib support */ -/* #undef LIBMPEG2_MLIB */ - -/* libvo DirectX support */ -/* #undef LIBVO_DX */ - -/* libvo mediaLib support */ -/* #undef LIBVO_MLIB */ - -/* libvo SDL support */ -#define LIBVO_SDL - -/* libvo X11 support */ -#define LIBVO_X11 - -/* libvo Xv support */ -#define LIBVO_XV - -/* mpeg2dec profiling */ -/* #undef MPEG2DEC_GPROF */ - -/* Name of package */ -#define PACKAGE "mpeg2dec" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "" - -/* Define as the return type of signal handlers (`int' or `void'). */ -#define RETSIGTYPE void - -/* The size of a `char', as computed by sizeof. */ -/* #undef SIZEOF_CHAR */ - -/* The size of a `int', as computed by sizeof. */ -/* #undef SIZEOF_INT */ - -/* The size of a `short', as computed by sizeof. */ -/* #undef SIZEOF_SHORT */ - -/* Define to 1 if you have the ANSI C header files. */ -/* #undef STDC_HEADERS */ - -/* Version number of package */ -#define VERSION "0.3.2-cvs" - -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -/* #undef WORDS_BIGENDIAN */ - -/* Define to 1 if the X Window System is missing or not being used. */ -/* #undef X_DISPLAY_MISSING */ - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define as `__inline' if that's what the C compiler calls it, or to nothing - if it is not supported. */ -#define inline __attribute__ ((__always_inline__)) - -/* Define as `__restrict' if that's what the C compiler calls it, or to - nothing if it is not supported. */ -#define restrict __restrict__ - -/* Define to `unsigned' if <sys/types.h> does not define. */ -/* #undef size_t */ diff --git a/src/libmpeg2new/include/config.h.in b/src/libmpeg2new/include/config.h.in deleted file mode 100644 index 365ab931c..000000000 --- a/src/libmpeg2new/include/config.h.in +++ /dev/null @@ -1,160 +0,0 @@ -/* include/config.h.in. Generated from configure.in by autoheader. */ - -/* autodetect accelerations */ -#undef ACCEL_DETECT - -/* alpha architecture */ -#undef ARCH_ALPHA - -/* ppc architecture */ -#undef ARCH_PPC - -/* x86 architecture */ -#undef ARCH_X86 - -/* maximum supported data alignment */ -#undef ATTRIBUTE_ALIGNED_MAX - -/* debug mode configuration */ -#undef DEBUG - -/* Define to 1 if you have the <altivec.h> header file. */ -#undef HAVE_ALTIVEC_H - -/* Define if you have the `__builtin_expect' function. */ -#undef HAVE_BUILTIN_EXPECT - -/* Define to 1 if you have the <ddraw.h> header file. */ -#undef HAVE_DDRAW_H - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the `ftime' function. */ -#undef HAVE_FTIME - -/* Define to 1 if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define to 1 if you have the <inttypes.h> header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the <io.h> header file. */ -#undef HAVE_IO_H - -/* Define to 1 if you have the `memalign' function. */ -#undef HAVE_MEMALIGN - -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the <stdint.h> header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the <string.h> header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if the system has the type `struct timeval'. */ -#undef HAVE_STRUCT_TIMEVAL - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the <sys/timeb.h> header file. */ -#undef HAVE_SYS_TIMEB_H - -/* Define to 1 if you have the <sys/time.h> header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the <sys/types.h> header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the <time.h> header file. */ -#undef HAVE_TIME_H - -/* Define to 1 if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* libmpeg2 mediaLib support */ -#undef LIBMPEG2_MLIB - -/* libvo DirectX support */ -#undef LIBVO_DX - -/* libvo mediaLib support */ -#undef LIBVO_MLIB - -/* libvo SDL support */ -#undef LIBVO_SDL - -/* libvo X11 support */ -#undef LIBVO_X11 - -/* libvo Xv support */ -#undef LIBVO_XV - -/* mpeg2dec profiling */ -#undef MPEG2DEC_GPROF - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define as the return type of signal handlers (`int' or `void'). */ -#undef RETSIGTYPE - -/* The size of a `char', as computed by sizeof. */ -#undef SIZEOF_CHAR - -/* The size of a `int', as computed by sizeof. */ -#undef SIZEOF_INT - -/* The size of a `short', as computed by sizeof. */ -#undef SIZEOF_SHORT - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION - -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN - -/* Define to 1 if the X Window System is missing or not being used. */ -#undef X_DISPLAY_MISSING - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define as `__inline' if that's what the C compiler calls it, or to nothing - if it is not supported. */ -#undef inline - -/* Define as `__restrict' if that's what the C compiler calls it, or to - nothing if it is not supported. */ -#undef restrict - -/* Define to `unsigned' if <sys/types.h> does not define. */ -#undef size_t diff --git a/src/libmpeg2new/include/mpeg2.h b/src/libmpeg2new/include/mpeg2.h index a67154772..6c1a3805b 100644 --- a/src/libmpeg2new/include/mpeg2.h +++ b/src/libmpeg2new/include/mpeg2.h @@ -1,6 +1,6 @@ /* * mpeg2.h - * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org> + * Copyright (C) 2000-2004 Michel Lespinasse <walken@zoy.org> * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> * * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. @@ -25,7 +25,7 @@ #define MPEG2_H #define MPEG2_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c)) -#define MPEG2_RELEASE MPEG2_VERSION (0, 3, 2) /* 0.3.2 */ +#define MPEG2_RELEASE MPEG2_VERSION (0, 4, 1) /* 0.4.1 */ #define SEQ_FLAG_MPEG2 1 #define SEQ_FLAG_CONSTRAINED_PARAMETERS 2 @@ -41,7 +41,7 @@ #define SEQ_VIDEO_FORMAT_MAC 0x80 #define SEQ_VIDEO_FORMAT_UNSPECIFIED 0xa0 -typedef struct { +typedef struct mpeg2_sequence_s { unsigned int width, height; unsigned int chroma_width, chroma_height; unsigned int byte_rate; @@ -63,7 +63,7 @@ typedef struct { #define GOP_FLAG_BROKEN_LINK 2 #define GOP_FLAG_CLOSED_GOP 4 -typedef struct { +typedef struct mpeg2_gop_s { uint8_t hours; uint8_t minutes; uint8_t seconds; @@ -81,25 +81,25 @@ typedef struct { #define PIC_FLAG_PROGRESSIVE_FRAME 16 #define PIC_FLAG_COMPOSITE_DISPLAY 32 #define PIC_FLAG_SKIP 64 -#define PIC_FLAG_PTS 128 +#define PIC_FLAG_TAGS 128 #define PIC_MASK_COMPOSITE_DISPLAY 0xfffff000 -typedef struct { +typedef struct mpeg2_picture_s { unsigned int temporal_reference; unsigned int nb_fields; - uint32_t pts; + uint32_t tag, tag2; uint32_t flags; struct { int x, y; } display_offset[3]; } mpeg2_picture_t; -typedef struct { +typedef struct mpeg2_fbuf_s { uint8_t * buf[3]; void * id; } mpeg2_fbuf_t; -typedef struct { +typedef struct mpeg2_info_s { const mpeg2_sequence_t * sequence; const mpeg2_gop_t * gop; const mpeg2_picture_t * current_picture; @@ -110,7 +110,7 @@ typedef struct { const mpeg2_fbuf_t * display_fbuf; const mpeg2_fbuf_t * discard_fbuf; const uint8_t * user_data; - int user_data_len; + unsigned int user_data_len; } mpeg2_info_t; typedef struct mpeg2dec_s mpeg2dec_t; @@ -120,48 +120,83 @@ typedef enum { STATE_BUFFER = 0, STATE_SEQUENCE = 1, STATE_SEQUENCE_REPEATED = 2, - STATE_GOP = 3, - STATE_PICTURE = 4, - STATE_SLICE_1ST = 5, - STATE_PICTURE_2ND = 6, - STATE_SLICE = 7, - STATE_END = 8, - STATE_INVALID = 9 + STATE_SEQUENCE_MODIFIED = 3, + STATE_GOP = 4, + STATE_PICTURE = 5, + STATE_SLICE_1ST = 6, + STATE_PICTURE_2ND = 7, + STATE_SLICE = 8, + STATE_END = 9, + STATE_INVALID = 10, + STATE_INVALID_END = 11 } mpeg2_state_t; -struct convert_init_s; -void mpeg2_convert (mpeg2dec_t * mpeg2dec, - void (* convert) (int, int, uint32_t, void *, - struct convert_init_s *), void * arg); +typedef struct mpeg2_convert_init_s { + unsigned int id_size; + unsigned int buf_size[3]; + void (* start) (void * id, const mpeg2_fbuf_t * fbuf, + const mpeg2_picture_t * picture, const mpeg2_gop_t * gop); + void (* copy) (void * id, uint8_t * const * src, unsigned int v_offset); +} mpeg2_convert_init_t; +typedef enum { + MPEG2_CONVERT_SET = 0, + MPEG2_CONVERT_STRIDE = 1, + MPEG2_CONVERT_START = 2 +} mpeg2_convert_stage_t; +typedef int mpeg2_convert_t (int stage, void * id, + const mpeg2_sequence_t * sequence, int stride, + uint32_t accel, void * arg, + mpeg2_convert_init_t * result); +int mpeg2_convert (mpeg2dec_t * mpeg2dec, mpeg2_convert_t convert, void * arg); +int mpeg2_stride (mpeg2dec_t * mpeg2dec, int stride); void mpeg2_set_buf (mpeg2dec_t * mpeg2dec, uint8_t * buf[3], void * id); void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf); #define MPEG2_ACCEL_X86_MMX 1 #define MPEG2_ACCEL_X86_3DNOW 2 #define MPEG2_ACCEL_X86_MMXEXT 4 +#define MPEG2_ACCEL_X86_SSE2 8 +#define MPEG2_ACCEL_X86_SSE3 16 #define MPEG2_ACCEL_PPC_ALTIVEC 1 #define MPEG2_ACCEL_ALPHA 1 #define MPEG2_ACCEL_ALPHA_MVI 2 -#define MPEG2_ACCEL_MLIB 0x40000000 +#define MPEG2_ACCEL_SPARC_VIS 1 +#define MPEG2_ACCEL_SPARC_VIS2 2 #define MPEG2_ACCEL_DETECT 0x80000000 uint32_t mpeg2_accel (uint32_t accel); mpeg2dec_t * mpeg2_init (void); const mpeg2_info_t * mpeg2_info (mpeg2dec_t * mpeg2dec); void mpeg2_close (mpeg2dec_t * mpeg2dec); -mpeg2_state_t mpeg2_reset (mpeg2dec_t * mpeg2dec); void mpeg2_buffer (mpeg2dec_t * mpeg2dec, uint8_t * start, uint8_t * end); int mpeg2_getpos (mpeg2dec_t * mpeg2dec); mpeg2_state_t mpeg2_parse (mpeg2dec_t * mpeg2dec); +void mpeg2_reset (mpeg2dec_t * mpeg2dec, int full_reset); void mpeg2_skip (mpeg2dec_t * mpeg2dec, int skip); void mpeg2_slice_region (mpeg2dec_t * mpeg2dec, int start, int end); -void mpeg2_pts (mpeg2dec_t * mpeg2dec, uint32_t pts); +void mpeg2_tag_picture (mpeg2dec_t * mpeg2dec, uint32_t tag, uint32_t tag2); void mpeg2_init_fbuf (mpeg2_decoder_t * decoder, uint8_t * current_fbuf[3], uint8_t * forward_fbuf[3], uint8_t * backward_fbuf[3]); void mpeg2_slice (mpeg2_decoder_t * decoder, int code, const uint8_t * buffer); +int mpeg2_guess_aspect (const mpeg2_sequence_t * sequence, + unsigned int * pixel_width, + unsigned int * pixel_height); + +typedef enum { + MPEG2_ALLOC_MPEG2DEC = 0, + MPEG2_ALLOC_CHUNK = 1, + MPEG2_ALLOC_YUV = 2, + MPEG2_ALLOC_CONVERT_ID = 3, + MPEG2_ALLOC_CONVERTED = 4 +} mpeg2_alloc_t; + +void * mpeg2_malloc (unsigned size, mpeg2_alloc_t reason); +void mpeg2_free (void * buf); +void mpeg2_malloc_hooks (void * malloc (unsigned, mpeg2_alloc_t), + int free (void *)); #endif /* MPEG2_H */ diff --git a/src/libmpeg2new/include/convert.h b/src/libmpeg2new/include/mpeg2convert.h index 8e4154d19..aac5d1991 100644 --- a/src/libmpeg2new/include/convert.h +++ b/src/libmpeg2new/include/mpeg2convert.h @@ -1,5 +1,5 @@ /* - * convert.h + * mpeg2convert.h * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org> * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> * @@ -21,36 +21,28 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef CONVERT_H -#define CONVERT_H +#ifndef MPEG2CONVERT_H +#define MPEG2CONVERT_H -#define CONVERT_FRAME 0 -#define CONVERT_TOP_FIELD 1 -#define CONVERT_BOTTOM_FIELD 2 -#define CONVERT_BOTH_FIELDS 3 +mpeg2_convert_t mpeg2convert_rgb32; +mpeg2_convert_t mpeg2convert_rgb24; +mpeg2_convert_t mpeg2convert_rgb16; +mpeg2_convert_t mpeg2convert_rgb15; +mpeg2_convert_t mpeg2convert_rgb8; +mpeg2_convert_t mpeg2convert_bgr32; +mpeg2_convert_t mpeg2convert_bgr24; +mpeg2_convert_t mpeg2convert_bgr16; +mpeg2_convert_t mpeg2convert_bgr15; +mpeg2_convert_t mpeg2convert_bgr8; -typedef struct convert_init_s { - void * id; - int id_size; - int buf_size[3]; - void (* start) (void * id, uint8_t * const * dest, int flags); - void (* copy) (void * id, uint8_t * const * src, unsigned int v_offset); -} convert_init_t; +typedef enum { + MPEG2CONVERT_RGB = 0, + MPEG2CONVERT_BGR = 1 +} mpeg2convert_rgb_order_t; -typedef void convert_t (int width, int height, uint32_t accel, void * arg, - convert_init_t * result); +mpeg2_convert_t * mpeg2convert_rgb (mpeg2convert_rgb_order_t order, + unsigned int bpp); -convert_t convert_rgb32; -convert_t convert_rgb24; -convert_t convert_rgb16; -convert_t convert_rgb15; -convert_t convert_bgr32; -convert_t convert_bgr24; -convert_t convert_bgr16; -convert_t convert_bgr15; +mpeg2_convert_t mpeg2convert_uyvy; -#define CONVERT_RGB 0 -#define CONVERT_BGR 1 -convert_t * convert_rgb (int order, int bpp); - -#endif /* CONVERT_H */ +#endif /* MPEG2CONVERT_H */ diff --git a/src/libmpeg2new/include/stamp-h1 b/src/libmpeg2new/include/stamp-h1 deleted file mode 100644 index b330768e9..000000000 --- a/src/libmpeg2new/include/stamp-h1 +++ /dev/null @@ -1 +0,0 @@ -timestamp for include/config.h diff --git a/src/libmpeg2new/include/video_out.h b/src/libmpeg2new/include/video_out.h index e7f661bbb..342c55197 100644 --- a/src/libmpeg2new/include/video_out.h +++ b/src/libmpeg2new/include/video_out.h @@ -21,15 +21,20 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -struct convert_init_s; +struct mpeg2_sequence_s; +struct mpeg2_convert_init_s; typedef struct { - void (* convert) (int, int, uint32_t, void *, struct convert_init_s *); + int (* convert) (int stage, void * id, + const struct mpeg2_sequence_s * sequence, + int stride, uint32_t accel, void * arg, + struct mpeg2_convert_init_s * result); } vo_setup_result_t; typedef struct vo_instance_s vo_instance_t; struct vo_instance_s { - int (* setup) (vo_instance_t * instance, int width, int height, - vo_setup_result_t * result); + int (* setup) (vo_instance_t * instance, unsigned int width, + unsigned int height, unsigned int chroma_width, + unsigned int chroma_height, vo_setup_result_t * result); void (* setup_fbuf) (vo_instance_t * instance, uint8_t ** buf, void ** id); void (* set_fbuf) (vo_instance_t * instance, uint8_t ** buf, void ** id); void (* start_fbuf) (vo_instance_t * instance, @@ -50,4 +55,4 @@ typedef struct { void vo_accel (uint32_t accel); /* return NULL terminated array of all drivers */ -vo_driver_t * vo_drivers (void); +vo_driver_t const * vo_drivers (void); diff --git a/src/libmpeg2new/include/vis.h b/src/libmpeg2new/include/vis.h new file mode 100644 index 000000000..69dd49075 --- /dev/null +++ b/src/libmpeg2new/include/vis.h @@ -0,0 +1,328 @@ +/* + * vis.h + * Copyright (C) 2003 David S. Miller <davem@redhat.com> + * + * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. + * See http://libmpeg2.sourceforge.net/ for updates. + * + * mpeg2dec is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * mpeg2dec is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* You may be asking why I hard-code the instruction opcodes and don't + * use the normal VIS assembler mnenomics for the VIS instructions. + * + * The reason is that Sun, in their infinite wisdom, decided that a binary + * using a VIS instruction will cause it to be marked (in the ELF headers) + * as doing so, and this prevents the OS from loading such binaries if the + * current cpu doesn't have VIS. There is no way to easily override this + * behavior of the assembler that I am aware of. + * + * This totally defeats what libmpeg2 is trying to do which is allow a + * single binary to be created, and then detect the availability of VIS + * at runtime. + * + * I'm not saying that tainting the binary by default is bad, rather I'm + * saying that not providing a way to override this easily unnecessarily + * ties people's hands. + * + * Thus, we do the opcode encoding by hand and output 32-bit words in + * the assembler to keep the binary from becoming tainted. + */ + +#define vis_opc_base ((0x1 << 31) | (0x36 << 19)) +#define vis_opf(X) ((X) << 5) +#define vis_sreg(X) (X) +#define vis_dreg(X) (((X)&0x1f)|((X)>>5)) +#define vis_rs1_s(X) (vis_sreg(X) << 14) +#define vis_rs1_d(X) (vis_dreg(X) << 14) +#define vis_rs2_s(X) (vis_sreg(X) << 0) +#define vis_rs2_d(X) (vis_dreg(X) << 0) +#define vis_rd_s(X) (vis_sreg(X) << 25) +#define vis_rd_d(X) (vis_dreg(X) << 25) + +#define vis_ss2s(opf,rs1,rs2,rd) \ + __asm__ __volatile__ (".word %0" \ + : : "i" (vis_opc_base | vis_opf(opf) | \ + vis_rs1_s(rs1) | \ + vis_rs2_s(rs2) | \ + vis_rd_s(rd))) + +#define vis_dd2d(opf,rs1,rs2,rd) \ + __asm__ __volatile__ (".word %0" \ + : : "i" (vis_opc_base | vis_opf(opf) | \ + vis_rs1_d(rs1) | \ + vis_rs2_d(rs2) | \ + vis_rd_d(rd))) + +#define vis_ss2d(opf,rs1,rs2,rd) \ + __asm__ __volatile__ (".word %0" \ + : : "i" (vis_opc_base | vis_opf(opf) | \ + vis_rs1_s(rs1) | \ + vis_rs2_s(rs2) | \ + vis_rd_d(rd))) + +#define vis_sd2d(opf,rs1,rs2,rd) \ + __asm__ __volatile__ (".word %0" \ + : : "i" (vis_opc_base | vis_opf(opf) | \ + vis_rs1_s(rs1) | \ + vis_rs2_d(rs2) | \ + vis_rd_d(rd))) + +#define vis_d2s(opf,rs2,rd) \ + __asm__ __volatile__ (".word %0" \ + : : "i" (vis_opc_base | vis_opf(opf) | \ + vis_rs2_d(rs2) | \ + vis_rd_s(rd))) + +#define vis_s2d(opf,rs2,rd) \ + __asm__ __volatile__ (".word %0" \ + : : "i" (vis_opc_base | vis_opf(opf) | \ + vis_rs2_s(rs2) | \ + vis_rd_d(rd))) + +#define vis_d12d(opf,rs1,rd) \ + __asm__ __volatile__ (".word %0" \ + : : "i" (vis_opc_base | vis_opf(opf) | \ + vis_rs1_d(rs1) | \ + vis_rd_d(rd))) + +#define vis_d22d(opf,rs2,rd) \ + __asm__ __volatile__ (".word %0" \ + : : "i" (vis_opc_base | vis_opf(opf) | \ + vis_rs2_d(rs2) | \ + vis_rd_d(rd))) + +#define vis_s12s(opf,rs1,rd) \ + __asm__ __volatile__ (".word %0" \ + : : "i" (vis_opc_base | vis_opf(opf) | \ + vis_rs1_s(rs1) | \ + vis_rd_s(rd))) + +#define vis_s22s(opf,rs2,rd) \ + __asm__ __volatile__ (".word %0" \ + : : "i" (vis_opc_base | vis_opf(opf) | \ + vis_rs2_s(rs2) | \ + vis_rd_s(rd))) + +#define vis_s(opf,rd) \ + __asm__ __volatile__ (".word %0" \ + : : "i" (vis_opc_base | vis_opf(opf) | \ + vis_rd_s(rd))) + +#define vis_d(opf,rd) \ + __asm__ __volatile__ (".word %0" \ + : : "i" (vis_opc_base | vis_opf(opf) | \ + vis_rd_d(rd))) + +#define vis_r2m(op,rd,mem) \ + __asm__ __volatile__ (#op "\t%%f" #rd ", [%0]" : : "r" (&(mem)) ) + +#define vis_r2m_2(op,rd,mem1,mem2) \ + __asm__ __volatile__ (#op "\t%%f" #rd ", [%0 + %1]" : : "r" (mem1), "r" (mem2) ) + +#define vis_m2r(op,mem,rd) \ + __asm__ __volatile__ (#op "\t[%0], %%f" #rd : : "r" (&(mem)) ) + +#define vis_m2r_2(op,mem1,mem2,rd) \ + __asm__ __volatile__ (#op "\t[%0 + %1], %%f" #rd : : "r" (mem1), "r" (mem2) ) + +static inline void vis_set_gsr(unsigned int _val) +{ + register unsigned int val asm("g1"); + + val = _val; + __asm__ __volatile__(".word 0xa7804000" + : : "r" (val)); +} + +#define VIS_GSR_ALIGNADDR_MASK 0x0000007 +#define VIS_GSR_ALIGNADDR_SHIFT 0 +#define VIS_GSR_SCALEFACT_MASK 0x0000078 +#define VIS_GSR_SCALEFACT_SHIFT 3 + +#define vis_ld32(mem,rs1) vis_m2r(ld, mem, rs1) +#define vis_ld32_2(mem1,mem2,rs1) vis_m2r_2(ld, mem1, mem2, rs1) +#define vis_st32(rs1,mem) vis_r2m(st, rs1, mem) +#define vis_st32_2(rs1,mem1,mem2) vis_r2m_2(st, rs1, mem1, mem2) +#define vis_ld64(mem,rs1) vis_m2r(ldd, mem, rs1) +#define vis_ld64_2(mem1,mem2,rs1) vis_m2r_2(ldd, mem1, mem2, rs1) +#define vis_st64(rs1,mem) vis_r2m(std, rs1, mem) +#define vis_st64_2(rs1,mem1,mem2) vis_r2m_2(std, rs1, mem1, mem2) + +#define vis_ldblk(mem, rd) \ +do { register void *__mem asm("g1"); \ + __mem = &(mem); \ + __asm__ __volatile__(".word 0xc1985e00 | %1" \ + : \ + : "r" (__mem), \ + "i" (vis_rd_d(rd)) \ + : "memory"); \ +} while (0) + +#define vis_stblk(rd, mem) \ +do { register void *__mem asm("g1"); \ + __mem = &(mem); \ + __asm__ __volatile__(".word 0xc1b85e00 | %1" \ + : \ + : "r" (__mem), \ + "i" (vis_rd_d(rd)) \ + : "memory"); \ +} while (0) + +#define vis_membar_storestore() \ + __asm__ __volatile__(".word 0x8143e008" : : : "memory") + +#define vis_membar_sync() \ + __asm__ __volatile__(".word 0x8143e040" : : : "memory") + +/* 16 and 32 bit partitioned addition and subtraction. The normal + * versions perform 4 16-bit or 2 32-bit additions or subtractions. + * The 's' versions perform 2 16-bit or 2 32-bit additions or + * subtractions. + */ + +#define vis_padd16(rs1,rs2,rd) vis_dd2d(0x50, rs1, rs2, rd) +#define vis_padd16s(rs1,rs2,rd) vis_ss2s(0x51, rs1, rs2, rd) +#define vis_padd32(rs1,rs2,rd) vis_dd2d(0x52, rs1, rs2, rd) +#define vis_padd32s(rs1,rs2,rd) vis_ss2s(0x53, rs1, rs2, rd) +#define vis_psub16(rs1,rs2,rd) vis_dd2d(0x54, rs1, rs2, rd) +#define vis_psub16s(rs1,rs2,rd) vis_ss2s(0x55, rs1, rs2, rd) +#define vis_psub32(rs1,rs2,rd) vis_dd2d(0x56, rs1, rs2, rd) +#define vis_psub32s(rs1,rs2,rd) vis_ss2s(0x57, rs1, rs2, rd) + +/* Pixel formatting instructions. */ + +#define vis_pack16(rs2,rd) vis_d2s( 0x3b, rs2, rd) +#define vis_pack32(rs1,rs2,rd) vis_dd2d(0x3a, rs1, rs2, rd) +#define vis_packfix(rs2,rd) vis_d2s( 0x3d, rs2, rd) +#define vis_expand(rs2,rd) vis_s2d( 0x4d, rs2, rd) +#define vis_pmerge(rs1,rs2,rd) vis_ss2d(0x4b, rs1, rs2, rd) + +/* Partitioned multiply instructions. */ + +#define vis_mul8x16(rs1,rs2,rd) vis_sd2d(0x31, rs1, rs2, rd) +#define vis_mul8x16au(rs1,rs2,rd) vis_ss2d(0x33, rs1, rs2, rd) +#define vis_mul8x16al(rs1,rs2,rd) vis_ss2d(0x35, rs1, rs2, rd) +#define vis_mul8sux16(rs1,rs2,rd) vis_dd2d(0x36, rs1, rs2, rd) +#define vis_mul8ulx16(rs1,rs2,rd) vis_dd2d(0x37, rs1, rs2, rd) +#define vis_muld8sux16(rs1,rs2,rd) vis_ss2d(0x38, rs1, rs2, rd) +#define vis_muld8ulx16(rs1,rs2,rd) vis_ss2d(0x39, rs1, rs2, rd) + +/* Alignment instructions. */ + +static inline void *vis_alignaddr(void *_ptr) +{ + register void *ptr asm("g1"); + + ptr = _ptr; + + __asm__ __volatile__(".word %2" + : "=&r" (ptr) + : "0" (ptr), + "i" (vis_opc_base | vis_opf(0x18) | + vis_rs1_s(1) | + vis_rs2_s(0) | + vis_rd_s(1))); + + return ptr; +} + +static inline void vis_alignaddr_g0(void *_ptr) +{ + register void *ptr asm("g1"); + + ptr = _ptr; + + __asm__ __volatile__(".word %2" + : "=&r" (ptr) + : "0" (ptr), + "i" (vis_opc_base | vis_opf(0x18) | + vis_rs1_s(1) | + vis_rs2_s(0) | + vis_rd_s(0))); +} + +static inline void *vis_alignaddrl(void *_ptr) +{ + register void *ptr asm("g1"); + + ptr = _ptr; + + __asm__ __volatile__(".word %2" + : "=&r" (ptr) + : "0" (ptr), + "i" (vis_opc_base | vis_opf(0x19) | + vis_rs1_s(1) | + vis_rs2_s(0) | + vis_rd_s(1))); + + return ptr; +} + +static inline void vis_alignaddrl_g0(void *_ptr) +{ + register void *ptr asm("g1"); + + ptr = _ptr; + + __asm__ __volatile__(".word %2" + : "=&r" (ptr) + : "0" (ptr), + "i" (vis_opc_base | vis_opf(0x19) | + vis_rs1_s(1) | + vis_rs2_s(0) | + vis_rd_s(0))); +} + +#define vis_faligndata(rs1,rs2,rd) vis_dd2d(0x48, rs1, rs2, rd) + +/* Logical operate instructions. */ + +#define vis_fzero(rd) vis_d( 0x60, rd) +#define vis_fzeros(rd) vis_s( 0x61, rd) +#define vis_fone(rd) vis_d( 0x7e, rd) +#define vis_fones(rd) vis_s( 0x7f, rd) +#define vis_src1(rs1,rd) vis_d12d(0x74, rs1, rd) +#define vis_src1s(rs1,rd) vis_s12s(0x75, rs1, rd) +#define vis_src2(rs2,rd) vis_d22d(0x78, rs2, rd) +#define vis_src2s(rs2,rd) vis_s22s(0x79, rs2, rd) +#define vis_not1(rs1,rd) vis_d12d(0x6a, rs1, rd) +#define vis_not1s(rs1,rd) vis_s12s(0x6b, rs1, rd) +#define vis_not2(rs2,rd) vis_d22d(0x66, rs2, rd) +#define vis_not2s(rs2,rd) vis_s22s(0x67, rs2, rd) +#define vis_or(rs1,rs2,rd) vis_dd2d(0x7c, rs1, rs2, rd) +#define vis_ors(rs1,rs2,rd) vis_ss2s(0x7d, rs1, rs2, rd) +#define vis_nor(rs1,rs2,rd) vis_dd2d(0x62, rs1, rs2, rd) +#define vis_nors(rs1,rs2,rd) vis_ss2s(0x63, rs1, rs2, rd) +#define vis_and(rs1,rs2,rd) vis_dd2d(0x70, rs1, rs2, rd) +#define vis_ands(rs1,rs2,rd) vis_ss2s(0x71, rs1, rs2, rd) +#define vis_nand(rs1,rs2,rd) vis_dd2d(0x6e, rs1, rs2, rd) +#define vis_nands(rs1,rs2,rd) vis_ss2s(0x6f, rs1, rs2, rd) +#define vis_xor(rs1,rs2,rd) vis_dd2d(0x6c, rs1, rs2, rd) +#define vis_xors(rs1,rs2,rd) vis_ss2s(0x6d, rs1, rs2, rd) +#define vis_xnor(rs1,rs2,rd) vis_dd2d(0x72, rs1, rs2, rd) +#define vis_xnors(rs1,rs2,rd) vis_ss2s(0x73, rs1, rs2, rd) +#define vis_ornot1(rs1,rs2,rd) vis_dd2d(0x7a, rs1, rs2, rd) +#define vis_ornot1s(rs1,rs2,rd) vis_ss2s(0x7b, rs1, rs2, rd) +#define vis_ornot2(rs1,rs2,rd) vis_dd2d(0x76, rs1, rs2, rd) +#define vis_ornot2s(rs1,rs2,rd) vis_ss2s(0x77, rs1, rs2, rd) +#define vis_andnot1(rs1,rs2,rd) vis_dd2d(0x68, rs1, rs2, rd) +#define vis_andnot1s(rs1,rs2,rd) vis_ss2s(0x69, rs1, rs2, rd) +#define vis_andnot2(rs1,rs2,rd) vis_dd2d(0x64, rs1, rs2, rd) +#define vis_andnot2s(rs1,rs2,rd) vis_ss2s(0x65, rs1, rs2, rd) + +/* Pixel component distance. */ + +#define vis_pdist(rs1,rs2,rd) vis_dd2d(0x3e, rs1, rs2, rd) |