1. A method of encoding image data, comprising: frequency-transforming input image data to generate an array of frequency-transformed input image coefficients by a matrix-multiplication process, according to a maximum dynamic range of the transformed data and using transform matrices having a data precision; and selecting the maximum dynamic range and/or the data precision of the transform matrices according to the bit depth of the input image data, wherein the selecting includes: setting the data precision of the transform matrices to a first offset number of bits less than the bit depth of the input image data; and setting the maximum dynamic range of the transformed data to a second offset number of bits greater than the bit depth of the input image data.