1. A method for encoding an image block, the image block comprising a set of pixel values, the method comprising: selecting, by one or more processors, a spatial directional mode for predicting pixels in the image block based on neighboring pixels; generating, by the one or more processors, a predicted block for the image block based on the neighboring pixels and the selected spatial directional mode; computing, by the one or more processors, a prediction error between the image block and the predicted block; based on the selected spatial directional mode, selecting, by the one or more processors, a set of transform basis functions for representing the prediction error from a plurality of sets of transform basis functions for a particular image block size, the plurality of sets of transform basis functions including a set of transform basis functions for a first spatial directional mode that is different from a set of transform basis functions for a second spatial directional mode; and transforming, by the one or more processors, the prediction error using the set of transform basis functions to derive at least one transform coefficient.