Macroblock size and offset would have to be passed to the filter as parameters. Well AFAIK the offset should always be 0,0 and the DCT blocks always 8,8 for MPEG. But someone might like to correct me on this. I think it's still an interesting idea that I'm going to play with some. Also, the current spatial detail detection could result in some thresholding artifacts in very clean sources. You might want to consider fading the edges of the noise out. I was thinking the same thing after writing the "show" code and before I'd finished the actual noising part, but with reasonable means and variances (i.e. those most people would need to use) it's very difficult to spot even when you look real close. I noticed it a couple of times over the course of an hour's testing, but it was only where I already knew (from "show") that a block of noise would appear in an area. Of course if you jack up the variance to something unrealistic (say, >30) then it starts getting noticible, but I would say that's enough of a noise difference that feathering wouldn't really help.