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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 zd->gf_active_ptr = xd->gf_active_ptr; | 409 zd->gf_active_ptr = xd->gf_active_ptr; |
410 zd->frames_since_golden = xd->frames_since_golden; | 410 zd->frames_since_golden = xd->frames_since_golden; |
411 zd->frames_till_alt_ref_frame = xd->frames_till_alt_ref_frame; | 411 zd->frames_till_alt_ref_frame = xd->frames_till_alt_ref_frame; |
412 */ | 412 */ |
413 zd->subpixel_predict = xd->subpixel_predict; | 413 zd->subpixel_predict = xd->subpixel_predict; |
414 zd->subpixel_predict8x4 = xd->subpixel_predict8x4; | 414 zd->subpixel_predict8x4 = xd->subpixel_predict8x4; |
415 zd->subpixel_predict8x8 = xd->subpixel_predict8x8; | 415 zd->subpixel_predict8x8 = xd->subpixel_predict8x8; |
416 zd->subpixel_predict16x16 = xd->subpixel_predict16x16; | 416 zd->subpixel_predict16x16 = xd->subpixel_predict16x16; |
417 zd->segmentation_enabled = xd->segmentation_enabled; | 417 zd->segmentation_enabled = xd->segmentation_enabled; |
418 zd->mb_segement_abs_delta = xd->mb_segement_abs_delta; | 418 zd->mb_segement_abs_delta = xd->mb_segement_abs_delta; |
419 vpx_memcpy(zd->segment_feature_data, xd->segment_feature_data, | 419 memcpy(zd->segment_feature_data, xd->segment_feature_data, |
420 sizeof(xd->segment_feature_data)); | 420 sizeof(xd->segment_feature_data)); |
421 | 421 |
422 vpx_memcpy(zd->dequant_y1_dc, xd->dequant_y1_dc, | 422 memcpy(zd->dequant_y1_dc, xd->dequant_y1_dc, sizeof(xd->dequant_y1_dc)); |
423 sizeof(xd->dequant_y1_dc)); | 423 memcpy(zd->dequant_y1, xd->dequant_y1, sizeof(xd->dequant_y1)); |
424 vpx_memcpy(zd->dequant_y1, xd->dequant_y1, sizeof(xd->dequant_y1)); | 424 memcpy(zd->dequant_y2, xd->dequant_y2, sizeof(xd->dequant_y2)); |
425 vpx_memcpy(zd->dequant_y2, xd->dequant_y2, sizeof(xd->dequant_y2)); | 425 memcpy(zd->dequant_uv, xd->dequant_uv, sizeof(xd->dequant_uv)); |
426 vpx_memcpy(zd->dequant_uv, xd->dequant_uv, sizeof(xd->dequant_uv)); | |
427 | 426 |
428 #if 1 | 427 #if 1 |
429 /*TODO: Remove dequant from BLOCKD. This is a temporary solution until | 428 /*TODO: Remove dequant from BLOCKD. This is a temporary solution until |
430 * the quantizer code uses a passed in pointer to the dequant constants. | 429 * the quantizer code uses a passed in pointer to the dequant constants. |
431 * This will also require modifications to the x86 and neon assembly. | 430 * This will also require modifications to the x86 and neon assembly. |
432 * */ | 431 * */ |
433 for (i = 0; i < 16; i++) | 432 for (i = 0; i < 16; i++) |
434 zd->block[i].dequant = zd->dequant_y1; | 433 zd->block[i].dequant = zd->dequant_y1; |
435 for (i = 16; i < 24; i++) | 434 for (i = 16; i < 24; i++) |
436 zd->block[i].dequant = zd->dequant_uv; | 435 zd->block[i].dequant = zd->dequant_uv; |
437 zd->block[24].dequant = zd->dequant_y2; | 436 zd->block[24].dequant = zd->dequant_y2; |
438 #endif | 437 #endif |
439 | 438 |
440 | 439 |
441 vpx_memcpy(z->rd_threshes, x->rd_threshes, sizeof(x->rd_threshes)); | 440 memcpy(z->rd_threshes, x->rd_threshes, sizeof(x->rd_threshes)); |
442 vpx_memcpy(z->rd_thresh_mult, x->rd_thresh_mult, | 441 memcpy(z->rd_thresh_mult, x->rd_thresh_mult, sizeof(x->rd_thresh_mult)); |
443 sizeof(x->rd_thresh_mult)); | |
444 | 442 |
445 z->zbin_over_quant = x->zbin_over_quant; | 443 z->zbin_over_quant = x->zbin_over_quant; |
446 z->zbin_mode_boost_enabled = x->zbin_mode_boost_enabled; | 444 z->zbin_mode_boost_enabled = x->zbin_mode_boost_enabled; |
447 z->zbin_mode_boost = x->zbin_mode_boost; | 445 z->zbin_mode_boost = x->zbin_mode_boost; |
448 | 446 |
449 vpx_memset(z->error_bins, 0, sizeof(z->error_bins)); | 447 memset(z->error_bins, 0, sizeof(z->error_bins)); |
450 } | 448 } |
451 } | 449 } |
452 | 450 |
453 void vp8cx_init_mbrthread_data(VP8_COMP *cpi, | 451 void vp8cx_init_mbrthread_data(VP8_COMP *cpi, |
454 MACROBLOCK *x, | 452 MACROBLOCK *x, |
455 MB_ROW_COMP *mbr_ei, | 453 MB_ROW_COMP *mbr_ei, |
456 int count | 454 int count |
457 ) | 455 ) |
458 { | 456 { |
459 | 457 |
460 VP8_COMMON *const cm = & cpi->common; | 458 VP8_COMMON *const cm = & cpi->common; |
461 MACROBLOCKD *const xd = & x->e_mbd; | 459 MACROBLOCKD *const xd = & x->e_mbd; |
462 int i; | 460 int i; |
463 | 461 |
464 for (i = 0; i < count; i++) | 462 for (i = 0; i < count; i++) |
465 { | 463 { |
466 MACROBLOCK *mb = & mbr_ei[i].mb; | 464 MACROBLOCK *mb = & mbr_ei[i].mb; |
467 MACROBLOCKD *mbd = &mb->e_mbd; | 465 MACROBLOCKD *mbd = &mb->e_mbd; |
468 | 466 |
469 mbd->subpixel_predict = xd->subpixel_predict; | 467 mbd->subpixel_predict = xd->subpixel_predict; |
470 mbd->subpixel_predict8x4 = xd->subpixel_predict8x4; | 468 mbd->subpixel_predict8x4 = xd->subpixel_predict8x4; |
471 mbd->subpixel_predict8x8 = xd->subpixel_predict8x8; | 469 mbd->subpixel_predict8x8 = xd->subpixel_predict8x8; |
472 mbd->subpixel_predict16x16 = xd->subpixel_predict16x16; | 470 mbd->subpixel_predict16x16 = xd->subpixel_predict16x16; |
473 mb->gf_active_ptr = x->gf_active_ptr; | 471 mb->gf_active_ptr = x->gf_active_ptr; |
474 | 472 |
475 vpx_memset(mbr_ei[i].segment_counts, 0, sizeof(mbr_ei[i].segment_counts)
); | 473 memset(mbr_ei[i].segment_counts, 0, sizeof(mbr_ei[i].segment_counts)); |
476 mbr_ei[i].totalrate = 0; | 474 mbr_ei[i].totalrate = 0; |
477 | 475 |
478 mb->partition_info = x->pi + x->e_mbd.mode_info_stride * (i + 1); | 476 mb->partition_info = x->pi + x->e_mbd.mode_info_stride * (i + 1); |
479 | 477 |
480 mbd->mode_info_context = cm->mi + x->e_mbd.mode_info_stride * (i + 1); | 478 mbd->mode_info_context = cm->mi + x->e_mbd.mode_info_stride * (i + 1); |
481 mbd->mode_info_stride = cm->mode_info_stride; | 479 mbd->mode_info_stride = cm->mode_info_stride; |
482 | 480 |
483 mbd->frame_type = cm->frame_type; | 481 mbd->frame_type = cm->frame_type; |
484 | 482 |
485 mb->src = * cpi->Source; | 483 mb->src = * cpi->Source; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 | 538 |
541 if(th_count == 0) | 539 if(th_count == 0) |
542 return 0; | 540 return 0; |
543 | 541 |
544 CHECK_MEM_ERROR(cpi->h_encoding_thread, | 542 CHECK_MEM_ERROR(cpi->h_encoding_thread, |
545 vpx_malloc(sizeof(pthread_t) * th_count)); | 543 vpx_malloc(sizeof(pthread_t) * th_count)); |
546 CHECK_MEM_ERROR(cpi->h_event_start_encoding, | 544 CHECK_MEM_ERROR(cpi->h_event_start_encoding, |
547 vpx_malloc(sizeof(sem_t) * th_count)); | 545 vpx_malloc(sizeof(sem_t) * th_count)); |
548 CHECK_MEM_ERROR(cpi->mb_row_ei, | 546 CHECK_MEM_ERROR(cpi->mb_row_ei, |
549 vpx_memalign(32, sizeof(MB_ROW_COMP) * th_count)); | 547 vpx_memalign(32, sizeof(MB_ROW_COMP) * th_count)); |
550 vpx_memset(cpi->mb_row_ei, 0, sizeof(MB_ROW_COMP) * th_count); | 548 memset(cpi->mb_row_ei, 0, sizeof(MB_ROW_COMP) * th_count); |
551 CHECK_MEM_ERROR(cpi->en_thread_data, | 549 CHECK_MEM_ERROR(cpi->en_thread_data, |
552 vpx_malloc(sizeof(ENCODETHREAD_DATA) * th_count)); | 550 vpx_malloc(sizeof(ENCODETHREAD_DATA) * th_count)); |
553 | 551 |
554 sem_init(&cpi->h_event_end_encoding, 0, 0); | 552 sem_init(&cpi->h_event_end_encoding, 0, 0); |
555 | 553 |
556 cpi->b_multi_threaded = 1; | 554 cpi->b_multi_threaded = 1; |
557 cpi->encoding_thread_count = th_count; | 555 cpi->encoding_thread_count = th_count; |
558 | 556 |
559 /* | 557 /* |
560 printf("[VP8:] multi_threaded encoding is enabled with %d threads\n\n", | 558 printf("[VP8:] multi_threaded encoding is enabled with %d threads\n\n", |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 sem_destroy(&cpi->h_event_start_lpf); | 663 sem_destroy(&cpi->h_event_start_lpf); |
666 | 664 |
667 /* free thread related resources */ | 665 /* free thread related resources */ |
668 vpx_free(cpi->h_event_start_encoding); | 666 vpx_free(cpi->h_event_start_encoding); |
669 vpx_free(cpi->h_encoding_thread); | 667 vpx_free(cpi->h_encoding_thread); |
670 vpx_free(cpi->mb_row_ei); | 668 vpx_free(cpi->mb_row_ei); |
671 vpx_free(cpi->en_thread_data); | 669 vpx_free(cpi->en_thread_data); |
672 } | 670 } |
673 } | 671 } |
674 #endif | 672 #endif |
OLD | NEW |