avoid operation on invalid ref_row
avoid operation on invalid ref_row

BUG=aomedia:718

Change-Id: Ib3fc5e83dd915d6869ee2d7e0bf40427111c6499

GrokImageCompression/aom,GrokImageCompression/aom,GrokImageCompression/aom,GrokImageCompression/aom,GrokImageCompression/aom,GrokImageCompression/aom