[xiph-commits] r11425 - branches/theora-mmx/lib

msmith at svn.xiph.org msmith at svn.xiph.org
Fri May 26 10:48:11 PDT 2006


Author: msmith
Date: 2006-05-26 10:48:03 -0700 (Fri, 26 May 2006)
New Revision: 11425

Modified:
   branches/theora-mmx/lib/codec_internal.h
   branches/theora-mmx/lib/cpu.c
   branches/theora-mmx/lib/cpu.h
   branches/theora-mmx/lib/dct.c
   branches/theora-mmx/lib/dct_decode.c
   branches/theora-mmx/lib/dct_encode.c
   branches/theora-mmx/lib/decode.c
   branches/theora-mmx/lib/dsp.c
   branches/theora-mmx/lib/dsp.h
   branches/theora-mmx/lib/encode.c
   branches/theora-mmx/lib/encoder_toplevel.c
   branches/theora-mmx/lib/mcomp.c
   branches/theora-mmx/lib/pp.c
   branches/theora-mmx/lib/reconstruct.c
   branches/theora-mmx/lib/scan.c
   branches/theora-mmx/lib/toplevel.c
Log:
Make dsp stuff threadsafe. Mid-quake-commit!


Modified: branches/theora-mmx/lib/codec_internal.h
===================================================================
--- branches/theora-mmx/lib/codec_internal.h	2006-05-26 13:07:47 UTC (rev 11424)
+++ branches/theora-mmx/lib/codec_internal.h	2006-05-26 17:48:03 UTC (rev 11425)
@@ -228,6 +228,8 @@
   ogg_int32_t ChLocalsCircularBufferSize;
   ogg_int32_t PixelMapCircularBufferSize;
 
+  DspFunctions dsp;  /* Selected functions for this platform */
+
 } PP_INSTANCE;
 
 /** block coding modes */
@@ -493,6 +495,8 @@
 
   unsigned char *DataOutputInPtr;
 
+  DspFunctions   dsp;  /* Selected functions for this platform */
+
 } PB_INSTANCE;
 
 /* Encoder (Compressor) instance -- installed in a theora_state */
@@ -679,6 +683,8 @@
   int               packetflag;
   int               doneflag;
 
+  DspFunctions   dsp;  /* Selected functions for this platform */
+
 } CP_INSTANCE;
 
 #define clamp255(x) ((unsigned char)((((x)<0)-1) & ((x) | -((x)>255))))
@@ -688,7 +694,7 @@
                                      ogg_uint32_t * KFIndicator );
 
 extern void ClearPPInstance(PP_INSTANCE *ppi);
-extern void InitPPInstance(PP_INSTANCE *ppi);
+extern void InitPPInstance(PP_INSTANCE *ppi, DspFunctions *funcs);
 extern int GetFrameType(PB_INSTANCE *pbi);
 extern void InitPBInstance(PB_INSTANCE *pbi);
 extern void ClearPBInstance(PB_INSTANCE *pbi);

Modified: branches/theora-mmx/lib/cpu.c
===================================================================
--- branches/theora-mmx/lib/cpu.c	2006-05-26 13:07:47 UTC (rev 11424)
+++ branches/theora-mmx/lib/cpu.c	2006-05-26 17:48:03 UTC (rev 11425)
@@ -18,8 +18,6 @@
 #include <stdio.h>
 #include "cpu.h"
 
-ogg_uint32_t cpu_flags = 0;
-
 void
 cpuid(ogg_int32_t op, ogg_uint32_t *eax, ogg_uint32_t *ebx, ogg_uint32_t *ecx, ogg_uint32_t *edx)
 {
@@ -75,7 +73,7 @@
     return 0;
 #endif
 
-  //cpuid(0, &eax, &ebx, &ecx, &edx);
+  /*cpuid(0, &eax, &ebx, &ecx, &edx); */
   /* Intel */
   cpuid(1, &eax, &ebx, &ecx, &edx);
   if ((edx & 0x00800000) == 0)
@@ -112,10 +110,11 @@
 
 #endif
 
-void cpu_init () 
+ogg_uint32_t cpu_init (void)
 {
-  cpu_flags = cpu_get_flags();
+  ogg_uint32_t cpu_flags = cpu_get_flags();
 
+  /*
   if (cpu_flags) {
     fprintf(stderr, "vectorized instruction sets supported:");
     if (cpu_flags & CPU_X86_MMX)      fprintf(stderr, " mmx");
@@ -126,4 +125,7 @@
     if (cpu_flags & CPU_X86_3DNOWEXT) fprintf(stderr, " 3dnowext");
     fprintf(stderr, "\n");
   }
+  */
+
+  return cpu_flags;
 }

Modified: branches/theora-mmx/lib/cpu.h
===================================================================
--- branches/theora-mmx/lib/cpu.h	2006-05-26 13:07:47 UTC (rev 11424)
+++ branches/theora-mmx/lib/cpu.h	2006-05-26 17:48:03 UTC (rev 11425)
@@ -17,7 +17,7 @@
 
 #include "codec_internal.h"
 
-extern ogg_uint32_t cpu_flags;
+//extern ogg_uint32_t cpu_flags;
 
 #define CPU_X86_MMX	(1<<0)
 #define CPU_X86_3DNOW	(1<<1)
@@ -26,4 +26,5 @@
 #define CPU_X86_SSE2	(1<<4)
 #define CPU_X86_3DNOWEXT (1<<5)
 
-void cpu_init () ;
+ogg_uint32_t cpu_init (void);
+

Modified: branches/theora-mmx/lib/dct.c
===================================================================
--- branches/theora-mmx/lib/dct.c	2006-05-26 13:07:47 UTC (rev 11424)
+++ branches/theora-mmx/lib/dct.c	2006-05-26 17:48:03 UTC (rev 11425)
@@ -16,6 +16,7 @@
  ********************************************************************/
 
 #include "codec_internal.h"
+#include "dsp.h"
 #include "cpu.h"
 
 static ogg_int32_t xC1S7 = 64277;
@@ -253,12 +254,12 @@
   }
 }
 
-void dsp_dct_init (DspFunctions *funcs)
+void dsp_dct_init (DspFunctions *funcs, ogg_uint32_t cpu_flags)
 {
   funcs->fdct_short = fdct_short__c;
 #if (defined(__i386__) || defined(__x86_64__))
   if (cpu_flags & CPU_X86_MMX) {
-    dsp_mmx_fdct_init(&dsp_funcs);
+    dsp_mmx_fdct_init(funcs);
   }
 #endif
 }

Modified: branches/theora-mmx/lib/dct_decode.c
===================================================================
--- branches/theora-mmx/lib/dct_decode.c	2006-05-26 13:07:47 UTC (rev 11424)
+++ branches/theora-mmx/lib/dct_decode.c	2006-05-26 17:48:03 UTC (rev 11425)
@@ -148,7 +148,7 @@
   ReconPixelIndex = pbi->recon_pixel_index_table[FragmentNumber];
 
   /* Get the pixel index for the first pixel in the fragment. */
