Previous | Next --- Slide 21 of 63
Back to Lecture Thumbnails
pizza

Here we're doing a 2-pass image blur for 1 row of the image at a time and then throwing it away, so we don't have to allocate a lot of memory. Additionally, the 3 rows of the image can fit in the cache, so we will get cache hits. However, this will do 3*3 + 3 = 12 operations per element, which is way too much work to be efficient.

lordpancake

What is being said here is that we can reduce memory usage by running through the entire pipeline for each chunk rather than do each step in a "whole" batch, then going to the next, and so forth

lindenli

All we need is those three layer of tmp_buf to compute a layer of the output. A problem we talked about in class though is that there's a lot of overdone computation since we do a lot of re-computations of pixel values. A solution could be to compute one row at a time, but that creates a sequential algorithm.

derrick

This is an interesting property I didn't think about but is pretty important to realize. Normally, I would assume that if we had a large enough amount of memory, we don't really care how big our temporary buffer is, and we can make it bigger than it has to be. But in this case, we see how the temporary buffer can actually be made small enough to fit in the cache itself. So really, even if we may not be memory limited, it is still in our favor to use this smaller temporary buffer scheme if not just to get more cache hits overall.

A bar cat

Im a little confused about this slide. I thought a two pass filter meant we split up doing the horizontal and vertical blurring. However, in this code I only see that we are doing the verticla blur. Where do we do the horizontal blurring?

rubensl

It seems the horizontal blurring is done in the code block pointed to by the second arrow similar to the original code a few slides before this one. The output from the horizontal blurring is then used afterwards to combine the horizontal blurring and the vertical blurring portion in the next code block.

Please log in to leave a comment.