| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 for (mb_row = ithread + 1; mb_row < cm->mb_rows; mb_row += (cpi->enc
oding_thread_count + 1)) | 84 for (mb_row = ithread + 1; mb_row < cm->mb_rows; mb_row += (cpi->enc
oding_thread_count + 1)) |
| 85 { | 85 { |
| 86 | 86 |
| 87 int i; | 87 int i; |
| 88 int recon_yoffset, recon_uvoffset; | 88 int recon_yoffset, recon_uvoffset; |
| 89 int mb_col; | 89 int mb_col; |
| 90 int ref_fb_idx = cm->lst_fb_idx; | 90 int ref_fb_idx = cm->lst_fb_idx; |
| 91 int dst_fb_idx = cm->new_fb_idx; | 91 int dst_fb_idx = cm->new_fb_idx; |
| 92 int recon_y_stride = cm->yv12_fb[ref_fb_idx].y_stride; | 92 int recon_y_stride = cm->yv12_fb[ref_fb_idx].y_stride; |
| 93 int recon_uv_stride = cm->yv12_fb[ref_fb_idx].uv_stride; | 93 int recon_uv_stride = cm->yv12_fb[ref_fb_idx].uv_stride; |
| 94 int map_index = (mb_row * cm->mb_cols); |
| 94 volatile int *last_row_current_mb_col; | 95 volatile int *last_row_current_mb_col; |
| 95 INT64 activity_sum = 0; | |
| 96 | 96 |
| 97 tp = cpi->tok + (mb_row * (cm->mb_cols * 16 * 24)); | 97 tp = cpi->tok + (mb_row * (cm->mb_cols * 16 * 24)); |
| 98 | 98 |
| 99 last_row_current_mb_col = &cpi->mt_current_mb_col[mb_row - 1]; | 99 last_row_current_mb_col = &cpi->mt_current_mb_col[mb_row - 1]; |
| 100 | 100 |
| 101 // reset above block coeffs | 101 // reset above block coeffs |
| 102 xd->above_context = cm->above_context; | 102 xd->above_context = cm->above_context; |
| 103 xd->left_context = &mb_row_left_context; | 103 xd->left_context = &mb_row_left_context; |
| 104 | 104 |
| 105 vp8_zero(mb_row_left_context); | 105 vp8_zero(mb_row_left_context); |
| 106 | 106 |
| 107 xd->up_available = (mb_row != 0); | 107 xd->up_available = (mb_row != 0); |
| 108 recon_yoffset = (mb_row * recon_y_stride * 16); | 108 recon_yoffset = (mb_row * recon_y_stride * 16); |
| 109 recon_uvoffset = (mb_row * recon_uv_stride * 8); | 109 recon_uvoffset = (mb_row * recon_uv_stride * 8); |
| 110 | 110 |
| 111 cpi->tplist[mb_row].start = tp; | 111 cpi->tplist[mb_row].start = tp; |
| 112 | 112 |
| 113 //printf("Thread mb_row = %d\n", mb_row); | 113 //printf("Thread mb_row = %d\n", mb_row); |
| 114 | 114 |
| 115 // Set the mb activity pointer to the start of the row. |
| 116 x->mb_activity_ptr = &cpi->mb_activity_map[map_index]; |
| 117 |
| 115 // for each macroblock col in image | 118 // for each macroblock col in image |
| 116 for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) | 119 for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) |
| 117 { | 120 { |
| 118 int seg_map_index = (mb_row * cm->mb_cols); | |
| 119 | |
| 120 if ((mb_col & (nsync - 1)) == 0) | 121 if ((mb_col & (nsync - 1)) == 0) |
| 121 { | 122 { |
| 122 while (mb_col > (*last_row_current_mb_col - nsync) && *l
ast_row_current_mb_col != cm->mb_cols - 1) | 123 while (mb_col > (*last_row_current_mb_col - nsync) && *l
ast_row_current_mb_col != cm->mb_cols - 1) |
| 123 { | 124 { |
| 124 x86_pause_hint(); | 125 x86_pause_hint(); |
| 125 thread_sleep(0); | 126 thread_sleep(0); |
| 126 } | 127 } |
| 127 } | 128 } |
| 128 | 129 |
| 129 // Distance of Mb to the various image edges. | 130 // Distance of Mb to the various image edges. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 140 x->mv_row_max = ((cm->mb_rows - 1 - mb_row) * 16) + (VP8BORD
ERINPIXELS - 16); | 141 x->mv_row_max = ((cm->mb_rows - 1 - mb_row) * 16) + (VP8BORD
ERINPIXELS - 16); |
| 141 | 142 |
| 142 xd->dst.y_buffer = cm->yv12_fb[dst_fb_idx].y_buffer + recon_
yoffset; | 143 xd->dst.y_buffer = cm->yv12_fb[dst_fb_idx].y_buffer + recon_
yoffset; |
| 143 xd->dst.u_buffer = cm->yv12_fb[dst_fb_idx].u_buffer + recon_
uvoffset; | 144 xd->dst.u_buffer = cm->yv12_fb[dst_fb_idx].u_buffer + recon_
uvoffset; |
| 144 xd->dst.v_buffer = cm->yv12_fb[dst_fb_idx].v_buffer + recon_
uvoffset; | 145 xd->dst.v_buffer = cm->yv12_fb[dst_fb_idx].v_buffer + recon_
uvoffset; |
| 145 xd->left_available = (mb_col != 0); | 146 xd->left_available = (mb_col != 0); |
| 146 | 147 |
| 147 x->rddiv = cpi->RDDIV; | 148 x->rddiv = cpi->RDDIV; |
| 148 x->rdmult = cpi->RDMULT; | 149 x->rdmult = cpi->RDMULT; |
| 149 | 150 |
| 151 //Copy current mb to a buffer |
| 152 RECON_INVOKE(&xd->rtcd->recon, copy16x16)(x->src.y_buffer, x
->src.y_stride, x->thismb, 16); |
| 153 |
| 150 if (cpi->oxcf.tuning == VP8_TUNE_SSIM) | 154 if (cpi->oxcf.tuning == VP8_TUNE_SSIM) |
| 151 activity_sum += vp8_activity_masking(cpi, x); | 155 vp8_activity_masking(cpi, x); |
| 152 | 156 |
| 153 // Is segmentation enabled | 157 // Is segmentation enabled |
| 154 // MB level adjutment to quantizer | 158 // MB level adjutment to quantizer |
| 155 if (xd->segmentation_enabled) | 159 if (xd->segmentation_enabled) |
| 156 { | 160 { |
| 157 // Code to set segment id in xd->mbmi.segment_id for cur
rent MB (with range checking) | 161 // Code to set segment id in xd->mbmi.segment_id for cur
rent MB (with range checking) |
| 158 if (cpi->segmentation_map[seg_map_index + mb_col] <= 3) | 162 if (cpi->segmentation_map[map_index + mb_col] <= 3) |
| 159 xd->mode_info_context->mbmi.segment_id = cpi->segmen
tation_map[seg_map_index + mb_col]; | 163 xd->mode_info_context->mbmi.segment_id = cpi->segmen
tation_map[map_index + mb_col]; |
| 160 else | 164 else |
| 161 xd->mode_info_context->mbmi.segment_id = 0; | 165 xd->mode_info_context->mbmi.segment_id = 0; |
| 162 | 166 |
| 163 vp8cx_mb_init_quantizer(cpi, x); | 167 vp8cx_mb_init_quantizer(cpi, x); |
| 164 } | 168 } |
| 165 else | 169 else |
| 166 xd->mode_info_context->mbmi.segment_id = 0; // Set to Se
gment 0 by default | 170 xd->mode_info_context->mbmi.segment_id = 0; // Set to Se
gment 0 by default |
| 167 | 171 |
| 168 x->active_ptr = cpi->active_map + seg_map_index + mb_col; | 172 x->active_ptr = cpi->active_map + map_index + mb_col; |
| 169 | 173 |
| 170 if (cm->frame_type == KEY_FRAME) | 174 if (cm->frame_type == KEY_FRAME) |
| 171 { | 175 { |
| 172 *totalrate += vp8cx_encode_intra_macro_block(cpi, x, &tp
); | 176 *totalrate += vp8cx_encode_intra_macro_block(cpi, x, &tp
); |
| 173 #ifdef MODE_STATS | 177 #ifdef MODE_STATS |
| 174 y_modes[xd->mbmi.mode] ++; | 178 y_modes[xd->mbmi.mode] ++; |
| 175 #endif | 179 #endif |
| 176 } | 180 } |
| 177 else | 181 else |
| 178 { | 182 { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 196 // Count of last ref frame 0,0 useage | 200 // Count of last ref frame 0,0 useage |
| 197 if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd-
>mode_info_context->mbmi.ref_frame == LAST_FRAME)) | 201 if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd-
>mode_info_context->mbmi.ref_frame == LAST_FRAME)) |
| 198 cpi->inter_zz_count++; | 202 cpi->inter_zz_count++; |
| 199 | 203 |
| 200 // Special case code for cyclic refresh | 204 // Special case code for cyclic refresh |
| 201 // If cyclic update enabled then copy xd->mbmi.segment_i
d; (which may have been updated based on mode | 205 // If cyclic update enabled then copy xd->mbmi.segment_i
d; (which may have been updated based on mode |
| 202 // during vp8cx_encode_inter_macroblock()) back into the
global sgmentation map | 206 // during vp8cx_encode_inter_macroblock()) back into the
global sgmentation map |
| 203 if (cpi->cyclic_refresh_mode_enabled && xd->segmentation
_enabled) | 207 if (cpi->cyclic_refresh_mode_enabled && xd->segmentation
_enabled) |
| 204 { | 208 { |
| 205 const MB_MODE_INFO * mbmi = &xd->mode_info_context->
mbmi; | 209 const MB_MODE_INFO * mbmi = &xd->mode_info_context->
mbmi; |
| 206 cpi->segmentation_map[seg_map_index + mb_col] = mbmi
->segment_id; | 210 cpi->segmentation_map[map_index + mb_col] = mbmi->se
gment_id; |
| 207 | 211 |
| 208 // If the block has been refreshed mark it as clean
(the magnitude of the -ve influences how long it will be before we consider anot
her refresh): | 212 // If the block has been refreshed mark it as clean
(the magnitude of the -ve influences how long it will be before we consider anot
her refresh): |
| 209 // 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 (marke
d 0) | 213 // 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 (marke
d 0) |
| 210 // else mark it as dirty (1). | 214 // else mark it as dirty (1). |
| 211 if (mbmi->segment_id) | 215 if (mbmi->segment_id) |
| 212 cpi->cyclic_refresh_map[seg_map_index + mb_col]
= -1; | 216 cpi->cyclic_refresh_map[map_index + mb_col] = -1
; |
| 213 else if ((mbmi->mode == ZEROMV) && (mbmi->ref_frame
== LAST_FRAME)) | 217 else if ((mbmi->mode == ZEROMV) && (mbmi->ref_frame
== LAST_FRAME)) |
| 214 { | 218 { |
| 215 if (cpi->cyclic_refresh_map[seg_map_index + mb_c
ol] == 1) | 219 if (cpi->cyclic_refresh_map[map_index + mb_col]
== 1) |
| 216 cpi->cyclic_refresh_map[seg_map_index + mb_c
ol] = 0; | 220 cpi->cyclic_refresh_map[map_index + mb_col]
= 0; |
| 217 } | 221 } |
| 218 else | 222 else |
| 219 cpi->cyclic_refresh_map[seg_map_index + mb_col]
= 1; | 223 cpi->cyclic_refresh_map[map_index + mb_col] = 1; |
| 220 | 224 |
| 221 } | 225 } |
| 222 } | 226 } |
| 223 cpi->tplist[mb_row].stop = tp; | 227 cpi->tplist[mb_row].stop = tp; |
| 224 | 228 |
| 225 x->gf_active_ptr++; // Increment pointer into gf useage flag
s structure for next mb | 229 // Increment pointer into gf useage flags structure. |
| 230 x->gf_active_ptr++; |
| 226 | 231 |
| 232 // Increment the activity mask pointers. |
| 233 x->mb_activity_ptr++; |
| 234 |
| 235 /* save the block info */ |
| 227 for (i = 0; i < 16; i++) | 236 for (i = 0; i < 16; i++) |
| 228 vpx_memcpy(&xd->mode_info_context->bmi[i], &xd->block[i]
.bmi, sizeof(xd->block[i].bmi)); | 237 xd->mode_info_context->bmi[i] = xd->block[i].bmi; |
| 229 | 238 |
| 230 // adjust to the next column of macroblocks | 239 // adjust to the next column of macroblocks |
| 231 x->src.y_buffer += 16; | 240 x->src.y_buffer += 16; |
| 232 x->src.u_buffer += 8; | 241 x->src.u_buffer += 8; |
| 233 x->src.v_buffer += 8; | 242 x->src.v_buffer += 8; |
| 234 | 243 |
| 235 recon_yoffset += 16; | 244 recon_yoffset += 16; |
| 236 recon_uvoffset += 8; | 245 recon_uvoffset += 8; |
| 237 | 246 |
| 238 // Keep track of segment useage | 247 // Keep track of segment useage |
| (...skipping 10 matching lines...) Expand all Loading... |
| 249 //extend the recon for intra prediction | 258 //extend the recon for intra prediction |
| 250 vp8_extend_mb_row( | 259 vp8_extend_mb_row( |
| 251 &cm->yv12_fb[dst_fb_idx], | 260 &cm->yv12_fb[dst_fb_idx], |
| 252 xd->dst.y_buffer + 16, | 261 xd->dst.y_buffer + 16, |
| 253 xd->dst.u_buffer + 8, | 262 xd->dst.u_buffer + 8, |
| 254 xd->dst.v_buffer + 8); | 263 xd->dst.v_buffer + 8); |
| 255 | 264 |
| 256 // this is to account for the border | 265 // this is to account for the border |
| 257 xd->mode_info_context++; | 266 xd->mode_info_context++; |
| 258 x->partition_info++; | 267 x->partition_info++; |
| 259 x->activity_sum += activity_sum; | |
| 260 | 268 |
| 261 x->src.y_buffer += 16 * x->src.y_stride * (cpi->encoding_thread_
count + 1) - 16 * cm->mb_cols; | 269 x->src.y_buffer += 16 * x->src.y_stride * (cpi->encoding_thread_
count + 1) - 16 * cm->mb_cols; |
| 262 x->src.u_buffer += 8 * x->src.uv_stride * (cpi->encoding_thread_
count + 1) - 8 * cm->mb_cols; | 270 x->src.u_buffer += 8 * x->src.uv_stride * (cpi->encoding_thread_
count + 1) - 8 * cm->mb_cols; |
| 263 x->src.v_buffer += 8 * x->src.uv_stride * (cpi->encoding_thread_
count + 1) - 8 * cm->mb_cols; | 271 x->src.v_buffer += 8 * x->src.uv_stride * (cpi->encoding_thread_
count + 1) - 8 * cm->mb_cols; |
| 264 | 272 |
| 265 xd->mode_info_context += xd->mode_info_stride * cpi->encoding_th
read_count; | 273 xd->mode_info_context += xd->mode_info_stride * cpi->encoding_th
read_count; |
| 266 x->partition_info += xd->mode_info_stride * cpi->encoding_thread
_count; | 274 x->partition_info += xd->mode_info_stride * cpi->encoding_thread
_count; |
| 275 x->gf_active_ptr += cm->mb_cols * cpi->encoding_thread_count; |
| 267 | 276 |
| 268 if (mb_row == cm->mb_rows - 1) | 277 if (mb_row == cm->mb_rows - 1) |
| 269 { | 278 { |
| 270 //SetEvent(cpi->h_event_main); | 279 //SetEvent(cpi->h_event_main); |
| 271 sem_post(&cpi->h_event_end_encoding); /* signal frame encodi
ng end */ | 280 sem_post(&cpi->h_event_end_encoding); /* signal frame encodi
ng end */ |
| 272 } | 281 } |
| 273 } | 282 } |
| 274 } | 283 } |
| 275 } | 284 } |
| 276 | 285 |
| 277 //printf("exit thread %d\n", ithread); | 286 //printf("exit thread %d\n", ithread); |
| 278 return 0; | 287 return 0; |
| 279 } | 288 } |
| 280 | 289 |
| 281 static void setup_mbby_copy(MACROBLOCK *mbdst, MACROBLOCK *mbsrc) | 290 static void setup_mbby_copy(MACROBLOCK *mbdst, MACROBLOCK *mbsrc) |
| 282 { | 291 { |
| 283 | 292 |
| 284 MACROBLOCK *x = mbsrc; | 293 MACROBLOCK *x = mbsrc; |
| 285 MACROBLOCK *z = mbdst; | 294 MACROBLOCK *z = mbdst; |
| 286 int i; | 295 int i; |
| 287 | 296 |
| 288 z->ss = x->ss; | 297 z->ss = x->ss; |
| 289 z->ss_count = x->ss_count; | 298 z->ss_count = x->ss_count; |
| 290 z->searches_per_step = x->searches_per_step; | 299 z->searches_per_step = x->searches_per_step; |
| 291 z->errorperbit = x->errorperbit; | 300 z->errorperbit = x->errorperbit; |
| 292 | 301 |
| 293 z->sadperbit16 = x->sadperbit16; | 302 z->sadperbit16 = x->sadperbit16; |
| 294 z->sadperbit4 = x->sadperbit4; | 303 z->sadperbit4 = x->sadperbit4; |
| 295 z->errthresh = x->errthresh; | |
| 296 | 304 |
| 297 /* | 305 /* |
| 298 z->mv_col_min = x->mv_col_min; | 306 z->mv_col_min = x->mv_col_min; |
| 299 z->mv_col_max = x->mv_col_max; | 307 z->mv_col_max = x->mv_col_max; |
| 300 z->mv_row_min = x->mv_row_min; | 308 z->mv_row_min = x->mv_row_min; |
| 301 z->mv_row_max = x->mv_row_max; | 309 z->mv_row_max = x->mv_row_max; |
| 302 z->vector_range = x->vector_range ; | 310 z->vector_range = x->vector_range ; |
| 303 */ | 311 */ |
| 304 | 312 |
| 305 z->vp8_short_fdct4x4 = x->vp8_short_fdct4x4; | 313 z->vp8_short_fdct4x4 = x->vp8_short_fdct4x4; |
| 306 z->vp8_short_fdct8x4 = x->vp8_short_fdct8x4; | 314 z->vp8_short_fdct8x4 = x->vp8_short_fdct8x4; |
| 307 z->short_walsh4x4 = x->short_walsh4x4; | 315 z->short_walsh4x4 = x->short_walsh4x4; |
| 308 z->quantize_b = x->quantize_b; | 316 z->quantize_b = x->quantize_b; |
| 317 z->quantize_b_pair = x->quantize_b_pair; |
| 309 z->optimize = x->optimize; | 318 z->optimize = x->optimize; |
| 310 | 319 |
| 311 /* | 320 /* |
| 312 z->mvc = x->mvc; | 321 z->mvc = x->mvc; |
| 313 z->src.y_buffer = x->src.y_buffer; | 322 z->src.y_buffer = x->src.y_buffer; |
| 314 z->src.u_buffer = x->src.u_buffer; | 323 z->src.u_buffer = x->src.u_buffer; |
| 315 z->src.v_buffer = x->src.v_buffer; | 324 z->src.v_buffer = x->src.v_buffer; |
| 316 */ | 325 */ |
| 317 | 326 |
| 318 | 327 |
| 319 vpx_memcpy(z->mvcosts, x->mvcosts, sizeof(x->mvcosts)); | 328 vpx_memcpy(z->mvcosts, x->mvcosts, sizeof(x->mvcosts)); |
| 320 z->mvcost[0] = &z->mvcosts[0][mv_max+1]; | 329 z->mvcost[0] = &z->mvcosts[0][mv_max+1]; |
| 321 z->mvcost[1] = &z->mvcosts[1][mv_max+1]; | 330 z->mvcost[1] = &z->mvcosts[1][mv_max+1]; |
| 322 z->mvsadcost[0] = &z->mvsadcosts[0][mv_max+1]; | 331 z->mvsadcost[0] = &z->mvsadcosts[0][mvfp_max+1]; |
| 323 z->mvsadcost[1] = &z->mvsadcosts[1][mv_max+1]; | 332 z->mvsadcost[1] = &z->mvsadcosts[1][mvfp_max+1]; |
| 324 | 333 |
| 325 | 334 |
| 326 vpx_memcpy(z->token_costs, x->token_costs, sizeof(x->token_costs)
); | 335 vpx_memcpy(z->token_costs, x->token_costs, sizeof(x->token_costs)
); |
| 327 vpx_memcpy(z->inter_bmode_costs, x->inter_bmode_costs, sizeof(x->inter_bmod
e_costs)); | 336 vpx_memcpy(z->inter_bmode_costs, x->inter_bmode_costs, sizeof(x->inter_bmod
e_costs)); |
| 328 //memcpy(z->mvcosts, x->mvcosts, sizeof(x->mvcosts)); | 337 //memcpy(z->mvcosts, x->mvcosts, sizeof(x->mvcosts)); |
| 329 //memcpy(z->mvcost, x->mvcost, sizeof(x->mvcost)); | 338 //memcpy(z->mvcost, x->mvcost, sizeof(x->mvcost)); |
| 330 vpx_memcpy(z->mbmode_cost, x->mbmode_cost, sizeof(x->mbmode_cost)
); | 339 vpx_memcpy(z->mbmode_cost, x->mbmode_cost, sizeof(x->mbmode_cost)
); |
| 331 vpx_memcpy(z->intra_uv_mode_cost, x->intra_uv_mode_cost, sizeof(x->intra_uv
_mode_cost)); | 340 vpx_memcpy(z->intra_uv_mode_cost, x->intra_uv_mode_cost, sizeof(x->intra_uv
_mode_cost)); |
| 332 vpx_memcpy(z->bmode_costs, x->bmode_costs, sizeof(x->bmode_costs)
); | 341 vpx_memcpy(z->bmode_costs, x->bmode_costs, sizeof(x->bmode_costs)
); |
| 333 | 342 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 mb->src.y_buffer += 16 * x->src.y_stride * (i + 1); | 445 mb->src.y_buffer += 16 * x->src.y_stride * (i + 1); |
| 437 mb->src.u_buffer += 8 * x->src.uv_stride * (i + 1); | 446 mb->src.u_buffer += 8 * x->src.uv_stride * (i + 1); |
| 438 mb->src.v_buffer += 8 * x->src.uv_stride * (i + 1); | 447 mb->src.v_buffer += 8 * x->src.uv_stride * (i + 1); |
| 439 | 448 |
| 440 vp8_build_block_offsets(mb); | 449 vp8_build_block_offsets(mb); |
| 441 | 450 |
| 442 vp8_setup_block_dptrs(mbd); | 451 vp8_setup_block_dptrs(mbd); |
| 443 | 452 |
| 444 vp8_setup_block_ptrs(mb); | 453 vp8_setup_block_ptrs(mb); |
| 445 | 454 |
| 446 mb->activity_sum = 0; | |
| 447 | |
| 448 mbd->left_context = &cm->left_context; | 455 mbd->left_context = &cm->left_context; |
| 449 mb->mvc = cm->fc.mvc; | 456 mb->mvc = cm->fc.mvc; |
| 450 | 457 |
| 451 setup_mbby_copy(&mbr_ei[i].mb, x); | 458 setup_mbby_copy(&mbr_ei[i].mb, x); |
| 452 | 459 |
| 453 } | 460 } |
| 454 } | 461 } |
| 455 | 462 |
| 456 void vp8cx_create_encoder_threads(VP8_COMP *cpi) | 463 void vp8cx_create_encoder_threads(VP8_COMP *cpi) |
| 457 { | 464 { |
| 458 const VP8_COMMON * cm = &cpi->common; | 465 const VP8_COMMON * cm = &cpi->common; |
| 459 | 466 |
| 460 cpi->b_multi_threaded = 0; | 467 cpi->b_multi_threaded = 0; |
| 461 cpi->encoding_thread_count = 0; | 468 cpi->encoding_thread_count = 0; |
| 462 cpi->processor_core_count = 32; //vp8_get_proc_core_count(); | |
| 463 | 469 |
| 464 if (cpi->processor_core_count > 1 && cpi->oxcf.multi_threaded > 1) | 470 if (cm->processor_core_count > 1 && cpi->oxcf.multi_threaded > 1) |
| 465 { | 471 { |
| 466 int ithread; | 472 int ithread; |
| 467 int th_count = cpi->oxcf.multi_threaded - 1; | 473 int th_count = cpi->oxcf.multi_threaded - 1; |
| 468 | 474 |
| 469 if (cpi->oxcf.multi_threaded > cpi->processor_core_count) | 475 /* don't allocate more threads than cores available */ |
| 470 th_count = cpi->processor_core_count - 1; | 476 if (cpi->oxcf.multi_threaded > cm->processor_core_count) |
| 477 th_count = cm->processor_core_count - 1; |
| 471 | 478 |
| 472 /* we have th_count + 1 (main) threads processing one row each */ | 479 /* we have th_count + 1 (main) threads processing one row each */ |
| 473 /* no point to have more threads than the sync range allows */ | 480 /* no point to have more threads than the sync range allows */ |
| 474 if(th_count > ((cm->mb_cols / cpi->mt_sync_range) - 1)) | 481 if(th_count > ((cm->mb_cols / cpi->mt_sync_range) - 1)) |
| 475 { | 482 { |
| 476 th_count = (cm->mb_cols / cpi->mt_sync_range) - 1; | 483 th_count = (cm->mb_cols / cpi->mt_sync_range) - 1; |
| 477 } | 484 } |
| 478 | 485 |
| 479 if(th_count == 0) | 486 if(th_count == 0) |
| 480 return; | 487 return; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 558 |
| 552 //free thread related resources | 559 //free thread related resources |
| 553 vpx_free(cpi->h_event_start_encoding); | 560 vpx_free(cpi->h_event_start_encoding); |
| 554 vpx_free(cpi->h_encoding_thread); | 561 vpx_free(cpi->h_encoding_thread); |
| 555 vpx_free(cpi->mb_row_ei); | 562 vpx_free(cpi->mb_row_ei); |
| 556 vpx_free(cpi->en_thread_data); | 563 vpx_free(cpi->en_thread_data); |
| 557 vpx_free(cpi->mt_current_mb_col); | 564 vpx_free(cpi->mt_current_mb_col); |
| 558 } | 565 } |
| 559 } | 566 } |
| 560 #endif | 567 #endif |
| OLD | NEW |