Pull in various bug fixes and improvements from upstream...

- accelerate the exit from the audio and video threads when we want to exit
- GCC 4 fixes
- Handle automatic endian swapping
- Fix multi-threaded crash when rewinding and seeking during playback
- Fix minor compiler warning
- Check for SDL_CreateYUVOverlay() failure
- Add missing decleration of stack markings
- Support PIC properly and no longer contains any TEXTRELs
- Use SDL to decide about byte order

Also remove pval as MAINTAINER as he has not been active in ages.

Could someone please do a build/runtime test on i386 by trying to
play an MPEG video with plaympeg?

OK?


Index: Makefile
===================================================================
RCS file: /home/cvs/ports/devel/smpeg/Makefile,v
retrieving revision 1.40
diff -u -p -r1.40 Makefile
--- Makefile    21 Mar 2013 08:45:16 -0000      1.40
+++ Makefile    4 Dec 2013 03:06:26 -0000
@@ -3,15 +3,13 @@
 COMMENT=       MPEG video player library with sound support
 
 DISTNAME=      smpeg-0.4.4
-REVISION=      12
+REVISION=      13
 CATEGORIES=    devel graphics
 MASTER_SITES=  http://mirrors.sunsite.dk/lokigames/open-source/smpeg/
 
 SHARED_LIBS=   smpeg   2.0
 
 HOMEPAGE=      http://icculus.org/smpeg/
-
-MAINTAINER=    Peter Valchev <pvalc...@openbsd.org>
 
 # GPLv2+
 PERMIT_PACKAGE_CDROM=   Yes
Index: patches/patch-MPEGaction_h
===================================================================
RCS file: patches/patch-MPEGaction_h
diff -N patches/patch-MPEGaction_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-MPEGaction_h  4 Dec 2013 03:51:50 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+accelerate the exit from the audio and video threads when we want to exit.
+
+--- MPEGaction.h.orig  Tue Dec  3 22:04:09 2013
++++ MPEGaction.h       Tue Dec  3 22:04:36 2013
+@@ -70,6 +70,8 @@ class MPEGaction { (protected)
+     bool looping;
+     double play_time;
+ 
++    bool force_exit;
++
+     void ResetPause(void) {
+         paused = false;
+     }
Index: patches/patch-MPEGaudio_h
===================================================================
RCS file: /home/cvs/ports/devel/smpeg/patches/patch-MPEGaudio_h,v
retrieving revision 1.1
diff -u -p -r1.1 patch-MPEGaudio_h
--- patches/patch-MPEGaudio_h   9 May 2010 15:17:18 -0000       1.1
+++ patches/patch-MPEGaudio_h   4 Dec 2013 03:45:51 -0000
@@ -1,17 +1,61 @@
 $OpenBSD: patch-MPEGaudio_h,v 1.1 2010/05/09 15:17:18 robert Exp $
---- MPEGaudio.h.orig   Sun May  9 17:10:03 2010
-+++ MPEGaudio.h        Sun May  9 17:10:20 2010
-@@ -148,6 +148,13 @@ class Mpegbitwindow (private)
-   char buffer[2*WINDOWSIZE];
- };
+
+- GCC 4 fixes
+- Handle automatic endian swapping
+
+--- MPEGaudio.h.orig   Tue Dec  3 21:59:55 2013
++++ MPEGaudio.h        Tue Dec  3 22:03:09 2013
+@@ -32,6 +32,11 @@
+ #include "MPEGring.h"
+ #endif
  
-+class MPEGaudio;
-+      void Play_MPEGaudioSDL(void *udata, Uint8 *stream, int len);
-+      int Play_MPEGaudio(MPEGaudio *audio, Uint8 *stream, int len);
++void Play_MPEGaudioSDL(void *udata, Uint8 *stream, int len);
 +#ifdef THREADED_AUDIO
-+      int Decode_MPEGaudio(void *udata);
++    int Decode_MPEGaudio(void *udata);
 +#endif
 +
