| 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 |
| 11 #include "onyx_int.h" | 11 #include "onyx_int.h" |
| 12 #include "vp8/common/threading.h" | 12 #include "vp8/common/threading.h" |
| 13 #include "vp8/common/common.h" | 13 #include "vp8/common/common.h" |
| 14 #include "vp8/common/extend.h" | 14 #include "vp8/common/extend.h" |
| 15 #include "bitstream.h" | 15 #include "bitstream.h" |
| 16 #include "encodeframe.h" | 16 #include "encodeframe.h" |
| 17 | 17 |
| 18 #if CONFIG_MULTITHREAD | 18 #if CONFIG_MULTITHREAD |
| 19 | 19 |
| 20 extern int vp8cx_encode_inter_macroblock(VP8_COMP *cpi, MACROBLOCK *x, | |
| 21 TOKENEXTRA **t, | |
| 22 int recon_yoffset, int recon_uvoffset, | |
| 23 int mb_row, int mb_col); | |
| 24 extern int vp8cx_encode_intra_macroblock(VP8_COMP *cpi, MACROBLOCK *x, | |
| 25 TOKENEXTRA **t); | |
| 26 extern void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x, int ok_to_skip
); | 20 extern void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x, int ok_to_skip
); |
| 27 | 21 |
| 28 extern void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm); | 22 extern void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm); |
| 29 | 23 |
| 30 static THREAD_FUNCTION thread_loopfilter(void *p_data) | 24 static THREAD_FUNCTION thread_loopfilter(void *p_data) |
| 31 { | 25 { |
| 32 VP8_COMP *cpi = (VP8_COMP *)(((LPFTHREAD_DATA *)p_data)->ptr1); | 26 VP8_COMP *cpi = (VP8_COMP *)(((LPFTHREAD_DATA *)p_data)->ptr1); |
| 33 VP8_COMMON *cm = &cpi->common; | 27 VP8_COMMON *cm = &cpi->common; |
| 34 | 28 |
| 35 while (1) | 29 while (1) |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 207 |
| 214 #endif | 208 #endif |
| 215 | 209 |
| 216 /* Special case code for cyclic refresh | 210 /* Special case code for cyclic refresh |
| 217 * If cyclic update enabled then copy | 211 * If cyclic update enabled then copy |
| 218 * xd->mbmi.segment_id; (which may have been updated | 212 * xd->mbmi.segment_id; (which may have been updated |
| 219 * based on mode during | 213 * based on mode during |
| 220 * vp8cx_encode_inter_macroblock()) back into the | 214 * vp8cx_encode_inter_macroblock()) back into the |
| 221 * global segmentation map | 215 * global segmentation map |
| 222 */ | 216 */ |
| 223 if (cpi->cyclic_refresh_mode_enabled && xd->segmentation
_enabled) | 217 if ((cpi->current_layer == 0) && |
| 218 (cpi->cyclic_refresh_mode_enabled && |
| 219 xd->segmentation_enabled)) |
| 224 { | 220 { |
| 225 const MB_MODE_INFO * mbmi = &xd->mode_info_context->
mbmi; | 221 const MB_MODE_INFO * mbmi = &xd->mode_info_context->
mbmi; |
| 226 cpi->segmentation_map[map_index + mb_col] = mbmi->se
gment_id; | 222 cpi->segmentation_map[map_index + mb_col] = mbmi->se
gment_id; |
| 227 | 223 |
| 228 /* If the block has been refreshed mark it as clean | 224 /* If the block has been refreshed mark it as clean |
| 229 * (the magnitude of the -ve influences how long it | 225 * (the magnitude of the -ve influences how long it |
| 230 * will be before we consider another refresh): | 226 * will be before we consider another refresh): |
| 231 * Else if it was coded (last frame 0,0) and has | 227 * Else if it was coded (last frame 0,0) and has |
| 232 * not already been refreshed then mark it as a | 228 * not already been refreshed then mark it as a |
| 233 * candidate for cleanup next time (marked 0) else | 229 * candidate for cleanup next time (marked 0) else |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 /*TODO: Remove dequant from BLOCKD. This is a temporary solution until | 411 /*TODO: Remove dequant from BLOCKD. This is a temporary solution until |
| 416 * the quantizer code uses a passed in pointer to the dequant constants. | 412 * the quantizer code uses a passed in pointer to the dequant constants. |
| 417 * This will also require modifications to the x86 and neon assembly. | 413 * This will also require modifications to the x86 and neon assembly. |
| 418 * */ | 414 * */ |
| 419 for (i = 0; i < 16; i++) | 415 for (i = 0; i < 16; i++) |
| 420 zd->block[i].dequant = zd->dequant_y1; | 416 zd->block[i].dequant = zd->dequant_y1; |
| 421 for (i = 16; i < 24; i++) | 417 for (i = 16; i < 24; i++) |
| 422 zd->block[i].dequant = zd->dequant_uv; | 418 zd->block[i].dequant = zd->dequant_uv; |
| 423 zd->block[24].dequant = zd->dequant_y2; | 419 zd->block[24].dequant = zd->dequant_y2; |
| 424 #endif | 420 #endif |
| 421 |
| 422 |
| 423 vpx_memcpy(z->rd_threshes, x->rd_threshes, sizeof(x->rd_threshes)); |
| 424 vpx_memcpy(z->rd_thresh_mult, x->rd_thresh_mult, |
| 425 sizeof(x->rd_thresh_mult)); |
| 426 |
| 427 z->zbin_over_quant = x->zbin_over_quant; |
| 428 z->zbin_mode_boost_enabled = x->zbin_mode_boost_enabled; |
| 429 z->zbin_mode_boost = x->zbin_mode_boost; |
| 430 |
| 431 vpx_memset(z->error_bins, 0, sizeof(z->error_bins)); |
| 425 } | 432 } |
| 426 } | 433 } |
| 427 | 434 |
| 428 void vp8cx_init_mbrthread_data(VP8_COMP *cpi, | 435 void vp8cx_init_mbrthread_data(VP8_COMP *cpi, |
| 429 MACROBLOCK *x, | 436 MACROBLOCK *x, |
| 430 MB_ROW_COMP *mbr_ei, | 437 MB_ROW_COMP *mbr_ei, |
| 431 int mb_row, | |
| 432 int count | 438 int count |
| 433 ) | 439 ) |
| 434 { | 440 { |
| 435 | 441 |
| 436 VP8_COMMON *const cm = & cpi->common; | 442 VP8_COMMON *const cm = & cpi->common; |
| 437 MACROBLOCKD *const xd = & x->e_mbd; | 443 MACROBLOCKD *const xd = & x->e_mbd; |
| 438 int i; | 444 int i; |
| 439 (void) mb_row; | |
| 440 | 445 |
| 441 for (i = 0; i < count; i++) | 446 for (i = 0; i < count; i++) |
| 442 { | 447 { |
| 443 MACROBLOCK *mb = & mbr_ei[i].mb; | 448 MACROBLOCK *mb = & mbr_ei[i].mb; |
| 444 MACROBLOCKD *mbd = &mb->e_mbd; | 449 MACROBLOCKD *mbd = &mb->e_mbd; |
| 445 | 450 |
| 446 mbd->subpixel_predict = xd->subpixel_predict; | 451 mbd->subpixel_predict = xd->subpixel_predict; |
| 447 mbd->subpixel_predict8x4 = xd->subpixel_predict8x4; | 452 mbd->subpixel_predict8x4 = xd->subpixel_predict8x4; |
| 448 mbd->subpixel_predict8x8 = xd->subpixel_predict8x8; | 453 mbd->subpixel_predict8x8 = xd->subpixel_predict8x8; |
| 449 mbd->subpixel_predict16x16 = xd->subpixel_predict16x16; | 454 mbd->subpixel_predict16x16 = xd->subpixel_predict16x16; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 470 vp8_build_block_offsets(mb); | 475 vp8_build_block_offsets(mb); |
| 471 | 476 |
| 472 mbd->left_context = &cm->left_context; | 477 mbd->left_context = &cm->left_context; |
| 473 mb->mvc = cm->fc.mvc; | 478 mb->mvc = cm->fc.mvc; |
| 474 | 479 |
| 475 setup_mbby_copy(&mbr_ei[i].mb, x); | 480 setup_mbby_copy(&mbr_ei[i].mb, x); |
| 476 | 481 |
| 477 mbd->fullpixel_mask = 0xffffffff; | 482 mbd->fullpixel_mask = 0xffffffff; |
| 478 if(cm->full_pixel) | 483 if(cm->full_pixel) |
| 479 mbd->fullpixel_mask = 0xfffffff8; | 484 mbd->fullpixel_mask = 0xfffffff8; |
| 485 |
| 486 vp8_zero(mb->coef_counts); |
| 487 vp8_zero(x->ymode_count); |
| 488 mb->skip_true_count = 0; |
| 489 vp8_zero(mb->MVcount); |
| 490 mb->prediction_error = 0; |
| 491 mb->intra_error = 0; |
| 492 vp8_zero(mb->count_mb_ref_frame_usage); |
| 493 mb->mbs_tested_so_far = 0; |
| 480 } | 494 } |
| 481 } | 495 } |
| 482 | 496 |
| 483 int vp8cx_create_encoder_threads(VP8_COMP *cpi) | 497 int vp8cx_create_encoder_threads(VP8_COMP *cpi) |
| 484 { | 498 { |
| 485 const VP8_COMMON * cm = &cpi->common; | 499 const VP8_COMMON * cm = &cpi->common; |
| 486 | 500 |
| 487 cpi->b_multi_threaded = 0; | 501 cpi->b_multi_threaded = 0; |
| 488 cpi->encoding_thread_count = 0; | 502 cpi->encoding_thread_count = 0; |
| 489 cpi->b_lpf_running = 0; | 503 cpi->b_lpf_running = 0; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 sem_destroy(&cpi->h_event_start_lpf); | 646 sem_destroy(&cpi->h_event_start_lpf); |
| 633 | 647 |
| 634 /* free thread related resources */ | 648 /* free thread related resources */ |
| 635 vpx_free(cpi->h_event_start_encoding); | 649 vpx_free(cpi->h_event_start_encoding); |
| 636 vpx_free(cpi->h_encoding_thread); | 650 vpx_free(cpi->h_encoding_thread); |
| 637 vpx_free(cpi->mb_row_ei); | 651 vpx_free(cpi->mb_row_ei); |
| 638 vpx_free(cpi->en_thread_data); | 652 vpx_free(cpi->en_thread_data); |
| 639 } | 653 } |
| 640 } | 654 } |
| 641 #endif | 655 #endif |
| OLD | NEW |