-  dsp_static_recon_intra8x8 ((unsigned char *)(&pbi->ThisFrameRecon[ReconPixelIndex]),
+  dsp_recon_intra8x8 (pbi->dsp, (unsigned char *)(&pbi->ThisFrameRecon[ReconPixelIndex]),
               (ogg_int16_t *)pbi->ReconDataBuffer, ReconPixelsPerLine);
 
 }
@@ -233,7 +233,7 @@
     /* Reconstruct the pixel data using the last frame reconstruction
        and change data when the motion vector is (0,0), the recon is
        based on the lastframe without loop filtering---- for testing */
-    dsp_static_recon_inter8x8 (&pbi->ThisFrameRecon[ReconPixelIndex],
+    dsp_recon_inter8x8 (pbi->dsp, &pbi->ThisFrameRecon[ReconPixelIndex],
                 &pbi->LastFrameRecon[ReconPixelIndex],
                   pbi->ReconDataBuffer, ReconPixelsPerLine);
   }else if ( ModeUsesMC[pbi->CodingMode] ) {
@@ -282,7 +282,7 @@
     if ( (int)(LastFrameRecPtr - LastFrameRecPtr2) == 0 ) {
       /* Reconstruct the pixel dats from the reference frame and change data
          (no half pixel in this case as the two references were the same. */
-      dsp_static_recon_inter8x8 (
+      dsp_recon_inter8x8 (pbi->dsp,
 		  &pbi->ThisFrameRecon[ReconPixelIndex],
                   LastFrameRecPtr, pbi->ReconDataBuffer,
                   ReconPixelsPerLine);
@@ -290,7 +290,7 @@
       /* Fractional pixel reconstruction. */
       /* Note that we only use two pixels per reconstruction even for
          the diagonal. */
-      dsp_static_recon_inter8x8_half(&pbi->ThisFrameRecon[ReconPixelIndex],
+      dsp_recon_inter8x8_half(pbi->dsp, &pbi->ThisFrameRecon[ReconPixelIndex],
                             LastFrameRecPtr, LastFrameRecPtr2,
                             pbi->ReconDataBuffer, ReconPixelsPerLine);
     }
@@ -298,13 +298,13 @@
     /* Golden frame with motion vector */
     /* Reconstruct the pixel data using the golden frame
        reconstruction and change data */
-    dsp_static_recon_inter8x8 (&pbi->ThisFrameRecon[ReconPixelIndex],
+    dsp_recon_inter8x8 (pbi->dsp, &pbi->ThisFrameRecon[ReconPixelIndex],
                 &pbi->GoldenFrame[ ReconPixelIndex ],
                   pbi->ReconDataBuffer, ReconPixelsPerLine);
   } else {
     /* Simple Intra coding */
     /* Get the pixel index for the first pixel in the fragment. */
-    dsp_static_recon_intra8x8 (&pbi->ThisFrameRecon[ReconPixelIndex],
+    dsp_recon_intra8x8 (pbi->dsp, &pbi->ThisFrameRecon[ReconPixelIndex],
               pbi->ReconDataBuffer, ReconPixelsPerLine);
   }
 }
@@ -460,7 +460,7 @@
       SrcPtr = &SrcReconPtr[ PixelIndex ];
       DestPtr = &DestReconPtr[ PixelIndex ];
 
-      dsp_static_copy8x8 (SrcPtr, DestPtr, PlaneLineStep);
+      dsp_copy8x8 (pbi->dsp, SrcPtr, DestPtr, PlaneLineStep);
     }
   }
 
@@ -472,7 +472,7 @@
       SrcPtr = &SrcReconPtr[ PixelIndex ];
       DestPtr = &DestReconPtr[ PixelIndex ];
 
-      dsp_static_copy8x8 (SrcPtr, DestPtr, PlaneLineStep);
+      dsp_copy8x8 (pbi->dsp, SrcPtr, DestPtr, PlaneLineStep);
 
     }
   }
@@ -497,7 +497,7 @@
       SrcPtr = &SrcReconPtr[ PixelIndex ];
       DestPtr = &DestReconPtr[ PixelIndex ];
 
-      dsp_static_copy8x8 (SrcPtr, DestPtr, PlaneLineStep);
+      dsp_copy8x8 (pbi->dsp, SrcPtr, DestPtr, PlaneLineStep);
     }
   }
 
@@ -509,7 +509,7 @@
       SrcPtr = &SrcReconPtr[ PixelIndex ];
       DestPtr = &DestReconPtr[ PixelIndex ];
 
-      dsp_static_copy8x8 (SrcPtr, DestPtr, PlaneLineStep);
+      dsp_copy8x8 (pbi->dsp, SrcPtr, DestPtr, PlaneLineStep);
 
     }
   }
