summaryrefslogtreecommitdiff
path: root/vp9/common
diff options
context:
space:
mode:
authorJohn Koleszar <jkoleszar@google.com>2013-01-16 12:19:42 -0800
committerJohn Koleszar <jkoleszar@google.com>2013-01-16 15:57:02 -0800
commit26bd81b955c0f20edc9ffad0a03f99edf485d0be (patch)
treeb3027e7c0c77e92360d8fc1de2e7539983e3ffc0 /vp9/common
parent4b65837bc6d7d341e7c4be078d5a26e0bb717eeb (diff)
downloadlibvpx-26bd81b955c0f20edc9ffad0a03f99edf485d0be.tar
libvpx-26bd81b955c0f20edc9ffad0a03f99edf485d0be.tar.gz
libvpx-26bd81b955c0f20edc9ffad0a03f99edf485d0be.tar.bz2
libvpx-26bd81b955c0f20edc9ffad0a03f99edf485d0be.zip
Preserve the previous golden frame on golden updates
This commit restores the quality lost when the buffer-to-buffer copy logic was removed. Note that this is specific to the current use of golden frames and will need rework when RTC functionality is added. Change-Id: I7324a75acd96eafd9e0f9b8633d782e390d5dc21
Diffstat (limited to 'vp9/common')
-rw-r--r--vp9/common/vp9_alloccommon.c14
-rw-r--r--vp9/common/vp9_onyxc_int.h6
2 files changed, 14 insertions, 6 deletions
diff --git a/vp9/common/vp9_alloccommon.c b/vp9/common/vp9_alloccommon.c
index 895928b90..f2107d7aa 100644
--- a/vp9/common/vp9_alloccommon.c
+++ b/vp9/common/vp9_alloccommon.c
@@ -87,14 +87,16 @@ int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) {
}
}
- oci->new_fb_idx = 0;
+ oci->new_fb_idx = NUM_YV12_BUFFERS - 1;
+ oci->fb_idx_ref_cnt[oci->new_fb_idx] = 1;
+
for (i = 0; i < 3; i++)
- oci->active_ref_idx[i] = i + 1;
+ oci->active_ref_idx[i] = i;
- oci->fb_idx_ref_cnt[0] = 1;
- oci->fb_idx_ref_cnt[1] = 1;
- oci->fb_idx_ref_cnt[2] = 1;
- oci->fb_idx_ref_cnt[3] = 1;
+ for (i = 0; i < NUM_REF_FRAMES; i++) {
+ oci->ref_frame_map[i] = i;
+ oci->fb_idx_ref_cnt[i] = 1;
+ }
if (vp8_yv12_alloc_frame_buffer(&oci->temp_scale_frame, width, 16,
VP9BORDERINPIXELS) < 0) {
diff --git a/vp9/common/vp9_onyxc_int.h b/vp9/common/vp9_onyxc_int.h
index 46a9ff781..0f40e9faa 100644
--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -38,6 +38,7 @@ void vp9_initialize_common(void);
#define QINDEX_RANGE (MAXQ + 1)
#define NUM_REF_FRAMES 3
+#define NUM_REF_FRAMES_LG2 2
#define NUM_YV12_BUFFERS (NUM_REF_FRAMES + 1)
#define NUM_FRAME_CONTEXTS_LG2 2
@@ -147,6 +148,11 @@ typedef struct VP9Common {
YV12_BUFFER_CONFIG yv12_fb[NUM_YV12_BUFFERS];
int fb_idx_ref_cnt[NUM_YV12_BUFFERS]; /* reference counts */
+ int ref_frame_map[NUM_REF_FRAMES]; /* maps fb_idx to reference slot */
+
+ /* TODO(jkoleszar): could expand active_ref_idx to 4, with 0 as intra, and
+ * roll new_fb_idx into it.
+ */
int active_ref_idx[3]; /* each frame can reference 3 buffers */
int new_fb_idx;