diff options
31 files changed, 0 insertions, 13963 deletions
@@ -28,19 +28,6 @@ Copyright: 1998-2008 VideoLAN License: GNU General Public License -Name: libmpeg2 -Version: 0.5.1 + patches -URL: http://libmpeg2.sourceforge.net/ -Directory: libmpeg2 -Copyright: 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> - 2000-2004 Michel Lespinasse <walken@zoy.org> - 2002-2003 Falk Hueffner <falk@debian.org> - 2003 David S. Miller <davem@redhat.com> - 2003 Regis Duchesne <hpreg@zoy.org> - 2003 Peter Gubanov <peter@elecard.net.ru> -License: GNU General Public License - - Name: mpg123 Version: 0.59s + significant changes URL: http://www.mpg123.de/ @@ -109,26 +109,6 @@ SRCS_COMMON-$(LIBDVDCSS_INTERNAL) += libdvdcss/css.c \ SRCS_COMMON-$(LIBMAD) += libmpcodecs/ad_libmad.c -SRCS_LIBMPEG2-$(ARCH_ALPHA) += libmpeg2/idct_alpha.c \ - libmpeg2/motion_comp_alpha.c -SRCS_LIBMPEG2-$(ARCH_ARM) += libmpeg2/motion_comp_arm.c \ - libmpeg2/motion_comp_arm_s.S -SRCS_LIBMPEG2-$(HAVE_ALTIVEC) += libmpeg2/idct_altivec.c \ - libmpeg2/motion_comp_altivec.c -SRCS_LIBMPEG2-$(HAVE_MMX) += libmpeg2/idct_mmx.c \ - libmpeg2/motion_comp_mmx.c -SRCS_LIBMPEG2-$(HAVE_VIS) += libmpeg2/motion_comp_vis.c -SRCS_COMMON-$(LIBMPEG2) += libmpcodecs/vd_libmpeg2.c \ - libmpeg2/alloc.c \ - libmpeg2/cpu_accel.c\ - libmpeg2/cpu_state.c \ - libmpeg2/decode.c \ - libmpeg2/header.c \ - libmpeg2/idct.c \ - libmpeg2/motion_comp.c \ - libmpeg2/slice.c \ - $(SRCS_LIBMPEG2-yes) - SRCS_COMMON-$(LIBNEMESI) += libmpdemux/demux_nemesi.c \ stream/stream_nemesi.c SRCS_COMMON-$(LIBNUT) += libmpdemux/demux_nut.c @@ -609,7 +589,6 @@ DIRS = . \ libmpcodecs \ libmpcodecs/native \ libmpdemux \ - libmpeg2 \ libvo \ loader \ loader/dshow \ @@ -382,7 +382,6 @@ Codecs: --enable-libdca enable libdca support [autodetect] --disable-mp3lib disable builtin mp3lib [autodetect] --disable-liba52 disable liba52 [autodetect] - --disable-libmpeg2 disable builtin libmpeg2 [autodetect] --disable-musepack disable musepack support [autodetect] Video output: @@ -621,7 +620,6 @@ _mpg123=auto _mp3lib=auto _liba52=auto _libdca=auto -_libmpeg2=auto _faad=auto _ladspa=auto _libbs2b=auto @@ -987,8 +985,6 @@ for ac_option do --disable-liba52) _liba52=no ;; --enable-libdca) _libdca=yes ;; --disable-libdca) _libdca=no ;; - --enable-libmpeg2) _libmpeg2=yes ;; - --disable-libmpeg2) _libmpeg2=no ;; --enable-musepack) _musepack=yes ;; --disable-musepack) _musepack=no ;; --enable-faad) _faad=yes ;; @@ -3096,23 +3092,6 @@ if test "$_inttypes" = no ; then fi -echocheck "int_fastXY_t in inttypes.h" -_fast_inttypes=no -statement_check "inttypes.h" 'volatile int_fast16_t v = 0' && _fast_inttypes=yes -if test "$_fast_inttypes" = no ; then - def_fast_inttypes=' - typedef signed char int_fast8_t; - typedef signed int int_fast16_t; - typedef signed int int_fast32_t; - typedef signed long long int_fast64_t; - typedef unsigned char uint_fast8_t; - typedef unsigned int uint_fast16_t; - typedef unsigned int uint_fast32_t; - typedef unsigned long long uint_fast64_t;' -fi -echores "$_fast_inttypes" - - echocheck "malloc.h" _malloc=no header_check malloc.h && _malloc=yes @@ -5864,27 +5843,6 @@ else fi echores "$_liba52" -echocheck "internal libmpeg2 support" -if test "$_libmpeg2" = auto ; then - _libmpeg2=yes - if alpha && test cc_vendor=gnu; then - case $cc_version in - 2*|3.0*|3.1*) # cannot compile MVI instructions - _libmpeg2=no - res_comment="broken gcc" - ;; - esac - fi -fi -if test "$_libmpeg2" = yes ; then - def_libmpeg2='#define CONFIG_LIBMPEG2 1' - codecmodules="libmpeg2(internal) $codecmodules" -else - def_libmpeg2='#undef CONFIG_LIBMPEG2' - nocodecmodules="libmpeg2(internal) $nocodecmodules" -fi -echores "$_libmpeg2" - echocheck "libdca support" if test "$_libdca" = auto ; then _libdca=no @@ -6938,7 +6896,6 @@ LIBLZO = $_liblzo LIBMAD = $_mad LIBMENU = $_menu LIBMENU_DVBIN = $_menu_dvbin -LIBMPEG2 = $_libmpeg2 LIBNEMESI = $_nemesi LIBNUT = $_libnut LIBSMBCLIENT = $_smb @@ -7072,10 +7029,6 @@ cat > $TMPH << EOF #undef FAST_OSD #undef FAST_OSD_TABLE -/* Define this to enable MPEG-1/2 image postprocessing in libmpeg2 */ -#define MPEG12_POSTPROC 1 -#define ATTRIBUTE_ALIGNED_MAX 16 - #define CONFIGURATION "$configuration" @@ -7089,8 +7042,6 @@ $def_translation /* definitions needed by included libraries */ #define HAVE_INTTYPES_H 1 -/* libmpeg2 + FFmpeg */ -$def_fast_inttypes /* libdvdcss */ #define HAVE_ERRNO_H 1 /* libdvdcss + libdvdread */ @@ -7219,7 +7170,6 @@ $def_liba52 $def_libdca $def_libdv $def_liblzo -$def_libmpeg2 $def_mad $def_mp3lib $def_mpg123 diff --git a/etc/codecs.conf b/etc/codecs.conf index f80d717043..be54e79035 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -255,45 +255,6 @@ videocodec ffmpeg12 out YV12,I420,IYUV out 422P,444P -videocodec mpeg12 - info "MPEG-1 or 2 (libmpeg2)" - comment "with postprocessing" - status working - format 0x10000001 ; MPEG-1 - format 0x10000002 ; MPEG-2 - fourcc "DVR " - fourcc hdv2 - fourcc mpg1 - fourcc PIM1 ; Pinnacle hardware-MPEG-1 - fourcc PIM2 ; Pinnacle hardware-MPEG-2 - fourcc mpg2,MPG2 - fourcc MPEG - fourcc hdv1 - fourcc hdv3 ; HDV 1080i50 - fourcc hdv5 ; HDV 720p25 - fourcc mx5p ; MPEG IMX 625/50 (50 Mb/s) - fourcc MMES,mmes ; matrox mpeg2 in avi - fourcc M701 ; matrox mpeg2 intra-only - fourcc hdv6,hdv7,hdv8 - fourcc xdv1,xdv2,xdv3 - fourcc xdv4,xdv5,xdv6 - fourcc xdv7,xdv8,xdv9 - fourcc xdva,xdvb,xdvc - fourcc xdvd,xdve,xdvf - fourcc xd5a,xd5b,xd5c - fourcc xd5d,xd5e,xd5f - fourcc xd59,xd54 - fourcc mx5n,mx4n,mx4p - fourcc mx3n,mx3p - fourcc AVmp - fourcc mp2v,mpgv - fourcc m2v1,m1v1 - fourcc LMP2 ; Lead mpeg2 in avi - driver libmpeg2 -; dll "libmpeg2" - out YV12,I420,IYUV - out 422P - videocodec ffmpeg12mc info "FFmpeg MPEG-1/2 (XvMC)" status buggy diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c index cbe979a100..c54ae5260b 100644 --- a/libmpcodecs/vd.c +++ b/libmpcodecs/vd.c @@ -50,7 +50,6 @@ extern const vd_functions_t mpcodecs_vd_mpng; extern const vd_functions_t mpcodecs_vd_ijpg; extern const vd_functions_t mpcodecs_vd_mtga; extern const vd_functions_t mpcodecs_vd_sgi; -extern const vd_functions_t mpcodecs_vd_libmpeg2; extern const vd_functions_t mpcodecs_vd_mpegpes; extern const vd_functions_t mpcodecs_vd_realvid; extern const vd_functions_t mpcodecs_vd_xvid; @@ -90,9 +89,6 @@ const vd_functions_t * const mpcodecs_vd_drivers[] = { #endif &mpcodecs_vd_mtga, &mpcodecs_vd_sgi, -#ifdef CONFIG_LIBMPEG2 - &mpcodecs_vd_libmpeg2, -#endif &mpcodecs_vd_mpegpes, #ifdef CONFIG_REALCODECS &mpcodecs_vd_realvid, diff --git a/libmpcodecs/vd_libmpeg2.c b/libmpcodecs/vd_libmpeg2.c deleted file mode 100644 index c686ad67a4..0000000000 --- a/libmpcodecs/vd_libmpeg2.c +++ /dev/null @@ -1,314 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer 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. - * - * MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <stdio.h> -#include <stdlib.h> - -#include "config.h" -#include "options.h" -#include "mp_msg.h" - -#include "vd_internal.h" - -//#undef MPEG12_POSTPROC - -static const vd_info_t info = -{ - "libmpeg2 MPEG 1/2 Video decoder", - "libmpeg2", - "A'rpi & Fabian Franz", - "Aaron & Walken", - "native" -}; - -LIBVD_EXTERN(libmpeg2) - -//#include "libvo/video_out.h" // FIXME!!! - -#include "libmpeg2/mpeg2.h" -#include "libmpeg2/attributes.h" -#include "libmpeg2/mpeg2_internal.h" - -#include "cpudetect.h" - -typedef struct { - mpeg2dec_t *mpeg2dec; - int quant_store_idx; - char *quant_store[3]; - int imgfmt; - int width; - int height; - double aspect; -} vd_libmpeg2_ctx_t; - -// to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,void* arg,...){ - vd_libmpeg2_ctx_t *context = sh->context; - mpeg2dec_t * mpeg2dec = context->mpeg2dec; - const mpeg2_info_t * info = mpeg2_info (mpeg2dec); - - switch(cmd) { - case VDCTRL_QUERY_FORMAT: - if (info->sequence->width >> 1 == info->sequence->chroma_width && - info->sequence->height >> 1 == info->sequence->chroma_height && - (*((int*)arg)) == IMGFMT_YV12) - return CONTROL_TRUE; - if (info->sequence->width >> 1 == info->sequence->chroma_width && - info->sequence->height == info->sequence->chroma_height && - (*((int*)arg)) == IMGFMT_422P) - return CONTROL_TRUE; - return CONTROL_FALSE; - } - - return CONTROL_UNKNOWN; -} - -// init driver -static int init(sh_video_t *sh){ - vd_libmpeg2_ctx_t *context; - mpeg2dec_t * mpeg2dec; -// const mpeg2_info_t * info; - int accel; - - accel = 0; - if(gCpuCaps.hasMMX) - accel |= MPEG2_ACCEL_X86_MMX; - if(gCpuCaps.hasMMX2) - accel |= MPEG2_ACCEL_X86_MMXEXT; - if(gCpuCaps.has3DNow) - accel |= MPEG2_ACCEL_X86_3DNOW; - if(gCpuCaps.hasSSE2) - accel |= MPEG2_ACCEL_X86_SSE2; - if(gCpuCaps.hasAltiVec) - accel |= MPEG2_ACCEL_PPC_ALTIVEC; - #if ARCH_ALPHA - accel |= MPEG2_ACCEL_ALPHA; - #elif ARCH_ARM - accel |= MPEG2_ACCEL_ARM; - #endif - #if HAVE_MVI - accel |= MPEG2_ACCEL_ALPHA_MVI; - #elif HAVE_VIS - accel |= MPEG2_ACCEL_SPARC_VIS; - #endif - mpeg2_accel(accel); - - mpeg2dec = mpeg2_init (); - - if(!mpeg2dec) return 0; - - mpeg2_custom_fbuf(mpeg2dec,1); // enable DR1 - - context = calloc(1, sizeof(vd_libmpeg2_ctx_t)); - context->mpeg2dec = mpeg2dec; - sh->context = context; - - mpeg2dec->pending_buffer = 0; - mpeg2dec->pending_length = 0; - - return 1; -} - -// uninit driver -static void uninit(sh_video_t *sh){ - int i; - vd_libmpeg2_ctx_t *context = sh->context; - mpeg2dec_t * mpeg2dec = context->mpeg2dec; - free(mpeg2dec->pending_buffer); - mpeg2dec->decoder.convert=NULL; - mpeg2dec->decoder.convert_id=NULL; - mpeg2_close (mpeg2dec); - for (i=0; i < 3; i++) - free(context->quant_store[i]); - free(sh->context); -} - -static void draw_slice (void * _sh, uint8_t * const * src, unsigned int y){ - sh_video_t* sh = (sh_video_t*) _sh; - vd_libmpeg2_ctx_t *context = sh->context; - mpeg2dec_t* mpeg2dec = context->mpeg2dec; - const mpeg2_info_t * info = mpeg2_info (mpeg2dec); - int stride[MP_MAX_PLANES] = {mpeg2dec->decoder.stride, mpeg2dec->decoder.uv_stride, mpeg2dec->decoder.uv_stride}; - uint8_t *srcs[MP_MAX_PLANES] = {src[0], src[1], src[2]}; - -// printf("draw_slice() y=%d \n",y); - - mpcodecs_draw_slice(sh, srcs, - stride, info->sequence->picture_width, - (y+16<=info->sequence->picture_height) ? 16 : - info->sequence->picture_height-y, - 0, y); -} - -// decode a frame -static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ - vd_libmpeg2_ctx_t *context = sh->context; - mpeg2dec_t * mpeg2dec = context->mpeg2dec; - const mpeg2_info_t * info = mpeg2_info (mpeg2dec); - int drop_frame, framedrop=flags&3; - - // MPlayer registers its own draw_slice callback, prevent libmpeg2 from freeing the context - mpeg2dec->decoder.convert=NULL; - mpeg2dec->decoder.convert_id=NULL; - - if(len<=0) return NULL; // skipped null frame - - // append extra 'end of frame' code: - ((char*)data+len)[0]=0; - ((char*)data+len)[1]=0; - ((char*)data+len)[2]=1; - ((char*)data+len)[3]=0xff; - len+=4; - - if (mpeg2dec->pending_length) { - mpeg2_buffer (mpeg2dec, mpeg2dec->pending_buffer, mpeg2dec->pending_buffer + mpeg2dec->pending_length); - } else { - mpeg2_buffer (mpeg2dec, data, (uint8_t *)data+len); - } - - while(1){ - int state=mpeg2_parse (mpeg2dec); - int type, use_callback; - mp_image_t* mpi_new; - unsigned long pw, ph; - int imgfmt; - - switch(state){ - case STATE_BUFFER: - if (mpeg2dec->pending_length) { - // just finished the pending data, continue with processing of the passed buffer - mpeg2dec->pending_length = 0; - mpeg2_buffer (mpeg2dec, data, (uint8_t *)data+len); - } else { - // parsing of the passed buffer finished, return. - return 0; - } - break; - case STATE_SEQUENCE: - pw = info->sequence->display_width * info->sequence->pixel_width; - ph = info->sequence->display_height * info->sequence->pixel_height; - if(ph) sh->aspect = (float) pw / (float) ph; - // video parameters initialized/changed, (re)init libvo: - if (info->sequence->width >> 1 == info->sequence->chroma_width && - info->sequence->height >> 1 == info->sequence->chroma_height) { - imgfmt = IMGFMT_YV12; - } else if (info->sequence->width >> 1 == info->sequence->chroma_width && - info->sequence->height == info->sequence->chroma_height) { - imgfmt = IMGFMT_422P; - } else return 0; - if (imgfmt == context->imgfmt && - info->sequence->picture_width == context->width && - info->sequence->picture_height == context->height && - sh->aspect == context->aspect) - break; - if(!mpcodecs_config_vo(sh, - info->sequence->picture_width, - info->sequence->picture_height, imgfmt)) - return 0; - context->imgfmt = imgfmt; - context->width = info->sequence->picture_width; - context->height = info->sequence->picture_height; - context->aspect = sh->aspect; - break; - case STATE_PICTURE: - type=info->current_picture->flags&PIC_MASK_CODING_TYPE; - - drop_frame = framedrop && (mpeg2dec->decoder.coding_type == B_TYPE); - drop_frame |= framedrop>=2; // hard drop - if (drop_frame) { - mpeg2_skip(mpeg2dec, 1); - //printf("Dropping Frame ...\n"); - break; - } - mpeg2_skip(mpeg2dec, 0); //mpeg2skip skips frames until set again to 0 - - use_callback = (!framedrop && sh->opts->vd_use_slices && - (info->current_picture->flags&PIC_FLAG_PROGRESSIVE_FRAME)) ? - MP_IMGFLAG_DRAW_CALLBACK:0; - - // get_buffer "callback": - mpi_new=mpcodecs_get_image(sh,MP_IMGTYPE_IPB, - (type==PIC_FLAG_CODING_TYPE_B) ? - use_callback : (MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE), - info->sequence->width, - info->sequence->height); - - if(!mpi_new) return 0; // VO ERROR!!!!!!!! - mpeg2_set_buf(mpeg2dec, mpi_new->planes, mpi_new); - mpi_new->stride[0] = info->sequence->width; - mpi_new->stride[1] = info->sequence->chroma_width; - mpi_new->stride[2] = info->sequence->chroma_width; - if (info->current_picture->flags&PIC_FLAG_TOP_FIELD_FIRST) - mpi_new->fields |= MP_IMGFIELD_TOP_FIRST; - else mpi_new->fields &= ~MP_IMGFIELD_TOP_FIRST; - if (info->current_picture->flags&PIC_FLAG_REPEAT_FIRST_FIELD) - mpi_new->fields |= MP_IMGFIELD_REPEAT_FIRST; - else mpi_new->fields &= ~MP_IMGFIELD_REPEAT_FIRST; - mpi_new->fields |= MP_IMGFIELD_ORDERED; - if (!(info->current_picture->flags&PIC_FLAG_PROGRESSIVE_FRAME)) - mpi_new->fields |= MP_IMGFIELD_INTERLACED; - -#ifdef MPEG12_POSTPROC - mpi_new->qstride=info->sequence->width>>4; - { - char **p = &context->quant_store[type==PIC_FLAG_CODING_TYPE_B ? - 2 : (context->quant_store_idx ^= 1)]; - *p = realloc(*p, mpi_new->qstride*(info->sequence->height>>4)); - mpi_new->qscale = *p; - } - mpeg2dec->decoder.quant_store=mpi_new->qscale; - mpeg2dec->decoder.quant_stride=mpi_new->qstride; - mpi_new->pict_type=type; // 1->I, 2->P, 3->B - mpi_new->qscale_type= 1; -#endif - - if (mpi_new->flags&MP_IMGFLAG_DRAW_CALLBACK - && !(mpi_new->flags&MP_IMGFLAG_DIRECT)) { - // nice, filter/vo likes draw_callback :) - mpeg2dec->decoder.convert=draw_slice; - mpeg2dec->decoder.convert_id=sh; - } else { - mpeg2dec->decoder.convert=NULL; - mpeg2dec->decoder.convert_id=NULL; - } - - break; - case STATE_SLICE: - case STATE_END: - case STATE_INVALID_END: - // decoding done: - if(info->display_fbuf) { - mp_image_t* mpi = info->display_fbuf->id; - if (mpeg2dec->pending_length == 0) { - mpeg2dec->pending_length = mpeg2dec->buf_end - mpeg2dec->buf_start; - mpeg2dec->pending_buffer = realloc(mpeg2dec->pending_buffer, mpeg2dec->pending_length); - memcpy(mpeg2dec->pending_buffer, mpeg2dec->buf_start, mpeg2dec->pending_length); - } else { - // still some data in the pending buffer, shouldn't happen - mpeg2dec->pending_length = mpeg2dec->buf_end - mpeg2dec->buf_start; - memmove(mpeg2dec->pending_buffer, mpeg2dec->buf_start, mpeg2dec->pending_length); - mpeg2dec->pending_buffer = realloc(mpeg2dec->pending_buffer, mpeg2dec->pending_length + len); - memcpy(mpeg2dec->pending_buffer+mpeg2dec->pending_length, data, len); - mpeg2dec->pending_length += len; - } -// fprintf(stderr, "pending = %d\n", mpeg2dec->pending_length); - return mpi; - } - } - } -} diff --git a/libmpeg2/alloc.c b/libmpeg2/alloc.c deleted file mode 100644 index 71bc18b692..0000000000 --- a/libmpeg2/alloc.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * alloc.c - * Copyright (C) 2000-2003 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. - * 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 - */ - -#include <stdlib.h> -#include <inttypes.h> - -#include "mpeg2.h" - -static void * (* malloc_hook) (unsigned size, mpeg2_alloc_t reason) = NULL; -static int (* free_hook) (void * buf) = NULL; - -void * mpeg2_malloc (unsigned size, mpeg2_alloc_t reason) -{ - char * buf; - - if (malloc_hook) { - buf = (char *) malloc_hook (size, reason); - if (buf) - return buf; - } - - if (size) { - buf = (char *) malloc (size + 63 + sizeof (void **)); - if (buf) { - char * align_buf; - - align_buf = buf + 63 + sizeof (void **); - align_buf -= (long)align_buf & 63; - *(((void **)align_buf) - 1) = buf; - return align_buf; - } - } - return NULL; -} - -void mpeg2_free (void * buf) -{ - if (free_hook && free_hook (buf)) - return; - - if (buf) - free (*(((void **)buf) - 1)); -} - -void mpeg2_malloc_hooks (void * alloc_func (unsigned, mpeg2_alloc_t), - int free_func (void *)) -{ - malloc_hook = alloc_func; - free_hook = free_func; -} diff --git a/libmpeg2/alpha_asm.h b/libmpeg2/alpha_asm.h deleted file mode 100644 index 8cebbcb817..0000000000 --- a/libmpeg2/alpha_asm.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Alpha assembly macros - * Copyright (c) 2002-2003 Falk Hueffner <falk@debian.org> - * - * 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 - */ - -#ifndef LIBMPEG2_ALPHA_ASM_H -#define LIBMPEG2_ALPHA_ASM_H - -#include <inttypes.h> - -#if defined __GNUC__ -# define GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -#else -# define GNUC_PREREQ(maj, min) 0 -#endif - -#define AMASK_BWX (1 << 0) -#define AMASK_FIX (1 << 1) -#define AMASK_CIX (1 << 2) -#define AMASK_MVI (1 << 8) - -#ifdef __alpha_bwx__ -# define HAVE_BWX() 1 -#else -# define HAVE_BWX() (amask(AMASK_BWX) == 0) -#endif -#ifdef __alpha_fix__ -# define HAVE_FIX() 1 -#else -# define HAVE_FIX() (amask(AMASK_FIX) == 0) -#endif -#ifdef __alpha_max__ -# define HAVE_MVI() 1 -#else -# define HAVE_MVI() (amask(AMASK_MVI) == 0) -#endif -#ifdef __alpha_cix__ -# define HAVE_CIX() 1 -#else -# define HAVE_CIX() (amask(AMASK_CIX) == 0) -#endif - -inline static uint64_t BYTE_VEC(uint64_t x) -{ - x |= x << 8; - x |= x << 16; - x |= x << 32; - return x; -} -inline static uint64_t WORD_VEC(uint64_t x) -{ - x |= x << 16; - x |= x << 32; - return x; -} - -#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) -#define sextw(x) ((int16_t) (x)) - -#ifdef __GNUC__ -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_PREREQ(3,3) -#define prefetch(p) __builtin_prefetch((p), 0, 1) -#define prefetch_en(p) __builtin_prefetch((p), 0, 0) -#define prefetch_m(p) __builtin_prefetch((p), 1, 1) -#define prefetch_men(p) __builtin_prefetch((p), 1, 0) -#define cmpbge __builtin_alpha_cmpbge -/* Avoid warnings. */ -#define extql(a, b) __builtin_alpha_extql(a, (uint64_t) (b)) -#define extwl(a, b) __builtin_alpha_extwl(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 -#else -#define prefetch(p) asm volatile("ldl $31,%0" : : "m"(*(const char *) (p)) : "memory") -#define prefetch_en(p) asm volatile("ldq $31,%0" : : "m"(*(const char *) (p)) : "memory") -#define prefetch_m(p) asm volatile("lds $f31,%0" : : "m"(*(const char *) (p)) : "memory") -#define prefetch_men(p) asm volatile("ldt $f31,%0" : : "m"(*(const char *) (p)) : "memory") -#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 extwl(a, b) ({ uint64_t __r; asm ("extwl %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; }) -#endif -#define wh64(p) asm volatile("wh64 (%0)" : : "r"(p) : "memory") - -#if GNUC_PREREQ(3,3) && defined(__alpha_max__) -#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 |