An I-frame is encoded as a single image, with no reference to any past or future frames. The encoding scheme used is similar to JPEG compression. Each 8x8 block is encoded independently with one exception explained below. Most frequency information is in the upper left corner of the resulting 8x8 block. After this, the data is quantized.
Quantization is the only lossy part of the whole compression process other than subsampling.
A P-frame is encoded relative to the past reference frame. The past reference frame is the closest preceding reference frame. A P-macroblock is encoded as a 16x16 area of the past reference frame, plus an error term. To specify the 16x16 area of the reference frame, a motion vector is included. Other motion vectors are relative to that position.