@@ -663,7 +663,7 @@
 }
 
 void ClearDownQFragData(PB_INSTANCE *pbi){
-  ogg_int32_t       i,j;
+  ogg_int32_t       i;
   Q_LIST_ENTRY *    QFragPtr;
 
   for ( i = 0; i < pbi->CodedBlockIndex; i++ ) {

Modified: branches/theora-mmx/lib/dct_encode.c
===================================================================
--- branches/theora-mmx/lib/dct_encode.c	2006-05-26 13:07:47 UTC (rev 11424)
+++ branches/theora-mmx/lib/dct_encode.c	2006-05-26 17:48:03 UTC (rev 11425)
@@ -352,15 +352,15 @@
 
   /* Is the MV offset exactly pixel alligned */
   if ( AbsRefOffset == 0 ){
-    dsp_static_sub8x8( FiltPtr, ReconPtr1, DctInputPtr,
+    dsp_sub8x8(cpi->dsp, FiltPtr, ReconPtr1, DctInputPtr,
                PixelsPerLine, ReconPixelsPerLine);
-    dsp_static_copy8x8 (new_ptr1, old_ptr1, PixelsPerLine);
+    dsp_copy8x8 (cpi->dsp, new_ptr1, old_ptr1, PixelsPerLine);
   } else {
     /* Fractional pixel MVs. */
     /* Note that we only use two pixel values even for the diagonal */
-    dsp_static_sub8x8avg2(FiltPtr, ReconPtr1,ReconPtr2,DctInputPtr,
+    dsp_sub8x8avg2(cpi->dsp, FiltPtr, ReconPtr1,ReconPtr2,DctInputPtr,
                  PixelsPerLine, ReconPixelsPerLine);
-    dsp_static_copy8x8 (new_ptr1, old_ptr1, PixelsPerLine);
+    dsp_copy8x8 (cpi->dsp, new_ptr1, old_ptr1, PixelsPerLine);
   }
 }
 
@@ -436,18 +436,18 @@
         pb.GoldenFrame[cpi->pb.recon_pixel_index_table[FragIndex]];
     }
 
-    dsp_static_sub8x8( FiltPtr, ReconPtr1, DctInputPtr,
+    dsp_sub8x8(cpi->dsp, FiltPtr, ReconPtr1, DctInputPtr,
                PixelsPerLine, ReconPixelsPerLine);
-    dsp_static_copy8x8 (new_ptr1, old_ptr1, PixelsPerLine);
+    dsp_copy8x8 (cpi->dsp, new_ptr1, old_ptr1, PixelsPerLine);
   } else if ( cpi->pb.CodingMode==CODE_INTRA ) {
-    dsp_static_sub8x8_128(FiltPtr, DctInputPtr, PixelsPerLine);
-    dsp_static_copy8x8 (new_ptr1, old_ptr1, PixelsPerLine);
+    dsp_sub8x8_128(cpi->dsp, FiltPtr, DctInputPtr, PixelsPerLine);
+    dsp_copy8x8 (cpi->dsp, new_ptr1, old_ptr1, PixelsPerLine);
   }
 
   /* Proceed to encode the data into the encode buffer if the encoder
      is enabled. */
   /* Perform a 2D DCT transform on the data. */
-  dsp_static_fdct_short( cpi->DCTDataBuffer, cpi->DCT_codes );
+  dsp_fdct_short(cpi->dsp, cpi->DCTDataBuffer, cpi->DCT_codes );
 
   /* Quantize that transform data. */
   quantize ( &cpi->pb, cpi->DCT_codes, cpi->pb.QFragData[FragIndex] );

Modified: branches/theora-mmx/lib/decode.c
===================================================================
--- branches/theora-mmx/lib/decode.c	2006-05-26 13:07:47 UTC (rev 11424)
+++ branches/theora-mmx/lib/decode.c	2006-05-26 17:48:03 UTC (rev 11425)
@@ -865,9 +865,9 @@
   if (pbi->DecoderErrorCode) return;
 
   /* Reconstruct and display the frame */
-  dsp_static_save_fpu ();
+  dsp_save_fpu (pbi->dsp);
   ReconRefFrames(pbi);
-  dsp_static_restore_fpu ();
+  dsp_restore_fpu (pbi->dsp);
 
 }
 

Modified: branches/theora-mmx/lib/dsp.c
===================================================================
--- branches/theora-mmx/lib/dsp.c	2006-05-26 13:07:47 UTC (rev 11424)
+++ branches/theora-mmx/lib/dsp.c	2006-05-26 17:48:03 UTC (rev 11425)
@@ -25,8 +25,6 @@
 #define DSP_OP_DIFF(a,b) (((int)(a)) - ((int)(b)))
 #define DSP_OP_ABS_DIFF(a,b) abs((((int)(a)) - ((int)(b))))
 
-DspFunctions dsp_funcs;
-
 static void sub8x8__c (unsigned char *FiltPtr, unsigned char *ReconPtr,
                   ogg_int16_t *DctInputPtr, ogg_uint32_t PixelsPerLine,
                   ogg_uint32_t ReconPixelsPerLine) {
@@ -387,7 +385,7 @@
 
 void dsp_init(DspFunctions *funcs)
 {
-  fprintf(stderr, "setting dsp functions to C defaults.\n");
+  /*fprintf(stderr, "setting dsp functions to C defaults.\n"); */
   funcs->save_fpu = nop;
   funcs->restore_fpu = nop;
   funcs->sub8x8 = sub8x8__c;
@@ -403,19 +401,21 @@
   funcs->inter8x8_err_xy2 = inter8x8_err_xy2__c;
 }
 
-void dsp_static_init(void)
+void dsp_static_init(DspFunctions *funcs)
 {
-  cpu_init ();
-  dsp_init (&dsp_funcs);
+  ogg_uint32_t cpuflags;
 
-  dsp_recon_init (&dsp_funcs);
-  dsp_dct_init (&dsp_funcs);
+  cpuflags = cpu_init ();
+  dsp_init (funcs);
+
+  dsp_recon_init (funcs, cpuflags);
+  dsp_dct_init (funcs, cpuflags);
 #if (defined(__i386__) || defined(__x86_64__))
-  if (cpu_flags & CPU_X86_MMX) {
-    dsp_mmx_init(&dsp_funcs);
+  if (cpuflags & CPU_X86_MMX) {
+    dsp_mmx_init(funcs);
   }
-  if (cpu_flags & CPU_X86_MMXEXT) {
-    dsp_mmxext_init(&dsp_funcs);
+  if (cpuflags & CPU_X86_MMXEXT) {
+    dsp_mmxext_init(funcs);
   }
 #endif
 }

Modified: branches/theora-mmx/lib/dsp.h
===================================================================
--- branches/theora-mmx/lib/dsp.h	2006-05-26 13:07:47 UTC (rev 11424)
+++ branches/theora-mmx/lib/dsp.h	2006-05-26 17:48:03 UTC (rev 11425)
@@ -80,13 +80,11 @@
 			         unsigned char *RefDataPtr2, ogg_uint32_t RefStride);
 } DspFunctions;
 
-extern DspFunctions dsp_funcs;
+extern void dsp_dct_init(DspFunctions *funcs, ogg_uint32_t cpu_flags);
+extern void dsp_recon_init (DspFunctions *funcs, ogg_uint32_t cpu_flags);
 
-extern void dsp_dct_init(DspFunctions *funcs);
-extern void dsp_recon_init (DspFunctions *funcs);
-
 void dsp_init(DspFunctions *funcs);
-void dsp_static_init(void);
+void dsp_static_init(DspFunctions *funcs);
 #if defined(__i386__)
 extern void dsp_mmx_init(DspFunctions *funcs);
 extern void dsp_mmxext_init(DspFunctions *funcs);
@@ -95,68 +93,45 @@
 #endif
 
 #define dsp_save_fpu(funcs) (funcs.save_fpu ())
-#define dsp_static_save_fpu() dsp_save_fpu(dsp_funcs)
 
 #define dsp_restore_fpu(funcs) (funcs.restore_fpu ())
-#define dsp_static_restore_fpu() dsp_restore_fpu(dsp_funcs)
 
 #define dsp_sub8x8(funcs,a1,a2,a3,a4,a5) (funcs.sub8x8 (a1,a2,a3,a4,a5))
-#define dsp_static_sub8x8(a1,a2,a3,a4,a5) dsp_sub8x8(dsp_funcs,a1,a2,a3,a4,a5)
 
 #define dsp_sub8x8_128(funcs,a1,a2,a3) (funcs.sub8x8_128 (a1,a2,a3))
-#define dsp_static_sub8x8_128(a1,a2,a3) dsp_sub8x8_128(dsp_funcs,a1,a2,a3)
 
 #define dsp_sub8x8avg2(funcs,a1,a2,a3,a4,a5,a6) (funcs.sub8x8avg2 (a1,a2,a3,a4,a5,a6))
-#define dsp_static_sub8x8avg2(a1,a2,a3,a4,a5,a6) dsp_sub8x8avg2(dsp_funcs,a1,a2,a3,a4,a5,a6)
 
 #define dsp_copy8x8(funcs,ptr1,ptr2,str1) (funcs.copy8x8 (ptr1,ptr2,str1))
-#define dsp_static_copy8x8(ptr1,ptr2,str1) dsp_copy8x8(dsp_funcs,ptr1,ptr2,str1)
 
 #define dsp_recon_intra8x8(funcs,ptr1,ptr2,str1) (funcs.recon_intra8x8 (ptr1,ptr2,str1))
-#define dsp_static_recon_intra8x8(ptr1,ptr2,str1) dsp_recon_intra8x8(dsp_funcs,ptr1,ptr2,str1)
 
 #define dsp_recon_inter8x8(funcs,ptr1,ptr2,ptr3,str1) \
 	(funcs.recon_inter8x8 (ptr1,ptr2,ptr3,str1))
-#define dsp_static_recon_inter8x8(ptr1,ptr2,ptr3,str1) \
-	dsp_recon_inter8x8(dsp_funcs,ptr1,ptr2,ptr3,str1)
 
 #define dsp_recon_inter8x8_half(funcs,ptr1,ptr2,ptr3,ptr4,str1) \
 	(funcs.recon_inter8x8_half (ptr1,ptr2,ptr3,ptr4,str1))
-#define dsp_static_recon_inter8x8_half(ptr1,ptr2,ptr3,ptr4,str1) \
-	dsp_recon_inter8x8_half(dsp_funcs,ptr1,ptr2,ptr3,ptr4,str1)
 
 #define dsp_fdct_short(funcs,in,out) (funcs.fdct_short (in,out))
-#define dsp_static_fdct_short(in,out) dsp_fdct_short(dsp_funcs,in,out)
 
 #define dsp_row_sad8(funcs,ptr1,ptr2) (funcs.row_sad8 (ptr1,ptr2))
-#define dsp_static_row_sad8(ptr1,ptr2) dsp_row_sad8(dsp_funcs,ptr1,ptr2)
 
 #define dsp_col_sad8x8(funcs,ptr1,ptr2,str1) (funcs.col_sad8x8 (ptr1,ptr2,str1))
-#define dsp_static_col_sad8x8(ptr1,ptr2,str1) dsp_col_sad8x8(dsp_funcs,ptr1,ptr2,str1)
 
 #define dsp_sad8x8(funcs,ptr1,str1,ptr2,str2) (funcs.sad8x8 (ptr1,str1,ptr2,str2))
-#define dsp_static_sad8x8(ptr1,str1,ptr2,str2) dsp_sad8x8(dsp_funcs,ptr1,str1,ptr2,str2)
 
 #define dsp_sad8x8_thres(funcs,ptr1,str1,ptr2,str2,t) (funcs.sad8x8_thres (ptr1,str1,ptr2,str2,t))
-#define dsp_static_sad8x8_thres(ptr1,str1,ptr2,str2,t) dsp_sad8x8_thres(dsp_funcs,ptr1,str1,ptr2,str2,t)
 
 #define dsp_sad8x8_xy2_thres(funcs,ptr1,str1,ptr2,ptr3,str2,t) \
 	(funcs.sad8x8_xy2_thres (ptr1,str1,ptr2,ptr3,str2,t))
-#define dsp_static_sad8x8_xy2_thres(ptr1,str1,ptr2,ptr3,str2,t) \
-	dsp_sad8x8_xy2_thres(dsp_funcs,ptr1,str1,ptr2,ptr3,str2,t)
 
 #define dsp_intra8x8_err(funcs,ptr1,str1) (funcs.intra8x8_err (ptr1,str1))
-#define dsp_static_intra8x8_err(ptr1,str1) dsp_intra8x8_err(dsp_funcs,ptr1,str1)
 
 #define dsp_inter8x8_err(funcs,ptr1,str1,ptr2,str2) \
 	(funcs.inter8x8_err (ptr1,str1,ptr2,str2))
-#define dsp_static_inter8x8_err(ptr1,str1,ptr2,str2) \
-	dsp_inter8x8_err(dsp_funcs,ptr1,str1,ptr2,str2)
 
 #define dsp_inter8x8_err_xy2(funcs,ptr1,str1,ptr2,ptr3,str2) \
 	(funcs.inter8x8_err_xy2 (ptr1,str1,ptr2,ptr3,str2))
-#define dsp_static_inter8x8_err_xy2(ptr1,str1,ptr2,ptr3,str2) \
-	dsp_inter8x8_err_xy2(dsp_funcs,ptr1,str1,ptr2,ptr3,str2)
 
 
 #endif /* DSP_H */

Modified: branches/theora-mmx/lib/encode.c
===================================================================
--- branches/theora-mmx/lib/encode.c	2006-05-26 13:07:47 UTC (rev 11424)
+++ branches/theora-mmx/lib/encode.c	2006-05-26 17:48:03 UTC (rev 11425)
@@ -549,7 +549,7 @@
     RecStride = cpi->pb.UVStride;
   }
 
-  ErrorVal = dsp_static_sad8x8 (SrcDataPtr, SrcStride, RecDataPtr, RecStride);
+  ErrorVal = dsp_sad8x8 (cpi->dsp, SrcDataPtr, SrcStride, RecDataPtr, RecStride);
 
   return ErrorVal;
 }
