I am missing something?
Indeed, the context is standard stereo and (all) pixel comparisons ($w\times h$).
In a rectified image, the epipolar line can be typically be about the width of the image. Thus the search range would be $D\times w$.
Thus total number of comparisons = $D\times w \times wh$.