• John Koleszar's avatar
    fix last frame buffer copy logic regression · 1942eeb8
    John Koleszar authored
    Commit 0ce39012 introduced a change in the frame buffer copy logic where
    the NEW frame could be copied to the ARF or GF buffer through the
    copy_buffer_to_{arf,gf}==1 flags, if the LAST frame was not being
    refreshed. This is not correct. The intent of the
    copy_buffer_to_{arf,gf}==1 flag is to copy the LAST buffer. To copy the
    NEW buffer, the refresh_{alt_ref,golden}_frame flag should be used.
    The original buffer copy logic is fairly convoluted. For example:
        if (cm->refresh_last_frame)
            vp8_swap_yv12_buffer(&cm->last_frame, &cm->new_frame);
            cm->frame_to_show = &cm->last_frame;
            cm->frame_to_show = &cm->new_frame;
        if (cm->copy_buffer_to_arf)
            if (cm->copy_buffer_to_arf == 1)
                if (cm->refresh_last_frame)
                    vp8_yv12_copy_frame_ptr(&cm->new_frame, &cm->alt_ref_frame);
                    vp8_yv12_copy_frame_ptr(&cm->last_frame, &cm->alt_ref_frame);
            else if (cm->copy_buffer_to_arf == 2)
                vp8_yv12_copy_frame_ptr(&cm->golden_frame, &cm->alt_ref_frame);
    Effectively, if refresh_last_frame, then new and last are swapped, so
    when "new" is copied to ARF, it's equivalent to copying LAST to ARF. If
    not refresh_last_frame, then LAST is copied to ARF. So LAST is copied to
    ARF in both cases.
    Commit 0ce39012 removed the first buffer swap but kept the
    refresh_last_frame?new:last behavior, changing the sense since the first
    swap wasn't done to the more readable refresh_last_frame?last:new, but
    this logic is not correct when !refresh_last_frame.
    This commit restores the correct behavior from v0.9.1 and prior. This
    case is missing from the test vector set.
    Change-Id: I8369fc13a37ae882e31a8a104da808a08bc8428f
onyxd_if.c 12.6 KB