From: John Koleszar Date: Mon, 7 Feb 2011 19:16:09 +0000 (-0500) Subject: Merge remote branch 'internal/upstream-experimental' into HEAD X-Git-Tag: v1.3.0~1217^2~380^2~390 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2bb322380d6b4b046e7a9aeba2b1058684d46e30;p=libvpx Merge remote branch 'internal/upstream-experimental' into HEAD Conflicts: vp8/encoder/encodeframe.c vp8/encoder/ethreading.c vp8/encoder/onyx_int.h Change-Id: I1c562d2fe6e42c0d1d86f68c77c0e899066e02bd --- 2bb322380d6b4b046e7a9aeba2b1058684d46e30 diff --cc vp8/encoder/encodeframe.c index 07aa18fd9,92f200da2..88e8d02b8 --- a/vp8/encoder/encodeframe.c +++ b/vp8/encoder/encodeframe.c @@@ -494,10 -479,18 +487,20 @@@ void encode_mb_row(VP8_COMP *cpi 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 seg_map_index = (mb_row * cpi->common.mb_cols); - +#if CONFIG_SEGMENTATION + int left_id, above_id; + int sum; ++#endif + #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 xd->above_context = cm->above_context; @@@ -691,8 -665,15 +714,13 @@@ xd->mode_info_context++; x->partition_info++; 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) { int mb_row; diff --cc vp8/encoder/ethreading.c index bf03560e1,8da93a67c..d3f3bc4ca --- a/vp8/encoder/ethreading.c +++ b/vp8/encoder/ethreading.c @@@ -38,57 -40,59 +40,59 @@@ THREAD_FUNCTION thread_encoding_proc(vo break; //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 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 recon_yoffset, recon_uvoffset; - int mb_col; - int ref_fb_idx = cm->lst_fb_idx; - int dst_fb_idx = cm->new_fb_idx; - int recon_y_stride = cm->yv12_fb[ref_fb_idx].y_stride; - int recon_uv_stride = cm->yv12_fb[ref_fb_idx].uv_stride; - volatile int *last_row_current_mb_col; - 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; + int i; + int recon_yoffset, recon_uvoffset; + int mb_col; + int ref_fb_idx = cm->lst_fb_idx; + int dst_fb_idx = cm->new_fb_idx; + int recon_y_stride = cm->yv12_fb[ref_fb_idx].y_stride; + int recon_uv_stride = cm->yv12_fb[ref_fb_idx].uv_stride; + volatile int *last_row_current_mb_col; + INT64 activity_sum = 0; - // reset above block coeffs - xd->above_context = cm->above_context; - xd->left_context = &mb_row_left_context; + tp = cpi->tok + (mb_row * (cm->mb_cols * 16 * 24)); - 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); - recon_yoffset = (mb_row * recon_y_stride * 16); - recon_uvoffset = (mb_row * recon_uv_stride * 8); + // reset above block coeffs + xd->above_context = cm->above_context; + 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 - for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) - { - int seg_map_index = (mb_row * cm->mb_cols); + //printf("Thread mb_row = %d\n", mb_row); + + // 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); - + - while (mb_col > (*last_row_current_mb_col - 1) && *last_row_current_mb_col != cm->mb_cols - 1) + 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); diff --cc vp8/encoder/onyx_if.c index b56696d0a,1f5006ee1..1821f6c53 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@@ -3673,11 -3697,18 +3693,22 @@@ static void encode_frame_to_data_rat // Test code for segmentation of gf/arf (0,0) //segmentation_test_function((VP8_PTR) cpi); +#if CONFIG_SEGMENTATION + cpi->mb.e_mbd.segmentation_enabled = 1; + cpi->mb.e_mbd.update_mb_segmentation_map = 1; +#endif + #if CONFIG_REALTIME_ONLY + if(cpi->oxcf.auto_key && cm->frame_type != KEY_FRAME) + { + if(cpi->force_next_frame_intra) + { + cm->frame_type = KEY_FRAME; /* delayed intra frame */ + } + } + cpi->force_next_frame_intra = 0; + #endif + // For an alt ref frame in 2 pass we skip the call to the second pass function that sets the target bandwidth #if !(CONFIG_REALTIME_ONLY) diff --cc vp8/encoder/onyx_int.h index 41ebd3bcd,e8a452dca..d0e48eee2 --- a/vp8/encoder/onyx_int.h +++ b/vp8/encoder/onyx_int.h @@@ -191,15 -191,8 +191,12 @@@ typedef struc typedef struct { MACROBLOCK mb; - int mb_row; - TOKENEXTRA *tp; +#if CONFIG_SEGMENTATION + int segment_counts[MAX_MB_SEGMENTS + 8]; +#else int segment_counts[MAX_MB_SEGMENTS]; +#endif int totalrate; - int current_mb_col; } MB_ROW_COMP; typedef struct