From c53aa61d2d061e0fa15f6c8a4fe945766a2733d1 Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Sun, 25 Jan 2009 21:25:31 +0100 Subject: [PATCH] do a gauss blur on high resolution monochrome images --- lib/modules/swfbits.c | 102 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/lib/modules/swfbits.c b/lib/modules/swfbits.c index 90c8549..4f6b310 100644 --- a/lib/modules/swfbits.c +++ b/lib/modules/swfbits.c @@ -1382,6 +1382,100 @@ static void decodeMonochromeImage(RGBA*data, int width, int height, RGBA*colors) } } +static void blurImage(RGBA*src, int width, int height, int r) +{ + int e = 2; // r times e is the sampling interval + double*gauss = (double*)malloc(r*e*sizeof(double)); + double sum=0; + int x; + for(x=0;x> 16; + d[x].g = g >> 16; + d[x].b = b >> 16; + d[x].a = a >> 16; + } + for(x=width-range;x> 16; + d[yy].g = g >> 16; + d[yy].b = b >> 16; + d[yy].a = a >> 16; + yy += width; + } + for(y=0;y4) { + /* high-resolution monochrome images are usually dithered, so + low-pass filter them first to get rid of any moire patterns */ + blurImage(data, width, height, r+1); + } } tmpline = (rgba_int_t*)malloc(width*sizeof(rgba_int_t)); -- 1.7.10.4