1. A method for coding, in a video encoder, a block of pixels, called the current block, by spatial prediction comprising the following steps for: determining, for each pixel of said current block, a prediction pixel by thresholding, with a current threshold value, of coefficients from a transformation applied on a window covering at least said pixel of said current block and by inverse transformation applied to said thresholded coefficients, extracting from said current block a prediction block formed of prediction pixels to generate a residue block, coding said residue block, wherein said current threshold value is determined or coded from neighbouring reconstructed pixels of the current block.