Commit a8703156 authored by Yunqing Wang's avatar Yunqing Wang Committed by Code Review
Browse files

Merge "Improved encoder threading"

parents a5ecaca6 385c2a76
...@@ -487,6 +487,16 @@ void encode_mb_row(VP8_COMP *cpi, ...@@ -487,6 +487,16 @@ void encode_mb_row(VP8_COMP *cpi,
int recon_uv_stride = cm->yv12_fb[ref_fb_idx].uv_stride; int recon_uv_stride = cm->yv12_fb[ref_fb_idx].uv_stride;
int seg_map_index = (mb_row * cpi->common.mb_cols); int seg_map_index = (mb_row * cpi->common.mb_cols);
#if CONFIG_MULTITHREAD
const int nsync = cpi->mt_sync_range;
const int rightmost_col = cm->mb_cols - 1;
volatile const int *last_row_current_mb_col;
if ((cpi->b_multi_threaded != 0) && (mb_row != 0))
last_row_current_mb_col = &cpi->mt_current_mb_col[mb_row - 1];
else
last_row_current_mb_col = &rightmost_col;
#endif
// reset above block coeffs // reset above block coeffs
xd->above_context = cm->above_context; xd->above_context = cm->above_context;
...@@ -532,6 +542,21 @@ void encode_mb_row(VP8_COMP *cpi, ...@@ -532,6 +542,21 @@ void encode_mb_row(VP8_COMP *cpi,
x->rddiv = cpi->RDDIV; x->rddiv = cpi->RDDIV;
x->rdmult = cpi->RDMULT; x->rdmult = cpi->RDMULT;
#if CONFIG_MULTITHREAD
if ((cpi->b_multi_threaded != 0) && (mb_row != 0))
{
if ((mb_col & (nsync - 1)) == 0)
{
while (mb_col > (*last_row_current_mb_col - nsync)
&& (*last_row_current_mb_col) != (cm->mb_cols - 1))
{
x86_pause_hint();
thread_sleep(0);
}
}
}
#endif
if(cpi->oxcf.tuning == VP8_TUNE_SSIM) if(cpi->oxcf.tuning == VP8_TUNE_SSIM)
activity_sum += vp8_activity_masking(cpi, x); activity_sum += vp8_activity_masking(cpi, x);
...@@ -628,7 +653,12 @@ void encode_mb_row(VP8_COMP *cpi, ...@@ -628,7 +653,12 @@ void encode_mb_row(VP8_COMP *cpi,
x->partition_info++; x->partition_info++;
xd->above_context++; xd->above_context++;
cpi->current_mb_col_main = mb_col; #if CONFIG_MULTITHREAD
if (cpi->b_multi_threaded != 0)
{
cpi->mt_current_mb_col[mb_row] = mb_col;
}
#endif
} }
//extend the recon for intra prediction //extend the recon for intra prediction
...@@ -642,11 +672,14 @@ void encode_mb_row(VP8_COMP *cpi, ...@@ -642,11 +672,14 @@ void encode_mb_row(VP8_COMP *cpi,
xd->mode_info_context++; xd->mode_info_context++;
x->partition_info++; x->partition_info++;
x->activity_sum += activity_sum; x->activity_sum += activity_sum;
}
#if CONFIG_MULTITHREAD
if ((cpi->b_multi_threaded != 0) && (mb_row == cm->mb_rows - 1))
{
sem_post(&cpi->h_event_end_encoding); /* signal frame encoding end */
}
#endif
}
void vp8_encode_frame(VP8_COMP *cpi) void vp8_encode_frame(VP8_COMP *cpi)
{ {
...@@ -800,22 +833,16 @@ void vp8_encode_frame(VP8_COMP *cpi) ...@@ -800,22 +833,16 @@ void vp8_encode_frame(VP8_COMP *cpi)
vp8cx_init_mbrthread_data(cpi, x, cpi->mb_row_ei, 1, cpi->encoding_thread_count); vp8cx_init_mbrthread_data(cpi, x, cpi->mb_row_ei, 1, cpi->encoding_thread_count);
for (mb_row = 0; mb_row < cm->mb_rows; mb_row += (cpi->encoding_thread_count + 1)) for (i = 0; i < cm->mb_rows; i++)
{ cpi->mt_current_mb_col[i] = 0;
cpi->current_mb_col_main = -1;
for (i = 0; i < cpi->encoding_thread_count; i++) for (i = 0; i < cpi->encoding_thread_count; i++)
{ {
if ((mb_row + i + 1) >= cm->mb_rows) sem_post(&cpi->h_event_start_encoding[i]);
break; }
cpi->mb_row_ei[i].mb_row = mb_row + i + 1;
cpi->mb_row_ei[i].tp = cpi->tok + (mb_row + i + 1) * (cm->mb_cols * 16 * 24);
cpi->mb_row_ei[i].current_mb_col = -1;
//SetEvent(cpi->h_event_mbrencoding[i]);
sem_post(&cpi->h_event_mbrencoding[i]);
}
for (mb_row = 0; mb_row < cm->mb_rows; mb_row += (cpi->encoding_thread_count + 1))
{
vp8_zero(cm->left_context) vp8_zero(cm->left_context)
tp = cpi->tok + mb_row * (cm->mb_cols * 16 * 24); tp = cpi->tok + mb_row * (cm->mb_cols * 16 * 24);
...@@ -830,26 +857,10 @@ void vp8_encode_frame(VP8_COMP *cpi) ...@@ -830,26 +857,10 @@ void vp8_encode_frame(VP8_COMP *cpi)
xd->mode_info_context += xd->mode_info_stride * cpi->encoding_thread_count; xd->mode_info_context += xd->mode_info_stride * cpi->encoding_thread_count;
x->partition_info += xd->mode_info_stride * cpi->encoding_thread_count; x->partition_info += xd->mode_info_stride * cpi->encoding_thread_count;
if (mb_row < cm->mb_rows - 1)
//WaitForSingleObject(cpi->h_event_main, INFINITE);
sem_wait(&cpi->h_event_main);
} }
/* sem_wait(&cpi->h_event_end_encoding); /* wait for other threads to finish */
for( ;mb_row<cm->mb_rows; mb_row ++)
{
vp8_zero( cm->left_context)
tp = cpi->tok + mb_row * (cm->mb_cols * 16 * 24);
encode_mb_row(cpi, cm, mb_row, x, xd, &tp, segment_counts, &totalrate);
// adjust to the next row of mbs
x->src.y_buffer += 16 * x->src.y_stride - 16 * cm->mb_cols;
x->src.u_buffer += 8 * x->src.uv_stride - 8 * cm->mb_cols;
x->src.v_buffer += 8 * x->src.uv_stride - 8 * cm->mb_cols;
}
*/
cpi->tok_count = 0; cpi->tok_count = 0;
for (mb_row = 0; mb_row < cm->mb_rows; mb_row ++) for (mb_row = 0; mb_row < cm->mb_rows; mb_row ++)
...@@ -859,7 +870,6 @@ void vp8_encode_frame(VP8_COMP *cpi) ...@@ -859,7 +870,6 @@ void vp8_encode_frame(VP8_COMP *cpi)
if (xd->segmentation_enabled) if (xd->segmentation_enabled)
{ {
int i, j; int i, j;
if (xd->segmentation_enabled) if (xd->segmentation_enabled)
...@@ -871,7 +881,6 @@ void vp8_encode_frame(VP8_COMP *cpi) ...@@ -871,7 +881,6 @@ void vp8_encode_frame(VP8_COMP *cpi)
segment_counts[j] += cpi->mb_row_ei[i].segment_counts[j]; segment_counts[j] += cpi->mb_row_ei[i].segment_counts[j];
} }
} }
} }
for (i = 0; i < cpi->encoding_thread_count; i++) for (i = 0; i < cpi->encoding_thread_count; i++)
......
...@@ -8,15 +8,16 @@ ...@@ -8,15 +8,16 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include "onyx_int.h" #include "onyx_int.h"
#include "threading.h" #include "threading.h"
#include "common.h" #include "common.h"
#include "extend.h" #include "extend.h"
extern int vp8cx_encode_inter_macroblock(VP8_COMP *cpi, MACROBLOCK *x,
extern int vp8cx_encode_inter_macroblock(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t, int recon_yoffset, int recon_uvoffset); TOKENEXTRA **t, int recon_yoffset,
extern int vp8cx_encode_intra_macro_block(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t); int recon_uvoffset);
extern int vp8cx_encode_intra_macro_block(VP8_COMP *cpi, MACROBLOCK *x,
TOKENEXTRA **t);
extern void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x); extern void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x);
extern void vp8_build_block_offsets(MACROBLOCK *x); extern void vp8_build_block_offsets(MACROBLOCK *x);
extern void vp8_setup_block_ptrs(MACROBLOCK *x); extern void vp8_setup_block_ptrs(MACROBLOCK *x);
...@@ -26,10 +27,11 @@ THREAD_FUNCTION thread_encoding_proc(void *p_data) ...@@ -26,10 +27,11 @@ THREAD_FUNCTION thread_encoding_proc(void *p_data)
{ {
#if CONFIG_MULTITHREAD #if CONFIG_MULTITHREAD
int ithread = ((ENCODETHREAD_DATA *)p_data)->ithread; int ithread = ((ENCODETHREAD_DATA *)p_data)->ithread;
VP8_COMP *cpi = (VP8_COMP *)(((ENCODETHREAD_DATA *)p_data)->ptr1); VP8_COMP *cpi = (VP8_COMP *)(((ENCODETHREAD_DATA *)p_data)->ptr1);
MB_ROW_COMP *mbri = (MB_ROW_COMP *)(((ENCODETHREAD_DATA *)p_data)->ptr2); MB_ROW_COMP *mbri = (MB_ROW_COMP *)(((ENCODETHREAD_DATA *)p_data)->ptr2);
ENTROPY_CONTEXT_PLANES mb_row_left_context; ENTROPY_CONTEXT_PLANES mb_row_left_context;
const int nsync = cpi->mt_sync_range;
//printf("Started thread %d\n", ithread); //printf("Started thread %d\n", ithread);
while (1) while (1)
...@@ -38,210 +40,209 @@ THREAD_FUNCTION thread_encoding_proc(void *p_data) ...@@ -38,210 +40,209 @@ THREAD_FUNCTION thread_encoding_proc(void *p_data)
break; break;
//if(WaitForSingleObject(cpi->h_event_mbrencoding[ithread], INFINITE) == WAIT_OBJECT_0) //if(WaitForSingleObject(cpi->h_event_mbrencoding[ithread], INFINITE) == WAIT_OBJECT_0)
if (sem_wait(&cpi->h_event_mbrencoding[ithread]) == 0) if (sem_wait(&cpi->h_event_start_encoding[ithread]) == 0)
{ {
VP8_COMMON *cm = &cpi->common;
int mb_row;
MACROBLOCK *x = &mbri->mb;
MACROBLOCKD *xd = &x->e_mbd;
TOKENEXTRA *tp ;
int *segment_counts = mbri->segment_counts;
int *totalrate = &mbri->totalrate;
if (cpi->b_multi_threaded == FALSE) // we're shutting down if (cpi->b_multi_threaded == FALSE) // we're shutting down
break; break;
else
for (mb_row = ithread + 1; mb_row < cm->mb_rows; mb_row += (cpi->encoding_thread_count + 1))
{ {
VP8_COMMON *cm = &cpi->common;
int mb_row = mbri->mb_row;
MACROBLOCK *x = &mbri->mb;
MACROBLOCKD *xd = &x->e_mbd;
TOKENEXTRA **tp = &mbri->tp;
int *segment_counts = mbri->segment_counts;
int *totalrate = &mbri->totalrate;
{ int i;
int i; int recon_yoffset, recon_uvoffset;
int recon_yoffset, recon_uvoffset; int mb_col;
int mb_col; int ref_fb_idx = cm->lst_fb_idx;
int ref_fb_idx = cm->lst_fb_idx; int dst_fb_idx = cm->new_fb_idx;
int dst_fb_idx = cm->new_fb_idx; int recon_y_stride = cm->yv12_fb[ref_fb_idx].y_stride;
int recon_y_stride = cm->yv12_fb[ref_fb_idx].y_stride; int recon_uv_stride = cm->yv12_fb[ref_fb_idx].uv_stride;
int recon_uv_stride = cm->yv12_fb[ref_fb_idx].uv_stride; volatile int *last_row_current_mb_col;
volatile int *last_row_current_mb_col; INT64 activity_sum = 0;
INT64 activity_sum = 0;
if (ithread > 0)
last_row_current_mb_col = &cpi->mb_row_ei[ithread-1].current_mb_col;
else
last_row_current_mb_col = &cpi->current_mb_col_main;
// reset above block coeffs tp = cpi->tok + (mb_row * (cm->mb_cols * 16 * 24));
xd->above_context = cm->above_context;
xd->left_context = &mb_row_left_context;
vp8_zero(mb_row_left_context); last_row_current_mb_col = &cpi->mt_current_mb_col[mb_row - 1];
xd->up_available = (mb_row != 0); // reset above block coeffs
recon_yoffset = (mb_row * recon_y_stride * 16); xd->above_context = cm->above_context;
recon_uvoffset = (mb_row * recon_uv_stride * 8); xd->left_context = &mb_row_left_context;
vp8_zero(mb_row_left_context);
cpi->tplist[mb_row].start = *tp; xd->up_available = (mb_row != 0);
recon_yoffset = (mb_row * recon_y_stride * 16);
recon_uvoffset = (mb_row * recon_uv_stride * 8);
//printf("Thread mb_row = %d\n", mb_row); cpi->tplist[mb_row].start = tp;
// for each macroblock col in image //printf("Thread mb_row = %d\n", mb_row);
for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
{
int seg_map_index = (mb_row * cm->mb_cols);
while (mb_col > (*last_row_current_mb_col - 1) && *last_row_current_mb_col != cm->mb_cols - 1) // for each macroblock col in image
for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
{
int seg_map_index = (mb_row * cm->mb_cols);
if ((mb_col & (nsync - 1)) == 0)
{
while (mb_col > (*last_row_current_mb_col - nsync) && *last_row_current_mb_col != cm->mb_cols - 1)
{ {
x86_pause_hint(); x86_pause_hint();
thread_sleep(0); thread_sleep(0);
} }
}
// Distance of Mb to the various image edges. // Distance of Mb to the various image edges.
// These specified to 8th pel as they are always compared to values that are in 1/8th pel units // These specified to 8th pel as they are always compared to values that are in 1/8th pel units
xd->mb_to_left_edge = -((mb_col * 16) << 3); xd->mb_to_left_edge = -((mb_col * 16) << 3);
xd->mb_to_right_edge = ((cm->mb_cols - 1 - mb_col) * 16) << 3; xd->mb_to_right_edge = ((cm->mb_cols - 1 - mb_col) * 16) << 3;
xd->mb_to_top_edge = -((mb_row * 16) << 3); xd->mb_to_top_edge = -((mb_row * 16) << 3);
xd->mb_to_bottom_edge = ((cm->mb_rows - 1 - mb_row) * 16) << 3; xd->mb_to_bottom_edge = ((cm->mb_rows - 1 - mb_row) * 16) << 3;
// Set up limit values for motion vectors used to prevent them extending outside the UMV borders // Set up limit values for motion vectors used to prevent them extending outside the UMV borders
x->mv_col_min = -((mb_col * 16) + (VP8BORDERINPIXELS - 16)); x->mv_col_min = -((mb_col * 16) + (VP8BORDERINPIXELS - 16));
x->mv_col_max = ((cm->mb_cols - 1 - mb_col) * 16) + (VP8BORDERINPIXELS - 16); x->mv_col_max = ((cm->mb_cols - 1 - mb_col) * 16) + (VP8BORDERINPIXELS - 16);
x->mv_row_min = -((mb_row * 16) + (VP8BORDERINPIXELS - 16)); x->mv_row_min = -((mb_row * 16) + (VP8BORDERINPIXELS - 16));
x->mv_row_max = ((cm->mb_rows - 1 - mb_row) * 16) + (VP8BORDERINPIXELS - 16); x->mv_row_max = ((cm->mb_rows - 1 - mb_row) * 16) + (VP8BORDERINPIXELS - 16);
xd->dst.y_buffer = cm->yv12_fb[dst_fb_idx].y_buffer + recon_yoffset; xd->dst.y_buffer = cm->yv12_fb[dst_fb_idx].y_buffer + recon_yoffset;
xd->dst.u_buffer = cm->yv12_fb[dst_fb_idx].u_buffer + recon_uvoffset; xd->dst.u_buffer = cm->yv12_fb[dst_fb_idx].u_buffer + recon_uvoffset;
xd->dst.v_buffer = cm->yv12_fb[dst_fb_idx].v_buffer + recon_uvoffset; xd->dst.v_buffer = cm->yv12_fb[dst_fb_idx].v_buffer + recon_uvoffset;
xd->left_available = (mb_col != 0); xd->left_available = (mb_col != 0);
x->rddiv = cpi->RDDIV; x->rddiv = cpi->RDDIV;
x->rdmult = cpi->RDMULT; x->rdmult = cpi->RDMULT;
if(cpi->oxcf.tuning == VP8_TUNE_SSIM) if (cpi->oxcf.tuning == VP8_TUNE_SSIM)
activity_sum += vp8_activity_masking(cpi, x); activity_sum += vp8_activity_masking(cpi, x);
// Is segmentation enabled // Is segmentation enabled
// MB level adjutment to quantizer // MB level adjutment to quantizer
if (xd->segmentation_enabled) if (xd->segmentation_enabled)
{ {
// Code to set segment id in xd->mbmi.segment_id for current MB (with range checking) // Code to set segment id in xd->mbmi.segment_id for current MB (with range checking)
if (cpi->segmentation_map[seg_map_index+mb_col] <= 3) if (cpi->segmentation_map[seg_map_index + mb_col] <= 3)
xd->mode_info_context->mbmi.segment_id = cpi->segmentation_map[seg_map_index+mb_col]; xd->mode_info_context->mbmi.segment_id = cpi->segmentation_map[seg_map_index + mb_col];
else
xd->mode_info_context->mbmi.segment_id = 0;
vp8cx_mb_init_quantizer(cpi, x);
}
else else
xd->mode_info_context->mbmi.segment_id = 0; // Set to Segment 0 by default xd->mode_info_context->mbmi.segment_id = 0;
x->active_ptr = cpi->active_map + seg_map_index + mb_col; vp8cx_mb_init_quantizer(cpi, x);
}
else
xd->mode_info_context->mbmi.segment_id = 0; // Set to Segment 0 by default
if (cm->frame_type == KEY_FRAME) x->active_ptr = cpi->active_map + seg_map_index + mb_col;
{
*totalrate += vp8cx_encode_intra_macro_block(cpi, x, tp); if (cm->frame_type == KEY_FRAME)
{
*totalrate += vp8cx_encode_intra_macro_block(cpi, x, &tp);
#ifdef MODE_STATS #ifdef MODE_STATS
y_modes[xd->mbmi.mode] ++; y_modes[xd->mbmi.mode] ++;
#endif #endif
} }
else else
{ {
*totalrate += vp8cx_encode_inter_macroblock(cpi, x, tp, recon_yoffset, recon_uvoffset); *totalrate += vp8cx_encode_inter_macroblock(cpi, x, &tp, recon_yoffset, recon_uvoffset);
#ifdef MODE_STATS #ifdef MODE_STATS
inter_y_modes[xd->mbmi.mode] ++; inter_y_modes[xd->mbmi.mode] ++;
if (xd->mbmi.mode == SPLITMV) if (xd->mbmi.mode == SPLITMV)
{ {
int b; int b;
for (b = 0; b < xd->mbmi.partition_count; b++) for (b = 0; b < xd->mbmi.partition_count; b++)
{ {
inter_b_modes[x->partition->bmi[b].mode] ++; inter_b_modes[x->partition->bmi[b].mode] ++;
}
} }
}
#endif #endif
// Count of last ref frame 0,0 useage // Count of last ref frame 0,0 useage
if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME)) if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME))
cpi->inter_zz_count ++; cpi->inter_zz_count++;
// Special case code for cyclic refresh // Special case code for cyclic refresh
// If cyclic update enabled then copy xd->mbmi.segment_id; (which may have been updated based on mode // If cyclic update enabled then copy xd->mbmi.segment_id; (which may have been updated based on mode
// during vp8cx_encode_inter_macroblock()) back into the global sgmentation map // during vp8cx_encode_inter_macroblock()) back into the global sgmentation map
if (cpi->cyclic_refresh_mode_enabled && xd->segmentation_enabled) if (cpi->cyclic_refresh_mode_enabled && xd->segmentation_enabled)
{
const MB_MODE_INFO * mbmi = &xd->mode_info_context->mbmi;
cpi->segmentation_map[seg_map_index + mb_col] = mbmi->segment_id;
// If the block has been refreshed mark it as clean (the magnitude of the -ve influences how long it will be before we consider another refresh):
// Else if it was coded (last frame 0,0) and has not already been refreshed then mark it as a candidate for cleanup next time (marked 0)
// else mark it as dirty (1).
if (mbmi->segment_id)
cpi->cyclic_refresh_map[seg_map_index + mb_col] = -1;
else if ((mbmi->mode == ZEROMV) && (mbmi->ref_frame == LAST_FRAME))
{ {
cpi->segmentation_map[seg_map_index+mb_col] = xd->mode_info_context->mbmi.segment_id; if (cpi->cyclic_refresh_map[seg_map_index + mb_col] == 1)
cpi->cyclic_refresh_map[seg_map_index + mb_col] = 0;
// If the block has been refreshed mark it as clean (the magnitude of the -ve influences how long it will be before we consider another refresh):
// Else if it was coded (last frame 0,0) and has not already been refreshed then mark it as a candidate for cleanup next time (marked 0)
// else mark it as dirty (1).
if (xd->mode_info_context->mbmi.segment_id)
cpi->cyclic_refresh_map[seg_map_index+mb_col] = -1;
else if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME))
{
if (cpi->cyclic_refresh_map[seg_map_index+mb_col] == 1)
cpi->cyclic_refresh_map[seg_map_index+mb_col] = 0;
}
else
cpi->cyclic_refresh_map[seg_map_index+mb_col] = 1;
} }
} else
cpi->tplist[mb_row].stop = *tp; cpi->cyclic_refresh_map[seg_map_index + mb_col] = 1;
x->gf_active_ptr++; // Increment pointer into gf useage flags structure for next mb
for (i = 0; i < 16; i++)
vpx_memcpy(&xd->mode_info_context->bmi[i], &xd->block[i].bmi, sizeof(xd->block[i].bmi));
// adjust to the next column of macroblocks
x->src.y_buffer += 16;
x->src.u_buffer += 8;
x->src.v_buffer += 8;
recon_yoffset += 16;
recon_uvoffset += 8;
// Keep track of segment useage }
segment_counts[xd->mode_info_context->mbmi.segment_id] ++; }
cpi->tplist[mb_row].stop = tp;
// skip to next mb x->gf_active_ptr++; // Increment pointer into gf useage flags structure for next mb
xd->mode_info_context++;
x->partition_info++;
xd->above_context++; for (i = 0; i < 16; i++)
vpx_memcpy(&xd->mode_info_context->bmi[i], &xd->block[i].bmi, sizeof(xd->block[i].bmi));
cpi->mb_row_ei[ithread].current_mb_col = mb_col; // adjust to the next column of macroblocks
x->src.y_buffer += 16;
x->src.u_buffer += 8;
x->src.v_buffer += 8;
} recon_yoffset += 16;
recon_uvoffset += 8;
//extend the recon for intra prediction // Keep track of segment useage
vp8_extend_mb_row( segment_counts[xd->mode_info_context->mbmi.segment_id]++;
&cm->yv12_fb[dst_fb_idx],
xd->dst.y_buffer + 16,
xd->dst.u_buffer + 8,
xd->dst.v_buffer + 8);
// this is to account for the border // skip to next mb
xd->mode_info_context++; xd->mode_info_context++;
x->partition_info++; x->partition_info++;
x->activity_sum += activity_sum; xd->above_context++;
x->src.y_buffer += 16 * x->src.y_stride * (cpi->encoding_thread_count + 1) - 16 * cm->mb_cols; cpi->mt_current_mb_col[mb_row] = mb_col;
x->src.u_buffer += 8 * x->src.uv_stride * (cpi->encoding_thread_count + 1) - 8 * cm->mb_cols; }
x->src.v_buffer += 8 * x->src.uv_stride * (cpi->encoding_thread_count + 1) - 8 * cm->mb_cols;
xd->mode_info_context += xd->mode_info_stride * cpi->encoding_thread_count; //extend the recon for intra prediction
x->partition_info += xd->mode_info_stride * cpi->encoding_thread_count; vp8_extend_mb_row(
&cm->yv12_fb[dst_fb_idx],
xd->dst.y_buffer + 16,
xd->dst.u_buffer + 8,
xd->dst.v_buffer + 8);
if (ithread == (cpi->encoding_thread_count - 1) || mb_row == cm->mb_rows - 1) // this is to account for the border
{ xd->mode_info_context++;
//SetEvent(cpi->h_event_main); x->partition_info++;
sem_post(&cpi->h_event_main); x->activity_sum += activity_sum;