• David Barker's avatar
    Fix for the use of prev frame mvs when ext-refs is on · 40a42d4b
    David Barker authored
    Also fix a mismatch for resizing with ext-refs enabled.
    
    There are various preconditions which need to be true for it to
    be valid to set cm->use_prev_frame_mvs = 1, including that the
    sizes of this frame and cm->prev_frame must be equal.
    
    With ext-refs enabled, we would sometimes decide to change
    cm->prev_frame to point to the LAST_FRAME reference, without
    re-checking the preconditions. If the LAST_FRAME was smaller
    than the current frame, this could lead to reading garbage off the
    end of its mv array, and eventually to an encode/decode mismatch.
    
    We fix this by rewriting the preconditions as checks on
    cm->prev_frame directly (rather than using cm->last_width and
    cm->last_height), and by testing the preconditions after any
    possible adjustment.
    
    This should not affect the bitstream unless ext-refs is enabled,
    but may affect the bitstream with ext-refs even if resizing is
    not used.
    
    BUG=aomedia:521
    
    Change-Id: I7dfd9ba82cdf77acc2e27e0c9f3aee21d6afeb54
    40a42d4b
encodeframe.c 265 KB