[xiph-commits] r9779 - branches/theora-oil/lib
giles at svn.xiph.org
giles at svn.xiph.org
Fri Aug 19 21:28:46 PDT 2005
Author: giles
Date: 2005-08-19 21:28:45 -0700 (Fri, 19 Aug 2005)
New Revision: 9779
Modified:
branches/theora-oil/lib/mcomp.c
branches/theora-oil/lib/scan.c
Log:
Replace the SadTemp macro with inline functions. Patch from j^, who
reports no speed difference. Note that inline will need to be protected
in config.h eventually.
Modified: branches/theora-oil/lib/mcomp.c
===================================================================
--- branches/theora-oil/lib/mcomp.c 2005-08-20 02:21:15 UTC (rev 9778)
+++ branches/theora-oil/lib/mcomp.c 2005-08-20 04:28:45 UTC (rev 9779)
@@ -21,23 +21,6 @@
#ifdef USE_LIBOIL
#include <liboil/liboil.h>
-/* redirect some functions to liboil */
-#define SadTemp uint32_t _sad_tmp;
-
-#define GetSumAbsDiffs(NewDataPtr, RefDataPtr, PixelsPerLine, ErrorSoFar) \
- (oil_sad8x8_u8 (&_sad_tmp, NewDataPtr, PixelsPerLine, RefDataPtr, \
- PixelsPerLine+STRIDE_EXTRA), ErrorSoFar+_sad_tmp)
-
-#define GetNextSumAbsDiffs(NewDataPtr, RefDataPtr, PixelsPerLine, \
- ErrorSoFar, BestSoFar) \
- (oil_sad8x8_u8(&_sad_tmp, NewDataPtr, PixelsPerLine, \
- RefDataPtr, PixelsPerLine+STRIDE_EXTRA), ErrorSoFar+_sad_tmp)
-
-#define GetIntraError(DataPtr,PixelsPerLine) \
- (oil_err_intra8x8_u8 (&_sad_tmp,DataPtr, PixelsPerLine),_sad_tmp)
-
-#else
-#define SadTemp
#endif
/* Initialises motion compentsation. */
@@ -244,7 +227,32 @@
return Result;
}
-#ifndef USE_LIBOIL
+#ifdef USE_LIBOIL
+inline static ogg_uint32_t GetSumAbsDiffs (unsigned char * NewDataPtr,
+ unsigned char * RefDataPtr,
+ ogg_uint32_t PixelsPerLine,
+ ogg_uint32_t ErrorSoFar) {
+ uint32_t _sad_tmp;
+ return (oil_sad8x8_u8 (&_sad_tmp, NewDataPtr, PixelsPerLine, RefDataPtr, PixelsPerLine+STRIDE_EXTRA), ErrorSoFar+_sad_tmp);
+
+}
+
+inline static ogg_uint32_t GetNextSumAbsDiffs (unsigned char * NewDataPtr,
+ unsigned char * RefDataPtr,
+ ogg_uint32_t PixelsPerLine,
+ ogg_uint32_t ErrorSoFar,
+ ogg_uint32_t BestSoFar ) {
+ uint32_t _sad_tmp;
+ return (oil_sad8x8_u8(&_sad_tmp, NewDataPtr, PixelsPerLine, \
+ RefDataPtr, PixelsPerLine+STRIDE_EXTRA), ErrorSoFar+_sad_tmp);
+}
+
+static ogg_uint32_t GetIntraError (unsigned char * DataPtr,
+ ogg_uint32_t PixelsPerLine ) {
+ uint32_t _sad_tmp;
+ return (oil_err_intra8x8_u8 (&_sad_tmp,DataPtr, PixelsPerLine),_sad_tmp);
+}
+#else
static ogg_uint32_t GetSumAbsDiffs (unsigned char * NewDataPtr,
unsigned char * RefDataPtr,
ogg_uint32_t PixelsPerLine,
@@ -310,7 +318,6 @@
ogg_uint32_t DiffVal = ErrorSoFar;
ogg_int32_t RefOffset = (int)(RefDataPtr1 - RefDataPtr2);
ogg_uint32_t RefPixelsPerLine = PixelsPerLine + STRIDE_EXTRA;
- SadTemp;
if ( RefOffset == 0 ) {
/* Simple case as for non 0.5 pixel */
@@ -400,7 +407,6 @@
ogg_uint32_t PixelsPerLine ) {
ogg_uint32_t LocalFragIndex = FragIndex;
ogg_uint32_t IntraError = 0;
- SadTemp;
/* Add together the intra errors for those blocks in the macro block
that are coded (Y only) */
@@ -533,7 +539,6 @@
ogg_int32_t x=0, y=0;
ogg_int32_t step;
ogg_int32_t SearchSite=0;
- SadTemp;
unsigned char *SrcPtr[4] = {NULL,NULL,NULL,NULL};
unsigned char *RefPtr=NULL;
@@ -738,7 +743,6 @@
unsigned char BestHalfOffset;
unsigned char * RefDataPtr1;
unsigned char * RefDataPtr2;
- SadTemp;
/* Note which of the four blocks in the macro block are to be
included in the search. */
@@ -890,7 +894,6 @@
ogg_int32_t BestHalfPixelError;
unsigned char BestHalfOffset;
unsigned char * RefDataPtr2;
- SadTemp;
/* Set up the source pointer for the block. */
SrcPtr = &cpi->
Modified: branches/theora-oil/lib/scan.c
===================================================================
--- branches/theora-oil/lib/scan.c 2005-08-20 02:21:15 UTC (rev 9778)
+++ branches/theora-oil/lib/scan.c 2005-08-20 04:28:45 UTC (rev 9779)
@@ -22,17 +22,6 @@
#ifdef USE_LIBOIL
#include <liboil/liboil.h>
-/* redirect some functions to liboil */
-#define SadTemp uint32_t _sad_tmp;
-
-#define ScalarRowSAD(Src1, Src2) \
- (oil_rowsad8x8_u8 (&_sad_tmp, Src1, Src2), _sad_tmp)
-
-#define ScalarColSAD(ppi, Src1, Src2) \
- (oil_colsad8x8_u8 (&_sad_tmp, Src1, ppi->PlaneStride, \
- Src2, ppi->PlaneStride), _sad_tmp)
-#else
-#define SadTemp
#endif
#define MAX_SEARCH_LINE_LEN 7
@@ -409,7 +398,22 @@
ppi->KFIndicator = ((ppi->KFIndicator*100)/((ppi->ScanYPlaneFragments*3)/4));
}
-#ifndef USE_LIBOIL
+#ifdef USE_LIBOIL
+inline static ogg_uint32_t ScalarRowSAD( unsigned char * Src1,
+ unsigned char * Src2 ){
+ uint32_t _sad_tmp;
+ return (oil_rowsad8x8_u8 (&_sad_tmp, Src1, Src2), _sad_tmp);
+}
+
+inline static ogg_uint32_t ScalarColSAD( PP_INSTANCE *ppi,
+ unsigned char * Src1,
+ unsigned char * Src2 ){
+
+ uint32_t _sad_tmp;
+ return (oil_colsad8x8_u8 (&_sad_tmp, Src1, ppi->PlaneStride,
+ Src2, ppi->PlaneStride), _sad_tmp);
+}
+#else
static ogg_uint32_t ScalarRowSAD( unsigned char * Src1,
unsigned char * Src2 ){
ogg_uint32_t SadValue;
@@ -487,7 +491,6 @@
unsigned char *LocalYuvPtr2;
int InterestingBlocksInRow = 0;
- SadTemp;
/* For each row of pixels in the row of blocks */
for ( j = 0; j < VFRAGPIXELS; j++ ){
@@ -547,7 +550,6 @@
unsigned char * LocalYuvPtr2;
int InterestingBlocksInRow = 0;
- SadTemp;
/* Set the local pixel data pointers for this row. */
LocalYuvPtr1 = YuvPtr1;
More information about the commits
mailing list