1. A method to decode image data with a decoder, the method comprising: receiving a coded image, the coded image comprising a compressed low dynamic range image, a compressed residual image, and a prediction function, wherein the prediction function provides as an output a predicted pixel value for a pixel in high dynamic range data based on one or more pixel values of pixel values in low dynamic range data and the prediction function is based on the low dynamic range image and a reference high dynamic range image corresponding to the low dynamic range image; decompressing the compressed low dynamic range image to generate a decoded low dynamic range image; decompressing the compressed residual image to generate decoded residual image data; decoding the prediction function to generate a decoded prediction function; applying the decoded prediction function to the decoded low dynamic range image to generate a predicted high dynamic range image; and combining the predicted high dynamic range image with the decoded residual image data to generate an output high dynamic range image.