@@ -919,12 +919,12 @@
     /* Zero Decoder EOB run count */
     cpi->pb.EOB_Run = 0;
 
-    dsp_static_save_fpu ();
+    dsp_save_fpu (cpi->dsp);
 
     /* Encode any fragments coded using DCT. */
     coded_pixels += QuadCodeDisplayFragments (cpi);
 
-    dsp_static_restore_fpu ();
+    dsp_restore_fpu (cpi->dsp);
 
     return coded_pixels;
 

Modified: branches/theora-mmx/lib/encoder_toplevel.c
===================================================================
--- branches/theora-mmx/lib/encoder_toplevel.c	2006-05-26 13:07:47 UTC (rev 11424)
+++ branches/theora-mmx/lib/encoder_toplevel.c	2006-05-26 17:48:03 UTC (rev 11425)
@@ -774,19 +774,20 @@
 
   CP_INSTANCE *cpi;
 
-  dsp_static_init ();
-
   memset(th, 0, sizeof(*th));
   /*Currently only the 4:2:0 format is supported.*/
   if(c->pixelformat!=OC_PF_420)return OC_IMPL;
   th->internal_encode=cpi=_ogg_calloc(1,sizeof(*cpi));
 
+  dsp_static_init (&cpi->dsp);
+  memcpy (&cpi->pb.dsp, &cpi->dsp, sizeof(DspFunctions));
+
   c->version_major=VERSION_MAJOR;
   c->version_minor=VERSION_MINOR;
   c->version_subminor=VERSION_SUB;
 
   InitTmpBuffers(&cpi->pb);