+ class MPEGstream;
+ 
+ /* MPEG/WAVE Sound library
+@@ -151,12 +156,6 @@ class Mpegbitwindow (private)
  /* The actual MPEG audio class */
  class MPEGaudio : public MPEGerror, public MPEGaudioaction {
  
+-    friend void Play_MPEGaudioSDL(void *udata, Uint8 *stream, int len);
+-    friend int Play_MPEGaudio(MPEGaudio *audio, Uint8 *stream, int len);
+-#ifdef THREADED_AUDIO
+-    friend int Decode_MPEGaudio(void *udata);
+-#endif
+-
+ public:
+     MPEGaudio(MPEGstream *stream, bool initSDL = true);
+     virtual ~MPEGaudio();
+@@ -223,6 +222,7 @@ class MPEGaudio : public MPEGerror, public MPEGaudioac
+ private:
+   bool forcetomonoflag;
+   bool forcetostereoflag;
++  bool swapendianflag;
+   int  downfrequency;
+ 
+ public:
+@@ -366,6 +366,20 @@ class MPEGaudio : public MPEGerror, public MPEGaudioac
+ #define N_TIMESTAMPS 5
+ 
+   double timestamp[N_TIMESTAMPS];
++
++  /* Functions which access MPEGaudio internals */
++  friend void Play_MPEGaudioSDL(void *udata, Uint8 *stream, int len);
++  friend int Play_MPEGaudio(MPEGaudio *audio, Uint8 *stream, int len);
++#ifdef THREADED_AUDIO
++  friend int Decode_MPEGaudio(void *udata);
++#endif
+ };
++
++/* Need to duplicate the prototypes, this is not a typo :) */
++void Play_MPEGaudioSDL(void *udata, Uint8 *stream, int len);
++int Play_MPEGaudio(MPEGaudio *audio, Uint8 *stream, int len);
++#ifdef THREADED_AUDIO
++int Decode_MPEGaudio(void *udata);
++#endif
+ 
+ #endif /* _MPEGAUDIO_H_ */
Index: patches/patch-audio_MPEGaudio_cpp
===================================================================
RCS file: /home/cvs/ports/devel/smpeg/patches/patch-audio_MPEGaudio_cpp,v
retrieving revision 1.2
diff -u -p -r1.2 patch-audio_MPEGaudio_cpp
--- patches/patch-audio_MPEGaudio_cpp   25 Jan 2009 01:25:39 -0000      1.2
+++ patches/patch-audio_MPEGaudio_cpp   4 Dec 2013 03:44:40 -0000
@@ -1,7 +1,22 @@
 $OpenBSD: patch-audio_MPEGaudio_cpp,v 1.2 2009/01/25 01:25:39 jakemsr Exp $
