A method for encoding video data including a frame, the method comprising: generating a reconstructed frame from compressed data for the frame; partitioning at least some pixels of the reconstructed frame into a plurality of sets of one or more pixels, wherein the plurality of sets of one or more pixels are determined based at least in part on local variation information for individual pixels, wherein local variation information characterizes a degree to which the magnitudes of pixel values vary in a local region surrounding a given pixel, wherein pixels that have respective values of the local variation information within different ones of multiple ranges belong to different respective ones of the plurality of sets of one or more pixels; partitioning at least a first of the sets of one or more pixels into a plurality of subsets of one or more pixels, based at least in part on pattern information for individual pixels, wherein pattern information for an individual pixel is based on intensity values of pixels in a neighborhood surrounding the pixel, compared to an intensity value of the individual pixel, determined using a Local Binary Pattern, LBP, function; subsequent to partitioning at least some pixels of the reconstructed frame into a plurality of sets and subsets of one or more pixels, determining respective filter parameters for each of the plurality of sets and each of the plurality of subsets, wherein respective filter parameters define respective filters to be applied to respective sets and subsets; filtering pixels in a first set of the plurality of sets by applying the filter defined by the filter parameters of one of the plurality of sets corresponding to the first set; filtering pixels in a first subset of the plurality of subsets by applying the filter defined by the filter parameters of one of the plurality of subsets corresponding to the first subset; and generating encoded video data that includes the compressed data for the frame and information identifying the determined filter parameters. generating a reconstructed frame from compressed data for the frame; partitioning at least some pixels of the reconstructed frame into a plurality of sets of one or more pixels, wherein the plurality of sets of one or more pixels are determined based at least in part on local variation information for individual pixels, wherein local variation information characterizes a degree to which the magnitudes of pixel values vary in a local region surrounding a given pixel, wherein pixels that have respective values of the local variation information within different ones of multiple ranges belong to different respective ones of the plurality of sets of one or more pixels; partitioning at least a first of the sets of one or more pixels into a plurality of subsets of one or more pixels, based at least in part on pattern information for individual pixels, wherein pattern information for an individual pixel is based on intensity values of pixels in a neighborhood surrounding the pixel, compared to an intensity value of the individual pixel, determined using a Local Binary Pattern, LBP, function; subsequent to partitioning at least some pixels of the reconstructed frame into a plurality of sets and subsets of one or more pixels, determining respective filter parameters for each of the plurality of sets and each of the plurality of subsets, wherein respective filter parameters define respective filters to be applied to respective sets and subsets; filtering pixels in a first set of the plurality of sets by applying the filter defined by the filter parameters of one of the plurality of sets corresponding to the first set; filtering pixels in a first subset of the plurality of subsets by applying the filter defined by the filter parameters of one of the plurality of subsets corresponding to the first subset; and generating encoded video data that includes the compressed data for the frame and information identifying the determined filter parameters.