We propose an adaptive ltering approach for coding video that exhibits localized camera focus changes, e.g., such that different portions of a video frame can undergo different blurriness / sharpness changes with respect to corresponding areas in frames used for prediction. First we obtain, for each macroblock, the lter that provides maximum reduction in residual energy, when applied to the reference macroblock before to motion compensation. Then, starting from the block-wise lter parameters, we divide the macroblocks into classes, by clustering macroblocks that have been assigned “similar” lters. Finally, for each class, a two-dimensional lter is designed to minimize the average residual energy for all macroblocks in the class. The resulting lters are applied to the reference frames to generate better matches for motion compensation. Simulation results shows that the proposed method provides up to 1 dB gain over current H.264 for certain sequences. As compared to H.264 with multi...