-  InitPPInstance(&cpi->pp);
+  InitPPInstance(&cpi->pp, &cpi->dsp);
 
   /* Initialise Configuration structure to legal values */
   if(c->quality>63)c->quality=63;

Modified: branches/theora-mmx/lib/mcomp.c
===================================================================
--- branches/theora-mmx/lib/mcomp.c	2006-05-26 13:07:47 UTC (rev 11424)
+++ branches/theora-mmx/lib/mcomp.c	2006-05-26 17:48:03 UTC (rev 11425)
@@ -97,7 +97,7 @@
     cpi->MVPixelOffsetY[i] = (cpi->MVOffsetY[i]*LineStepY) + cpi->MVOffsetX[i];
 }
 
-static ogg_uint32_t GetInterErr (unsigned char * NewDataPtr,
+static ogg_uint32_t GetInterErr (CP_INSTANCE *cpi, unsigned char * NewDataPtr,
                           unsigned char * RefDataPtr1,
                           unsigned char * RefDataPtr2,
                           ogg_uint32_t PixelsPerLine ) {
@@ -108,10 +108,10 @@
   /* Mode of interpolation chosen based upon on the offset of the
      second reference pointer */
   if ( RefOffset == 0 ) {
-    DiffVal = dsp_static_inter8x8_err (NewDataPtr, PixelsPerLine,
+    DiffVal = dsp_inter8x8_err (cpi->dsp, NewDataPtr, PixelsPerLine,
 		          RefDataPtr1, RefPixelsPerLine);
   }else{
-    DiffVal = dsp_static_inter8x8_err_xy2 (NewDataPtr, PixelsPerLine,
+    DiffVal = dsp_inter8x8_err_xy2 (cpi->dsp, NewDataPtr, PixelsPerLine,
 		          RefDataPtr1, 
 		          RefDataPtr2, RefPixelsPerLine);
   }
@@ -120,7 +120,8 @@
   return DiffVal;
 }
 
-static ogg_uint32_t GetHalfPixelSumAbsDiffs (unsigned char * SrcData,
+static ogg_uint32_t GetHalfPixelSumAbsDiffs (CP_INSTANCE *cpi,
+                                      unsigned char * SrcData,
                                       unsigned char * RefDataPtr1,
                                       unsigned char * RefDataPtr2,
                                       ogg_uint32_t PixelsPerLine,
@@ -133,10 +134,10 @@
 
   if ( RefOffset == 0 ) {
     /* Simple case as for non 0.5 pixel */
-    DiffVal += dsp_static_sad8x8 (SrcData, PixelsPerLine, 
+    DiffVal += dsp_sad8x8 (cpi->dsp, SrcData, PixelsPerLine, 
 		               RefDataPtr1, RefPixelsPerLine);
   } else  {
-    DiffVal += dsp_static_sad8x8_xy2_thres (SrcData, PixelsPerLine, 
+    DiffVal += dsp_sad8x8_xy2_thres (cpi->dsp, SrcData, PixelsPerLine, 
 		               RefDataPtr1, 
 		               RefDataPtr2, RefPixelsPerLine, BestSoFar);
   }
@@ -149,38 +150,38 @@
   ogg_uint32_t  LocalFragIndex = FragIndex;
   ogg_uint32_t  IntraError = 0;
 
-  dsp_static_save_fpu ();
+  dsp_save_fpu (cpi->dsp);
 
   /* Add together the intra errors for those blocks in the macro block
      that are coded (Y only) */
   if ( cpi->pb.display_fragments[LocalFragIndex] )
     IntraError +=
-      dsp_static_intra8x8_err (&cpi->
+      dsp_intra8x8_err (cpi->dsp, &cpi->
                     ConvDestBuffer[cpi->pb.pixel_index_table[LocalFragIndex]],
                     PixelsPerLine);
 
   LocalFragIndex++;
   if ( cpi->pb.display_fragments[LocalFragIndex] )
     IntraError +=
-      dsp_static_intra8x8_err (&cpi->
+      dsp_intra8x8_err (cpi->dsp, &cpi->
                     ConvDestBuffer[cpi->pb.pixel_index_table[LocalFragIndex]],
                     PixelsPerLine);
 
   LocalFragIndex = FragIndex + cpi->pb.HFragments;
   if ( cpi->pb.display_fragments[LocalFragIndex] )
     IntraError +=
-      dsp_static_intra8x8_err (&cpi->
+      dsp_intra8x8_err (cpi->dsp, &cpi->
                      ConvDestBuffer[cpi->pb.pixel_index_table[LocalFragIndex]],
                     PixelsPerLine);
 
   LocalFragIndex++;
   if ( cpi->pb.display_fragments[LocalFragIndex] )
     IntraError +=
-      dsp_static_intra8x8_err (&cpi->
+      dsp_intra8x8_err (cpi->dsp, &cpi->
                     ConvDestBuffer[cpi->pb.pixel_index_table[LocalFragIndex]],
                     PixelsPerLine);
 
-  dsp_static_restore_fpu ();
+  dsp_restore_fpu (cpi->dsp);
 
   return IntraError;
 }
@@ -204,7 +205,7 @@
   unsigned char * SrcPtr1;
   unsigned char * RefPtr1;
 
-  dsp_static_save_fpu ();
+  dsp_save_fpu (cpi->dsp);
 
   /* Work out pixel offset into source buffer. */
   PixelIndex = cpi->pb.pixel_index_table[LocalFragIndex];
@@ -234,7 +235,7 @@
   if ( cpi->pb.display_fragments[LocalFragIndex] ) {
     SrcPtr1 = &SrcPtr[PixelIndex];
     RefPtr1 = &RefPtr[RefPixelIndex + RefPixelOffset];
-    InterError += GetInterErr( SrcPtr1, RefPtr1,
+    InterError += GetInterErr(cpi, SrcPtr1, RefPtr1,
                                  &RefPtr1[RefPtr2Offset], PixelsPerLine );
   }
 
@@ -244,7 +245,7 @@
     RefPixelIndex = cpi->pb.recon_pixel_index_table[LocalFragIndex];
     SrcPtr1 = &SrcPtr[PixelIndex];
     RefPtr1 = &RefPtr[RefPixelIndex + RefPixelOffset];
-    InterError += GetInterErr( SrcPtr1, RefPtr1,
+    InterError += GetInterErr(cpi, SrcPtr1, RefPtr1,
                                  &RefPtr1[RefPtr2Offset], PixelsPerLine );
 
   }
@@ -255,7 +256,7 @@
     RefPixelIndex = cpi->pb.recon_pixel_index_table[LocalFragIndex];
     SrcPtr1 = &SrcPtr[PixelIndex];
     RefPtr1 = &RefPtr[RefPixelIndex + RefPixelOffset];
-    InterError += GetInterErr( SrcPtr1, RefPtr1,
+    InterError += GetInterErr(cpi, SrcPtr1, RefPtr1,
                                  &RefPtr1[RefPtr2Offset], PixelsPerLine );
   }
 
@@ -265,11 +266,11 @@
     RefPixelIndex = cpi->pb.recon_pixel_index_table[LocalFragIndex];
     SrcPtr1 = &SrcPtr[PixelIndex];
     RefPtr1 = &RefPtr[RefPixelIndex + RefPixelOffset];
-    InterError += GetInterErr( SrcPtr1, RefPtr1,
+    InterError += GetInterErr(cpi, SrcPtr1, RefPtr1,
                                  &RefPtr1[RefPtr2Offset], PixelsPerLine );
   }
 
-  dsp_static_restore_fpu ();
+  dsp_restore_fpu (cpi->dsp);
 
   return InterError;
 }
@@ -305,7 +306,7 @@
   unsigned char * RefDataPtr1;
   unsigned char * RefDataPtr2;
 
-  dsp_static_save_fpu ();
+  dsp_save_fpu (cpi->dsp);
 
   /* Note which of the four blocks in the macro block are to be
      included in the search. */
@@ -329,19 +330,19 @@
 
   /* Check the 0,0 candidate. */
   if ( MBlockDispFrags[0] ) {
-    Error += dsp_static_sad8x8 (SrcPtr[0], PixelsPerLine, RefPtr,
+    Error += dsp_sad8x8 (cpi->dsp, SrcPtr[0], PixelsPerLine, RefPtr,
                          PixelsPerLine + STRIDE_EXTRA);
   }
   if ( MBlockDispFrags[1] ) {
-    Error += dsp_static_sad8x8 (SrcPtr[1], PixelsPerLine, RefPtr + 8,
+    Error += dsp_sad8x8 (cpi->dsp, SrcPtr[1], PixelsPerLine, RefPtr + 8,
                          PixelsPerLine + STRIDE_EXTRA);
   }
   if ( MBlockDispFrags[2] ) {
-    Error += dsp_static_sad8x8 (SrcPtr[2], PixelsPerLine, RefPtr + RefRow2Offset,
+    Error += dsp_sad8x8 (cpi->dsp, SrcPtr[2], PixelsPerLine, RefPtr + RefRow2Offset,
                          PixelsPerLine + STRIDE_EXTRA);
   }
   if ( MBlockDispFrags[3] ) {
-    Error += dsp_static_sad8x8 (SrcPtr[3], PixelsPerLine, RefPtr + RefRow2Offset + 8,
+    Error += dsp_sad8x8 (cpi->dsp, SrcPtr[3], PixelsPerLine, RefPtr + RefRow2Offset + 8,
                          PixelsPerLine + STRIDE_EXTRA);
   }
 
@@ -365,22 +366,22 @@
 
       /* Get the score for the current offset */
       if ( MBlockDispFrags[0] ) {
-        Error += dsp_static_sad8x8 (SrcPtr[0], PixelsPerLine, CandidateBlockPtr,
+        Error += dsp_sad8x8 (cpi->dsp, SrcPtr[0], PixelsPerLine, CandidateBlockPtr,
                              PixelsPerLine + STRIDE_EXTRA);
       }
 
       if ( MBlockDispFrags[1] && (Error < MinError) ) {
-        Error += dsp_static_sad8x8_thres (SrcPtr[1], PixelsPerLine, CandidateBlockPtr + 8,
+        Error += dsp_sad8x8_thres (cpi->dsp, SrcPtr[1], PixelsPerLine, CandidateBlockPtr + 8,
                              PixelsPerLine + STRIDE_EXTRA, MinError);
       }
 
       if ( MBlockDispFrags[2] && (Error < MinError) ) {
-        Error += dsp_static_sad8x8_thres (SrcPtr[2], PixelsPerLine, CandidateBlockPtr + RefRow2Offset,
+        Error += dsp_sad8x8_thres (cpi->dsp, SrcPtr[2], PixelsPerLine, CandidateBlockPtr + RefRow2Offset,
                              PixelsPerLine + STRIDE_EXTRA, MinError);
       }
 
       if ( MBlockDispFrags[3] && (Error < MinError) ) {
-        Error += dsp_static_sad8x8_thres (SrcPtr[3], PixelsPerLine, CandidateBlockPtr + RefRow2Offset + 8,
+        Error += dsp_sad8x8_thres (cpi->dsp, SrcPtr[3], PixelsPerLine, CandidateBlockPtr + RefRow2Offset + 8,
                              PixelsPerLine + STRIDE_EXTRA, MinError);
       }
 
@@ -420,7 +421,7 @@
       RefDataPtr1 = BestBlockPtr;
       RefDataPtr2 = RefDataPtr1 + cpi->HalfPixelRef2Offset[i];
       HalfPixelError =
-        GetHalfPixelSumAbsDiffs( SrcPtr[0], RefDataPtr1, RefDataPtr2,
+        GetHalfPixelSumAbsDiffs(cpi, SrcPtr[0], RefDataPtr1, RefDataPtr2,
                          PixelsPerLine, HalfPixelError, BestHalfPixelError );
     }
 
@@ -428,7 +429,7 @@
       RefDataPtr1 = BestBlockPtr + 8;
       RefDataPtr2 = RefDataPtr1 + cpi->HalfPixelRef2Offset[i];
       HalfPixelError =
-        GetHalfPixelSumAbsDiffs( SrcPtr[1], RefDataPtr1, RefDataPtr2,
+        GetHalfPixelSumAbsDiffs(cpi, SrcPtr[1], RefDataPtr1, RefDataPtr2,
                          PixelsPerLine, HalfPixelError, BestHalfPixelError );
     }
 
@@ -436,7 +437,7 @@
       RefDataPtr1 = BestBlockPtr + RefRow2Offset;
       RefDataPtr2 = RefDataPtr1 + cpi->HalfPixelRef2Offset[i];
       HalfPixelError =
-        GetHalfPixelSumAbsDiffs( SrcPtr[2], RefDataPtr1, RefDataPtr2,
+        GetHalfPixelSumAbsDiffs(cpi, SrcPtr[2], RefDataPtr1, RefDataPtr2,
                          PixelsPerLine, HalfPixelError, BestHalfPixelError );
     }
 
@@ -444,7 +445,7 @@
       RefDataPtr1 = BestBlockPtr + RefRow2Offset + 8;
       RefDataPtr2 = RefDataPtr1 + cpi->HalfPixelRef2Offset[i];
       HalfPixelError =
-        GetHalfPixelSumAbsDiffs( SrcPtr[3], RefDataPtr1, RefDataPtr2,
+        GetHalfPixelSumAbsDiffs(cpi, SrcPtr[3], RefDataPtr1, RefDataPtr2,
                          PixelsPerLine, HalfPixelError, BestHalfPixelError );
     }
 
@@ -462,7 +463,7 @@
   InterMVError = GetMBInterError( cpi, cpi->ConvDestBuffer, RefFramePtr,
                                   FragIndex, MV->x, MV->y, PixelsPerLine );
 
-  dsp_static_restore_fpu ();
+  dsp_restore_fpu (cpi->dsp);
 
   /* Return score of best matching block. */
   return InterMVError;
@@ -496,7 +497,7 @@
   unsigned char * RefDataPtr1;
   unsigned char * RefDataPtr2;
 
-  dsp_static_save_fpu ();
+  dsp_save_fpu (cpi->dsp);
 
   /* Note which of the four blocks in the macro block are to be
      included in the search. */
@@ -531,19 +532,19 @@
 
       /* Summ errors for each block. */
       if ( MBlockDispFrags[0] ) {
-        Error += dsp_static_sad8x8 (SrcPtr[0], PixelsPerLine, CandidateBlockPtr,
+        Error += dsp_sad8x8 (cpi->dsp, SrcPtr[0], PixelsPerLine, CandidateBlockPtr,
                              PixelsPerLine + STRIDE_EXTRA);
       }
       if ( MBlockDispFrags[1] ){
-        Error += dsp_static_sad8x8 (SrcPtr[1], PixelsPerLine, CandidateBlockPtr + 8,
+        Error += dsp_sad8x8 (cpi->dsp, SrcPtr[1], PixelsPerLine, CandidateBlockPtr + 8,
                              PixelsPerLine + STRIDE_EXTRA);
       }
       if ( MBlockDispFrags[2] ){
-        Error += dsp_static_sad8x8 (SrcPtr[2], PixelsPerLine, CandidateBlockPtr + RefRow2Offset,
+        Error += dsp_sad8x8 (cpi->dsp, SrcPtr[2], PixelsPerLine, CandidateBlockPtr + RefRow2Offset,
                              PixelsPerLine + STRIDE_EXTRA);
       }
       if ( MBlockDispFrags[3] ){
-        Error += dsp_static_sad8x8 (SrcPtr[3], PixelsPerLine, CandidateBlockPtr + RefRow2Offset + 8,
+        Error += dsp_sad8x8 (cpi->dsp, SrcPtr[3], PixelsPerLine, CandidateBlockPtr + RefRow2Offset + 8,
                              PixelsPerLine + STRIDE_EXTRA);
       }
 
@@ -580,7 +581,7 @@
       RefDataPtr1 = BestBlockPtr;
       RefDataPtr2 = RefDataPtr1 + cpi->HalfPixelRef2Offset[i];
       HalfPixelError =
-        GetHalfPixelSumAbsDiffs( SrcPtr[0], RefDataPtr1, RefDataPtr2,
+        GetHalfPixelSumAbsDiffs(cpi, SrcPtr[0], RefDataPtr1, RefDataPtr2,
                          PixelsPerLine, HalfPixelError, BestHalfPixelError );
     }
 
@@ -588,7 +589,7 @@
       RefDataPtr1 = BestBlockPtr + 8;
       RefDataPtr2 = RefDataPtr1 + cpi->HalfPixelRef2Offset[i];
       HalfPixelError =
-        GetHalfPixelSumAbsDiffs( SrcPtr[1], RefDataPtr1, RefDataPtr2,
+        GetHalfPixelSumAbsDiffs(cpi, SrcPtr[1], RefDataPtr1, RefDataPtr2,
                          PixelsPerLine, HalfPixelError, BestHalfPixelError );
     }
 
@@ -596,7 +597,7 @@
       RefDataPtr1 = BestBlockPtr + RefRow2Offset;
       RefDataPtr2 = RefDataPtr1 + cpi->HalfPixelRef2Offset[i];
       HalfPixelError =
-        GetHalfPixelSumAbsDiffs( SrcPtr[2], RefDataPtr1, RefDataPtr2,
+        GetHalfPixelSumAbsDiffs(cpi, SrcPtr[2], RefDataPtr1, RefDataPtr2,
                          PixelsPerLine, HalfPixelError, BestHalfPixelError );
     }
 
@@ -604,7 +605,7 @@
       RefDataPtr1 = BestBlockPtr + RefRow2Offset + 8;
       RefDataPtr2 = RefDataPtr1 + cpi->HalfPixelRef2Offset[i];
       HalfPixelError =
-        GetHalfPixelSumAbsDiffs( SrcPtr[3], RefDataPtr1, RefDataPtr2,
+        GetHalfPixelSumAbsDiffs(cpi, SrcPtr[3], RefDataPtr1, RefDataPtr2,
                          PixelsPerLine, HalfPixelError, BestHalfPixelError );
     }
 
@@ -622,7 +623,7 @@
   InterMVError = GetMBInterError( cpi, cpi->ConvDestBuffer, RefFramePtr,
                                   FragIndex, MV->x, MV->y, PixelsPerLine );
 
-  dsp_static_restore_fpu ();
+  dsp_restore_fpu (cpi->dsp);
 
   /* Return score of best matching block. */
   return InterMVError;
@@ -666,7 +667,7 @@
 
     for ( j = 0; j < (ogg_int32_t)MAX_MV_EXTENT; j++ ){
       /* Get the block error score. */
-      Error = dsp_static_sad8x8 (SrcPtr, PixelsPerLine, CandidateBlockPtr,
+      Error = dsp_sad8x8 (cpi->dsp, SrcPtr, PixelsPerLine, CandidateBlockPtr,
                              PixelsPerLine + STRIDE_EXTRA);
 
       /* Was this the best so far */
@@ -697,7 +698,7 @@
   for ( i=0; i < 9; i++ ) {
     RefDataPtr2 = BestBlockPtr + cpi->HalfPixelRef2Offset[i];
     HalfPixelError =
-      GetHalfPixelSumAbsDiffs( SrcPtr, BestBlockPtr, RefDataPtr2,
+      GetHalfPixelSumAbsDiffs(cpi, SrcPtr, BestBlockPtr, RefDataPtr2,
                             PixelsPerLine, 0, BestHalfPixelError );
 
     if ( HalfPixelError < BestHalfPixelError ){
@@ -714,7 +715,7 @@
   RefDataPtr2 = BestBlockPtr + cpi->HalfPixelRef2Offset[BestHalfOffset];
 
   InterMVError =
-    GetInterErr( SrcPtr, BestBlockPtr, RefDataPtr2, PixelsPerLine );
+    GetInterErr(cpi, SrcPtr, BestBlockPtr, RefDataPtr2, PixelsPerLine );
 
   /* Return score of best matching block. */
   return InterMVError;
@@ -727,7 +728,7 @@
                                         MOTION_VECTOR *MV ) {
   ogg_uint32_t  InterMVError;
 
-  dsp_static_save_fpu ();
+  dsp_save_fpu (cpi->dsp);
 
   /* For the moment the 4MV mode is only deemed to be valid 
      if all four Y blocks are to be updated */
@@ -759,7 +760,7 @@
     InterMVError = HUGE_ERROR;
   }
 
-  dsp_static_restore_fpu ();
+  dsp_restore_fpu (cpi->dsp);
 
   /* Return score of best matching block. */
   return InterMVError;

Modified: branches/theora-mmx/lib/pp.c
===================================================================
--- branches/theora-mmx/lib/pp.c	2006-05-26 13:07:47 UTC (rev 11424)
+++ branches/theora-mmx/lib/pp.c	2006-05-26 17:48:03 UTC (rev 11425)
@@ -151,10 +151,12 @@
 }
 
 
-void InitPPInstance(PP_INSTANCE *ppi){
+void InitPPInstance(PP_INSTANCE *ppi, DspFunctions *funcs){
 
   memset(ppi,0,sizeof(*ppi));
 
+  memcpy(&ppi->dsp, funcs, sizeof(DspFunctions));
+
   /* Initializations */
   ppi->PrevFrameLimit = 3; /* Must not exceed MAX_PREV_FRAMES (Note
                               that this number includes the current
@@ -491,7 +493,7 @@
 
       } else {
 
-        dsp_static_copy8x8(SrcPtr + 8 * col, DestPtr + 8 * col, LineLength);
+        dsp_copy8x8(pbi->dsp, SrcPtr + 8 * col, DestPtr + 8 * col, LineLength);
 
       }
 
@@ -530,7 +532,7 @@
         DeringBlockWeak(SrcPtr + 8 * col, DestPtr + 8 * col,
                         LineLength,Quality,QuantScale);
       }else{
-        dsp_static_copy8x8(SrcPtr + 8 * col, DestPtr + 8 * col, LineLength);
+        dsp_copy8x8(pbi->dsp, SrcPtr + 8 * col, DestPtr + 8 * col, LineLength);
       }
 
       ++Block;
@@ -566,7 +568,7 @@
         DeringBlockWeak(SrcPtr + 8 * col, DestPtr + 8 * col,
                         LineLength,Quality,QuantScale);
       }else{
-        dsp_static_copy8x8(SrcPtr + 8 * col, DestPtr + 8 * col, LineLength);
+        dsp_copy8x8(pbi->dsp, SrcPtr + 8 * col, DestPtr + 8 * col, LineLength);
       }
 
       ++Block;

Modified: branches/theora-mmx/lib/reconstruct.c
===================================================================
--- branches/theora-mmx/lib/reconstruct.c	2006-05-26 13:07:47 UTC (rev 11424)
+++ branches/theora-mmx/lib/reconstruct.c	2006-05-26 17:48:03 UTC (rev 11425)
@@ -98,7 +98,7 @@
   }
 }
 
-void dsp_recon_init (DspFunctions *funcs)
+void dsp_recon_init (DspFunctions *funcs, ogg_uint32_t cpu_flags)
 {
   funcs->copy8x8 = copy8x8__c;
   funcs->recon_intra8x8 = recon_intra8x8__c;
@@ -106,7 +106,7 @@
   funcs->recon_inter8x8_half = recon_inter8x8_half__c;
 #if (defined(__i386__) || defined(__x86_64__))
   if (cpu_flags & CPU_X86_MMX) {
-    dsp_mmx_recon_init(&dsp_funcs);
+    dsp_mmx_recon_init(funcs);
   }
 #endif
 }

Modified: branches/theora-mmx/lib/scan.c
===================================================================
--- branches/theora-mmx/lib/scan.c	2006-05-26 13:07:47 UTC (rev 11424)
+++ branches/theora-mmx/lib/scan.c	2006-05-26 17:48:03 UTC (rev 11425)
@@ -423,7 +423,7 @@
     for ( i = 0; i < ppi->PlaneHFragments; i ++ ){
       if ( *LocalDispFragPtr <= BLOCK_NOT_CODED ){
         /* Calculate the SAD score for the block row */
-        GrpSad = dsp_static_row_sad8(LocalYuvPtr1,LocalYuvPtr2);
+        GrpSad = dsp_row_sad8(ppi->dsp, LocalYuvPtr1,LocalYuvPtr2);
 
         /* Now test the group SAD score */
         if ( GrpSad > LocalGrpLowSadThresh ){
@@ -480,7 +480,7 @@
     /* Skip if block already marked to be coded. */
     if ( *LocalDispFragPtr <= BLOCK_NOT_CODED ){
       /* Calculate the SAD score for the block column */
-      MaxSad = dsp_static_col_sad8x8(LocalYuvPtr1, LocalYuvPtr2, ppi->PlaneStride );
+      MaxSad = dsp_col_sad8x8(ppi->dsp, LocalYuvPtr1, LocalYuvPtr2, ppi->PlaneStride );
 
       /* Now test the group SAD score */
       if ( MaxSad > LocalGrpLowSadThresh ){
@@ -2074,12 +2074,12 @@
     /* Fast break out test for obvious yes and no cases in this row of
        blocks */
     if ( i < ppi->PlaneVFragments ){
-      dsp_static_save_fpu ();
+      dsp_save_fpu (ppi->dsp);
       UpdatedOrCandidateBlocks =
         RowSadScan( ppi, RawPlanePtr0, RawPlanePtr1, DispFragPtr0 );
       UpdatedOrCandidateBlocks |=
         ColSadScan( ppi, RawPlanePtr0, RawPlanePtr1, DispFragPtr0 );
-      dsp_static_restore_fpu ();
+      dsp_restore_fpu (ppi->dsp);
     }else{
       /* Make sure we still call other functions if RowSadScan() disabled */
       UpdatedOrCandidateBlocks = 1;

Modified: branches/theora-mmx/lib/toplevel.c
===================================================================
--- branches/theora-mmx/lib/toplevel.c	2006-05-26 13:07:47 UTC (rev 11424)
+++ branches/theora-mmx/lib/toplevel.c	2006-05-26 17:48:03 UTC (rev 11425)
@@ -304,14 +304,15 @@
   PB_INSTANCE *pbi;
   codec_setup_info *ci;
 
-  dsp_static_init ();
-
   ci=(codec_setup_info *)c->codec_setup;
   memset(th, 0, sizeof(*th));
   th->internal_decode=pbi=_ogg_calloc(1,sizeof(*pbi));
   th->internal_encode=NULL;
 
   InitPBInstance(pbi);
+
+  dsp_static_init (&pbi->dsp);
+
   memcpy(&pbi->info,c,sizeof(*c));
   pbi->info.codec_setup=NULL;
   th->i=&pbi->info;



More information about the commits mailing list