Fast filtering for pack/filter/unpack with variable dimensions