---- audio/MPEGaudio.cpp.orig   Wed Apr  4 13:42:40 2001
-+++ audio/MPEGaudio.cpp        Sat Jan 24 04:31:08 2009
-@@ -54,10 +54,16 @@ MPEGaudio:: MPEGaudio(MPEGstream *stream, bool initSDL
+
+- accelerate the exit from the audio and video threads when we want to exit.
+- GCC 4 fixes
+- Handle automatic endian swapping
+- Fix multi-threaded crash when rewinding and seeking during playback
+
+--- audio/MPEGaudio.cpp.orig   Wed Apr  4 16:42:40 2001
++++ audio/MPEGaudio.cpp        Tue Dec  3 22:42:37 2013
+@@ -21,6 +21,8 @@
+ 
+ /* A class based on the MPEG stream class, used to parse and play audio */
+ 
++using namespace std;
++
+ #include "MPEGaudio.h"
+ #include "MPEGstream.h"
+ 
+@@ -54,10 +56,16 @@ MPEGaudio:: MPEGaudio(MPEGstream *stream, bool initSDL
          if ( sdl_audio ) {
              /* Open the audio, get actual audio hardware format and convert */
              bool audio_active;
@@ -18,7 +33,7 @@ $OpenBSD: patch-audio_MPEGaudio_cpp,v 1.
                  valid_stream = true;
              } else {
                  SetError(SDL_GetError());
-@@ -112,6 +118,8 @@ MPEGaudio:: WantedSpec(SDL_AudioSpec *wanted)
+@@ -112,6 +120,8 @@ MPEGaudio:: WantedSpec(SDL_AudioSpec *wanted)
  void
  MPEGaudio:: ActualSpec(const SDL_AudioSpec *actual)
  {
@@ -27,17 +42,38 @@ $OpenBSD: patch-audio_MPEGaudio_cpp,v 1.
      /* Splay can optimize some of the conversion */
      if ( actual->channels == 1 && outputstereo ) {
          forcetomonoflag = true;
-@@ -131,6 +139,9 @@ MPEGaudio:: ActualSpec(const SDL_AudioSpec *actual)
+@@ -131,13 +141,16 @@ MPEGaudio:: ActualSpec(const SDL_AudioSpec *actual)
        ;
  #endif
      }
+-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+-    if ( actual->format != AUDIO_S16LSB)
+-#else
+-    if ( actual->format != AUDIO_S16MSB)
+-#endif
 +
 +#endif        /* DISABLE_SDL_CONVERSIONS */
 +
- #if SDL_BYTEORDER == SDL_LIL_ENDIAN
-     if ( actual->format != AUDIO_S16LSB)
- #else
-@@ -200,9 +211,11 @@ void
++    if ( actual->format != AUDIO_S16SYS )
+     {
+-        fprintf(stderr, "Warning: incorrect audio format\n");
++        if ( (actual->format^0x1000) == AUDIO_S16SYS ) {
++            swapendianflag = true;
++        } else {
++            fprintf(stderr, "Warning: incorrect audio format\n");
++        }
+     }
+     
rate_in_s=((double)((actual->format&0xFF)/8)*actual->channels*actual->freq);
+     stereo=((actual->channels-1) > 0);
+@@ -161,6 +174,7 @@ MPEGaudio:: StopDecoding(void)
+ {
+     decoding = false;
+     if ( decode_thread ) {
++        force_exit = true;
+         if( ring ) ring->ReleaseThreads();
+         SDL_WaitThread(decode_thread, NULL);
+         decode_thread = NULL;
+@@ -200,9 +214,11 @@ void
  MPEGaudio:: Stop(void)
  {
      if ( valid_stream ) {
@@ -51,3 +87,36 @@ $OpenBSD: patch-audio_MPEGaudio_cpp,v 1.
      }
      ResetPause();
  }
+@@ -234,14 +250,24 @@ MPEGaudio:: ResetSynchro(double time)
+ void
+ MPEGaudio:: Skip(float seconds)
+ {
+-   /* Called only when there is no timestamp info in the MPEG */
+-   printf("Audio: Skipping %f seconds...\n", seconds);
+-   while(seconds > 0)
+-   {
+-     seconds -= (float) samplesperframe / ((float) 
frequencies[version][frequency]*(1+inputstereo));
+-     if(!loadheader()) break;
+-   }
+- }
++#ifdef THREADED_AUDIO
++    /* Stop the decode thread */
++    StopDecoding();
++#endif
++
++    /* Called only when there is no timestamp info in the MPEG */
++    //printf("Audio: Skipping %f seconds...\n", seconds);
++    while(seconds > 0)
++    {
++        seconds -= (float) samplesperframe / ((float) 
frequencies[version][frequency]*(1+inputstereo));
++        if(!loadheader()) break;
++    }
++
++#ifdef THREADED_AUDIO
++    StartDecoding();
++#endif
++}
++
+ void
+ MPEGaudio:: Volume(int vol)
+ {
Index: patches/patch-audio_mpegtoraw_cpp
===================================================================
RCS file: patches/patch-audio_mpegtoraw_cpp
diff -N patches/patch-audio_mpegtoraw_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-audio_mpegtoraw_cpp   4 Dec 2013 03:47:22 -0000
@@ -0,0 +1,69 @@
+$OpenBSD$
+
+- accelerate the exit from the audio and video threads when we want to exit
+- Handle automatic endian swapping
+- Fix minor compiler warning
+
+--- audio/mpegtoraw.cpp.orig   Tue Dec  3 17:09:45 2013
++++ audio/mpegtoraw.cpp        Tue Dec  3 21:59:30 2013
+@@ -87,6 +87,7 @@ void MPEGaudio::initialize()
+   stereo = true;
+   forcetomonoflag = false;
+   forcetostereoflag = false;
++  swapendianflag = false;
+   downfrequency = 0;
+ 
+   scalefactor=SCALE;
+@@ -286,18 +287,30 @@ bool MPEGaudio::run( int frames, double *timestamp)
+         return false;   
+         }
+ 
+-        if (frames == totFrames  && timestamp != NULL)
++        if (frames == totFrames  && timestamp != NULL) {
+             if (last_timestamp != mpeg->timestamp){
+               if (mpeg->timestamp_pos <= _buffer_pos)
+                   last_timestamp = *timestamp = mpeg->timestamp;
+           }
+             else
+                 *timestamp = -1;
++        }
+ 
+         if     ( layer == 3 ) extractlayer3();
+         else if( layer == 2 ) extractlayer2();
+         else if( layer == 1 ) extractlayer1();
+ 
++        /* Handle swapping data endianness */
++        if ( swapendianflag ) {
++            Sint16 *p;
++
++            p = rawdata+rawdatawriteoffset;
++            while ( p > rawdata ) {
++                --p;
++                *p = SDL_Swap16(*p);
++            }
++        }
++
+         /* Handle expanding to stereo output */
+         if ( forcetostereoflag ) {
+             Sint16 *in, *out;
+@@ -334,7 +347,8 @@ int Decode_MPEGaudio(void *udata)
+     SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
+ #endif
+ 
+-    while ( audio->decoding && ! audio->mpeg->eof() ) {
++    audio->force_exit = false;
++    while ( audio->decoding && ! audio->mpeg->eof() && !audio->force_exit ) {
+         audio->rawdata = (Sint16 *)audio->ring->NextWriteBuffer();
+ 
+         if ( audio->rawdata ) {
+@@ -432,7 +446,9 @@ int Play_MPEGaudio(MPEGaudio *audio, Uint8 *stream, in
+ #endif
+           audio->timestamp[0] = -1;
+       }
+-    } while ( copylen && (len > 0) && ((audio->currentframe < 
audio->decodedframe) || audio->decoding));
++    } while ( copylen && (len > 0) && ((audio->currentframe < 
audio->decodedframe) || audio->decoding)  
++              && !audio->force_exit );
++
+ #else
+     /* The length is interpreted as being in samples */
+     len /= 2;
Index: patches/patch-video_MPEGvideo_cpp
===================================================================
RCS file: patches/patch-video_MPEGvideo_cpp
diff -N patches/patch-video_MPEGvideo_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-video_MPEGvideo_cpp   4 Dec 2013 03:52:04 -0000
@@ -0,0 +1,48 @@
+$OpenBSD$
+
+- Check for SDL_CreateYUVOverlay() failure
+- accelerate the exit from the audio and video threads when we want to exit
+
+--- video/MPEGvideo.cpp.orig   Mon Jun 18 16:57:02 2001
++++ video/MPEGvideo.cpp        Tue Dec  3 22:50:10 2013
+@@ -243,17 +243,18 @@ int Play_MPEGvideo( void *udata )
+     start_frames = mpeg->_stream->totNumFrames;
+     start_time = SDL_GetTicks();
+ #endif
+-    while( mpeg->playing )
++    mpeg->force_exit = false;
++    while( mpeg->playing && !mpeg->force_exit )
+     {
+         int mark = mpeg->_stream->totNumFrames;
+ 
+         /* make sure we do a whole frame */
+-        while( (mark == mpeg->_stream->totNumFrames) && mpeg->playing )
++        while( (mark == mpeg->_stream->totNumFrames) && mpeg->playing && 
!mpeg->force_exit )
+         {
+             mpegVidRsrc( 0, mpeg->_stream, 0 );
+         }
+ 
+-        if( mpeg->_stream->film_has_ended )
++        if( mpeg->_stream->film_has_ended || mpeg->force_exit )
+         {
+             mpeg->playing = false;
+         }
+@@ -297,6 +298,7 @@ void
+ MPEGvideo:: Stop(void)
+ {
+     if ( _thread ) {
++        force_exit = true;
+         playing = false;
+         SDL_WaitThread(_thread, NULL);
+         _thread = NULL;
+@@ -438,6 +440,10 @@ MPEGvideo:: SetDisplay(SDL_Surface *dst, SDL_mutex *lo
+       SDL_FreeYUVOverlay(_image);
+     }
+     _image = SDL_CreateYUVOverlay(_srcrect.w, _srcrect.h, SDL_YV12_OVERLAY, 
dst);
++    if ( _image == NULL ) {
++        return false;
++    }
++
+     if ( !_dstrect.w || !_dstrect.h ) {
+         _dstrect.w = dst->w;
+         _dstrect.h = dst->h;
Index: patches/patch-video_mmxflags_asm_S
===================================================================
RCS file: patches/patch-video_mmxflags_asm_S
diff -N patches/patch-video_mmxflags_asm_S
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-video_mmxflags_asm_S  4 Dec 2013 03:56:41 -0000
@@ -0,0 +1,47 @@
+$OpenBSD$
+
+- Add missing decleration of stack markings
+- Support PIC properly and no longer contains any TEXTRELs
+
+--- video/mmxflags_asm.S.orig  Tue Dec  3 15:42:25 2013
++++ video/mmxflags_asm.S       Tue Dec  3 16:51:00 2013
+@@ -1,11 +1,6 @@
+ 
+ #if defined(i386) && defined(USE_MMX)
+ 
+-.data
+-      .align 16
+-      .type    flags,@object
+-flags: .long 0
+-
+ .text
+       .align 4
+ .globl cpu_flags
+@@ -40,20 +35,21 @@ cpu_flags: 
+         xorl %ecx,%eax
+         je cpu_flags.L1
+ 
+-        pusha
++        pushl %ebx
+ 
+         movl $1,%eax
+         cpuid
++        movl %edx,%eax
+ 
+-        movl %edx,flags
++        popl %ebx
+ 
+-        popa
+-
+-        movl flags,%eax
+-
+ cpu_flags.L1: 
+         ret
+ .Lfe1:
+       .size    cpu_flags,.Lfe1-cpu_flags
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",%progbits
++#endif
+ 
+ #endif /* i386 && USE_MMX */
Index: patches/patch-video_mmxidct_asm_S
===================================================================
RCS file: patches/patch-video_mmxidct_asm_S
diff -N patches/patch-video_mmxidct_asm_S
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-video_mmxidct_asm_S   4 Dec 2013 03:56:19 -0000
@@ -0,0 +1,281 @@
+$OpenBSD$
+
+- Add missing decleration of stack markings
+- Support PIC properly and no longer contains any TEXTRELs
+
+
+--- video/mmxidct_asm.S.orig   Tue Dec  3 15:46:26 2013
++++ video/mmxidct_asm.S        Tue Dec  3 16:50:55 2013
+@@ -31,11 +31,6 @@ preSC:  .short  16384,22725,21407,19266,16384,12873,88
+ x0005000200010001:
+       .long   0x00010001,0x00050002
+       .align 8
+-      .type   x0040000000000000,@object
+-      .size   x0040000000000000,8
+-x0040000000000000:
+-      .long   0, 0x00400000
+-      .align 8
+       .type   x5a825a825a825a82,@object
+       .size   x5a825a825a825a82,8
+ x5a825a825a825a82:
+@@ -80,8 +75,21 @@ scratch7:
+ x0:
+       .long 0,0
+       .align 8
++
+ .text
+       .align 4
++
++#ifdef __PIC__
++# undef __i686 /* gcc define gets in our way */
++# define MUNG(sym) sym ## @GOTOFF(%ebx)
++# define INIT_PIC() \
++      call __i686.get_pc_thunk.bx ; \
++      addl $_GLOBAL_OFFSET_TABLE_, %ebx
++#else
++# define MUNG(sym) sym
++# define INIT_PIC()
++#endif
++
+ .globl IDCT_mmx
+       .type    IDCT_mmx,@function
+ IDCT_mmx:
+@@ -92,8 +100,9 @@ IDCT_mmx:
+       pushl %edx
+       pushl %esi
+       pushl %edi
++      INIT_PIC()
+       movl 8(%ebp),%esi               /* source matrix */
+-      leal preSC, %ecx
++      leal MUNG(preSC), %ecx
+ /* column 0: even part
+  * use V4, V12, V0, V8 to produce V22..V25
+  */
+@@ -109,7 +118,7 @@ IDCT_mmx:
+       movq %mm1, %mm2                 /* added 11/1/96 */
+       pmulhw 8*8(%esi),%mm5           /* V8 */
+       psubsw %mm0, %mm1               /* V16 */
+-      pmulhw x5a825a825a825a82, %mm1  /* 23170 ->V18 */
++      pmulhw MUNG(x5a825a825a825a82), %mm1    /* 23170 ->V18 */
+       paddsw %mm0, %mm2               /* V17 */
+       movq %mm2, %mm0                 /* duplicate V17 */
+       psraw $1, %mm2                  /* t75=t82 */
+@@ -150,7 +159,7 @@ IDCT_mmx:
+       paddsw %mm0, %mm3               /* V29 ; free mm0 */
+       movq %mm7, %mm1                 /* duplicate V26 */
+       psraw $1, %mm3                  /* t91=t94 */
+-      pmulhw x539f539f539f539f,%mm7   /* V33 */
++      pmulhw MUNG(x539f539f539f539f),%mm7     /* V33 */
+       psraw $1, %mm1                  /* t96 */
+       movq %mm5, %mm0                 /* duplicate V2 */
+       psraw $2, %mm4                  /* t85=t87 */
+@@ -158,15 +167,15 @@ IDCT_mmx:
+       psubsw %mm4, %mm0               /* V28 ; free mm4 */
+       movq %mm0, %mm2                 /* duplicate V28 */
+       psraw $1, %mm5                  /* t90=t93 */
+-      pmulhw x4546454645464546,%mm0   /* V35 */
++      pmulhw MUNG(x4546454645464546),%mm0     /* V35 */
+       psraw $1, %mm2                  /* t97 */
+       movq %mm5, %mm4                 /* duplicate t90=t93 */
+       psubsw %mm2, %mm1               /* V32 ; free mm2 */
+-      pmulhw x61f861f861f861f8,%mm1   /* V36 */
++      pmulhw MUNG(x61f861f861f861f8),%mm1     /* V36 */
+       psllw $1, %mm7                  /* t107 */
+       paddsw %mm3, %mm5               /* V31 */
+       psubsw %mm3, %mm4               /* V30 ; free mm3 */
+-      pmulhw x5a825a825a825a82,%mm4   /* V34 */
++      pmulhw MUNG(x5a825a825a825a82),%mm4     /* V34 */
+       nop
+       psubsw %mm1, %mm0               /* V38 */
+       psubsw %mm7, %mm1               /* V37 ; free mm7 */
+@@ -233,7 +242,7 @@ IDCT_mmx:
+       psubsw %mm7, %mm1               /* V50 */
+       pmulhw 8*9(%esi), %mm5          /* V9 */
+       paddsw %mm7, %mm2               /* V51 */
+-      pmulhw x5a825a825a825a82, %mm1  /* 23170 ->V52 */
++      pmulhw MUNG(x5a825a825a825a82), %mm1    /* 23170 ->V52 */
+       movq %mm2, %mm6                 /* duplicate V51 */
+       psraw $1, %mm2                  /* t138=t144 */
+       movq %mm3, %mm4                 /* duplicate V1 */
+@@ -274,11 +283,11 @@ IDCT_mmx:
+  * even more by doing the correction step in a later stage when the number
+  * is actually multiplied by 16
+  */
+-      paddw x0005000200010001, %mm4
++      paddw MUNG(x0005000200010001), %mm4
+       psubsw %mm6, %mm3               /* V60 ; free mm6 */
+       psraw $1, %mm0                  /* t154=t156 */
+       movq %mm3, %mm1                 /* duplicate V60 */
+-      pmulhw x539f539f539f539f, %mm1  /* V67 */
++      pmulhw MUNG(x539f539f539f539f), %mm1    /* V67 */
+       movq %mm5, %mm6                 /* duplicate V3 */
+       psraw $2, %mm4                  /* t148=t150 */
+       paddsw %mm4, %mm5               /* V61 */
+@@ -287,13 +296,13 @@ IDCT_mmx:
+       psllw $1, %mm1                  /* t169 */
+       paddsw %mm0, %mm5               /* V65 -> result */
+       psubsw %mm0, %mm4               /* V64 ; free mm0 */
+-      pmulhw x5a825a825a825a82, %mm4  /* V68 */
++      pmulhw MUNG(x5a825a825a825a82), %mm4    /* V68 */
+       psraw $1, %mm3                  /* t158 */
+       psubsw %mm6, %mm3               /* V66 */
+       movq %mm5, %mm2                 /* duplicate V65 */
+-      pmulhw x61f861f861f861f8, %mm3  /* V70 */
++      pmulhw MUNG(x61f861f861f861f8), %mm3    /* V70 */
+       psllw $1, %mm6                  /* t165 */
+-      pmulhw x4546454645464546, %mm6  /* V69 */
++      pmulhw MUNG(x4546454645464546), %mm6    /* V69 */
+       psraw $1, %mm2                  /* t172 */
+ /* moved from next block */
+       movq 8*5(%esi), %mm0            /* V56 */
+@@ -418,7 +427,7 @@ IDCT_mmx:
+ *     movq 8*13(%esi), %mm4           tmt13
+ */
+       psubsw %mm4, %mm3               /* V134 */
+-      pmulhw x5a825a825a825a82, %mm3  /* 23170 ->V136 */
++      pmulhw MUNG(x5a825a825a825a82), %mm3    /* 23170 ->V136 */
+       movq 8*9(%esi), %mm6            /* tmt9 */
+       paddsw %mm4, %mm5               /* V135 ; mm4 free */
+       movq %mm0, %mm4                 /* duplicate tmt1 */
+@@ -447,17 +456,17 @@ IDCT_mmx:
+       psubsw %mm7, %mm0               /* V144 */
+       movq %mm0, %mm3                 /* duplicate V144 */
+       paddsw %mm7, %mm2               /* V147 ; free mm7 */
+-      pmulhw x539f539f539f539f, %mm0  /* 21407-> V151 */
++      pmulhw MUNG(x539f539f539f539f), %mm0    /* 21407-> V151 */
+       movq %mm1, %mm7                 /* duplicate tmt3 */
+       paddsw %mm5, %mm7               /* V145 */
+       psubsw %mm5, %mm1               /* V146 ; free mm5 */
+       psubsw %mm1, %mm3               /* V150 */
+       movq %mm7, %mm5                 /* duplicate V145 */
+-      pmulhw x4546454645464546, %mm1  /* 17734-> V153 */
++      pmulhw MUNG(x4546454645464546), %mm1    /* 17734-> V153 */
+       psubsw %mm2, %mm5               /* V148 */
+-      pmulhw x61f861f861f861f8, %mm3  /* 25080-> V154 */
++      pmulhw MUNG(x61f861f861f861f8), %mm3    /* 25080-> V154 */
+       psllw $2, %mm0                  /* t311 */
+-      pmulhw x5a825a825a825a82, %mm5  /* 23170-> V152 */
++      pmulhw MUNG(x5a825a825a825a82), %mm5    /* 23170-> V152 */
+       paddsw %mm2, %mm7               /* V149 ; free mm2 */
+       psllw $1, %mm1                  /* t313 */
+       nop     /* without the nop - freeze here for one clock */
+@@ -483,7 +492,7 @@ IDCT_mmx:
+       paddsw %mm3, %mm6               /* V164 ; free mm3 */
+       movq %mm4, %mm3                 /* duplicate V142 */
+       psubsw %mm5, %mm4               /* V165 ; free mm5 */
+-      movq %mm2, scratch7             /* out7 */
++      movq %mm2, MUNG(scratch7)               /* out7 */
+       psraw $4, %mm6
+       psraw $4, %mm4
+       paddsw %mm5, %mm3               /* V162 */
+@@ -494,11 +503,11 @@ IDCT_mmx:
+  */
+       movq %mm6, 8*9(%esi)            /* out9 */
+       paddsw %mm1, %mm0               /* V161 */
+-      movq %mm3, scratch5             /* out5 */
++      movq %mm3, MUNG(scratch5)               /* out5 */
+       psubsw %mm1, %mm5               /* V166 ; free mm1 */
+       movq %mm4, 8*11(%esi)           /* out11 */
+       psraw $4, %mm5
+-      movq %mm0, scratch3             /* out3 */
++      movq %mm0, MUNG(scratch3)               /* out3 */
+       movq %mm2, %mm4                 /* duplicate V140 */
+       movq %mm5, 8*13(%esi)           /* out13 */
+       paddsw %mm7, %mm2               /* V160 */
+@@ -508,7 +517,7 @@ IDCT_mmx:
+ /* moved from the next block */
+       movq 8*3(%esi), %mm7
+       psraw $4, %mm4
+-      movq %mm2, scratch1             /* out1 */
++      movq %mm2, MUNG(scratch1)               /* out1 */
+ /* moved from the next block */
+       movq %mm0, %mm1
+       movq %mm4, 8*15(%esi)           /* out15 */
+@@ -565,15 +574,15 @@ IDCT_mmx:
+       paddsw %mm4, %mm3               /* V113 ; free mm4 */
+       movq %mm0, %mm4                 /* duplicate V110 */
+       paddsw %mm1, %mm2               /* V111 */
+-      pmulhw x539f539f539f539f, %mm0  /* 21407-> V117 */
++      pmulhw MUNG(x539f539f539f539f), %mm0    /* 21407-> V117 */
+       psubsw %mm1, %mm5               /* V112 ; free mm1 */
+       psubsw %mm5, %mm4               /* V116 */
+       movq %mm2, %mm1                 /* duplicate V111 */
+-      pmulhw x4546454645464546, %mm5  /* 17734-> V119 */
++      pmulhw MUNG(x4546454645464546), %mm5    /* 17734-> V119 */
+       psubsw %mm3, %mm2               /* V114 */
+-      pmulhw x61f861f861f861f8, %mm4  /* 25080-> V120 */
++      pmulhw MUNG(x61f861f861f861f8), %mm4    /* 25080-> V120 */
+       paddsw %mm3, %mm1               /* V115 ; free mm3 */
+-      pmulhw x5a825a825a825a82, %mm2  /* 23170-> V118 */
++      pmulhw MUNG(x5a825a825a825a82), %mm2    /* 23170-> V118 */
+       psllw $2, %mm0                  /* t266 */
+       movq %mm1, (%esi)               /* save V115 */
+       psllw $1, %mm5                  /* t268 */
+@@ -591,7 +600,7 @@ IDCT_mmx:
+       movq %mm6, %mm3                 /* duplicate tmt4 */
+       psubsw %mm0, %mm6               /* V100 */
+       paddsw %mm0, %mm3               /* V101 ; free mm0 */
+-      pmulhw x5a825a825a825a82, %mm6  /* 23170 ->V102 */
++      pmulhw MUNG(x5a825a825a825a82), %mm6    /* 23170 ->V102 */
+       movq %mm7, %mm5                 /* duplicate tmt0 */
+       movq 8*8(%esi), %mm1            /* tmt8 */
+       paddsw %mm1, %mm7               /* V103 */
+@@ -625,10 +634,10 @@ IDCT_mmx:
+       movq 8*2(%esi), %mm3            /* V123 */
+       paddsw %mm4, %mm7               /* out0 */
+ /* moved up from next block */
+-      movq scratch3, %mm0
++      movq MUNG(scratch3), %mm0
+       psraw $4, %mm7
+ /* moved up from next block */
+-      movq scratch5, %mm6 
++      movq MUNG(scratch5), %mm6 
+       psubsw %mm4, %mm1               /* out14 ; free mm4 */
+       paddsw %mm3, %mm5               /* out2 */
+       psraw $4, %mm1
+@@ -639,7 +648,7 @@ IDCT_mmx:
+       movq %mm5, 8*2(%esi)            /* out2 ; free mm5 */
+       psraw $4, %mm2
+ /* moved up to the prev block */
+-      movq scratch7, %mm4
++      movq MUNG(scratch7), %mm4
+ /* moved up to the prev block */
+       psraw $4, %mm0
+       movq %mm2, 8*12(%esi)           /* out12 ; free mm2 */
+@@ -647,13 +656,13 @@ IDCT_mmx:
+       psraw $4, %mm6
+ /* move back the data to its correct place
+ * moved up to the prev block
+- *    movq scratch3, %mm0
+- *    movq scratch5, %mm6
+- *    movq scratch7, %mm4
++ *    movq MUNG(scratch3), %mm0
++ *    movq MUNG(scratch5), %mm6
++ *    movq MUNG(scratch7), %mm4
+  *    psraw $4, %mm0
+  *    psraw $4, %mm6
+ */
+-      movq scratch1, %mm1
++      movq MUNG(scratch1), %mm1
+       psraw $4, %mm4
+       movq %mm0, 8*3(%esi)            /* out3 */
+       psraw $4, %mm1
+@@ -671,5 +680,18 @@ IDCT_mmx:
+ .Lfe1:
+       .size    IDCT_mmx,.Lfe1-IDCT_mmx
+ 
++#ifdef __PIC__
++      .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
++.globl __i686.get_pc_thunk.bx
++      .hidden  __i686.get_pc_thunk.bx
++      .type    __i686.get_pc_thunk.bx,@function
++ __i686.get_pc_thunk.bx:
++      movl (%esp), %ebx
++      ret
++#endif
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",%progbits
++#endif
+ 
+ #endif /* i386 && USE_MMX */
Index: patches/patch-video_video_h
===================================================================
RCS file: /home/cvs/ports/devel/smpeg/patches/patch-video_video_h,v
retrieving revision 1.1
diff -u -p -r1.1 patch-video_video_h
--- patches/patch-video_video_h 22 Nov 2003 00:53:39 -0000      1.1
+++ patches/patch-video_video_h 4 Dec 2013 03:52:31 -0000
@@ -1,12 +1,50 @@
 $OpenBSD: patch-video_video_h,v 1.1 2003/11/22 00:53:39 pvalchev Exp $
---- video/video.h.orig 2003-11-21 17:32:20.000000000 -0700
-+++ video/video.h      2003-11-21 17:32:34.000000000 -0700
-@@ -432,7 +432,7 @@ extern unsigned int cacheMiss[8][8];
- #undef  LITTLE_ENDIAN_ARCHITECTURE
+
+Use SDL to decide about byte order.
+
+--- video/video.h.orig Tue Dec  3 16:54:51 2013
++++ video/video.h      Tue Dec  3 17:05:50 2013
+@@ -413,36 +413,17 @@ extern unsigned int cacheMiss[8][8];
+ #define __SCO__ 1
+ #endif
+ 
+-#if defined(__i386__) || defined(__VAX__) || defined(__MIPSEL__) || 
defined(__alpha__) || defined(__SCO__)
+-#undef  BIG_ENDIAN_ARCHITECTURE
+-#define LITTLE_ENDIAN_ARCHITECTURE 1
++#include "SDL_endian.h"
++#if SDL_BYTEORDER == SDL_BIG_ENDIAN
++#ifdef LITTLE_ENDIAN_ARCHITECTURE
++#undef LITTLE_ENDIAN_ARCHITECTURE
+ #endif
+-
+-#if defined(__RS6000__) || defined(__SPARC__) || defined(__mc68000__) || 
defined(__HPUX__) || defined(__MIPSEB__) || defined(convex) || 
defined(__convex__) || defined(__powerpc__)
+-#undef  LITTLE_ENDIAN_ARCHITECTURE
  #define BIG_ENDIAN_ARCHITECTURE 1
+-#endif
+-
+-#if !defined(LITTLE_ENDIAN_ARCHITECTURE) && !defined(BIG_ENDIAN_ARCHITECTURE)
+-#ifdef WIN32
+-#undef  BIG_ENDIAN_ARCHITECTURE
+-#define LITTLE_ENDIAN_ARCHITECTURE
  #else
+-#ifdef __BIG_ENDIAN__
+-#undef  LITTLE_ENDIAN_ARCHITECTURE
+-#define BIG_ENDIAN_ARCHITECTURE 1
+-#else
 -#include <endian.h>
-+#include <sys/endian.h>
- #if __BYTE_ORDER == __LITTLE_ENDIAN
- #undef  BIG_ENDIAN_ARCHITECTURE
- #define LITTLE_ENDIAN_ARCHITECTURE 1
+-#if __BYTE_ORDER == __LITTLE_ENDIAN
+-#undef  BIG_ENDIAN_ARCHITECTURE
+-#define LITTLE_ENDIAN_ARCHITECTURE 1
++#ifdef BIG_ENDIAN_ARCHITECTURE
++#undef BIG_ENDIAN_ARCHITECTURE
+ #endif
+-#if __BYTE_ORDER == __BIG_ENDIAN
+-#undef  LITTLE_ENDIAN_ARCHITECTURE
+-#define BIG_ENDIAN_ARCHITECTURE 1
+-#endif
+-#endif
+-#endif
++#define LITTLE_ENDIAN_ARCHITECTURE 1
+ #endif
+ 
+ #if !defined(LITTLE_ENDIAN_ARCHITECTURE) && !defined(BIG_ENDIAN_ARCHITECTURE)

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Reply via email to