Change code style to match the rest of libav.
---
libavfilter/vf_hqdn3d.c | 308 +++
1 files changed, 152 insertions(+), 156 deletions(-)
diff --git a/libavfilter/vf_hqdn3d.c b/libavfilter/vf_hqdn3d.c
index 9e01606..1fa70c6 100644
--- a/libavfilter/vf_hqdn3d.c
+++ b/libavfilter/vf_hqdn3d.c
@@ -32,165 +32,161 @@
#include "video.h"
typedef struct {
-int Coefs[4][512*16];
-unsigned int *Line;
-unsigned short *Frame[3];
+int coefs[4][512*16];
+uint32_t *line;
+uint16_t *frame_prev[3];
int hsub, vsub;
} HQDN3DContext;
-static inline unsigned int LowPassMul(unsigned int PrevMul, unsigned int
CurrMul, int *Coef)
+static inline uint32_t lowpass(unsigned int prev, unsigned int cur, int *coef)
{
-//int dMul= (PrevMul&0xFF)-(CurrMul&0xFF);
-int dMul= PrevMul-CurrMul;
-unsigned int d=((dMul+0x10007FF)>>12);
-return CurrMul + Coef[d];
+int dmul = prev-cur;
+unsigned int d = (dmul+0x10007FF)>>12; // 0x1000 to convert to unsigned,
7FF for rounding
+return cur + coef[d];
}
-static void deNoiseTemporal(unsigned char *FrameSrc,
-unsigned char *FrameDest,
-unsigned short *FrameAnt,
-int W, int H, int sStride, int dStride,
-int *Temporal)
+static void denoise_temporal(uint8_t *src, uint8_t *dst,
+ uint16_t *frame_ant,
+ int w, int h, int sstride, int dstride,
+ int *temporal)
{
-long X, Y;
-unsigned int PixelDst;
-
-for (Y = 0; Y < H; Y++) {
-for (X = 0; X < W; X++) {
-PixelDst = LowPassMul(FrameAnt[X]<<8, FrameSrc[X]<<16, Temporal);
-FrameAnt[X] = ((PixelDst+0x107F)>>8);
-FrameDest[X]= ((PixelDst+0x10007FFF)>>16);
+long x, y;
+uint32_t pixel;
+
+for (y = 0; y < h; y++) {
+for (x = 0; x < w; x++) {
+pixel = lowpass(frame_ant[x]<<8, src[x]<<16, temporal);
+frame_ant[x] = ((pixel+0x107F)>>8);
+dst[x]= ((pixel+0x10007FFF)>>16);
}
-FrameSrc += sStride;
-FrameDest += dStride;
-FrameAnt += W;
+src += sstride;
+dst += dstride;
+frame_ant += w;
}
}
-static void deNoiseSpacial(unsigned char *Frame,
- unsigned char *FrameDest,
- unsigned int *LineAnt,
- int W, int H, int sStride, int dStride,
- int *Horizontal, int *Vertical)
+static void denoise_spatial(uint8_t *src, uint8_t *dst,
+uint32_t *line_ant,
+int w, int h, int sstride, int dstride,
+int *horizontal, int *vertical)
{
-long X, Y;
-long sLineOffs = 0, dLineOffs = 0;
-unsigned int PixelAnt;
-unsigned int PixelDst;
+long x, y;
+long sline_offs = 0, dline_offs = 0;
+uint32_t pixel_ant;
+uint32_t pixel;
/* First pixel has no left nor top neighbor. */
-PixelDst = LineAnt[0] = PixelAnt = Frame[0]<<16;
-FrameDest[0]= ((PixelDst+0x10007FFF)>>16);
+pixel = line_ant[0] = pixel_ant = src[0]<<16;
+dst[0]= ((pixel+0x10007FFF)>>16);
/* First line has no top neighbor, only left. */
-for (X = 1; X < W; X++) {
-PixelDst = LineAnt[X] = LowPassMul(PixelAnt, Frame[X]<<16, Horizontal);
-FrameDest[X]= ((PixelDst+0x10007FFF)>>16);
+for (x = 1; x < w; x++) {
+pixel = line_ant[x] = lowpass(pixel_ant, src[x]<<16, horizontal);
+dst[x]= ((pixel+0x10007FFF)>>16);
}
-for (Y = 1; Y < H; Y++) {
-unsigned int PixelAnt;
-sLineOffs += sStride, dLineOffs += dStride;
+for (y = 1; y < h; y++) {
+uint32_t pixel_ant;
+sline_offs += sstride, dline_offs += dstride;
/* First pixel on each line doesn't have previous pixel */
-PixelAnt = Frame[sLineOffs]<<16;
-PixelDst = LineAnt[0] = LowPassMul(LineAnt[0], PixelAnt, Vertical);
-FrameDest[dLineOffs]= ((PixelDst+0x10007FFF)>>16);
+pixel_ant = src[sline_offs]<<16;
+pixel = line_ant[0] = lowpass(line_ant[0], pixel_ant, vertical);
+dst[dline_offs]= ((pixel+0x10007FFF)>>16);
-for (X = 1; X < W; X++) {
-unsigned int PixelDst;
+for (x = 1; x < w; x++) {
+uint32_t pixel;
/* The rest are normal */
-PixelAnt = LowPassMul(PixelAnt, Frame[sLineOffs+X]<<16,
Horizontal);
-PixelDst = LineAnt[X] = LowPassMul(LineAnt[X], PixelAnt, Vertical);
-FrameDest[dLineOffs+X]= ((PixelDst+0x10007FFF)>>16);
+pixel_ant = lowpass(pixel_ant, src[sline_offs+x]<<16, horizontal);
+pixel = line_ant[x] = lowpass(line_ant[x], pixel_ant, vertical);
+dst[dline_offs+x]= ((pixel+0x10007FFF)>>16);