Commit 7cea41c2 authored by Tristan Matthews's avatar Tristan Matthews

video_filter: hqdn3d: use C99 loop declarations

parent e959f0bf
...@@ -53,11 +53,10 @@ static void deNoiseTemporal( ...@@ -53,11 +53,10 @@ static void deNoiseTemporal(
int W, int H, int sStride, int dStride, int W, int H, int sStride, int dStride,
int *Temporal) int *Temporal)
{ {
long X, Y;
unsigned int PixelDst; unsigned int PixelDst;
for (Y = 0; Y < H; Y++){ for (long Y = 0; Y < H; Y++){
for (X = 0; X < W; X++){ for (long X = 0; X < W; X++){
PixelDst = LowPassMul(FrameAnt[X]<<8, Frame[X]<<16, Temporal); PixelDst = LowPassMul(FrameAnt[X]<<8, Frame[X]<<16, Temporal);
FrameAnt[X] = ((PixelDst+0x1000007F)>>8); FrameAnt[X] = ((PixelDst+0x1000007F)>>8);
FrameDest[X]= ((PixelDst+0x10007FFF)>>16); FrameDest[X]= ((PixelDst+0x10007FFF)>>16);
...@@ -75,7 +74,6 @@ static void deNoiseSpacial( ...@@ -75,7 +74,6 @@ static void deNoiseSpacial(
int W, int H, int sStride, int dStride, int W, int H, int sStride, int dStride,
int *Horizontal, int *Vertical) int *Horizontal, int *Vertical)
{ {
long X, Y;
long sLineOffs = 0, dLineOffs = 0; long sLineOffs = 0, dLineOffs = 0;
unsigned int PixelAnt; unsigned int PixelAnt;
unsigned int PixelDst; unsigned int PixelDst;
...@@ -85,12 +83,12 @@ static void deNoiseSpacial( ...@@ -85,12 +83,12 @@ static void deNoiseSpacial(
FrameDest[0]= ((PixelDst+0x10007FFF)>>16); FrameDest[0]= ((PixelDst+0x10007FFF)>>16);
/* First line has no top neighbor, only left. */ /* First line has no top neighbor, only left. */
for (X = 1; X < W; X++){ for (long X = 1; X < W; X++){
PixelDst = LineAnt[X] = LowPassMul(PixelAnt, Frame[X]<<16, Horizontal); PixelDst = LineAnt[X] = LowPassMul(PixelAnt, Frame[X]<<16, Horizontal);
FrameDest[X]= ((PixelDst+0x10007FFF)>>16); FrameDest[X]= ((PixelDst+0x10007FFF)>>16);
} }
for (Y = 1; Y < H; Y++){ for (long Y = 1; Y < H; Y++){
unsigned int PixelAnt; unsigned int PixelAnt;
sLineOffs += sStride, dLineOffs += dStride; sLineOffs += sStride, dLineOffs += dStride;
/* First pixel on each line doesn't have previous pixel */ /* First pixel on each line doesn't have previous pixel */
...@@ -98,7 +96,7 @@ static void deNoiseSpacial( ...@@ -98,7 +96,7 @@ static void deNoiseSpacial(
PixelDst = LineAnt[0] = LowPassMul(LineAnt[0], PixelAnt, Vertical); PixelDst = LineAnt[0] = LowPassMul(LineAnt[0], PixelAnt, Vertical);
FrameDest[dLineOffs]= ((PixelDst+0x10007FFF)>>16); FrameDest[dLineOffs]= ((PixelDst+0x10007FFF)>>16);
for (X = 1; X < W; X++){ for (long X = 1; X < W; X++){
unsigned int PixelDst; unsigned int PixelDst;
/* The rest are normal */ /* The rest are normal */
PixelAnt = LowPassMul(PixelAnt, Frame[sLineOffs+X]<<16, Horizontal); PixelAnt = LowPassMul(PixelAnt, Frame[sLineOffs+X]<<16, Horizontal);
...@@ -115,7 +113,6 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x] ...@@ -115,7 +113,6 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x]
int W, int H, int sStride, int dStride, int W, int H, int sStride, int dStride,
int *Horizontal, int *Vertical, int *Temporal) int *Horizontal, int *Vertical, int *Temporal)
{ {
long X, Y;
long sLineOffs = 0, dLineOffs = 0; long sLineOffs = 0, dLineOffs = 0;
unsigned int PixelAnt; unsigned int PixelAnt;
unsigned int PixelDst; unsigned int PixelDst;
...@@ -123,10 +120,10 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x] ...@@ -123,10 +120,10 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x]
if(!FrameAnt){ if(!FrameAnt){
(*FrameAntPtr)=FrameAnt=malloc(W*H*sizeof(unsigned short)); (*FrameAntPtr)=FrameAnt=malloc(W*H*sizeof(unsigned short));
for (Y = 0; Y < H; Y++){ for (long Y = 0; Y < H; Y++){
unsigned short* dst=&FrameAnt[Y*W]; unsigned short* dst=&FrameAnt[Y*W];
unsigned char* src=Frame+Y*sStride; unsigned char* src=Frame+Y*sStride;
for (X = 0; X < W; X++) dst[X]=src[X]<<8; for (long X = 0; X < W; X++) dst[X]=src[X]<<8;
} }
} }
...@@ -149,14 +146,14 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x] ...@@ -149,14 +146,14 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x]
/* First line has no top neighbor. Only left one for each pixel and /* First line has no top neighbor. Only left one for each pixel and
* last frame */ * last frame */
for (X = 1; X < W; X++){ for (long X = 1; X < W; X++){
LineAnt[X] = PixelAnt = LowPassMul(PixelAnt, Frame[X]<<16, Horizontal); LineAnt[X] = PixelAnt = LowPassMul(PixelAnt, Frame[X]<<16, Horizontal);
PixelDst = LowPassMul(FrameAnt[X]<<8, PixelAnt, Temporal); PixelDst = LowPassMul(FrameAnt[X]<<8, PixelAnt, Temporal);
FrameAnt[X] = ((PixelDst+0x1000007F)>>8); FrameAnt[X] = ((PixelDst+0x1000007F)>>8);
FrameDest[X]= ((PixelDst+0x10007FFF)>>16); FrameDest[X]= ((PixelDst+0x10007FFF)>>16);
} }
for (Y = 1; Y < H; Y++){ for (long Y = 1; Y < H; Y++){
unsigned int PixelAnt; unsigned int PixelAnt;
unsigned short* LinePrev=&FrameAnt[Y*W]; unsigned short* LinePrev=&FrameAnt[Y*W];
sLineOffs += sStride, dLineOffs += dStride; sLineOffs += sStride, dLineOffs += dStride;
...@@ -167,7 +164,7 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x] ...@@ -167,7 +164,7 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x]
LinePrev[0] = ((PixelDst+0x1000007F)>>8); LinePrev[0] = ((PixelDst+0x1000007F)>>8);
FrameDest[dLineOffs]= ((PixelDst+0x10007FFF)>>16); FrameDest[dLineOffs]= ((PixelDst+0x10007FFF)>>16);
for (X = 1; X < W; X++){ for (long X = 1; X < W; X++){
unsigned int PixelDst; unsigned int PixelDst;
/* The rest are normal */ /* The rest are normal */
PixelAnt = LowPassMul(PixelAnt, Frame[sLineOffs+X]<<16, Horizontal); PixelAnt = LowPassMul(PixelAnt, Frame[sLineOffs+X]<<16, Horizontal);
...@@ -184,12 +181,11 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x] ...@@ -184,12 +181,11 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x]
static void PrecalcCoefs(int *Ct, double Dist25) static void PrecalcCoefs(int *Ct, double Dist25)
{ {
int i;
double Gamma, Simil, C; double Gamma, Simil, C;
Gamma = log(0.25) / log(1.0 - Dist25/255.0 - 0.00001); Gamma = log(0.25) / log(1.0 - Dist25/255.0 - 0.00001);
for (i = -255*16; i <= 255*16; i++) for (int i = -255*16; i <= 255*16; i++)
{ {
Simil = 1.0 - abs(i) / (16*255.0); Simil = 1.0 - abs(i) / (16*255.0);
C = pow(Simil, Gamma) * 65536.0 * (double)i / 16.0; C = pow(Simil, Gamma) * 65536.0 * (double)i / 16.0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment