From: James Berry Date: Fri, 27 May 2011 18:57:25 +0000 (-0400) Subject: bug fix check frame buffer index before copy X-Git-Tag: 1.0_branch~441^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8795b52512b69193d91d27776513439fa96a9604;p=profile%2Fivi%2Flibvpx.git bug fix check frame buffer index before copy in onyx_if.c update_reference_frames() make sure that frame buffer indexes are not equal before preforming a buffer copy. If two frames share the same buffer the flags will already be set correctly. Change-Id: Ida9b5516d08e3435c90f131d2dc19d842cfb536e --- diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index ae3aa0b..dc2022c 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -3105,15 +3105,21 @@ void update_reference_frames(VP8_COMMON *cm) if (cm->copy_buffer_to_arf == 1) { - yv12_fb[cm->lst_fb_idx].flags |= VP8_ALT_FLAG; - yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG; - cm->alt_fb_idx = cm->lst_fb_idx; + if(cm->alt_fb_idx != cm->lst_fb_idx) + { + yv12_fb[cm->lst_fb_idx].flags |= VP8_ALT_FLAG; + yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG; + cm->alt_fb_idx = cm->lst_fb_idx; + } } else /* if (cm->copy_buffer_to_arf == 2) */ { - yv12_fb[cm->gld_fb_idx].flags |= VP8_ALT_FLAG; - yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG; - cm->alt_fb_idx = cm->gld_fb_idx; + if(cm->alt_fb_idx != cm->gld_fb_idx) + { + yv12_fb[cm->gld_fb_idx].flags |= VP8_ALT_FLAG; + yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG; + cm->alt_fb_idx = cm->gld_fb_idx; + } } } @@ -3131,15 +3137,21 @@ void update_reference_frames(VP8_COMMON *cm) if (cm->copy_buffer_to_gf == 1) { - yv12_fb[cm->lst_fb_idx].flags |= VP8_GOLD_FLAG; - yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG; - cm->gld_fb_idx = cm->lst_fb_idx; + if(cm->gld_fb_idx != cm->lst_fb_idx) + { + yv12_fb[cm->lst_fb_idx].flags |= VP8_GOLD_FLAG; + yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG; + cm->gld_fb_idx = cm->lst_fb_idx; + } } else /* if (cm->copy_buffer_to_gf == 2) */ { - yv12_fb[cm->alt_fb_idx].flags |= VP8_GOLD_FLAG; - yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG; - cm->gld_fb_idx = cm->alt_fb_idx; + if(cm->alt_fb_idx != cm->gld_fb_idx) + { + yv12_fb[cm->alt_fb_idx].flags |= VP8_GOLD_FLAG; + yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG; + cm->gld_fb_idx = cm->alt_fb_idx; + } } } }