1. A method for performing motion-compensated prediction in video coding, the method comprising: defining a block in an image, the defined block comprising a plurality of pixels arranged in rows and columns; identifying a first reference image corresponding to a first motion vector; calculating, using processing circuitry, a first set of residual values by subtracting the first reference image from the block, wherein each residual value of the first set of residual values corresponds to a respective pixel within the plurality of pixels; calculating, using the processing circuitry, a first plurality of horizontal absolute difference values, wherein each horizontal absolute difference value in the first plurality of horizontal absolute difference values is calculated between a different respective pair of horizontally-adjacent residual values in the first set of residual values; generating, using the processing circuitry, a first plurality of cumulative row sum values, wherein each cumulative row sum value in the first plurality of cumulative row sum values is calculated by summing a respective subset of the first plurality of horizontal absolute difference values, and wherein each subset of the first plurality of horizontal absolute difference values is calculated using a corresponding row of residual values in the first set of residual values; and generating, using the processing circuitry, a first sum value by summing each of the cumulative row sum values in the first plurality of cumulative row sum values.