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 | 11 |
12 #include "vpx_config.h" | 12 #include "vpx_config.h" |
13 #include "./vpx_scale_rtcd.h" | 13 #include "./vpx_scale_rtcd.h" |
| 14 #include "./vpx_dsp_rtcd.h" |
14 #include "./vp8_rtcd.h" | 15 #include "./vp8_rtcd.h" |
15 #include "vp8/common/onyxc_int.h" | 16 #include "vp8/common/onyxc_int.h" |
16 #include "vp8/common/blockd.h" | 17 #include "vp8/common/blockd.h" |
17 #include "onyx_int.h" | 18 #include "onyx_int.h" |
18 #include "vp8/common/systemdependent.h" | 19 #include "vp8/common/systemdependent.h" |
19 #include "quantize.h" | 20 #include "quantize.h" |
20 #include "vp8/common/alloccommon.h" | 21 #include "vp8/common/alloccommon.h" |
21 #include "mcomp.h" | 22 #include "mcomp.h" |
22 #include "firstpass.h" | 23 #include "firstpass.h" |
23 #include "vpx/internal/vpx_psnr.h" | 24 #include "vpx/internal/vpx_psnr.h" |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 cpi->mb.e_mbd.update_mb_segmentation_data = 1; | 422 cpi->mb.e_mbd.update_mb_segmentation_data = 1; |
422 } | 423 } |
423 else | 424 else |
424 { | 425 { |
425 cpi->mb.e_mbd.update_mb_segmentation_map = 0; | 426 cpi->mb.e_mbd.update_mb_segmentation_map = 0; |
426 cpi->mb.e_mbd.update_mb_segmentation_data = 0; | 427 cpi->mb.e_mbd.update_mb_segmentation_data = 0; |
427 } | 428 } |
428 | 429 |
429 cpi->mb.e_mbd.mode_ref_lf_delta_enabled = 0; | 430 cpi->mb.e_mbd.mode_ref_lf_delta_enabled = 0; |
430 cpi->mb.e_mbd.mode_ref_lf_delta_update = 0; | 431 cpi->mb.e_mbd.mode_ref_lf_delta_update = 0; |
431 vpx_memset(cpi->mb.e_mbd.ref_lf_deltas, 0, sizeof(cpi->mb.e_mbd.ref_lf_delta
s)); | 432 memset(cpi->mb.e_mbd.ref_lf_deltas, 0, sizeof(cpi->mb.e_mbd.ref_lf_deltas)); |
432 vpx_memset(cpi->mb.e_mbd.mode_lf_deltas, 0, sizeof(cpi->mb.e_mbd.mode_lf_del
tas)); | 433 memset(cpi->mb.e_mbd.mode_lf_deltas, 0, sizeof(cpi->mb.e_mbd.mode_lf_deltas)
); |
433 vpx_memset(cpi->mb.e_mbd.last_ref_lf_deltas, 0, sizeof(cpi->mb.e_mbd.ref_lf_
deltas)); | 434 memset(cpi->mb.e_mbd.last_ref_lf_deltas, 0, sizeof(cpi->mb.e_mbd.ref_lf_delt
as)); |
434 vpx_memset(cpi->mb.e_mbd.last_mode_lf_deltas, 0, sizeof(cpi->mb.e_mbd.mode_l
f_deltas)); | 435 memset(cpi->mb.e_mbd.last_mode_lf_deltas, 0, sizeof(cpi->mb.e_mbd.mode_lf_de
ltas)); |
435 | 436 |
436 set_default_lf_deltas(cpi); | 437 set_default_lf_deltas(cpi); |
437 | 438 |
438 } | 439 } |
439 | 440 |
440 | 441 |
441 static void dealloc_raw_frame_buffers(VP8_COMP *cpi); | 442 static void dealloc_raw_frame_buffers(VP8_COMP *cpi); |
442 | 443 |
443 | 444 |
444 static void dealloc_compressor_data(VP8_COMP *cpi) | 445 static void dealloc_compressor_data(VP8_COMP *cpi) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 /* Clear the appropriate feature bit */ | 502 /* Clear the appropriate feature bit */ |
502 cpi->mb.e_mbd.segmentation_enabled = 0; | 503 cpi->mb.e_mbd.segmentation_enabled = 0; |
503 } | 504 } |
504 | 505 |
505 /* Valid values for a segment are 0 to 3 | 506 /* Valid values for a segment are 0 to 3 |
506 * Segmentation map is arrange as [Rows][Columns] | 507 * Segmentation map is arrange as [Rows][Columns] |
507 */ | 508 */ |
508 static void set_segmentation_map(VP8_COMP *cpi, unsigned char *segmentation_map) | 509 static void set_segmentation_map(VP8_COMP *cpi, unsigned char *segmentation_map) |
509 { | 510 { |
510 /* Copy in the new segmentation map */ | 511 /* Copy in the new segmentation map */ |
511 vpx_memcpy(cpi->segmentation_map, segmentation_map, (cpi->common.mb_rows * c
pi->common.mb_cols)); | 512 memcpy(cpi->segmentation_map, segmentation_map, (cpi->common.mb_rows * cpi->
common.mb_cols)); |
512 | 513 |
513 /* Signal that the map should be updated. */ | 514 /* Signal that the map should be updated. */ |
514 cpi->mb.e_mbd.update_mb_segmentation_map = 1; | 515 cpi->mb.e_mbd.update_mb_segmentation_map = 1; |
515 cpi->mb.e_mbd.update_mb_segmentation_data = 1; | 516 cpi->mb.e_mbd.update_mb_segmentation_data = 1; |
516 } | 517 } |
517 | 518 |
518 /* The values given for each segment can be either deltas (from the default | 519 /* The values given for each segment can be either deltas (from the default |
519 * value chosen for the frame) or absolute values. | 520 * value chosen for the frame) or absolute values. |
520 * | 521 * |
521 * Valid range for abs values is: | 522 * Valid range for abs values is: |
522 * (0-127 for MB_LVL_ALT_Q), (0-63 for SEGMENT_ALT_LF) | 523 * (0-127 for MB_LVL_ALT_Q), (0-63 for SEGMENT_ALT_LF) |
523 * Valid range for delta values are: | 524 * Valid range for delta values are: |
524 * (+/-127 for MB_LVL_ALT_Q), (+/-63 for SEGMENT_ALT_LF) | 525 * (+/-127 for MB_LVL_ALT_Q), (+/-63 for SEGMENT_ALT_LF) |
525 * | 526 * |
526 * abs_delta = SEGMENT_DELTADATA (deltas) | 527 * abs_delta = SEGMENT_DELTADATA (deltas) |
527 * abs_delta = SEGMENT_ABSDATA (use the absolute values given). | 528 * abs_delta = SEGMENT_ABSDATA (use the absolute values given). |
528 * | 529 * |
529 */ | 530 */ |
530 static void set_segment_data(VP8_COMP *cpi, signed char *feature_data, unsigned
char abs_delta) | 531 static void set_segment_data(VP8_COMP *cpi, signed char *feature_data, unsigned
char abs_delta) |
531 { | 532 { |
532 cpi->mb.e_mbd.mb_segement_abs_delta = abs_delta; | 533 cpi->mb.e_mbd.mb_segement_abs_delta = abs_delta; |
533 vpx_memcpy(cpi->segment_feature_data, feature_data, sizeof(cpi->segment_feat
ure_data)); | 534 memcpy(cpi->segment_feature_data, feature_data, sizeof(cpi->segment_feature_
data)); |
534 } | 535 } |
535 | 536 |
536 | 537 |
537 static void segmentation_test_function(VP8_COMP *cpi) | 538 static void segmentation_test_function(VP8_COMP *cpi) |
538 { | 539 { |
539 unsigned char *seg_map; | 540 unsigned char *seg_map; |
540 signed char feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS]; | 541 signed char feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS]; |
541 | 542 |
542 // Create a temporary map for segmentation data. | 543 // Create a temporary map for segmentation data. |
543 CHECK_MEM_ERROR(seg_map, vpx_calloc(cpi->common.mb_rows * cpi->common.mb_col
s, 1)); | 544 CHECK_MEM_ERROR(seg_map, vpx_calloc(cpi->common.mb_rows * cpi->common.mb_col
s, 1)); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 cpi->cyclic_refresh_mode_max_mbs_perframe = 0; | 596 cpi->cyclic_refresh_mode_max_mbs_perframe = 0; |
596 } else { | 597 } else { |
597 cpi->cyclic_refresh_mode_max_mbs_perframe = | 598 cpi->cyclic_refresh_mode_max_mbs_perframe = |
598 (cpi->common.mb_rows * cpi->common.mb_cols) / 20; | 599 (cpi->common.mb_rows * cpi->common.mb_cols) / 20; |
599 } | 600 } |
600 block_count = cpi->cyclic_refresh_mode_max_mbs_perframe; | 601 block_count = cpi->cyclic_refresh_mode_max_mbs_perframe; |
601 } | 602 } |
602 | 603 |
603 // Set every macroblock to be eligible for update. | 604 // Set every macroblock to be eligible for update. |
604 // For key frame this will reset seg map to 0. | 605 // For key frame this will reset seg map to 0. |
605 vpx_memset(cpi->segmentation_map, 0, mbs_in_frame); | 606 memset(cpi->segmentation_map, 0, mbs_in_frame); |
606 | 607 |
607 if (cpi->common.frame_type != KEY_FRAME && block_count > 0) | 608 if (cpi->common.frame_type != KEY_FRAME && block_count > 0) |
608 { | 609 { |
609 /* Cycle through the macro_block rows */ | 610 /* Cycle through the macro_block rows */ |
610 /* MB loop to set local segmentation map */ | 611 /* MB loop to set local segmentation map */ |
611 i = cpi->cyclic_refresh_mode_index; | 612 i = cpi->cyclic_refresh_mode_index; |
612 assert(i < mbs_in_frame); | 613 assert(i < mbs_in_frame); |
613 do | 614 do |
614 { | 615 { |
615 /* If the MB is as a candidate for clean up then mark it for | 616 /* If the MB is as a candidate for clean up then mark it for |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 /* Initialise the feature data structure */ | 680 /* Initialise the feature data structure */ |
680 set_segment_data(cpi, &feature_data[0][0], SEGMENT_DELTADATA); | 681 set_segment_data(cpi, &feature_data[0][0], SEGMENT_DELTADATA); |
681 | 682 |
682 } | 683 } |
683 | 684 |
684 static void set_default_lf_deltas(VP8_COMP *cpi) | 685 static void set_default_lf_deltas(VP8_COMP *cpi) |
685 { | 686 { |
686 cpi->mb.e_mbd.mode_ref_lf_delta_enabled = 1; | 687 cpi->mb.e_mbd.mode_ref_lf_delta_enabled = 1; |
687 cpi->mb.e_mbd.mode_ref_lf_delta_update = 1; | 688 cpi->mb.e_mbd.mode_ref_lf_delta_update = 1; |
688 | 689 |
689 vpx_memset(cpi->mb.e_mbd.ref_lf_deltas, 0, sizeof(cpi->mb.e_mbd.ref_lf_delta
s)); | 690 memset(cpi->mb.e_mbd.ref_lf_deltas, 0, sizeof(cpi->mb.e_mbd.ref_lf_deltas)); |
690 vpx_memset(cpi->mb.e_mbd.mode_lf_deltas, 0, sizeof(cpi->mb.e_mbd.mode_lf_del
tas)); | 691 memset(cpi->mb.e_mbd.mode_lf_deltas, 0, sizeof(cpi->mb.e_mbd.mode_lf_deltas)
); |
691 | 692 |
692 /* Test of ref frame deltas */ | 693 /* Test of ref frame deltas */ |
693 cpi->mb.e_mbd.ref_lf_deltas[INTRA_FRAME] = 2; | 694 cpi->mb.e_mbd.ref_lf_deltas[INTRA_FRAME] = 2; |
694 cpi->mb.e_mbd.ref_lf_deltas[LAST_FRAME] = 0; | 695 cpi->mb.e_mbd.ref_lf_deltas[LAST_FRAME] = 0; |
695 cpi->mb.e_mbd.ref_lf_deltas[GOLDEN_FRAME] = -2; | 696 cpi->mb.e_mbd.ref_lf_deltas[GOLDEN_FRAME] = -2; |
696 cpi->mb.e_mbd.ref_lf_deltas[ALTREF_FRAME] = -2; | 697 cpi->mb.e_mbd.ref_lf_deltas[ALTREF_FRAME] = -2; |
697 | 698 |
698 cpi->mb.e_mbd.mode_lf_deltas[0] = 4; /* BPRED */ | 699 cpi->mb.e_mbd.mode_lf_deltas[0] = 4; /* BPRED */ |
699 | 700 |
700 if(cpi->oxcf.Mode == MODE_REALTIME) | 701 if(cpi->oxcf.Mode == MODE_REALTIME) |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 } | 1081 } |
1081 else | 1082 else |
1082 { | 1083 { |
1083 cm->filter_type = SIMPLE_LOOPFILTER; | 1084 cm->filter_type = SIMPLE_LOOPFILTER; |
1084 } | 1085 } |
1085 | 1086 |
1086 /* This has a big hit on quality. Last resort */ | 1087 /* This has a big hit on quality. Last resort */ |
1087 if (Speed >= 15) | 1088 if (Speed >= 15) |
1088 sf->half_pixel_search = 0; | 1089 sf->half_pixel_search = 0; |
1089 | 1090 |
1090 vpx_memset(cpi->mb.error_bins, 0, sizeof(cpi->mb.error_bins)); | 1091 memset(cpi->mb.error_bins, 0, sizeof(cpi->mb.error_bins)); |
1091 | 1092 |
1092 }; /* switch */ | 1093 }; /* switch */ |
1093 | 1094 |
1094 /* Slow quant, dct and trellis not worthwhile for first pass | 1095 /* Slow quant, dct and trellis not worthwhile for first pass |
1095 * so make sure they are always turned off. | 1096 * so make sure they are always turned off. |
1096 */ | 1097 */ |
1097 if ( cpi->pass == 1 ) | 1098 if ( cpi->pass == 1 ) |
1098 { | 1099 { |
1099 sf->improved_quant = 0; | 1100 sf->improved_quant = 0; |
1100 sf->optimize_coefficients = 0; | 1101 sf->optimize_coefficients = 0; |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 /* Create the encoder segmentation map and set all entries to 0 */ | 1292 /* Create the encoder segmentation map and set all entries to 0 */ |
1292 vpx_free(cpi->segmentation_map); | 1293 vpx_free(cpi->segmentation_map); |
1293 CHECK_MEM_ERROR(cpi->segmentation_map, | 1294 CHECK_MEM_ERROR(cpi->segmentation_map, |
1294 vpx_calloc(cm->mb_rows * cm->mb_cols, | 1295 vpx_calloc(cm->mb_rows * cm->mb_cols, |
1295 sizeof(*cpi->segmentation_map))); | 1296 sizeof(*cpi->segmentation_map))); |
1296 cpi->cyclic_refresh_mode_index = 0; | 1297 cpi->cyclic_refresh_mode_index = 0; |
1297 vpx_free(cpi->active_map); | 1298 vpx_free(cpi->active_map); |
1298 CHECK_MEM_ERROR(cpi->active_map, | 1299 CHECK_MEM_ERROR(cpi->active_map, |
1299 vpx_calloc(cm->mb_rows * cm->mb_cols, | 1300 vpx_calloc(cm->mb_rows * cm->mb_cols, |
1300 sizeof(*cpi->active_map))); | 1301 sizeof(*cpi->active_map))); |
1301 vpx_memset(cpi->active_map , 1, (cm->mb_rows * cm->mb_cols)); | 1302 memset(cpi->active_map , 1, (cm->mb_rows * cm->mb_cols)); |
1302 | 1303 |
1303 #if CONFIG_MULTITHREAD | 1304 #if CONFIG_MULTITHREAD |
1304 if (width < 640) | 1305 if (width < 640) |
1305 cpi->mt_sync_range = 1; | 1306 cpi->mt_sync_range = 1; |
1306 else if (width <= 1280) | 1307 else if (width <= 1280) |
1307 cpi->mt_sync_range = 4; | 1308 cpi->mt_sync_range = 4; |
1308 else if (width <= 2560) | 1309 else if (width <= 2560) |
1309 cpi->mt_sync_range = 8; | 1310 cpi->mt_sync_range = 8; |
1310 else | 1311 else |
1311 cpi->mt_sync_range = 16; | 1312 cpi->mt_sync_range = 16; |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1884 VP8_COMP *cpi; | 1885 VP8_COMP *cpi; |
1885 VP8_COMMON *cm; | 1886 VP8_COMMON *cm; |
1886 | 1887 |
1887 cpi = vpx_memalign(32, sizeof(VP8_COMP)); | 1888 cpi = vpx_memalign(32, sizeof(VP8_COMP)); |
1888 /* Check that the CPI instance is valid */ | 1889 /* Check that the CPI instance is valid */ |
1889 if (!cpi) | 1890 if (!cpi) |
1890 return 0; | 1891 return 0; |
1891 | 1892 |
1892 cm = &cpi->common; | 1893 cm = &cpi->common; |
1893 | 1894 |
1894 vpx_memset(cpi, 0, sizeof(VP8_COMP)); | 1895 memset(cpi, 0, sizeof(VP8_COMP)); |
1895 | 1896 |
1896 if (setjmp(cm->error.jmp)) | 1897 if (setjmp(cm->error.jmp)) |
1897 { | 1898 { |
1898 cpi->common.error.setjmp = 0; | 1899 cpi->common.error.setjmp = 0; |
1899 vp8_remove_compressor(&cpi); | 1900 vp8_remove_compressor(&cpi); |
1900 return 0; | 1901 return 0; |
1901 } | 1902 } |
1902 | 1903 |
1903 cpi->common.error.setjmp = 1; | 1904 cpi->common.error.setjmp = 1; |
1904 | 1905 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2119 #endif | 2120 #endif |
2120 | 2121 |
2121 #if CONFIG_MULTITHREAD | 2122 #if CONFIG_MULTITHREAD |
2122 if(vp8cx_create_encoder_threads(cpi)) | 2123 if(vp8cx_create_encoder_threads(cpi)) |
2123 { | 2124 { |
2124 vp8_remove_compressor(&cpi); | 2125 vp8_remove_compressor(&cpi); |
2125 return 0; | 2126 return 0; |
2126 } | 2127 } |
2127 #endif | 2128 #endif |
2128 | 2129 |
2129 cpi->fn_ptr[BLOCK_16X16].sdf = vp8_sad16x16; | 2130 cpi->fn_ptr[BLOCK_16X16].sdf = vpx_sad16x16; |
2130 cpi->fn_ptr[BLOCK_16X16].vf = vp8_variance16x16; | 2131 cpi->fn_ptr[BLOCK_16X16].vf = vp8_variance16x16; |
2131 cpi->fn_ptr[BLOCK_16X16].svf = vp8_sub_pixel_variance16x16; | 2132 cpi->fn_ptr[BLOCK_16X16].svf = vp8_sub_pixel_variance16x16; |
2132 cpi->fn_ptr[BLOCK_16X16].svf_halfpix_h = vp8_variance_halfpixvar16x16_h; | 2133 cpi->fn_ptr[BLOCK_16X16].svf_halfpix_h = vp8_variance_halfpixvar16x16_h; |
2133 cpi->fn_ptr[BLOCK_16X16].svf_halfpix_v = vp8_variance_halfpixvar16x16_v; | 2134 cpi->fn_ptr[BLOCK_16X16].svf_halfpix_v = vp8_variance_halfpixvar16x16_v; |
2134 cpi->fn_ptr[BLOCK_16X16].svf_halfpix_hv = vp8_variance_halfpixvar16x16_hv; | 2135 cpi->fn_ptr[BLOCK_16X16].svf_halfpix_hv = vp8_variance_halfpixvar16x16_hv; |
2135 cpi->fn_ptr[BLOCK_16X16].sdx3f = vp8_sad16x16x3; | 2136 cpi->fn_ptr[BLOCK_16X16].sdx3f = vpx_sad16x16x3; |
2136 cpi->fn_ptr[BLOCK_16X16].sdx8f = vp8_sad16x16x8; | 2137 cpi->fn_ptr[BLOCK_16X16].sdx8f = vpx_sad16x16x8; |
2137 cpi->fn_ptr[BLOCK_16X16].sdx4df = vp8_sad16x16x4d; | 2138 cpi->fn_ptr[BLOCK_16X16].sdx4df = vpx_sad16x16x4d; |
2138 | 2139 |
2139 cpi->fn_ptr[BLOCK_16X8].sdf = vp8_sad16x8; | 2140 cpi->fn_ptr[BLOCK_16X8].sdf = vpx_sad16x8; |
2140 cpi->fn_ptr[BLOCK_16X8].vf = vp8_variance16x8; | 2141 cpi->fn_ptr[BLOCK_16X8].vf = vp8_variance16x8; |
2141 cpi->fn_ptr[BLOCK_16X8].svf = vp8_sub_pixel_variance16x8; | 2142 cpi->fn_ptr[BLOCK_16X8].svf = vp8_sub_pixel_variance16x8; |
2142 cpi->fn_ptr[BLOCK_16X8].svf_halfpix_h = NULL; | 2143 cpi->fn_ptr[BLOCK_16X8].svf_halfpix_h = NULL; |
2143 cpi->fn_ptr[BLOCK_16X8].svf_halfpix_v = NULL; | 2144 cpi->fn_ptr[BLOCK_16X8].svf_halfpix_v = NULL; |
2144 cpi->fn_ptr[BLOCK_16X8].svf_halfpix_hv = NULL; | 2145 cpi->fn_ptr[BLOCK_16X8].svf_halfpix_hv = NULL; |
2145 cpi->fn_ptr[BLOCK_16X8].sdx3f = vp8_sad16x8x3; | 2146 cpi->fn_ptr[BLOCK_16X8].sdx3f = vpx_sad16x8x3; |
2146 cpi->fn_ptr[BLOCK_16X8].sdx8f = vp8_sad16x8x8; | 2147 cpi->fn_ptr[BLOCK_16X8].sdx8f = vpx_sad16x8x8; |
2147 cpi->fn_ptr[BLOCK_16X8].sdx4df = vp8_sad16x8x4d; | 2148 cpi->fn_ptr[BLOCK_16X8].sdx4df = vpx_sad16x8x4d; |
2148 | 2149 |
2149 cpi->fn_ptr[BLOCK_8X16].sdf = vp8_sad8x16; | 2150 cpi->fn_ptr[BLOCK_8X16].sdf = vpx_sad8x16; |
2150 cpi->fn_ptr[BLOCK_8X16].vf = vp8_variance8x16; | 2151 cpi->fn_ptr[BLOCK_8X16].vf = vp8_variance8x16; |
2151 cpi->fn_ptr[BLOCK_8X16].svf = vp8_sub_pixel_variance8x16; | 2152 cpi->fn_ptr[BLOCK_8X16].svf = vp8_sub_pixel_variance8x16; |
2152 cpi->fn_ptr[BLOCK_8X16].svf_halfpix_h = NULL; | 2153 cpi->fn_ptr[BLOCK_8X16].svf_halfpix_h = NULL; |
2153 cpi->fn_ptr[BLOCK_8X16].svf_halfpix_v = NULL; | 2154 cpi->fn_ptr[BLOCK_8X16].svf_halfpix_v = NULL; |
2154 cpi->fn_ptr[BLOCK_8X16].svf_halfpix_hv = NULL; | 2155 cpi->fn_ptr[BLOCK_8X16].svf_halfpix_hv = NULL; |
2155 cpi->fn_ptr[BLOCK_8X16].sdx3f = vp8_sad8x16x3; | 2156 cpi->fn_ptr[BLOCK_8X16].sdx3f = vpx_sad8x16x3; |
2156 cpi->fn_ptr[BLOCK_8X16].sdx8f = vp8_sad8x16x8; | 2157 cpi->fn_ptr[BLOCK_8X16].sdx8f = vpx_sad8x16x8; |
2157 cpi->fn_ptr[BLOCK_8X16].sdx4df = vp8_sad8x16x4d; | 2158 cpi->fn_ptr[BLOCK_8X16].sdx4df = vpx_sad8x16x4d; |
2158 | 2159 |
2159 cpi->fn_ptr[BLOCK_8X8].sdf = vp8_sad8x8; | 2160 cpi->fn_ptr[BLOCK_8X8].sdf = vpx_sad8x8; |
2160 cpi->fn_ptr[BLOCK_8X8].vf = vp8_variance8x8; | 2161 cpi->fn_ptr[BLOCK_8X8].vf = vp8_variance8x8; |
2161 cpi->fn_ptr[BLOCK_8X8].svf = vp8_sub_pixel_variance8x8; | 2162 cpi->fn_ptr[BLOCK_8X8].svf = vp8_sub_pixel_variance8x8; |
2162 cpi->fn_ptr[BLOCK_8X8].svf_halfpix_h = NULL; | 2163 cpi->fn_ptr[BLOCK_8X8].svf_halfpix_h = NULL; |
2163 cpi->fn_ptr[BLOCK_8X8].svf_halfpix_v = NULL; | 2164 cpi->fn_ptr[BLOCK_8X8].svf_halfpix_v = NULL; |
2164 cpi->fn_ptr[BLOCK_8X8].svf_halfpix_hv = NULL; | 2165 cpi->fn_ptr[BLOCK_8X8].svf_halfpix_hv = NULL; |
2165 cpi->fn_ptr[BLOCK_8X8].sdx3f = vp8_sad8x8x3; | 2166 cpi->fn_ptr[BLOCK_8X8].sdx3f = vpx_sad8x8x3; |
2166 cpi->fn_ptr[BLOCK_8X8].sdx8f = vp8_sad8x8x8; | 2167 cpi->fn_ptr[BLOCK_8X8].sdx8f = vpx_sad8x8x8; |
2167 cpi->fn_ptr[BLOCK_8X8].sdx4df = vp8_sad8x8x4d; | 2168 cpi->fn_ptr[BLOCK_8X8].sdx4df = vpx_sad8x8x4d; |
2168 | 2169 |
2169 cpi->fn_ptr[BLOCK_4X4].sdf = vp8_sad4x4; | 2170 cpi->fn_ptr[BLOCK_4X4].sdf = vpx_sad4x4; |
2170 cpi->fn_ptr[BLOCK_4X4].vf = vp8_variance4x4; | 2171 cpi->fn_ptr[BLOCK_4X4].vf = vp8_variance4x4; |
2171 cpi->fn_ptr[BLOCK_4X4].svf = vp8_sub_pixel_variance4x4; | 2172 cpi->fn_ptr[BLOCK_4X4].svf = vp8_sub_pixel_variance4x4; |
2172 cpi->fn_ptr[BLOCK_4X4].svf_halfpix_h = NULL; | 2173 cpi->fn_ptr[BLOCK_4X4].svf_halfpix_h = NULL; |
2173 cpi->fn_ptr[BLOCK_4X4].svf_halfpix_v = NULL; | 2174 cpi->fn_ptr[BLOCK_4X4].svf_halfpix_v = NULL; |
2174 cpi->fn_ptr[BLOCK_4X4].svf_halfpix_hv = NULL; | 2175 cpi->fn_ptr[BLOCK_4X4].svf_halfpix_hv = NULL; |
2175 cpi->fn_ptr[BLOCK_4X4].sdx3f = vp8_sad4x4x3; | 2176 cpi->fn_ptr[BLOCK_4X4].sdx3f = vpx_sad4x4x3; |
2176 cpi->fn_ptr[BLOCK_4X4].sdx8f = vp8_sad4x4x8; | 2177 cpi->fn_ptr[BLOCK_4X4].sdx8f = vpx_sad4x4x8; |
2177 cpi->fn_ptr[BLOCK_4X4].sdx4df = vp8_sad4x4x4d; | 2178 cpi->fn_ptr[BLOCK_4X4].sdx4df = vpx_sad4x4x4d; |
2178 | 2179 |
2179 #if ARCH_X86 || ARCH_X86_64 | 2180 #if ARCH_X86 || ARCH_X86_64 |
2180 cpi->fn_ptr[BLOCK_16X16].copymem = vp8_copy32xn; | 2181 cpi->fn_ptr[BLOCK_16X16].copymem = vp8_copy32xn; |
2181 cpi->fn_ptr[BLOCK_16X8].copymem = vp8_copy32xn; | 2182 cpi->fn_ptr[BLOCK_16X8].copymem = vp8_copy32xn; |
2182 cpi->fn_ptr[BLOCK_8X16].copymem = vp8_copy32xn; | 2183 cpi->fn_ptr[BLOCK_8X16].copymem = vp8_copy32xn; |
2183 cpi->fn_ptr[BLOCK_8X8].copymem = vp8_copy32xn; | 2184 cpi->fn_ptr[BLOCK_8X8].copymem = vp8_copy32xn; |
2184 cpi->fn_ptr[BLOCK_4X4].copymem = vp8_copy32xn; | 2185 cpi->fn_ptr[BLOCK_4X4].copymem = vp8_copy32xn; |
2185 #endif | 2186 #endif |
2186 | 2187 |
2187 cpi->full_search_sad = vp8_full_search_sad; | 2188 cpi->full_search_sad = vp8_full_search_sad; |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2860 * subsequent inter frames to account for the extra GF spend... | 2861 * subsequent inter frames to account for the extra GF spend... |
2861 * note that his does not apply for GF updates that occur | 2862 * note that his does not apply for GF updates that occur |
2862 * coincident with a key frame as the extra cost of key frames is | 2863 * coincident with a key frame as the extra cost of key frames is |
2863 * dealt with elsewhere. | 2864 * dealt with elsewhere. |
2864 */ | 2865 */ |
2865 cpi->gf_overspend_bits += cpi->projected_frame_size; | 2866 cpi->gf_overspend_bits += cpi->projected_frame_size; |
2866 cpi->non_gf_bitrate_adjustment = cpi->gf_overspend_bits / cpi->frames_ti
ll_gf_update_due; | 2867 cpi->non_gf_bitrate_adjustment = cpi->gf_overspend_bits / cpi->frames_ti
ll_gf_update_due; |
2867 } | 2868 } |
2868 | 2869 |
2869 /* Update data structure that monitors level of reference to last GF */ | 2870 /* Update data structure that monitors level of reference to last GF */ |
2870 vpx_memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols)); | 2871 memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols)); |
2871 cpi->gf_active_count = cm->mb_rows * cm->mb_cols; | 2872 cpi->gf_active_count = cm->mb_rows * cm->mb_cols; |
2872 | 2873 |
2873 /* this frame refreshes means next frames don't unless specified by user */ | 2874 /* this frame refreshes means next frames don't unless specified by user */ |
2874 cpi->frames_since_golden = 0; | 2875 cpi->frames_since_golden = 0; |
2875 | 2876 |
2876 /* Clear the alternate reference update pending flag. */ | 2877 /* Clear the alternate reference update pending flag. */ |
2877 cpi->source_alt_ref_pending = 0; | 2878 cpi->source_alt_ref_pending = 0; |
2878 | 2879 |
2879 /* Set the alternate reference frame active flag */ | 2880 /* Set the alternate reference frame active flag */ |
2880 cpi->source_alt_ref_active = 1; | 2881 cpi->source_alt_ref_active = 1; |
(...skipping 28 matching lines...) Expand all Loading... |
2909 * frames for clip as a whole | 2910 * frames for clip as a whole |
2910 */ | 2911 */ |
2911 cpi->gf_overspend_bits += (cpi->projected_frame_size - cpi->inte
r_frame_target); | 2912 cpi->gf_overspend_bits += (cpi->projected_frame_size - cpi->inte
r_frame_target); |
2912 } | 2913 } |
2913 | 2914 |
2914 cpi->non_gf_bitrate_adjustment = cpi->gf_overspend_bits / cpi->frame
s_till_gf_update_due; | 2915 cpi->non_gf_bitrate_adjustment = cpi->gf_overspend_bits / cpi->frame
s_till_gf_update_due; |
2915 | 2916 |
2916 } | 2917 } |
2917 | 2918 |
2918 /* Update data structure that monitors level of reference to last GF */ | 2919 /* Update data structure that monitors level of reference to last GF */ |
2919 vpx_memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols)); | 2920 memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols)); |
2920 cpi->gf_active_count = cm->mb_rows * cm->mb_cols; | 2921 cpi->gf_active_count = cm->mb_rows * cm->mb_cols; |
2921 | 2922 |
2922 /* this frame refreshes means next frames don't unless specified by | 2923 /* this frame refreshes means next frames don't unless specified by |
2923 * user | 2924 * user |
2924 */ | 2925 */ |
2925 cm->refresh_golden_frame = 0; | 2926 cm->refresh_golden_frame = 0; |
2926 cpi->frames_since_golden = 0; | 2927 cpi->frames_since_golden = 0; |
2927 | 2928 |
2928 cpi->recent_ref_frame_usage[INTRA_FRAME] = 1; | 2929 cpi->recent_ref_frame_usage[INTRA_FRAME] = 1; |
2929 cpi->recent_ref_frame_usage[LAST_FRAME] = 1; | 2930 cpi->recent_ref_frame_usage[LAST_FRAME] = 1; |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3823 /* The alternate reference frame cannot be active for a key frame */ | 3824 /* The alternate reference frame cannot be active for a key frame */ |
3824 cpi->source_alt_ref_active = 0; | 3825 cpi->source_alt_ref_active = 0; |
3825 | 3826 |
3826 /* Reset the RD threshold multipliers to default of * 1 (128) */ | 3827 /* Reset the RD threshold multipliers to default of * 1 (128) */ |
3827 for (i = 0; i < MAX_MODES; i++) | 3828 for (i = 0; i < MAX_MODES; i++) |
3828 { | 3829 { |
3829 cpi->mb.rd_thresh_mult[i] = 128; | 3830 cpi->mb.rd_thresh_mult[i] = 128; |
3830 } | 3831 } |
3831 | 3832 |
3832 // Reset the zero_last counter to 0 on key frame. | 3833 // Reset the zero_last counter to 0 on key frame. |
3833 vpx_memset(cpi->consec_zero_last, 0, cm->mb_rows * cm->mb_cols); | 3834 memset(cpi->consec_zero_last, 0, cm->mb_rows * cm->mb_cols); |
3834 vpx_memset(cpi->consec_zero_last_mvbias, 0, | 3835 memset(cpi->consec_zero_last_mvbias, 0, |
3835 (cpi->common.mb_rows * cpi->common.mb_cols)); | 3836 (cpi->common.mb_rows * cpi->common.mb_cols)); |
3836 } | 3837 } |
3837 | 3838 |
3838 #if 0 | 3839 #if 0 |
3839 /* Experimental code for lagged compress and one pass | 3840 /* Experimental code for lagged compress and one pass |
3840 * Initialise one_pass GF frames stats | 3841 * Initialise one_pass GF frames stats |
3841 * Update stats used for GF selection | 3842 * Update stats used for GF selection |
3842 */ | 3843 */ |
3843 { | 3844 { |
3844 cpi->one_pass_frame_index = cm->current_video_frame % MAX_LAG_BUFFERS; | 3845 cpi->one_pass_frame_index = cm->current_video_frame % MAX_LAG_BUFFERS; |
3845 | 3846 |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4355 */ | 4356 */ |
4356 Q = vp8_regulate_q(cpi, cpi->this_frame_target); | 4357 Q = vp8_regulate_q(cpi, cpi->this_frame_target); |
4357 if (cpi->cyclic_refresh_mode_enabled) | 4358 if (cpi->cyclic_refresh_mode_enabled) |
4358 { | 4359 { |
4359 if (cpi->current_layer==0) | 4360 if (cpi->current_layer==0) |
4360 cyclic_background_refresh(cpi, Q, 0); | 4361 cyclic_background_refresh(cpi, Q, 0); |
4361 else | 4362 else |
4362 disable_segmentation(cpi); | 4363 disable_segmentation(cpi); |
4363 } | 4364 } |
4364 // Reset the zero_last counter to 0 on key frame. | 4365 // Reset the zero_last counter to 0 on key frame. |
4365 vpx_memset(cpi->consec_zero_last, 0, cm->mb_rows * cm->mb_cols); | 4366 memset(cpi->consec_zero_last, 0, cm->mb_rows * cm->mb_cols); |
4366 vpx_memset(cpi->consec_zero_last_mvbias, 0, | 4367 memset(cpi->consec_zero_last_mvbias, 0, |
4367 (cpi->common.mb_rows * cpi->common.mb_cols)); | 4368 (cpi->common.mb_rows * cpi->common.mb_cols)); |
4368 vp8_set_quantizer(cpi, Q); | 4369 vp8_set_quantizer(cpi, Q); |
4369 } | 4370 } |
4370 | 4371 |
4371 vp8_setup_key_frame(cpi); | 4372 vp8_setup_key_frame(cpi); |
4372 } | 4373 } |
4373 | 4374 |
4374 | 4375 |
4375 | 4376 |
4376 #if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING | 4377 #if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING |
4377 { | 4378 { |
4378 if(cpi->oxcf.error_resilient_mode) | 4379 if(cpi->oxcf.error_resilient_mode) |
4379 cm->refresh_entropy_probs = 0; | 4380 cm->refresh_entropy_probs = 0; |
4380 | 4381 |
4381 if (cpi->oxcf.error_resilient_mode & VPX_ERROR_RESILIENT_PARTITIONS) | 4382 if (cpi->oxcf.error_resilient_mode & VPX_ERROR_RESILIENT_PARTITIONS) |
4382 { | 4383 { |
4383 if (cm->frame_type == KEY_FRAME) | 4384 if (cm->frame_type == KEY_FRAME) |
4384 cm->refresh_entropy_probs = 1; | 4385 cm->refresh_entropy_probs = 1; |
4385 } | 4386 } |
4386 | 4387 |
4387 if (cm->refresh_entropy_probs == 0) | 4388 if (cm->refresh_entropy_probs == 0) |
4388 { | 4389 { |
4389 /* save a copy for later refresh */ | 4390 /* save a copy for later refresh */ |
4390 vpx_memcpy(&cm->lfc, &cm->fc, sizeof(cm->fc)); | 4391 memcpy(&cm->lfc, &cm->fc, sizeof(cm->fc)); |
4391 } | 4392 } |
4392 | 4393 |
4393 vp8_update_coef_context(cpi); | 4394 vp8_update_coef_context(cpi); |
4394 | 4395 |
4395 vp8_update_coef_probs(cpi); | 4396 vp8_update_coef_probs(cpi); |
4396 | 4397 |
4397 /* transform / motion compensation build reconstruction frame | 4398 /* transform / motion compensation build reconstruction frame |
4398 * +pack coef partitions | 4399 * +pack coef partitions |
4399 */ | 4400 */ |
4400 vp8_encode_frame(cpi); | 4401 vp8_encode_frame(cpi); |
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5606 cpi->avg_pick_mode_time = duration2; | 5607 cpi->avg_pick_mode_time = duration2; |
5607 else | 5608 else |
5608 cpi->avg_pick_mode_time = (7 * cpi->avg_pick_mode_time + dur
ation2) >> 3; | 5609 cpi->avg_pick_mode_time = (7 * cpi->avg_pick_mode_time + dur
ation2) >> 3; |
5609 } | 5610 } |
5610 } | 5611 } |
5611 | 5612 |
5612 } | 5613 } |
5613 | 5614 |
5614 if (cm->refresh_entropy_probs == 0) | 5615 if (cm->refresh_entropy_probs == 0) |
5615 { | 5616 { |
5616 vpx_memcpy(&cm->fc, &cm->lfc, sizeof(cm->fc)); | 5617 memcpy(&cm->fc, &cm->lfc, sizeof(cm->fc)); |
5617 } | 5618 } |
5618 | 5619 |
5619 /* Save the contexts separately for alt ref, gold and last. */ | 5620 /* Save the contexts separately for alt ref, gold and last. */ |
5620 /* (TODO jbb -> Optimize this with pointers to avoid extra copies. ) */ | 5621 /* (TODO jbb -> Optimize this with pointers to avoid extra copies. ) */ |
5621 if(cm->refresh_alt_ref_frame) | 5622 if(cm->refresh_alt_ref_frame) |
5622 vpx_memcpy(&cpi->lfc_a, &cm->fc, sizeof(cm->fc)); | 5623 memcpy(&cpi->lfc_a, &cm->fc, sizeof(cm->fc)); |
5623 | 5624 |
5624 if(cm->refresh_golden_frame) | 5625 if(cm->refresh_golden_frame) |
5625 vpx_memcpy(&cpi->lfc_g, &cm->fc, sizeof(cm->fc)); | 5626 memcpy(&cpi->lfc_g, &cm->fc, sizeof(cm->fc)); |
5626 | 5627 |
5627 if(cm->refresh_last_frame) | 5628 if(cm->refresh_last_frame) |
5628 vpx_memcpy(&cpi->lfc_n, &cm->fc, sizeof(cm->fc)); | 5629 memcpy(&cpi->lfc_n, &cm->fc, sizeof(cm->fc)); |
5629 | 5630 |
5630 /* if its a dropped frame honor the requests on subsequent frames */ | 5631 /* if its a dropped frame honor the requests on subsequent frames */ |
5631 if (*size > 0) | 5632 if (*size > 0) |
5632 { | 5633 { |
5633 cpi->droppable = !frame_is_reference(cpi); | 5634 cpi->droppable = !frame_is_reference(cpi); |
5634 | 5635 |
5635 /* return to normal state */ | 5636 /* return to normal state */ |
5636 cm->refresh_entropy_probs = 1; | 5637 cm->refresh_entropy_probs = 1; |
5637 cm->refresh_alt_ref_frame = 0; | 5638 cm->refresh_alt_ref_frame = 0; |
5638 cm->refresh_golden_frame = 0; | 5639 cm->refresh_golden_frame = 0; |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5927 | 5928 |
5928 return 0; | 5929 return 0; |
5929 } | 5930 } |
5930 | 5931 |
5931 int vp8_set_active_map(VP8_COMP *cpi, unsigned char *map, unsigned int rows, uns
igned int cols) | 5932 int vp8_set_active_map(VP8_COMP *cpi, unsigned char *map, unsigned int rows, uns
igned int cols) |
5932 { | 5933 { |
5933 if (rows == cpi->common.mb_rows && cols == cpi->common.mb_cols) | 5934 if (rows == cpi->common.mb_rows && cols == cpi->common.mb_cols) |
5934 { | 5935 { |
5935 if (map) | 5936 if (map) |
5936 { | 5937 { |
5937 vpx_memcpy(cpi->active_map, map, rows * cols); | 5938 memcpy(cpi->active_map, map, rows * cols); |
5938 cpi->active_map_enabled = 1; | 5939 cpi->active_map_enabled = 1; |
5939 } | 5940 } |
5940 else | 5941 else |
5941 cpi->active_map_enabled = 0; | 5942 cpi->active_map_enabled = 0; |
5942 | 5943 |
5943 return 0; | 5944 return 0; |
5944 } | 5945 } |
5945 else | 5946 else |
5946 { | 5947 { |
5947 return -1 ; | 5948 return -1 ; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5989 } | 5990 } |
5990 | 5991 |
5991 return Total; | 5992 return Total; |
5992 } | 5993 } |
5993 | 5994 |
5994 | 5995 |
5995 int vp8_get_quantizer(VP8_COMP *cpi) | 5996 int vp8_get_quantizer(VP8_COMP *cpi) |
5996 { | 5997 { |
5997 return cpi->common.base_qindex; | 5998 return cpi->common.base_qindex; |
5998 } | 5999 } |
OLD | NEW |