[xiph-commits] r11540 - in branches/theora-playtime/lib: . x86_32_vs
illiminable at svn.xiph.org
illiminable at svn.xiph.org
Wed Jun 7 11:21:58 PDT 2006
Author: illiminable
Date: 2006-06-07 11:21:52 -0700 (Wed, 07 Jun 2006)
New Revision: 11540
Modified:
branches/theora-playtime/lib/scan.c
branches/theora-playtime/lib/x86_32_vs/idct_sse2.c
branches/theora-playtime/lib/x86_32_vs/perf_helper.h
Log:
* Let perf data be disabled
* break up rowdiffscan completely, profile shows 70% of RowDiffScan in one of the new functions
* Temproraliy put the C cversion of dequant_slow in, it modifies ebx and the profiler doesn't like it when it's different at the end of the function.
Modified: branches/theora-playtime/lib/scan.c
===================================================================
--- branches/theora-playtime/lib/scan.c 2006-06-07 17:27:44 UTC (rev 11539)
+++ branches/theora-playtime/lib/scan.c 2006-06-07 18:21:52 UTC (rev 11540)
@@ -21,6 +21,8 @@
#include "codec_internal.h"
#include "dsp.h"
+//#include "perf_helper.h"
+
#define MAX_SEARCH_LINE_LEN 7
#define SET8_0(ptr) \
@@ -680,6 +682,7 @@
}
+/* This is a new function factor out of rowdiffscan, maybe needs a better name */
static ogg_int32_t RowDiffScan_DiffAndThresholding(PP_INSTANCE *ppi,
unsigned char * YuvPtr1,
unsigned char * YuvPtr2,
@@ -710,7 +713,117 @@
}
+/* This is a new function factor out of rowdiffscan, maybe needs a better name */
+static ogg_int32_t RowDiffScan_DiffAndThresholdingFirstFrag(PP_INSTANCE *ppi,
+ unsigned char * YuvPtr1,
+ unsigned char * YuvPtr2,
+ ogg_int16_t * YUVDiffsPtr,
+ unsigned char * bits_map_ptr,
+ signed char * SgcPtr)
+{
+ ogg_int16_t Diff; /* Temp local workspace. */
+ ogg_int32_t j;
+ ogg_int32_t FragChangedPixels = 0;
+ for ( j = 0; j < HFRAGPIXELS; j++ ){
+ /* Take a local copy of the measured difference. */
+ Diff = (int)YuvPtr1[j] - (int)YuvPtr2[j];
+
+ /* Store the actual difference value */
+ YUVDiffsPtr[j] = Diff;
+
+ /* Test against the Level thresholds and record the results */
+ SgcPtr[0] += ppi->SgcThreshTable[Diff+255];
+
+ if (j>0 && ppi->SrfPakThreshTable[Diff+255] )
+ Diff = (int)ApplyPakLowPass( ppi, &YuvPtr1[j] ) -
+ (int)ApplyPakLowPass( ppi, &YuvPtr2[j] );
+
+ /* Test against the SRF thresholds */
+ bits_map_ptr[j] = ppi->SrfThreshTable[Diff+255];
+ FragChangedPixels += ppi->SrfThreshTable[Diff+255];
+ }
+ return FragChangedPixels;
+
+}
+
+
+
+/* This is a new function factor out of rowdiffscan, maybe needs a better name */
+static ogg_int32_t RowDiffScan_DiffAndThresholdingLastFrag(PP_INSTANCE *ppi,
+ unsigned char * YuvPtr1,
+ unsigned char * YuvPtr2,
+ ogg_int16_t * YUVDiffsPtr,
+ unsigned char * bits_map_ptr,
+ signed char * SgcPtr)
+{
+ ogg_int16_t Diff; /* Temp local workspace. */
+ ogg_int32_t j;
+ ogg_int32_t FragChangedPixels = 0;
+
+ for ( j = 0; j < HFRAGPIXELS; j++ ){
+ /* Take a local copy of the measured difference. */
+ Diff = (int)YuvPtr1[j] - (int)YuvPtr2[j];
+
+ /* Store the actual difference value */
+ YUVDiffsPtr[j] = Diff;
+
+ /* Test against the Level thresholds and record the results */
+ SgcPtr[0] += ppi->SgcThreshTable[Diff+255];
+
+ if (j<7 && ppi->SrfPakThreshTable[Diff+255] )
+ Diff = (int)ApplyPakLowPass( ppi, &YuvPtr1[j] ) -
+ (int)ApplyPakLowPass( ppi, &YuvPtr2[j] );
+
+
+ /* Test against the SRF thresholds */
+ bits_map_ptr[j] = ppi->SrfThreshTable[Diff+255];
+ FragChangedPixels += ppi->SrfThreshTable[Diff+255];
+ }
+ return FragChangedPixels;
+
+}
+
+
+
+
+
+
+/* This is a new function factor out of rowdiffscan, maybe needs a better name */
+static ogg_int32_t RowDiffScan_DiffAndThresholdingMiddleFrag(PP_INSTANCE *ppi,
+ unsigned char * YuvPtr1,
+ unsigned char * YuvPtr2,
+ ogg_int16_t * YUVDiffsPtr,
+ unsigned char * bits_map_ptr,
+ signed char * SgcPtr)
+{
+ ogg_int16_t Diff; /* Temp local workspace. */
+ ogg_int32_t j;
+ ogg_int32_t FragChangedPixels = 0;
+ for ( j = 0; j < HFRAGPIXELS; j++ ){
+ /* Take a local copy of the measured difference. */
+ Diff = (int)YuvPtr1[j] - (int)YuvPtr2[j];
+
+ /* Store the actual difference value */
+ YUVDiffsPtr[j] = Diff;
+
+ /* Test against the Level thresholds and record the results */
+ SgcPtr[0] += ppi->SgcThreshTable[Diff+255];
+
+ if (ppi->SrfPakThreshTable[Diff+255] )
+ Diff = (int)ApplyPakLowPass( ppi, &YuvPtr1[j] ) -
+ (int)ApplyPakLowPass( ppi, &YuvPtr2[j] );
+
+
+ /* Test against the SRF thresholds */
+ bits_map_ptr[j] = ppi->SrfThreshTable[Diff+255];
+ FragChangedPixels += ppi->SrfThreshTable[Diff+255];
+ }
+ return FragChangedPixels;
+
+}
+
+
static void RowDiffScan( PP_INSTANCE *ppi,
unsigned char * YuvPtr1,
unsigned char * YuvPtr2,
@@ -739,20 +852,13 @@
/* Clear down entries in changed locals array */
SET8_0(ChLocalsPtr);
- for ( j = 0; j < HFRAGPIXELS; j++ ){
- /* Take a local copy of the measured difference. */
- Diff = (int)YuvPtr1[j] - (int)YuvPtr2[j];
-
- /* Store the actual difference value */
- YUVDiffsPtr[j] = Diff;
-
- /* Test against the Level thresholds and record the results */
- SgcPtr[0] += ppi->SgcThreshTable[Diff+255];
-
- /* Test against the SRF thresholds */
- bits_map_ptr[j] = ppi->SrfThreshTable[Diff+255];
- FragChangedPixels += ppi->SrfThreshTable[Diff+255];
- }
+ FragChangedPixels += RowDiffScan_DiffAndThresholding( ppi,
+ YuvPtr1,
+ YuvPtr2,
+ YUVDiffsPtr,
+ bits_map_ptr,
+ SgcPtr);
+
}else{
/* If we are breaking out here mark all pixels as changed. */
if ( *DispFragPtr > BLOCK_NOT_CODED ){
@@ -797,24 +903,14 @@
/* Clear down entries in changed locals array */
SET8_0(ChLocalsPtr);
- for ( j = 0; j < HFRAGPIXELS; j++ ){
- /* Take a local copy of the measured difference. */
- Diff = (int)YuvPtr1[j] - (int)YuvPtr2[j];
+ FragChangedPixels += RowDiffScan_DiffAndThresholdingFirstFrag(
+ ppi,
+ YuvPtr1,
+ YuvPtr2,
+ YUVDiffsPtr,
+ bits_map_ptr,
+ SgcPtr);
- /* Store the actual difference value */
- YUVDiffsPtr[j] = Diff;
-
- /* Test against the Level thresholds and record the results */
- SgcPtr[0] += ppi->SgcThreshTable[Diff+255];
-
- if (j>0 && ppi->SrfPakThreshTable[Diff+255] )
- Diff = (int)ApplyPakLowPass( ppi, &YuvPtr1[j] ) -
- (int)ApplyPakLowPass( ppi, &YuvPtr2[j] );
-
- /* Test against the SRF thresholds */
- bits_map_ptr[j] = ppi->SrfThreshTable[Diff+255];
- FragChangedPixels += ppi->SrfThreshTable[Diff+255];
- }
}else{
/* If we are breaking out here mark all pixels as changed. */
if ( *DispFragPtr > BLOCK_NOT_CODED ){
@@ -856,25 +952,15 @@
if (*DispFragPtr == CANDIDATE_BLOCK){
/* Clear down entries in changed locals array */
SET8_0(ChLocalsPtr);
- for ( j = 0; j < HFRAGPIXELS; j++ ){
- /* Take a local copy of the measured difference. */
- Diff = (int)YuvPtr1[j] - (int)YuvPtr2[j];
- /* Store the actual difference value */
- YUVDiffsPtr[j] = Diff;
+ FragChangedPixels += RowDiffScan_DiffAndThresholdingMiddleFrag(
+ ppi,
+ YuvPtr1,
+ YuvPtr2,
+ YUVDiffsPtr,
+ bits_map_ptr,
+ SgcPtr);
- /* Test against the Level thresholds and record the results */
- SgcPtr[0] += ppi->SgcThreshTable[Diff+255];
-
- if (ppi->SrfPakThreshTable[Diff+255] )
- Diff = (int)ApplyPakLowPass( ppi, &YuvPtr1[j] ) -
- (int)ApplyPakLowPass( ppi, &YuvPtr2[j] );
-
-
- /* Test against the SRF thresholds */
- bits_map_ptr[j] = ppi->SrfThreshTable[Diff+255];
- FragChangedPixels += ppi->SrfThreshTable[Diff+255];
- }
}else{
/* If we are breaking out here mark all pixels as changed. */
if ( *DispFragPtr > BLOCK_NOT_CODED ){
@@ -916,25 +1002,15 @@
/* Clear down entries in changed locals array */
SET8_0(ChLocalsPtr);
- for ( j = 0; j < HFRAGPIXELS; j++ ){
- /* Take a local copy of the measured difference. */
- Diff = (int)YuvPtr1[j] - (int)YuvPtr2[j];
+ FragChangedPixels += RowDiffScan_DiffAndThresholdingLastFrag(
+ ppi,
+ YuvPtr1,
+ YuvPtr2,
+ YUVDiffsPtr,
+ bits_map_ptr,
+ SgcPtr);
- /* Store the actual difference value */
- YUVDiffsPtr[j] = Diff;
- /* Test against the Level thresholds and record the results */
- SgcPtr[0] += ppi->SgcThreshTable[Diff+255];
-
- if (j<7 && ppi->SrfPakThreshTable[Diff+255] )
- Diff = (int)ApplyPakLowPass( ppi, &YuvPtr1[j] ) -
- (int)ApplyPakLowPass( ppi, &YuvPtr2[j] );
-
-
- /* Test against the SRF thresholds */
- bits_map_ptr[j] = ppi->SrfThreshTable[Diff+255];
- FragChangedPixels += ppi->SrfThreshTable[Diff+255];
- }
}else{
/* If we are breaking out here mark all pixels as changed.*/
if ( *DispFragPtr > BLOCK_NOT_CODED ) {
Modified: branches/theora-playtime/lib/x86_32_vs/idct_sse2.c
===================================================================
--- branches/theora-playtime/lib/x86_32_vs/idct_sse2.c 2006-06-07 17:27:44 UTC (rev 11539)
+++ branches/theora-playtime/lib/x86_32_vs/idct_sse2.c 2006-06-07 18:21:52 UTC (rev 11540)
@@ -45,7 +45,7 @@
ogg_int16_t * quantized_list,
ogg_int32_t * DCT_block)
{
-#if 0
+#if 1
int i;
PERF_BLOCK_START();
Modified: branches/theora-playtime/lib/x86_32_vs/perf_helper.h
===================================================================
--- branches/theora-playtime/lib/x86_32_vs/perf_helper.h 2006-06-07 17:27:44 UTC (rev 11539)
+++ branches/theora-playtime/lib/x86_32_vs/perf_helper.h 2006-06-07 18:21:52 UTC (rev 11540)
@@ -9,16 +9,24 @@
extern unsigned __int64 GetCPUTime();
+#ifdef PERF_DATA_ON
+
#define PERF_BLOCK_START() perf_start_time[depth++] = GetCPUTime();
#define PERF_BLOCK_END(s, x, y, l, z) perf_temp = (GetCPUTime() - perf_start_time[--depth]); (l) = ((l) > perf_temp) ? perf_temp : (l); x += perf_temp; (y)++; \
if (((y) % (z)) == 0) \
{ \
printf(s " - %lld from %lld iterations -- @%lld cycles -- min(%lld)\n", x, y, (x) / (y), l); \
- }
+ }
+#else
+#define PERF_BLOCK_START()
+#define PERF_BLOCK_END(s, x, y, l, z)
+#endif
+
+
#endif
\ No newline at end of file
More information about the commits
mailing list