Commit 0ce39012 authored by Fritz Koenig's avatar Fritz Koenig
Browse files

Swap alt/gold/new/last frame buffer ptrs instead of copying.

At the end of the decode, frame buffers were being copied.
The frames are not updated after the copy, they are just
for reference on later frames.  This change allows multiple
references to the same frame buffer instead of copying it.

Changes needed to be made to the encoder to handle this.  The
encoder is still doing frame buffer copies in similar places
where pointer reference could be done.

Change-Id: I7c38be4d23979cc49b5f17241ca3a78703803e66
parent 68cf2431
...@@ -31,13 +31,15 @@ void vp8_update_mode_info_border(MODE_INFO *mi, int rows, int cols) ...@@ -31,13 +31,15 @@ void vp8_update_mode_info_border(MODE_INFO *mi, int rows, int cols)
vpx_memset(&mi[i*cols-1], 0, sizeof(MODE_INFO)); vpx_memset(&mi[i*cols-1], 0, sizeof(MODE_INFO));
} }
} }
void vp8_de_alloc_frame_buffers(VP8_COMMON *oci) void vp8_de_alloc_frame_buffers(VP8_COMMON *oci)
{ {
int i;
for (i = 0; i < NUM_YV12_BUFFERS; i++)
vp8_yv12_de_alloc_frame_buffer(&oci->yv12_fb[i]);
vp8_yv12_de_alloc_frame_buffer(&oci->temp_scale_frame); vp8_yv12_de_alloc_frame_buffer(&oci->temp_scale_frame);
vp8_yv12_de_alloc_frame_buffer(&oci->new_frame);
vp8_yv12_de_alloc_frame_buffer(&oci->last_frame);
vp8_yv12_de_alloc_frame_buffer(&oci->golden_frame);
vp8_yv12_de_alloc_frame_buffer(&oci->alt_ref_frame);
vp8_yv12_de_alloc_frame_buffer(&oci->post_proc_buffer); vp8_yv12_de_alloc_frame_buffer(&oci->post_proc_buffer);
vpx_free(oci->above_context[Y1CONTEXT]); vpx_free(oci->above_context[Y1CONTEXT]);
...@@ -61,6 +63,8 @@ void vp8_de_alloc_frame_buffers(VP8_COMMON *oci) ...@@ -61,6 +63,8 @@ void vp8_de_alloc_frame_buffers(VP8_COMMON *oci)
int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height) int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height)
{ {
int i;
vp8_de_alloc_frame_buffers(oci); vp8_de_alloc_frame_buffers(oci);
// our internal buffers are always multiples of 16 // our internal buffers are always multiples of 16
...@@ -71,32 +75,28 @@ int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height) ...@@ -71,32 +75,28 @@ int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height)
height += 16 - (height & 0xf); height += 16 - (height & 0xf);
if (vp8_yv12_alloc_frame_buffer(&oci->temp_scale_frame, width, 16, VP8BORDERINPIXELS) < 0) for (i = 0; i < NUM_YV12_BUFFERS; i++)
{ {
vp8_de_alloc_frame_buffers(oci); oci->fb_idx_ref_cnt[0] = 0;
return ALLOC_FAILURE;
}
if (vp8_yv12_alloc_frame_buffer(&oci->new_frame, width, height, VP8BORDERINPIXELS) < 0) if (vp8_yv12_alloc_frame_buffer(&oci->yv12_fb[i], width, height, VP8BORDERINPIXELS) < 0)
{ {
vp8_de_alloc_frame_buffers(oci); vp8_de_alloc_frame_buffers(oci);
return ALLOC_FAILURE; return ALLOC_FAILURE;
}
} }
if (vp8_yv12_alloc_frame_buffer(&oci->last_frame, width, height, VP8BORDERINPIXELS) < 0) oci->new_fb_idx = 0;
{ oci->lst_fb_idx = 1;
vp8_de_alloc_frame_buffers(oci); oci->gld_fb_idx = 2;
return ALLOC_FAILURE; oci->alt_fb_idx = 3;
}
if (vp8_yv12_alloc_frame_buffer(&oci->golden_frame, width, height, VP8BORDERINPIXELS) < 0) oci->fb_idx_ref_cnt[0] = 1;
{ oci->fb_idx_ref_cnt[1] = 1;
vp8_de_alloc_frame_buffers(oci); oci->fb_idx_ref_cnt[2] = 1;
return ALLOC_FAILURE; oci->fb_idx_ref_cnt[3] = 1;
}
if (vp8_yv12_alloc_frame_buffer(&oci->alt_ref_frame, width, height, VP8BORDERINPIXELS) < 0) if (vp8_yv12_alloc_frame_buffer(&oci->temp_scale_frame, width, 16, VP8BORDERINPIXELS) < 0)
{ {
vp8_de_alloc_frame_buffers(oci); vp8_de_alloc_frame_buffers(oci);
return ALLOC_FAILURE; return ALLOC_FAILURE;
......
...@@ -33,6 +33,7 @@ void vp8_initialize_common(void); ...@@ -33,6 +33,7 @@ void vp8_initialize_common(void);
#define MAXQ 127 #define MAXQ 127
#define QINDEX_RANGE (MAXQ + 1) #define QINDEX_RANGE (MAXQ + 1)
#define NUM_YV12_BUFFERS 4
typedef struct frame_contexts typedef struct frame_contexts
{ {
...@@ -94,11 +95,12 @@ typedef struct VP8Common ...@@ -94,11 +95,12 @@ typedef struct VP8Common
YUV_TYPE clr_type; YUV_TYPE clr_type;
CLAMP_TYPE clamp_type; CLAMP_TYPE clamp_type;
YV12_BUFFER_CONFIG last_frame;
YV12_BUFFER_CONFIG golden_frame;
YV12_BUFFER_CONFIG alt_ref_frame;
YV12_BUFFER_CONFIG new_frame;
YV12_BUFFER_CONFIG *frame_to_show; YV12_BUFFER_CONFIG *frame_to_show;
YV12_BUFFER_CONFIG yv12_fb[NUM_YV12_BUFFERS];
int fb_idx_ref_cnt[NUM_YV12_BUFFERS];
int new_fb_idx, lst_fb_idx, gld_fb_idx, alt_fb_idx;
YV12_BUFFER_CONFIG post_proc_buffer; YV12_BUFFER_CONFIG post_proc_buffer;
YV12_BUFFER_CONFIG temp_scale_frame; YV12_BUFFER_CONFIG temp_scale_frame;
......
...@@ -381,8 +381,10 @@ void vp8_decode_mb_row(VP8D_COMP *pbi, ...@@ -381,8 +381,10 @@ void vp8_decode_mb_row(VP8D_COMP *pbi,
int i; int i;
int recon_yoffset, recon_uvoffset; int recon_yoffset, recon_uvoffset;
int mb_col; int mb_col;
int recon_y_stride = pc->last_frame.y_stride; int ref_fb_idx = pc->lst_fb_idx;
int recon_uv_stride = pc->last_frame.uv_stride; int dst_fb_idx = pc->new_fb_idx;
int recon_y_stride = pc->yv12_fb[ref_fb_idx].y_stride;
int recon_uv_stride = pc->yv12_fb[ref_fb_idx].uv_stride;
vpx_memset(pc->left_context, 0, sizeof(pc->left_context)); vpx_memset(pc->left_context, 0, sizeof(pc->left_context));
recon_yoffset = mb_row * recon_y_stride * 16; recon_yoffset = mb_row * recon_y_stride * 16;
...@@ -419,33 +421,23 @@ void vp8_decode_mb_row(VP8D_COMP *pbi, ...@@ -419,33 +421,23 @@ void vp8_decode_mb_row(VP8D_COMP *pbi,
xd->mb_to_left_edge = -((mb_col * 16) << 3); xd->mb_to_left_edge = -((mb_col * 16) << 3);
xd->mb_to_right_edge = ((pc->mb_cols - 1 - mb_col) * 16) << 3; xd->mb_to_right_edge = ((pc->mb_cols - 1 - mb_col) * 16) << 3;
xd->dst.y_buffer = pc->new_frame.y_buffer + recon_yoffset; xd->dst.y_buffer = pc->yv12_fb[dst_fb_idx].y_buffer + recon_yoffset;
xd->dst.u_buffer = pc->new_frame.u_buffer + recon_uvoffset; xd->dst.u_buffer = pc->yv12_fb[dst_fb_idx].u_buffer + recon_uvoffset;
xd->dst.v_buffer = pc->new_frame.v_buffer + recon_uvoffset; xd->dst.v_buffer = pc->yv12_fb[dst_fb_idx].v_buffer + recon_uvoffset;
xd->left_available = (mb_col != 0); xd->left_available = (mb_col != 0);
// Select the appropriate reference frame for this MB // Select the appropriate reference frame for this MB
if (xd->mbmi.ref_frame == LAST_FRAME) if (xd->mbmi.ref_frame == LAST_FRAME)
{ ref_fb_idx = pc->lst_fb_idx;
xd->pre.y_buffer = pc->last_frame.y_buffer + recon_yoffset;
xd->pre.u_buffer = pc->last_frame.u_buffer + recon_uvoffset;
xd->pre.v_buffer = pc->last_frame.v_buffer + recon_uvoffset;
}
else if (xd->mbmi.ref_frame == GOLDEN_FRAME) else if (xd->mbmi.ref_frame == GOLDEN_FRAME)
{ ref_fb_idx = pc->gld_fb_idx;
// Golden frame reconstruction buffer
xd->pre.y_buffer = pc->golden_frame.y_buffer + recon_yoffset;
xd->pre.u_buffer = pc->golden_frame.u_buffer + recon_uvoffset;
xd->pre.v_buffer = pc->golden_frame.v_buffer + recon_uvoffset;
}
else else
{ ref_fb_idx = pc->alt_fb_idx;
// Alternate reference frame reconstruction buffer
xd->pre.y_buffer = pc->alt_ref_frame.y_buffer + recon_yoffset; xd->pre.y_buffer = pc->yv12_fb[ref_fb_idx].y_buffer + recon_yoffset;
xd->pre.u_buffer = pc->alt_ref_frame.u_buffer + recon_uvoffset; xd->pre.u_buffer = pc->yv12_fb[ref_fb_idx].u_buffer + recon_uvoffset;
xd->pre.v_buffer = pc->alt_ref_frame.v_buffer + recon_uvoffset; xd->pre.v_buffer = pc->yv12_fb[ref_fb_idx].v_buffer + recon_uvoffset;
}
vp8_build_uvmvs(xd, pc->full_pixel); vp8_build_uvmvs(xd, pc->full_pixel);
...@@ -475,7 +467,7 @@ void vp8_decode_mb_row(VP8D_COMP *pbi, ...@@ -475,7 +467,7 @@ void vp8_decode_mb_row(VP8D_COMP *pbi,
// adjust to the next row of mbs // adjust to the next row of mbs
vp8_extend_mb_row( vp8_extend_mb_row(
&pc->new_frame, &pc->yv12_fb[dst_fb_idx],
xd->dst.y_buffer + 16, xd->dst.u_buffer + 8, xd->dst.v_buffer + 8 xd->dst.y_buffer + 16, xd->dst.u_buffer + 8, xd->dst.v_buffer + 8
); );
...@@ -890,11 +882,11 @@ int vp8_decode_frame(VP8D_COMP *pbi) ...@@ -890,11 +882,11 @@ int vp8_decode_frame(VP8D_COMP *pbi)
} }
} }
vpx_memcpy(&xd->pre, &pc->last_frame, sizeof(YV12_BUFFER_CONFIG)); vpx_memcpy(&xd->pre, &pc->yv12_fb[pc->lst_fb_idx], sizeof(YV12_BUFFER_CONFIG));
vpx_memcpy(&xd->dst, &pc->new_frame, sizeof(YV12_BUFFER_CONFIG)); vpx_memcpy(&xd->dst, &pc->yv12_fb[pc->new_fb_idx], sizeof(YV12_BUFFER_CONFIG));
// set up frame new frame for intra coded blocks // set up frame new frame for intra coded blocks
vp8_setup_intra_recon(&pc->new_frame); vp8_setup_intra_recon(&pc->yv12_fb[pc->new_fb_idx]);
vp8_setup_block_dptrs(xd); vp8_setup_block_dptrs(xd);
......
...@@ -180,38 +180,38 @@ int vp8dx_get_reference(VP8D_PTR ptr, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_C ...@@ -180,38 +180,38 @@ int vp8dx_get_reference(VP8D_PTR ptr, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_C
{ {
VP8D_COMP *pbi = (VP8D_COMP *) ptr; VP8D_COMP *pbi = (VP8D_COMP *) ptr;
VP8_COMMON *cm = &pbi->common; VP8_COMMON *cm = &pbi->common;
int ref_fb_idx;
if (ref_frame_flag == VP8_LAST_FLAG) if (ref_frame_flag == VP8_LAST_FLAG)
vp8_yv12_copy_frame_ptr(&cm->last_frame, sd); ref_fb_idx = cm->lst_fb_idx;
else if (ref_frame_flag == VP8_GOLD_FLAG) else if (ref_frame_flag == VP8_GOLD_FLAG)
vp8_yv12_copy_frame_ptr(&cm->golden_frame, sd); ref_fb_idx = cm->gld_fb_idx;
else if (ref_frame_flag == VP8_ALT_FLAG) else if (ref_frame_flag == VP8_ALT_FLAG)
vp8_yv12_copy_frame_ptr(&cm->alt_ref_frame, sd); ref_fb_idx = cm->alt_fb_idx;
else else
return -1; return -1;
vp8_yv12_copy_frame_ptr(&cm->yv12_fb[ref_fb_idx], sd);
return 0; return 0;
} }
int vp8dx_set_reference(VP8D_PTR ptr, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd) int vp8dx_set_reference(VP8D_PTR ptr, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd)
{ {
VP8D_COMP *pbi = (VP8D_COMP *) ptr; VP8D_COMP *pbi = (VP8D_COMP *) ptr;
VP8_COMMON *cm = &pbi->common; VP8_COMMON *cm = &pbi->common;
int ref_fb_idx;
if (ref_frame_flag == VP8_LAST_FLAG) if (ref_frame_flag == VP8_LAST_FLAG)
vp8_yv12_copy_frame_ptr(sd, &cm->last_frame); ref_fb_idx = cm->lst_fb_idx;
else if (ref_frame_flag == VP8_GOLD_FLAG) else if (ref_frame_flag == VP8_GOLD_FLAG)
vp8_yv12_copy_frame_ptr(sd, &cm->golden_frame); ref_fb_idx = cm->gld_fb_idx;
else if (ref_frame_flag == VP8_ALT_FLAG) else if (ref_frame_flag == VP8_ALT_FLAG)
vp8_yv12_copy_frame_ptr(sd, &cm->alt_ref_frame); ref_fb_idx = cm->alt_fb_idx;
else else
return -1; return -1;
vp8_yv12_copy_frame_ptr(sd, &cm->yv12_fb[ref_fb_idx]);
return 0; return 0;
} }
...@@ -221,12 +221,95 @@ extern void vp8_push_neon(INT64 *store); ...@@ -221,12 +221,95 @@ extern void vp8_push_neon(INT64 *store);
extern void vp8_pop_neon(INT64 *store); extern void vp8_pop_neon(INT64 *store);
static INT64 dx_store_reg[8]; static INT64 dx_store_reg[8];
#endif #endif
static int get_free_fb (VP8_COMMON *cm)
{
int i;
for (i = 0; i < NUM_YV12_BUFFERS; i++)
if (cm->fb_idx_ref_cnt[i] == 0)
break;
cm->fb_idx_ref_cnt[i] = 1;
return i;
}
static void ref_cnt_fb (int *buf, int *idx, int new_idx)
{
if (buf[*idx] > 0)
buf[*idx]--;
*idx = new_idx;
buf[new_idx]++;
}
// If any buffer copy / swapping is signalled it should be done here.
static int swap_frame_buffers (VP8_COMMON *cm)
{
int fb_to_update_with, err = 0;
if (cm->refresh_last_frame)
fb_to_update_with = cm->lst_fb_idx;
else
fb_to_update_with = cm->new_fb_idx;
// The alternate reference frame or golden frame can be updated
// using the new, last, or golden/alt ref frame. If it
// is updated using the newly decoded frame it is a refresh.
// An update using the last or golden/alt ref frame is a copy.
if (cm->copy_buffer_to_arf)
{
int new_fb = 0;
if (cm->copy_buffer_to_arf == 1)
new_fb = fb_to_update_with;
else if (cm->copy_buffer_to_arf == 2)
new_fb = cm->gld_fb_idx;
else
err = -1;
ref_cnt_fb (cm->fb_idx_ref_cnt, &cm->alt_fb_idx, new_fb);
}
if (cm->copy_buffer_to_gf)
{
int new_fb = 0;
if (cm->copy_buffer_to_gf == 1)
new_fb = fb_to_update_with;
else if (cm->copy_buffer_to_gf == 2)
new_fb = cm->alt_fb_idx;
else
err = -1;
ref_cnt_fb (cm->fb_idx_ref_cnt, &cm->gld_fb_idx, new_fb);
}
if (cm->refresh_golden_frame)
ref_cnt_fb (cm->fb_idx_ref_cnt, &cm->gld_fb_idx, cm->new_fb_idx);
if (cm->refresh_alt_ref_frame)
ref_cnt_fb (cm->fb_idx_ref_cnt, &cm->alt_fb_idx, cm->new_fb_idx);
if (cm->refresh_last_frame)
{
ref_cnt_fb (cm->fb_idx_ref_cnt, &cm->lst_fb_idx, cm->new_fb_idx);
cm->frame_to_show = &cm->yv12_fb[cm->lst_fb_idx];
}
else
cm->frame_to_show = &cm->yv12_fb[cm->new_fb_idx];
cm->fb_idx_ref_cnt[cm->new_fb_idx]--;
return err;
}
int vp8dx_receive_compressed_data(VP8D_PTR ptr, unsigned long size, const unsigned char *source, INT64 time_stamp) int vp8dx_receive_compressed_data(VP8D_PTR ptr, unsigned long size, const unsigned char *source, INT64 time_stamp)
{ {
VP8D_COMP *pbi = (VP8D_COMP *) ptr; VP8D_COMP *pbi = (VP8D_COMP *) ptr;
VP8_COMMON *cm = &pbi->common; VP8_COMMON *cm = &pbi->common;
int retcode = 0; int retcode = 0;
struct vpx_usec_timer timer; struct vpx_usec_timer timer;
// if(pbi->ready_for_new_data == 0) // if(pbi->ready_for_new_data == 0)
...@@ -257,6 +340,8 @@ int vp8dx_receive_compressed_data(VP8D_PTR ptr, unsigned long size, const unsign ...@@ -257,6 +340,8 @@ int vp8dx_receive_compressed_data(VP8D_PTR ptr, unsigned long size, const unsign
pbi->Source = source; pbi->Source = source;
pbi->source_sz = size; pbi->source_sz = size;
cm->new_fb_idx = get_free_fb (cm);
retcode = vp8_decode_frame(pbi); retcode = vp8_decode_frame(pbi);
if (retcode < 0) if (retcode < 0)
...@@ -275,15 +360,11 @@ int vp8dx_receive_compressed_data(VP8D_PTR ptr, unsigned long size, const unsign ...@@ -275,15 +360,11 @@ int vp8dx_receive_compressed_data(VP8D_PTR ptr, unsigned long size, const unsign
if (pbi->b_multithreaded_lf && pbi->common.filter_level != 0) if (pbi->b_multithreaded_lf && pbi->common.filter_level != 0)
vp8_stop_lfthread(pbi); vp8_stop_lfthread(pbi);
if (cm->refresh_last_frame) if (swap_frame_buffers (cm))
{
vp8_swap_yv12_buffer(&cm->last_frame, &cm->new_frame);
cm->frame_to_show = &cm->last_frame;
}
else
{ {
cm->frame_to_show = &cm->new_frame; pbi->common.error.error_code = VPX_CODEC_ERROR;
pbi->common.error.setjmp = 0;
return -1;
} }
if (!pbi->b_multithreaded_lf) if (!pbi->b_multithreaded_lf)
...@@ -313,49 +394,6 @@ int vp8dx_receive_compressed_data(VP8D_PTR ptr, unsigned long size, const unsign ...@@ -313,49 +394,6 @@ int vp8dx_receive_compressed_data(VP8D_PTR ptr, unsigned long size, const unsign
write_dx_frame_to_file(cm->frame_to_show, cm->current_video_frame); write_dx_frame_to_file(cm->frame_to_show, cm->current_video_frame);
#endif #endif
// If any buffer copy / swaping is signalled it should be done here.
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);
else
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);
}
if (cm->copy_buffer_to_gf)
{
if (cm->copy_buffer_to_gf == 1)
{
if (cm->refresh_last_frame)
vp8_yv12_copy_frame_ptr(&cm->new_frame, &cm->golden_frame);
else
vp8_yv12_copy_frame_ptr(&cm->last_frame, &cm->golden_frame);
}
else if (cm->copy_buffer_to_gf == 2)
vp8_yv12_copy_frame_ptr(&cm->alt_ref_frame, &cm->golden_frame);
}
// Should the golden or alternate reference frame be refreshed?
if (cm->refresh_golden_frame || cm->refresh_alt_ref_frame)
{
if (cm->refresh_golden_frame)
vp8_yv12_copy_frame_ptr(cm->frame_to_show, &cm->golden_frame);
if (cm->refresh_alt_ref_frame)
vp8_yv12_copy_frame_ptr(cm->frame_to_show, &cm->alt_ref_frame);
//vpx_log("Decoder: recovery frame received \n");
// Update data structures that monitors GF useage
vpx_memset(cm->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
cm->gf_active_count = cm->mb_rows * cm->mb_cols;
}
vp8_clear_system_state(); vp8_clear_system_state();
vpx_usec_timer_mark(&timer); vpx_usec_timer_mark(&timer);
......
...@@ -59,11 +59,8 @@ void vp8_setup_decoding_thread_data(VP8D_COMP *pbi, MACROBLOCKD *xd, MB_ROW_DEC ...@@ -59,11 +59,8 @@ void vp8_setup_decoding_thread_data(VP8D_COMP *pbi, MACROBLOCKD *xd, MB_ROW_DEC
mbd->frames_since_golden = pc->frames_since_golden; mbd->frames_since_golden = pc->frames_since_golden;
mbd->frames_till_alt_ref_frame = pc->frames_till_alt_ref_frame; mbd->frames_till_alt_ref_frame = pc->frames_till_alt_ref_frame;
mbd->pre = pc->last_frame; mbd->pre = pc->yv12_fb[pc->lst_fb_idx];
mbd->dst = pc->new_frame; mbd->dst = pc->yv12_fb[pc->new_fb_idx];
vp8_setup_block_dptrs(mbd); vp8_setup_block_dptrs(mbd);
vp8_build_block_doffsets(mbd); vp8_build_block_doffsets(mbd);
...@@ -119,8 +116,10 @@ THREAD_FUNCTION vp8_thread_decoding_proc(void *p_data) ...@@ -119,8 +116,10 @@ THREAD_FUNCTION vp8_thread_decoding_proc(void *p_data)
int i; int i;
int recon_yoffset, recon_uvoffset; int recon_yoffset, recon_uvoffset;
int mb_col; int mb_col;
int recon_y_stride = pc->last_frame.y_stride; int ref_fb_idx = pc->lst_fb_idx;
int recon_uv_stride = pc->last_frame.uv_stride; int dst_fb_idx = pc->new_fb_idx;
int recon_y_stride = pc->yv12_fb[ref_fb_idx].y_stride;
int recon_uv_stride = pc->yv12_fb[ref_fb_idx].uv_stride;
volatile int *last_row_current_mb_col; volatile int *last_row_current_mb_col;
...@@ -172,33 +171,23 @@ THREAD_FUNCTION vp8_thread_decoding_proc(void *p_data) ...@@ -172,33 +171,23 @@ THREAD_FUNCTION vp8_thread_decoding_proc(void *p_data)
xd->mb_to_left_edge = -((mb_col * 16) << 3); xd->mb_to_left_edge = -((mb_col * 16) << 3);
xd->mb_to_right_edge = ((pc->mb_cols - 1 - mb_col) * 16) << 3; xd->mb_to_right_edge = ((pc->mb_cols - 1 - mb_col) * 16) << 3;
xd->dst.y_buffer = pc->new_frame.y_buffer + recon_yoffset; xd->dst.y_buffer = pc->yv12_fb[dst_fb_idx].y_buffer + recon_yoffset;
xd->dst.u_buffer = pc->new_frame.u_buffer + recon_uvoffset; xd->dst.u_buffer = pc->yv12_fb[dst_fb_idx].u_buffer + recon_uvoffset;
xd->dst.v_buffer = pc->new_frame.v_buffer + recon_uvoffset; xd->dst.v_buffer = pc->yv12_fb[dst_fb_idx].v_buffer + recon_uvoffset;
xd->left_available = (mb_col != 0); xd->left_available = (mb_col != 0);
// Select the appropriate reference frame for this MB // Select the appropriate reference frame for this MB
if (xd->mbmi.ref_frame == LAST_FRAME) if (xd->mbmi.ref_frame == LAST_FRAME)
{ ref_fb_idx = pc->lst_fb_idx;
xd->pre.y_buffer = pc->last_frame.y_buffer + recon_yoffset;
xd->pre.u_buffer = pc->last_frame.u_buffer + recon_uvoffset;
xd->pre.v_buffer = pc->last_frame.v_buffer + recon_uvoffset;
}
else if (xd->mbmi.ref_frame == GOLDEN_FRAME) else if (xd->mbmi.ref_frame == GOLDEN_FRAME)
{ ref_fb_idx = pc->gld_fb_idx;
// Golden frame reconstruction buffer
xd->pre.y_buffer = pc->golden_frame.y_buffer + recon_yoffset;
xd->pre.u_buffer = pc->golden_frame.u_buffer + recon_uvoffset;
xd->pre.v_buffer = pc->golden_frame.v_buffer + recon_uvoffset;
}
else else
{ ref_fb_idx = pc->alt_fb_idx;
// Alternate reference frame reconstruction buffer
xd->pre.y_buffer = pc->alt_ref_frame.y_buffer + recon_yoffset; xd->pre.y_buffer = pc->yv12_fb[ref_fb_idx].y_buffer + recon_yoffset;
xd->pre.u_buffer = pc->alt_ref_frame.u_buffer + recon_uvoffset; xd->pre.u_buffer = pc->yv12_fb[ref_fb_idx].u_buffer + recon_uvoffset;
xd->pre.v_buffer = pc->alt_ref_frame.v_buffer + recon_uvoffset; xd->pre.v_buffer = pc->yv12_fb[ref_fb_idx].v_buffer + recon_uvoffset;
}
vp8_build_uvmvs(xd, pc->full_pixel); vp8_build_uvmvs(xd, pc->full_pixel);
...@@ -222,7 +211,7 @@ THREAD_FUNCTION vp8_thread_decoding_proc(void *p_data) ...@@ -222,7 +211,7 @@ THREAD_FUNCTION vp8_thread_decoding_proc(void *p_data)
// adjust to the next row of mbs // adjust to the next row of mbs
vp8_extend_mb_row( vp8_extend_mb_row(
&pc->new_frame, &pc->yv12_fb[dst_fb_idx],
xd->dst.y_buffer + 16, xd->dst.u_buffer + 8, xd->dst.v_buffer + 8 xd->dst.y_buffer + 16, xd->dst.u_buffer + 8, xd->dst.v_buffer + 8
); );
...@@ -279,7 +268,7 @@ THREAD_FUNCTION vp8_thread_loop_filter(void *p_data) ...@@ -279,7 +268,7 @@ THREAD_FUNCTION vp8_thread_loop_filter(void *p_data)
MACROBLOCKD *mbd