A method for decoding a bitstream, wherein the bitstream corresponds to an encoded video, wherein the encoded video includes a sequence of frames, wherein each frame is partitioned into encoded blocks, for each encoded block characterized by comprising the steps of: determining a set of paths in the block, wherein each path is at a transform angle determined from a transform index in the bitstream and has a path length m, a minimum path of transform length L min > 2 being specified for the block; obtaining transform coefficients from the bitstream, wherein the transform coefficients include a one-dimensional vector of transformed DC coefficients wherein a length of the vector varies according to the transform angle, and a plurality of AC coefficients, each associated with a particular path within the block, applying a secondary inverse transform only to the one-dimensional vector of transformed DC coefficients to yield a plurality of DC coefficients, each corresponding to the particular path within the block; and applying a primary inverse transform to the transform coefficients on each completed path, comprising the DC coefficient and associated AC coefficients associated with said path, to produce a decoded video, wherein the steps are performed in a decoder, wherein the path is generated by starting at an untransformed starting pixel in the block and by repeatedly including adjacent pixels in a direction corresponding to said transform angle and making a U-turn when the edge of the block is reached until the path is reconstructed and considered to be complete when the path length m, corresponding to the number of pixels in the path, is equal or greater than L min, m ≥ L min and when the path ends at an edge of the block, which ensure that the number of coefficients which are simultaneously transformed at the decoder is above a minimum. determining a set of paths in the block, wherein each path is at a transform angle determined from a transform index in the bitstream and has a path length m, a minimum path of transform length L min > 2 being specified for the block; obtaining transform coefficients from the bitstream, wherein the transform coefficients include a one-dimensional vector of transformed DC coefficients wherein a length of the vector varies according to the transform angle, and a plurality of AC coefficients, each associated with a particular path within the block, applying a secondary inverse transform only to the one-dimensional vector of transformed DC coefficients to yield a plurality of DC coefficients, each corresponding to the particular path within the block; and applying a primary inverse transform to the transform coefficients on each completed path, comprising the DC coefficient and associated AC coefficients associated with said path, to produce a decoded video, wherein the steps are performed in a decoder, wherein the path is generated by starting at an untransformed starting pixel in the block and by repeatedly including adjacent pixels in a direction corresponding to said transform angle and making a U-turn when the edge of the block is reached until the path is reconstructed and considered to be complete when the path length m, corresponding to the number of pixels in the path, is equal or greater than L min, m ≥ L min and when the path ends at an edge of the block, which ensure that the number of coefficients which are simultaneously transformed at the decoder is above a minimum.