diff options
author | hkuang <hkuang@google.com> | 2014-10-27 16:19:04 -0700 |
---|---|---|
committer | hkuang <hkuang@google.com> | 2014-10-31 17:01:08 -0700 |
commit | 55577431ae364273dbaf2aa1e74f51b0cb893464 (patch) | |
tree | e28e42cdc88d2946fbd3aafe4c2ef364ab4be35d /vp9/encoder/vp9_encoder.c | |
parent | 1c84e73ebda82f0089f6ae71acfe1710f5bed2c2 (diff) | |
download | libvpx-55577431ae364273dbaf2aa1e74f51b0cb893464.tar libvpx-55577431ae364273dbaf2aa1e74f51b0cb893464.tar.gz libvpx-55577431ae364273dbaf2aa1e74f51b0cb893464.tar.bz2 libvpx-55577431ae364273dbaf2aa1e74f51b0cb893464.zip |
Bind motion vectors with frame buffer structure.
This will save a lot of memory for decoder due to removing of prev_mi,
but prev_mi is still needed in encoder. So this will increase a little bit
memory for encoder.
Change-Id: I24b2f1a423ebffa55a9bd2fcee1077dac995b2ed
Diffstat (limited to 'vp9/encoder/vp9_encoder.c')
-rw-r--r-- | vp9/encoder/vp9_encoder.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index dfc636a41..f8ff29993 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -2420,6 +2420,7 @@ void vp9_scale_references(VP9_COMP *cpi) { #if CONFIG_VP9_HIGHBITDEPTH if (ref->y_crop_width != cm->width || ref->y_crop_height != cm->height) { const int new_fb = get_free_fb(cm); + cm->cur_frame = &cm->frame_bufs[new_fb]; vp9_realloc_frame_buffer(&cm->frame_bufs[new_fb].buf, cm->width, cm->height, cm->subsampling_x, cm->subsampling_y, @@ -2437,6 +2438,15 @@ void vp9_scale_references(VP9_COMP *cpi) { scale_and_extend_frame(ref, &cm->frame_bufs[new_fb].buf); #endif // CONFIG_VP9_HIGHBITDEPTH cpi->scaled_ref_idx[ref_frame - 1] = new_fb; + if (cm->frame_bufs[new_fb].mvs == NULL || + cm->frame_bufs[new_fb].mi_rows < cm->mi_rows || + cm->frame_bufs[new_fb].mi_cols < cm->mi_cols) { + cm->frame_bufs[new_fb].mvs = + (MV_REF *)vpx_calloc(cm->mi_rows * cm->mi_cols, + sizeof(*cm->frame_bufs[new_fb].mvs)); + cm->frame_bufs[new_fb].mi_rows = cm->mi_rows; + cm->frame_bufs[new_fb].mi_cols = cm->mi_cols; + } } else { cpi->scaled_ref_idx[ref_frame - 1] = idx; ++cm->frame_bufs[idx].ref_count; @@ -3279,13 +3289,13 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, if (cm->show_frame) { vp9_swap_mi_and_prev_mi(cm); - // Don't increment frame counters if this was an altref buffer // update not a real frame ++cm->current_video_frame; if (cpi->use_svc) vp9_inc_frame_in_layer(cpi); } + cm->prev_frame = cm->cur_frame; if (is_two_pass_svc(cpi)) cpi->svc.layer_context[cpi->svc.spatial_layer_id].last_frame_type = @@ -3630,6 +3640,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, // held. cm->frame_bufs[cm->new_fb_idx].ref_count--; cm->new_fb_idx = get_free_fb(cm); + cm->cur_frame = &cm->frame_bufs[cm->new_fb_idx]; if (!cpi->use_svc && cpi->multi_arf_allowed) { if (cm->frame_type == KEY_FRAME) { |