static uint64_t __attribute__((aligned(8))) pQPb=0;
static uint64_t __attribute__((aligned(8))) pQPb2=0;
static uint8_t __attribute__((aligned(8))) tempBlocks[8*16*2]; //used for the horizontal code
+static uint32_t __attribute__((aligned(4))) maxTmpNoise[4];
#else
static uint64_t packedYOffset= 0x0000000000000000LL;
static uint64_t packedYScale= 0x0100010001000100LL;
//static int test=0;
static void inline tempNoiseReducer(uint8_t *src, int stride,
- uint8_t *tempBlured, int *maxNoise)
+ uint8_t *tempBlured, uint32_t *tempBluredPast, int *maxNoise)
{
#define FAST_L2_DIFF
//#define L1_DIFF //u should change the thresholds too if u try that one
"psrlq $32, %%mm0 \n\t"
"paddd %%mm0, %%mm4 \n\t"
"movd %%mm4, %%ecx \n\t"
+ "shll $2, %%ecx \n\t"
+ "movl %3, %%ebx \n\t"
+ "addl -4(%%ebx), %%ecx \n\t"
+ "addl 4(%%ebx), %%ecx \n\t"
+ "addl -1024(%%ebx), %%ecx \n\t"
+ "addl $4, %%ecx \n\t"
+ "addl 1024(%%ebx), %%ecx \n\t"
+ "shrl $3, %%ecx \n\t"
+ "movl %%ecx, (%%ebx) \n\t"
+ "leal (%%eax, %2, 2), %%ebx \n\t" // 5*stride
+
// "movl %3, %%ecx \n\t"
// "movl %%ecx, test \n\t"
// "jmp 4f \n\t"
- "cmpl %4, %%ecx \n\t"
+ "cmpl 4+maxTmpNoise, %%ecx \n\t"
" jb 2f \n\t"
- "cmpl %5, %%ecx \n\t"
+ "cmpl 8+maxTmpNoise, %%ecx \n\t"
" jb 1f \n\t"
"leal (%%ebx, %2, 2), %%ecx \n\t" // 7*stride
"jmp 4f \n\t"
"2: \n\t"
- "cmpl %3, %%ecx \n\t"
+ "cmpl maxTmpNoise, %%ecx \n\t"
" jb 3f \n\t"
"leal (%%ebx, %2, 2), %%ecx \n\t" // 7*stride
"4: \n\t"
- :: "r" (src), "r" (tempBlured), "r"(stride),
- "m"(maxNoise[0]), "m"(maxNoise[1]), "m"(maxNoise[2])
+ :: "r" (src), "r" (tempBlured), "r"(stride), "m" (tempBluredPast)
: "%eax", "%ebx", "%ecx", "memory"
);
//printf("%d\n", test);
int y;
int d=0;
int sysd=0;
+ int i;
for(y=0; y<8; y++)
{
sysd+= d1;
}
}
+ i=d;
+ d= (
+ 4*d
+ +(*(tempBluredPast-256))
+ +(*(tempBluredPast-1))+ (*(tempBluredPast+1))
+ +(*(tempBluredPast+256))
+ +4)>>3;
+ *tempBluredPast=i;
+// ((*tempBluredPast)*3 + d + 2)>>2;
+
//printf("%d %d %d\n", maxNoise[0], maxNoise[1], maxNoise[2]);
/*
Switch between
/* Temporal noise reducing buffers */
static uint8_t *tempBlured[3]= {NULL,NULL,NULL};
+ static uint32_t *tempBluredPast[3]= {NULL,NULL,NULL};
#ifdef PP_FUNNY_STRIDE
uint8_t *dstBlockPtrBackup;
sumTime= rdtsc();
#endif
//mode= 0x7F;
+#ifdef HAVE_MMX
+ maxTmpNoise[0]= ppMode->maxTmpNoise[0];
+ maxTmpNoise[1]= ppMode->maxTmpNoise[1];
+ maxTmpNoise[2]= ppMode->maxTmpNoise[2];
+#endif
if(tempDst==NULL)
{
//FIXME works only as long as the size doesnt increase
//Note:the +17*1024 is just there so i dont have to worry about r/w over te end
tempBlured[isColor]= (uint8_t*)memalign(8, dstStride*((height+7)&(~7)) + 17*1024);
+ tempBluredPast[isColor]= (uint32_t*)memalign(8, 256*((height+7)&(~7))/2 + 17*1024);
memset(tempBlured[isColor], 0, dstStride*((height+7)&(~7)) + 17*1024);
+ memset(tempBluredPast[isColor], 0, 256*((height+7)&(~7))/2 + 17*1024);
}
if(!yHistogram)
{
tempNoiseReducer(dstBlock-8, stride,
tempBlured[isColor] + y*dstStride + x,
+ tempBluredPast[isColor] + (y>>3)*256 + (x>>3),
ppMode->maxTmpNoise);
}
}
{
tempNoiseReducer(dstBlock-8, dstStride,
tempBlured[isColor] + y*dstStride + x,
+ tempBluredPast[isColor] + (y>>3)*256 + (x>>3),
ppMode->maxTmpNoise);
}
static uint64_t __attribute__((aligned(8))) pQPb=0;
static uint64_t __attribute__((aligned(8))) pQPb2=0;
static uint8_t __attribute__((aligned(8))) tempBlocks[8*16*2]; //used for the horizontal code
+static uint32_t __attribute__((aligned(4))) maxTmpNoise[4];
#else
static uint64_t packedYOffset= 0x0000000000000000LL;
static uint64_t packedYScale= 0x0100010001000100LL;
//static int test=0;
static void inline tempNoiseReducer(uint8_t *src, int stride,
- uint8_t *tempBlured, int *maxNoise)
+ uint8_t *tempBlured, uint32_t *tempBluredPast, int *maxNoise)
{
#define FAST_L2_DIFF
//#define L1_DIFF //u should change the thresholds too if u try that one
"psrlq $32, %%mm0 \n\t"
"paddd %%mm0, %%mm4 \n\t"
"movd %%mm4, %%ecx \n\t"
+ "shll $2, %%ecx \n\t"
+ "movl %3, %%ebx \n\t"
+ "addl -4(%%ebx), %%ecx \n\t"
+ "addl 4(%%ebx), %%ecx \n\t"
+ "addl -1024(%%ebx), %%ecx \n\t"
+ "addl $4, %%ecx \n\t"
+ "addl 1024(%%ebx), %%ecx \n\t"
+ "shrl $3, %%ecx \n\t"
+ "movl %%ecx, (%%ebx) \n\t"
+ "leal (%%eax, %2, 2), %%ebx \n\t" // 5*stride
+
// "movl %3, %%ecx \n\t"
// "movl %%ecx, test \n\t"
// "jmp 4f \n\t"
- "cmpl %4, %%ecx \n\t"
+ "cmpl 4+maxTmpNoise, %%ecx \n\t"
" jb 2f \n\t"
- "cmpl %5, %%ecx \n\t"
+ "cmpl 8+maxTmpNoise, %%ecx \n\t"
" jb 1f \n\t"
"leal (%%ebx, %2, 2), %%ecx \n\t" // 7*stride
"jmp 4f \n\t"
"2: \n\t"
- "cmpl %3, %%ecx \n\t"
+ "cmpl maxTmpNoise, %%ecx \n\t"
" jb 3f \n\t"
"leal (%%ebx, %2, 2), %%ecx \n\t" // 7*stride
"4: \n\t"
- :: "r" (src), "r" (tempBlured), "r"(stride),
- "m"(maxNoise[0]), "m"(maxNoise[1]), "m"(maxNoise[2])
+ :: "r" (src), "r" (tempBlured), "r"(stride), "m" (tempBluredPast)
: "%eax", "%ebx", "%ecx", "memory"
);
//printf("%d\n", test);
int y;
int d=0;
int sysd=0;
+ int i;
for(y=0; y<8; y++)
{
sysd+= d1;
}
}
+ i=d;
+ d= (
+ 4*d
+ +(*(tempBluredPast-256))
+ +(*(tempBluredPast-1))+ (*(tempBluredPast+1))
+ +(*(tempBluredPast+256))
+ +4)>>3;
+ *tempBluredPast=i;
+// ((*tempBluredPast)*3 + d + 2)>>2;
+
//printf("%d %d %d\n", maxNoise[0], maxNoise[1], maxNoise[2]);
/*
Switch between
/* Temporal noise reducing buffers */
static uint8_t *tempBlured[3]= {NULL,NULL,NULL};
+ static uint32_t *tempBluredPast[3]= {NULL,NULL,NULL};
#ifdef PP_FUNNY_STRIDE
uint8_t *dstBlockPtrBackup;
sumTime= rdtsc();
#endif
//mode= 0x7F;
+#ifdef HAVE_MMX
+ maxTmpNoise[0]= ppMode->maxTmpNoise[0];
+ maxTmpNoise[1]= ppMode->maxTmpNoise[1];
+ maxTmpNoise[2]= ppMode->maxTmpNoise[2];
+#endif
if(tempDst==NULL)
{
//FIXME works only as long as the size doesnt increase
//Note:the +17*1024 is just there so i dont have to worry about r/w over te end
tempBlured[isColor]= (uint8_t*)memalign(8, dstStride*((height+7)&(~7)) + 17*1024);
+ tempBluredPast[isColor]= (uint32_t*)memalign(8, 256*((height+7)&(~7))/2 + 17*1024);
memset(tempBlured[isColor], 0, dstStride*((height+7)&(~7)) + 17*1024);
+ memset(tempBluredPast[isColor], 0, 256*((height+7)&(~7))/2 + 17*1024);
}
if(!yHistogram)
{
tempNoiseReducer(dstBlock-8, stride,
tempBlured[isColor] + y*dstStride + x,
+ tempBluredPast[isColor] + (y>>3)*256 + (x>>3),
ppMode->maxTmpNoise);
}
}
{
tempNoiseReducer(dstBlock-8, dstStride,
tempBlured[isColor] + y*dstStride + x,
+ tempBluredPast[isColor] + (y>>3)*256 + (x>>3),
ppMode->maxTmpNoise);
}