A method for distortion optimization of image or video data while encoding of the image or video data, comprising: providing image or video data; evaluating an expected distortion of the coded image or video data as a function of transmission distortion D d (u,j) of the image or video data, wherein said transmission distortion represents the difference between a reconstructed image or video sample at the output of the encoder and a reconstructed image or video sample at the output of the decoder for a sub-pixel position u and a picture index j; and performing error resilient rate distortion optimization of the image or video data for coding mode selection while encoding the image or video data, characterized in that: evaluating the expected distortion includes calculating an approximated second moment of D d (u,j) based on the following equation: E X 2 ≈ ∑ i = 0 N − 1 w i E X i 2 wherein: X = D d (u,j), X i = D d (u i,j), and w i denotes a weight parameter for an N tap finite impulse response filter used for interpolation of values corresponding to sub-pixel positions u from values corresponding to integer pixel positions u i, wherein ∑ i = 0 N − 1 w i = 1, and N denotes an integer number of integer pixel locations u i. providing image or video data; evaluating an expected distortion of the coded image or video data as a function of transmission distortion D d (u,j) of the image or video data, wherein said transmission distortion represents the difference between a reconstructed image or video sample at the output of the encoder and a reconstructed image or video sample at the output of the decoder for a sub-pixel position u and a picture index j; and performing error resilient rate distortion optimization of the image or video data for coding mode selection while encoding the image or video data, characterized in that: evaluating the expected distortion includes calculating an approximated second moment of D d (u,j) based on the following equation: E X 2 ≈ ∑ i = 0 N − 1 w i E X i 2 wherein: X = D d (u,j), X i = D d (u i,j), and w i denotes a weight parameter for an N tap finite impulse response filter used for interpolation of values corresponding to sub-pixel positions u from values corresponding to integer pixel positions u i, wherein ∑ i = 0 N − 1 w i = 1, and N denotes an integer number of integer pixel locations u i. evaluating the expected distortion includes calculating an approximated second moment of D d (u,j) based on the following equation: E X 2 ≈ ∑ i = 0 N − 1 w i E X i 2 wherein: X = D d (u,j), X i = D d (u i,j), and w i denotes a weight parameter for an N tap finite impulse response filter used for interpolation of values corresponding to sub-pixel positions u from values corresponding to integer pixel positions u i, wherein ∑ i = 0 N − 1 w i = 1, and N denotes an integer number of integer pixel locations u i. X = D d (u,j), X i = D d (u i,j), and w i denotes a weight parameter for an N tap finite impulse response filter used for interpolation of values corresponding to sub-pixel positions u from values corresponding to integer pixel positions u i, wherein ∑ i = 0 N − 1 w i = 1, and N denotes an integer number of integer pixel locations u i.