I did end up using the dynamically loaded filter feature but without actually changing the h5py code.
ar = n.ascontiguousarray(ar,dtype=n.uint16)
dims = ar.shape
# define chunk as planes defined by the last two axes
chunk = dims[-2:]
if len(dims)==3: chunk = (1,)+chunk
file = h5py.h5f.create(filename)
# Create the dataspace.
space = h5py.h5s.create_simple(dims)
# Create the dataset creation property list and set the chunk size.
dcpl = h5py.h5p.create(h5py.h5p.DATASET_CREATE)
dcpl.set_chunk(chunk)
dcpl.set_filter(307,h5py.h5z.FLAG_MANDATORY,(chunk[-2],chunk[-1],quality))
# Create the chunked dataset.
dset = h5py.h5d.create(file, hierarchy, h5py.h5t.STD_U16LE, space, dcpl)
# Write the data to the dataset.
dset.write(h5py.h5s.ALL, space, ar)
# Force the objects to be closed.
del dcpl
del dset
del space
del file
dcpl.set_filter(307,h5py.h5z.FLAG_MANDATORY,(chunk[-2],chunk[-1],quality))
the filter number is set to 307 and as the last argument I pass the additional filter options.
Let me know if that helps.