BBC BASIC for Windows
Programming >> Graphics and Games >> BoxBlur 2
http://bb4w.conforums.com/index.cgi?board=graphics&action=display&num=1357188580

BoxBlur 2
Post by David Williams on Jan 3rd, 2013, 03:49am

If you haven't heard of 'box blurring' then consider looking it up!

Here's a BASIC prototype of a new, relatively fast box-blurring routine (includes EXE):

http://www.bb4wgames.com/temp/boxblur2_basic_prototype.zip

Try a value of 27 when asked for the filter window size.

It takes around 20 seconds to blur an image on my laptop (it is in BASIC, after all).

I know the unpleasant visual artefacts that can arise when using a square filter, but it's fine for its intended purposes (i.e. not broadcast-quality image processing!).

It should be much faster than the current, pretty dreadful GFXLIB_BoxBlurNxN routine after it's been translated to assembly language.

The image in the demo is that of the once-beautiful French actress, Emmanuelle Béart (before she ruined her looks with disastrous plastic surgery and which she now campaigns against).

The BB4W version was adapted from the source code at Mattias f*gerlund's Coding Blog:

(I don't know why this forum's software has inserted an asterisk in Mattias's surname.)

http://lotsacode.wordpress.com/2010/12/08/fast-blur-box-blur-with-accumulator/



My gratitude to Mattias! (To whom I will duly drop an e-mail.)


David.
Re: BoxBlur 2
Post by David Williams on Jan 3rd, 2013, 12:23pm

A demo of a somewhat suboptimal assembly language implementation of Mattias's algorithm:

http://www.bb4wgames.com/temp/boxblur2_asm.zip

Use the left/right mouse buttons to decrease/increase the filter window size.

Certainly not as fast as it could be, but a darn sight faster than the current GFXLIB_BoxBlurNxN routine (and better in other ways).


David.
--

Re: BoxBlur 2
Post by admin on Jan 3rd, 2013, 3:56pm

on Jan 3rd, 2013, 03:49am, David Williams wrote:
If you haven't heard of 'box blurring' then consider looking it up!

I've not heard that term, but isn't it identical to the more familiar 'running average' (or 'moving average') filter?

http://en.wikipedia.org/wiki/Moving_average

Quote:
(I don't know why this forum's software has inserted an asterisk in Mattias's surname.)

I suspect you do! I must admit, however, that in a mainly UK-centric forum it isn't really appropriate to censor that word: this side of the pond its common meaning is innocuous. My dictionary describes the 'offensive' meaning as "Slang, chiefly U.S. and Canadian".

Indeed many of Conforum's automatic substitutions are laughable, for example any reference to 'b*t*h' will be changed to 'pregnant dog' (it's not even accurate: my dictionary says 'female dog'), and as you've found the words are recognised not just in isolation but as part of a longer word.

So I think there's a good case for drastically pruning the 'profanity' list to include only the most offensive and commonly used swearwords; I've now done that for the groups I administer.

Richard.