Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: source/libvpx/vp9/encoder/vp9_encoder.c

Issue 1162573005: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_encodemv.c ('k') | source/libvpx/vp9/encoder/vp9_extend.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <math.h> 11 #include <math.h>
12 #include <stdio.h> 12 #include <stdio.h>
13 #include <limits.h> 13 #include <limits.h>
14 14
15 #include "./vpx_config.h" 15 #include "./vpx_config.h"
16 #include "./vp9_rtcd.h" 16 #include "./vp9_rtcd.h"
17 #include "./vpx_dsp_rtcd.h" 17 #include "./vpx_dsp_rtcd.h"
18 #include "./vpx_scale_rtcd.h" 18 #include "./vpx_scale_rtcd.h"
19 #include "vpx/internal/vpx_psnr.h" 19 #include "vpx/internal/vpx_psnr.h"
20 #include "vpx_ports/mem.h"
20 #include "vpx_ports/vpx_timer.h" 21 #include "vpx_ports/vpx_timer.h"
21 22
22 #include "vp9/common/vp9_alloccommon.h" 23 #include "vp9/common/vp9_alloccommon.h"
23 #include "vp9/common/vp9_filter.h" 24 #include "vp9/common/vp9_filter.h"
24 #include "vp9/common/vp9_idct.h" 25 #include "vp9/common/vp9_idct.h"
25 #if CONFIG_VP9_POSTPROC 26 #if CONFIG_VP9_POSTPROC
26 #include "vp9/common/vp9_postproc.h" 27 #include "vp9/common/vp9_postproc.h"
27 #endif 28 #endif
28 #include "vp9/common/vp9_reconinter.h" 29 #include "vp9/common/vp9_reconinter.h"
29 #include "vp9/common/vp9_reconintra.h" 30 #include "vp9/common/vp9_reconintra.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 default: 105 default:
105 *hr = 1; 106 *hr = 1;
106 *hs = 1; 107 *hs = 1;
107 assert(0); 108 assert(0);
108 break; 109 break;
109 } 110 }
110 } 111 }
111 112
112 // Mark all inactive blocks as active. Other segmentation features may be set 113 // Mark all inactive blocks as active. Other segmentation features may be set
113 // so memset cannot be used, instead only inactive blocks should be reset. 114 // so memset cannot be used, instead only inactive blocks should be reset.
114 void vp9_suppress_active_map(VP9_COMP *cpi) { 115 static void suppress_active_map(VP9_COMP *cpi) {
115 unsigned char *const seg_map = cpi->segmentation_map; 116 unsigned char *const seg_map = cpi->segmentation_map;
116 int i; 117 int i;
117 if (cpi->active_map.enabled || cpi->active_map.update) 118 if (cpi->active_map.enabled || cpi->active_map.update)
118 for (i = 0; i < cpi->common.mi_rows * cpi->common.mi_cols; ++i) 119 for (i = 0; i < cpi->common.mi_rows * cpi->common.mi_cols; ++i)
119 if (seg_map[i] == AM_SEGMENT_ID_INACTIVE) 120 if (seg_map[i] == AM_SEGMENT_ID_INACTIVE)
120 seg_map[i] = AM_SEGMENT_ID_ACTIVE; 121 seg_map[i] = AM_SEGMENT_ID_ACTIVE;
121 } 122 }
122 123
123 void vp9_apply_active_map(VP9_COMP *cpi) { 124 static void apply_active_map(VP9_COMP *cpi) {
124 struct segmentation *const seg = &cpi->common.seg; 125 struct segmentation *const seg = &cpi->common.seg;
125 unsigned char *const seg_map = cpi->segmentation_map; 126 unsigned char *const seg_map = cpi->segmentation_map;
126 const unsigned char *const active_map = cpi->active_map.map; 127 const unsigned char *const active_map = cpi->active_map.map;
127 int i; 128 int i;
128 129
129 assert(AM_SEGMENT_ID_ACTIVE == CR_SEGMENT_ID_BASE); 130 assert(AM_SEGMENT_ID_ACTIVE == CR_SEGMENT_ID_BASE);
130 131
131 if (frame_is_intra_only(&cpi->common)) { 132 if (frame_is_intra_only(&cpi->common)) {
132 cpi->active_map.enabled = 0; 133 cpi->active_map.enabled = 0;
133 cpi->active_map.update = 1; 134 cpi->active_map.update = 1;
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 679
679 { 680 {
680 unsigned int tokens = get_token_alloc(cm->mb_rows, cm->mb_cols); 681 unsigned int tokens = get_token_alloc(cm->mb_rows, cm->mb_cols);
681 CHECK_MEM_ERROR(cm, cpi->tile_tok[0][0], 682 CHECK_MEM_ERROR(cm, cpi->tile_tok[0][0],
682 vpx_calloc(tokens, sizeof(*cpi->tile_tok[0][0]))); 683 vpx_calloc(tokens, sizeof(*cpi->tile_tok[0][0])));
683 } 684 }
684 685
685 vp9_setup_pc_tree(&cpi->common, &cpi->td); 686 vp9_setup_pc_tree(&cpi->common, &cpi->td);
686 } 687 }
687 688
689 void vp9_new_framerate(VP9_COMP *cpi, double framerate) {
690 cpi->framerate = framerate < 0.1 ? 30 : framerate;
691 vp9_rc_update_framerate(cpi);
692 }
693
694 static void set_tile_limits(VP9_COMP *cpi) {
695 VP9_COMMON *const cm = &cpi->common;
696
697 int min_log2_tile_cols, max_log2_tile_cols;
698 vp9_get_tile_n_bits(cm->mi_cols, &min_log2_tile_cols, &max_log2_tile_cols);
699
700 if (is_two_pass_svc(cpi) &&
701 (cpi->svc.encode_empty_frame_state == ENCODING ||
702 cpi->svc.number_spatial_layers > 1)) {
703 cm->log2_tile_cols = 0;
704 cm->log2_tile_rows = 0;
705 } else {
706 cm->log2_tile_cols = clamp(cpi->oxcf.tile_columns,
707 min_log2_tile_cols, max_log2_tile_cols);
708 cm->log2_tile_rows = cpi->oxcf.tile_rows;
709 }
710 }
711
688 static void update_frame_size(VP9_COMP *cpi) { 712 static void update_frame_size(VP9_COMP *cpi) {
689 VP9_COMMON *const cm = &cpi->common; 713 VP9_COMMON *const cm = &cpi->common;
690 MACROBLOCKD *const xd = &cpi->td.mb.e_mbd; 714 MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
691 715
692 vp9_set_mb_mi(cm, cm->width, cm->height); 716 vp9_set_mb_mi(cm, cm->width, cm->height);
693 vp9_init_context_buffers(cm); 717 vp9_init_context_buffers(cm);
694 init_macroblockd(cm, xd); 718 init_macroblockd(cm, xd);
695 719
720 set_tile_limits(cpi);
721
696 if (is_two_pass_svc(cpi)) { 722 if (is_two_pass_svc(cpi)) {
697 if (vp9_realloc_frame_buffer(&cpi->alt_ref_buffer, 723 if (vp9_realloc_frame_buffer(&cpi->alt_ref_buffer,
698 cm->width, cm->height, 724 cm->width, cm->height,
699 cm->subsampling_x, cm->subsampling_y, 725 cm->subsampling_x, cm->subsampling_y,
700 #if CONFIG_VP9_HIGHBITDEPTH 726 #if CONFIG_VP9_HIGHBITDEPTH
701 cm->use_highbitdepth, 727 cm->use_highbitdepth,
702 #endif 728 #endif
703 VP9_ENC_BORDER_IN_PIXELS, cm->byte_alignment, 729 VP9_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
704 NULL, NULL, NULL)) 730 NULL, NULL, NULL))
705 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, 731 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
706 "Failed to reallocate alt_ref_buffer"); 732 "Failed to reallocate alt_ref_buffer");
707 } 733 }
708 } 734 }
709 735
710 void vp9_new_framerate(VP9_COMP *cpi, double framerate) {
711 cpi->framerate = framerate < 0.1 ? 30 : framerate;
712 vp9_rc_update_framerate(cpi);
713 }
714
715 static void set_tile_limits(VP9_COMP *cpi) {
716 VP9_COMMON *const cm = &cpi->common;
717
718 int min_log2_tile_cols, max_log2_tile_cols;
719 vp9_get_tile_n_bits(cm->mi_cols, &min_log2_tile_cols, &max_log2_tile_cols);
720
721 if (is_two_pass_svc(cpi) && cpi->svc.encode_empty_frame_state == ENCODING) {
722 cm->log2_tile_cols = 0;
723 cm->log2_tile_rows = 0;
724 } else {
725 cm->log2_tile_cols = clamp(cpi->oxcf.tile_columns,
726 min_log2_tile_cols, max_log2_tile_cols);
727 cm->log2_tile_rows = cpi->oxcf.tile_rows;
728 }
729 }
730
731 static void init_buffer_indices(VP9_COMP *cpi) { 736 static void init_buffer_indices(VP9_COMP *cpi) {
732 cpi->lst_fb_idx = 0; 737 cpi->lst_fb_idx = 0;
733 cpi->gld_fb_idx = 1; 738 cpi->gld_fb_idx = 1;
734 cpi->alt_fb_idx = 2; 739 cpi->alt_fb_idx = 2;
735 } 740 }
736 741
737 static void init_config(struct VP9_COMP *cpi, VP9EncoderConfig *oxcf) { 742 static void init_config(struct VP9_COMP *cpi, VP9EncoderConfig *oxcf) {
738 VP9_COMMON *const cm = &cpi->common; 743 VP9_COMMON *const cm = &cpi->common;
739 744
740 cpi->oxcf = *oxcf; 745 cpi->oxcf = *oxcf;
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad4x4x4d) 993 MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad4x4x4d)
989 994
990 static void highbd_set_var_fns(VP9_COMP *const cpi) { 995 static void highbd_set_var_fns(VP9_COMP *const cpi) {
991 VP9_COMMON *const cm = &cpi->common; 996 VP9_COMMON *const cm = &cpi->common;
992 if (cm->use_highbitdepth) { 997 if (cm->use_highbitdepth) {
993 switch (cm->bit_depth) { 998 switch (cm->bit_depth) {
994 case VPX_BITS_8: 999 case VPX_BITS_8:
995 HIGHBD_BFP(BLOCK_32X16, 1000 HIGHBD_BFP(BLOCK_32X16,
996 vpx_highbd_sad32x16_bits8, 1001 vpx_highbd_sad32x16_bits8,
997 vpx_highbd_sad32x16_avg_bits8, 1002 vpx_highbd_sad32x16_avg_bits8,
998 vp9_highbd_variance32x16, 1003 vpx_highbd_8_variance32x16,
999 vp9_highbd_sub_pixel_variance32x16, 1004 vp9_highbd_sub_pixel_variance32x16,
1000 vp9_highbd_sub_pixel_avg_variance32x16, 1005 vp9_highbd_sub_pixel_avg_variance32x16,
1001 NULL, 1006 NULL,
1002 NULL, 1007 NULL,
1003 vpx_highbd_sad32x16x4d_bits8) 1008 vpx_highbd_sad32x16x4d_bits8)
1004 1009
1005 HIGHBD_BFP(BLOCK_16X32, 1010 HIGHBD_BFP(BLOCK_16X32,
1006 vpx_highbd_sad16x32_bits8, 1011 vpx_highbd_sad16x32_bits8,
1007 vpx_highbd_sad16x32_avg_bits8, 1012 vpx_highbd_sad16x32_avg_bits8,
1008 vp9_highbd_variance16x32, 1013 vpx_highbd_8_variance16x32,
1009 vp9_highbd_sub_pixel_variance16x32, 1014 vp9_highbd_sub_pixel_variance16x32,
1010 vp9_highbd_sub_pixel_avg_variance16x32, 1015 vp9_highbd_sub_pixel_avg_variance16x32,
1011 NULL, 1016 NULL,
1012 NULL, 1017 NULL,
1013 vpx_highbd_sad16x32x4d_bits8) 1018 vpx_highbd_sad16x32x4d_bits8)
1014 1019
1015 HIGHBD_BFP(BLOCK_64X32, 1020 HIGHBD_BFP(BLOCK_64X32,
1016 vpx_highbd_sad64x32_bits8, 1021 vpx_highbd_sad64x32_bits8,
1017 vpx_highbd_sad64x32_avg_bits8, 1022 vpx_highbd_sad64x32_avg_bits8,
1018 vp9_highbd_variance64x32, 1023 vpx_highbd_8_variance64x32,
1019 vp9_highbd_sub_pixel_variance64x32, 1024 vp9_highbd_sub_pixel_variance64x32,
1020 vp9_highbd_sub_pixel_avg_variance64x32, 1025 vp9_highbd_sub_pixel_avg_variance64x32,
1021 NULL, 1026 NULL,
1022 NULL, 1027 NULL,
1023 vpx_highbd_sad64x32x4d_bits8) 1028 vpx_highbd_sad64x32x4d_bits8)
1024 1029
1025 HIGHBD_BFP(BLOCK_32X64, 1030 HIGHBD_BFP(BLOCK_32X64,
1026 vpx_highbd_sad32x64_bits8, 1031 vpx_highbd_sad32x64_bits8,
1027 vpx_highbd_sad32x64_avg_bits8, 1032 vpx_highbd_sad32x64_avg_bits8,
1028 vp9_highbd_variance32x64, 1033 vpx_highbd_8_variance32x64,
1029 vp9_highbd_sub_pixel_variance32x64, 1034 vp9_highbd_sub_pixel_variance32x64,
1030 vp9_highbd_sub_pixel_avg_variance32x64, 1035 vp9_highbd_sub_pixel_avg_variance32x64,
1031 NULL, 1036 NULL,
1032 NULL, 1037 NULL,
1033 vpx_highbd_sad32x64x4d_bits8) 1038 vpx_highbd_sad32x64x4d_bits8)
1034 1039
1035 HIGHBD_BFP(BLOCK_32X32, 1040 HIGHBD_BFP(BLOCK_32X32,
1036 vpx_highbd_sad32x32_bits8, 1041 vpx_highbd_sad32x32_bits8,
1037 vpx_highbd_sad32x32_avg_bits8, 1042 vpx_highbd_sad32x32_avg_bits8,
1038 vp9_highbd_variance32x32, 1043 vpx_highbd_8_variance32x32,
1039 vp9_highbd_sub_pixel_variance32x32, 1044 vp9_highbd_sub_pixel_variance32x32,
1040 vp9_highbd_sub_pixel_avg_variance32x32, 1045 vp9_highbd_sub_pixel_avg_variance32x32,
1041 vpx_highbd_sad32x32x3_bits8, 1046 vpx_highbd_sad32x32x3_bits8,
1042 vpx_highbd_sad32x32x8_bits8, 1047 vpx_highbd_sad32x32x8_bits8,
1043 vpx_highbd_sad32x32x4d_bits8) 1048 vpx_highbd_sad32x32x4d_bits8)
1044 1049
1045 HIGHBD_BFP(BLOCK_64X64, 1050 HIGHBD_BFP(BLOCK_64X64,
1046 vpx_highbd_sad64x64_bits8, 1051 vpx_highbd_sad64x64_bits8,
1047 vpx_highbd_sad64x64_avg_bits8, 1052 vpx_highbd_sad64x64_avg_bits8,
1048 vp9_highbd_variance64x64, 1053 vpx_highbd_8_variance64x64,
1049 vp9_highbd_sub_pixel_variance64x64, 1054 vp9_highbd_sub_pixel_variance64x64,
1050 vp9_highbd_sub_pixel_avg_variance64x64, 1055 vp9_highbd_sub_pixel_avg_variance64x64,
1051 vpx_highbd_sad64x64x3_bits8, 1056 vpx_highbd_sad64x64x3_bits8,
1052 vpx_highbd_sad64x64x8_bits8, 1057 vpx_highbd_sad64x64x8_bits8,
1053 vpx_highbd_sad64x64x4d_bits8) 1058 vpx_highbd_sad64x64x4d_bits8)
1054 1059
1055 HIGHBD_BFP(BLOCK_16X16, 1060 HIGHBD_BFP(BLOCK_16X16,
1056 vpx_highbd_sad16x16_bits8, 1061 vpx_highbd_sad16x16_bits8,
1057 vpx_highbd_sad16x16_avg_bits8, 1062 vpx_highbd_sad16x16_avg_bits8,
1058 vp9_highbd_variance16x16, 1063 vpx_highbd_8_variance16x16,
1059 vp9_highbd_sub_pixel_variance16x16, 1064 vp9_highbd_sub_pixel_variance16x16,
1060 vp9_highbd_sub_pixel_avg_variance16x16, 1065 vp9_highbd_sub_pixel_avg_variance16x16,
1061 vpx_highbd_sad16x16x3_bits8, 1066 vpx_highbd_sad16x16x3_bits8,
1062 vpx_highbd_sad16x16x8_bits8, 1067 vpx_highbd_sad16x16x8_bits8,
1063 vpx_highbd_sad16x16x4d_bits8) 1068 vpx_highbd_sad16x16x4d_bits8)
1064 1069
1065 HIGHBD_BFP(BLOCK_16X8, 1070 HIGHBD_BFP(BLOCK_16X8,
1066 vpx_highbd_sad16x8_bits8, 1071 vpx_highbd_sad16x8_bits8,
1067 vpx_highbd_sad16x8_avg_bits8, 1072 vpx_highbd_sad16x8_avg_bits8,
1068 vp9_highbd_variance16x8, 1073 vpx_highbd_8_variance16x8,
1069 vp9_highbd_sub_pixel_variance16x8, 1074 vp9_highbd_sub_pixel_variance16x8,
1070 vp9_highbd_sub_pixel_avg_variance16x8, 1075 vp9_highbd_sub_pixel_avg_variance16x8,
1071 vpx_highbd_sad16x8x3_bits8, 1076 vpx_highbd_sad16x8x3_bits8,
1072 vpx_highbd_sad16x8x8_bits8, 1077 vpx_highbd_sad16x8x8_bits8,
1073 vpx_highbd_sad16x8x4d_bits8) 1078 vpx_highbd_sad16x8x4d_bits8)
1074 1079
1075 HIGHBD_BFP(BLOCK_8X16, 1080 HIGHBD_BFP(BLOCK_8X16,
1076 vpx_highbd_sad8x16_bits8, 1081 vpx_highbd_sad8x16_bits8,
1077 vpx_highbd_sad8x16_avg_bits8, 1082 vpx_highbd_sad8x16_avg_bits8,
1078 vp9_highbd_variance8x16, 1083 vpx_highbd_8_variance8x16,
1079 vp9_highbd_sub_pixel_variance8x16, 1084 vp9_highbd_sub_pixel_variance8x16,
1080 vp9_highbd_sub_pixel_avg_variance8x16, 1085 vp9_highbd_sub_pixel_avg_variance8x16,
1081 vpx_highbd_sad8x16x3_bits8, 1086 vpx_highbd_sad8x16x3_bits8,
1082 vpx_highbd_sad8x16x8_bits8, 1087 vpx_highbd_sad8x16x8_bits8,
1083 vpx_highbd_sad8x16x4d_bits8) 1088 vpx_highbd_sad8x16x4d_bits8)
1084 1089
1085 HIGHBD_BFP(BLOCK_8X8, 1090 HIGHBD_BFP(BLOCK_8X8,
1086 vpx_highbd_sad8x8_bits8, 1091 vpx_highbd_sad8x8_bits8,
1087 vpx_highbd_sad8x8_avg_bits8, 1092 vpx_highbd_sad8x8_avg_bits8,
1088 vp9_highbd_variance8x8, 1093 vpx_highbd_8_variance8x8,
1089 vp9_highbd_sub_pixel_variance8x8, 1094 vp9_highbd_sub_pixel_variance8x8,
1090 vp9_highbd_sub_pixel_avg_variance8x8, 1095 vp9_highbd_sub_pixel_avg_variance8x8,
1091 vpx_highbd_sad8x8x3_bits8, 1096 vpx_highbd_sad8x8x3_bits8,
1092 vpx_highbd_sad8x8x8_bits8, 1097 vpx_highbd_sad8x8x8_bits8,
1093 vpx_highbd_sad8x8x4d_bits8) 1098 vpx_highbd_sad8x8x4d_bits8)
1094 1099
1095 HIGHBD_BFP(BLOCK_8X4, 1100 HIGHBD_BFP(BLOCK_8X4,
1096 vpx_highbd_sad8x4_bits8, 1101 vpx_highbd_sad8x4_bits8,
1097 vpx_highbd_sad8x4_avg_bits8, 1102 vpx_highbd_sad8x4_avg_bits8,
1098 vp9_highbd_variance8x4, 1103 vpx_highbd_8_variance8x4,
1099 vp9_highbd_sub_pixel_variance8x4, 1104 vp9_highbd_sub_pixel_variance8x4,
1100 vp9_highbd_sub_pixel_avg_variance8x4, 1105 vp9_highbd_sub_pixel_avg_variance8x4,
1101 NULL, 1106 NULL,
1102 vpx_highbd_sad8x4x8_bits8, 1107 vpx_highbd_sad8x4x8_bits8,
1103 vpx_highbd_sad8x4x4d_bits8) 1108 vpx_highbd_sad8x4x4d_bits8)
1104 1109
1105 HIGHBD_BFP(BLOCK_4X8, 1110 HIGHBD_BFP(BLOCK_4X8,
1106 vpx_highbd_sad4x8_bits8, 1111 vpx_highbd_sad4x8_bits8,
1107 vpx_highbd_sad4x8_avg_bits8, 1112 vpx_highbd_sad4x8_avg_bits8,
1108 vp9_highbd_variance4x8, 1113 vpx_highbd_8_variance4x8,
1109 vp9_highbd_sub_pixel_variance4x8, 1114 vp9_highbd_sub_pixel_variance4x8,
1110 vp9_highbd_sub_pixel_avg_variance4x8, 1115 vp9_highbd_sub_pixel_avg_variance4x8,
1111 NULL, 1116 NULL,
1112 vpx_highbd_sad4x8x8_bits8, 1117 vpx_highbd_sad4x8x8_bits8,
1113 vpx_highbd_sad4x8x4d_bits8) 1118 vpx_highbd_sad4x8x4d_bits8)
1114 1119
1115 HIGHBD_BFP(BLOCK_4X4, 1120 HIGHBD_BFP(BLOCK_4X4,
1116 vpx_highbd_sad4x4_bits8, 1121 vpx_highbd_sad4x4_bits8,
1117 vpx_highbd_sad4x4_avg_bits8, 1122 vpx_highbd_sad4x4_avg_bits8,
1118 vp9_highbd_variance4x4, 1123 vpx_highbd_8_variance4x4,
1119 vp9_highbd_sub_pixel_variance4x4, 1124 vp9_highbd_sub_pixel_variance4x4,
1120 vp9_highbd_sub_pixel_avg_variance4x4, 1125 vp9_highbd_sub_pixel_avg_variance4x4,
1121 vpx_highbd_sad4x4x3_bits8, 1126 vpx_highbd_sad4x4x3_bits8,
1122 vpx_highbd_sad4x4x8_bits8, 1127 vpx_highbd_sad4x4x8_bits8,
1123 vpx_highbd_sad4x4x4d_bits8) 1128 vpx_highbd_sad4x4x4d_bits8)
1124 break; 1129 break;
1125 1130
1126 case VPX_BITS_10: 1131 case VPX_BITS_10:
1127 HIGHBD_BFP(BLOCK_32X16, 1132 HIGHBD_BFP(BLOCK_32X16,
1128 vpx_highbd_sad32x16_bits10, 1133 vpx_highbd_sad32x16_bits10,
1129 vpx_highbd_sad32x16_avg_bits10, 1134 vpx_highbd_sad32x16_avg_bits10,
1130 vp9_highbd_10_variance32x16, 1135 vpx_highbd_10_variance32x16,
1131 vp9_highbd_10_sub_pixel_variance32x16, 1136 vp9_highbd_10_sub_pixel_variance32x16,
1132 vp9_highbd_10_sub_pixel_avg_variance32x16, 1137 vp9_highbd_10_sub_pixel_avg_variance32x16,
1133 NULL, 1138 NULL,
1134 NULL, 1139 NULL,
1135 vpx_highbd_sad32x16x4d_bits10) 1140 vpx_highbd_sad32x16x4d_bits10)
1136 1141
1137 HIGHBD_BFP(BLOCK_16X32, 1142 HIGHBD_BFP(BLOCK_16X32,
1138 vpx_highbd_sad16x32_bits10, 1143 vpx_highbd_sad16x32_bits10,
1139 vpx_highbd_sad16x32_avg_bits10, 1144 vpx_highbd_sad16x32_avg_bits10,
1140 vp9_highbd_10_variance16x32, 1145 vpx_highbd_10_variance16x32,
1141 vp9_highbd_10_sub_pixel_variance16x32, 1146 vp9_highbd_10_sub_pixel_variance16x32,
1142 vp9_highbd_10_sub_pixel_avg_variance16x32, 1147 vp9_highbd_10_sub_pixel_avg_variance16x32,
1143 NULL, 1148 NULL,
1144 NULL, 1149 NULL,
1145 vpx_highbd_sad16x32x4d_bits10) 1150 vpx_highbd_sad16x32x4d_bits10)
1146 1151
1147 HIGHBD_BFP(BLOCK_64X32, 1152 HIGHBD_BFP(BLOCK_64X32,
1148 vpx_highbd_sad64x32_bits10, 1153 vpx_highbd_sad64x32_bits10,
1149 vpx_highbd_sad64x32_avg_bits10, 1154 vpx_highbd_sad64x32_avg_bits10,
1150 vp9_highbd_10_variance64x32, 1155 vpx_highbd_10_variance64x32,
1151 vp9_highbd_10_sub_pixel_variance64x32, 1156 vp9_highbd_10_sub_pixel_variance64x32,
1152 vp9_highbd_10_sub_pixel_avg_variance64x32, 1157 vp9_highbd_10_sub_pixel_avg_variance64x32,
1153 NULL, 1158 NULL,
1154 NULL, 1159 NULL,
1155 vpx_highbd_sad64x32x4d_bits10) 1160 vpx_highbd_sad64x32x4d_bits10)
1156 1161
1157 HIGHBD_BFP(BLOCK_32X64, 1162 HIGHBD_BFP(BLOCK_32X64,
1158 vpx_highbd_sad32x64_bits10, 1163 vpx_highbd_sad32x64_bits10,
1159 vpx_highbd_sad32x64_avg_bits10, 1164 vpx_highbd_sad32x64_avg_bits10,
1160 vp9_highbd_10_variance32x64, 1165 vpx_highbd_10_variance32x64,
1161 vp9_highbd_10_sub_pixel_variance32x64, 1166 vp9_highbd_10_sub_pixel_variance32x64,
1162 vp9_highbd_10_sub_pixel_avg_variance32x64, 1167 vp9_highbd_10_sub_pixel_avg_variance32x64,
1163 NULL, 1168 NULL,
1164 NULL, 1169 NULL,
1165 vpx_highbd_sad32x64x4d_bits10) 1170 vpx_highbd_sad32x64x4d_bits10)
1166 1171
1167 HIGHBD_BFP(BLOCK_32X32, 1172 HIGHBD_BFP(BLOCK_32X32,
1168 vpx_highbd_sad32x32_bits10, 1173 vpx_highbd_sad32x32_bits10,
1169 vpx_highbd_sad32x32_avg_bits10, 1174 vpx_highbd_sad32x32_avg_bits10,
1170 vp9_highbd_10_variance32x32, 1175 vpx_highbd_10_variance32x32,
1171 vp9_highbd_10_sub_pixel_variance32x32, 1176 vp9_highbd_10_sub_pixel_variance32x32,
1172 vp9_highbd_10_sub_pixel_avg_variance32x32, 1177 vp9_highbd_10_sub_pixel_avg_variance32x32,
1173 vpx_highbd_sad32x32x3_bits10, 1178 vpx_highbd_sad32x32x3_bits10,
1174 vpx_highbd_sad32x32x8_bits10, 1179 vpx_highbd_sad32x32x8_bits10,
1175 vpx_highbd_sad32x32x4d_bits10) 1180 vpx_highbd_sad32x32x4d_bits10)
1176 1181
1177 HIGHBD_BFP(BLOCK_64X64, 1182 HIGHBD_BFP(BLOCK_64X64,
1178 vpx_highbd_sad64x64_bits10, 1183 vpx_highbd_sad64x64_bits10,
1179 vpx_highbd_sad64x64_avg_bits10, 1184 vpx_highbd_sad64x64_avg_bits10,
1180 vp9_highbd_10_variance64x64, 1185 vpx_highbd_10_variance64x64,
1181 vp9_highbd_10_sub_pixel_variance64x64, 1186 vp9_highbd_10_sub_pixel_variance64x64,
1182 vp9_highbd_10_sub_pixel_avg_variance64x64, 1187 vp9_highbd_10_sub_pixel_avg_variance64x64,
1183 vpx_highbd_sad64x64x3_bits10, 1188 vpx_highbd_sad64x64x3_bits10,
1184 vpx_highbd_sad64x64x8_bits10, 1189 vpx_highbd_sad64x64x8_bits10,
1185 vpx_highbd_sad64x64x4d_bits10) 1190 vpx_highbd_sad64x64x4d_bits10)
1186 1191
1187 HIGHBD_BFP(BLOCK_16X16, 1192 HIGHBD_BFP(BLOCK_16X16,
1188 vpx_highbd_sad16x16_bits10, 1193 vpx_highbd_sad16x16_bits10,
1189 vpx_highbd_sad16x16_avg_bits10, 1194 vpx_highbd_sad16x16_avg_bits10,
1190 vp9_highbd_10_variance16x16, 1195 vpx_highbd_10_variance16x16,
1191 vp9_highbd_10_sub_pixel_variance16x16, 1196 vp9_highbd_10_sub_pixel_variance16x16,
1192 vp9_highbd_10_sub_pixel_avg_variance16x16, 1197 vp9_highbd_10_sub_pixel_avg_variance16x16,
1193 vpx_highbd_sad16x16x3_bits10, 1198 vpx_highbd_sad16x16x3_bits10,
1194 vpx_highbd_sad16x16x8_bits10, 1199 vpx_highbd_sad16x16x8_bits10,
1195 vpx_highbd_sad16x16x4d_bits10) 1200 vpx_highbd_sad16x16x4d_bits10)
1196 1201
1197 HIGHBD_BFP(BLOCK_16X8, 1202 HIGHBD_BFP(BLOCK_16X8,
1198 vpx_highbd_sad16x8_bits10, 1203 vpx_highbd_sad16x8_bits10,
1199 vpx_highbd_sad16x8_avg_bits10, 1204 vpx_highbd_sad16x8_avg_bits10,
1200 vp9_highbd_10_variance16x8, 1205 vpx_highbd_10_variance16x8,
1201 vp9_highbd_10_sub_pixel_variance16x8, 1206 vp9_highbd_10_sub_pixel_variance16x8,
1202 vp9_highbd_10_sub_pixel_avg_variance16x8, 1207 vp9_highbd_10_sub_pixel_avg_variance16x8,
1203 vpx_highbd_sad16x8x3_bits10, 1208 vpx_highbd_sad16x8x3_bits10,
1204 vpx_highbd_sad16x8x8_bits10, 1209 vpx_highbd_sad16x8x8_bits10,
1205 vpx_highbd_sad16x8x4d_bits10) 1210 vpx_highbd_sad16x8x4d_bits10)
1206 1211
1207 HIGHBD_BFP(BLOCK_8X16, 1212 HIGHBD_BFP(BLOCK_8X16,
1208 vpx_highbd_sad8x16_bits10, 1213 vpx_highbd_sad8x16_bits10,
1209 vpx_highbd_sad8x16_avg_bits10, 1214 vpx_highbd_sad8x16_avg_bits10,
1210 vp9_highbd_10_variance8x16, 1215 vpx_highbd_10_variance8x16,
1211 vp9_highbd_10_sub_pixel_variance8x16, 1216 vp9_highbd_10_sub_pixel_variance8x16,
1212 vp9_highbd_10_sub_pixel_avg_variance8x16, 1217 vp9_highbd_10_sub_pixel_avg_variance8x16,
1213 vpx_highbd_sad8x16x3_bits10, 1218 vpx_highbd_sad8x16x3_bits10,
1214 vpx_highbd_sad8x16x8_bits10, 1219 vpx_highbd_sad8x16x8_bits10,
1215 vpx_highbd_sad8x16x4d_bits10) 1220 vpx_highbd_sad8x16x4d_bits10)
1216 1221
1217 HIGHBD_BFP(BLOCK_8X8, 1222 HIGHBD_BFP(BLOCK_8X8,
1218 vpx_highbd_sad8x8_bits10, 1223 vpx_highbd_sad8x8_bits10,
1219 vpx_highbd_sad8x8_avg_bits10, 1224 vpx_highbd_sad8x8_avg_bits10,
1220 vp9_highbd_10_variance8x8, 1225 vpx_highbd_10_variance8x8,
1221 vp9_highbd_10_sub_pixel_variance8x8, 1226 vp9_highbd_10_sub_pixel_variance8x8,
1222 vp9_highbd_10_sub_pixel_avg_variance8x8, 1227 vp9_highbd_10_sub_pixel_avg_variance8x8,
1223 vpx_highbd_sad8x8x3_bits10, 1228 vpx_highbd_sad8x8x3_bits10,
1224 vpx_highbd_sad8x8x8_bits10, 1229 vpx_highbd_sad8x8x8_bits10,
1225 vpx_highbd_sad8x8x4d_bits10) 1230 vpx_highbd_sad8x8x4d_bits10)
1226 1231
1227 HIGHBD_BFP(BLOCK_8X4, 1232 HIGHBD_BFP(BLOCK_8X4,
1228 vpx_highbd_sad8x4_bits10, 1233 vpx_highbd_sad8x4_bits10,
1229 vpx_highbd_sad8x4_avg_bits10, 1234 vpx_highbd_sad8x4_avg_bits10,
1230 vp9_highbd_10_variance8x4, 1235 vpx_highbd_10_variance8x4,
1231 vp9_highbd_10_sub_pixel_variance8x4, 1236 vp9_highbd_10_sub_pixel_variance8x4,
1232 vp9_highbd_10_sub_pixel_avg_variance8x4, 1237 vp9_highbd_10_sub_pixel_avg_variance8x4,
1233 NULL, 1238 NULL,
1234 vpx_highbd_sad8x4x8_bits10, 1239 vpx_highbd_sad8x4x8_bits10,
1235 vpx_highbd_sad8x4x4d_bits10) 1240 vpx_highbd_sad8x4x4d_bits10)
1236 1241
1237 HIGHBD_BFP(BLOCK_4X8, 1242 HIGHBD_BFP(BLOCK_4X8,
1238 vpx_highbd_sad4x8_bits10, 1243 vpx_highbd_sad4x8_bits10,
1239 vpx_highbd_sad4x8_avg_bits10, 1244 vpx_highbd_sad4x8_avg_bits10,
1240 vp9_highbd_10_variance4x8, 1245 vpx_highbd_10_variance4x8,
1241 vp9_highbd_10_sub_pixel_variance4x8, 1246 vp9_highbd_10_sub_pixel_variance4x8,
1242 vp9_highbd_10_sub_pixel_avg_variance4x8, 1247 vp9_highbd_10_sub_pixel_avg_variance4x8,
1243 NULL, 1248 NULL,
1244 vpx_highbd_sad4x8x8_bits10, 1249 vpx_highbd_sad4x8x8_bits10,
1245 vpx_highbd_sad4x8x4d_bits10) 1250 vpx_highbd_sad4x8x4d_bits10)
1246 1251
1247 HIGHBD_BFP(BLOCK_4X4, 1252 HIGHBD_BFP(BLOCK_4X4,
1248 vpx_highbd_sad4x4_bits10, 1253 vpx_highbd_sad4x4_bits10,
1249 vpx_highbd_sad4x4_avg_bits10, 1254 vpx_highbd_sad4x4_avg_bits10,
1250 vp9_highbd_10_variance4x4, 1255 vpx_highbd_10_variance4x4,
1251 vp9_highbd_10_sub_pixel_variance4x4, 1256 vp9_highbd_10_sub_pixel_variance4x4,
1252 vp9_highbd_10_sub_pixel_avg_variance4x4, 1257 vp9_highbd_10_sub_pixel_avg_variance4x4,
1253 vpx_highbd_sad4x4x3_bits10, 1258 vpx_highbd_sad4x4x3_bits10,
1254 vpx_highbd_sad4x4x8_bits10, 1259 vpx_highbd_sad4x4x8_bits10,
1255 vpx_highbd_sad4x4x4d_bits10) 1260 vpx_highbd_sad4x4x4d_bits10)
1256 break; 1261 break;
1257 1262
1258 case VPX_BITS_12: 1263 case VPX_BITS_12:
1259 HIGHBD_BFP(BLOCK_32X16, 1264 HIGHBD_BFP(BLOCK_32X16,
1260 vpx_highbd_sad32x16_bits12, 1265 vpx_highbd_sad32x16_bits12,
1261 vpx_highbd_sad32x16_avg_bits12, 1266 vpx_highbd_sad32x16_avg_bits12,
1262 vp9_highbd_12_variance32x16, 1267 vpx_highbd_12_variance32x16,
1263 vp9_highbd_12_sub_pixel_variance32x16, 1268 vp9_highbd_12_sub_pixel_variance32x16,
1264 vp9_highbd_12_sub_pixel_avg_variance32x16, 1269 vp9_highbd_12_sub_pixel_avg_variance32x16,
1265 NULL, 1270 NULL,
1266 NULL, 1271 NULL,
1267 vpx_highbd_sad32x16x4d_bits12) 1272 vpx_highbd_sad32x16x4d_bits12)
1268 1273
1269 HIGHBD_BFP(BLOCK_16X32, 1274 HIGHBD_BFP(BLOCK_16X32,
1270 vpx_highbd_sad16x32_bits12, 1275 vpx_highbd_sad16x32_bits12,
1271 vpx_highbd_sad16x32_avg_bits12, 1276 vpx_highbd_sad16x32_avg_bits12,
1272 vp9_highbd_12_variance16x32, 1277 vpx_highbd_12_variance16x32,
1273 vp9_highbd_12_sub_pixel_variance16x32, 1278 vp9_highbd_12_sub_pixel_variance16x32,
1274 vp9_highbd_12_sub_pixel_avg_variance16x32, 1279 vp9_highbd_12_sub_pixel_avg_variance16x32,
1275 NULL, 1280 NULL,
1276 NULL, 1281 NULL,
1277 vpx_highbd_sad16x32x4d_bits12) 1282 vpx_highbd_sad16x32x4d_bits12)
1278 1283
1279 HIGHBD_BFP(BLOCK_64X32, 1284 HIGHBD_BFP(BLOCK_64X32,
1280 vpx_highbd_sad64x32_bits12, 1285 vpx_highbd_sad64x32_bits12,
1281 vpx_highbd_sad64x32_avg_bits12, 1286 vpx_highbd_sad64x32_avg_bits12,
1282 vp9_highbd_12_variance64x32, 1287 vpx_highbd_12_variance64x32,
1283 vp9_highbd_12_sub_pixel_variance64x32, 1288 vp9_highbd_12_sub_pixel_variance64x32,
1284 vp9_highbd_12_sub_pixel_avg_variance64x32, 1289 vp9_highbd_12_sub_pixel_avg_variance64x32,
1285 NULL, 1290 NULL,
1286 NULL, 1291 NULL,
1287 vpx_highbd_sad64x32x4d_bits12) 1292 vpx_highbd_sad64x32x4d_bits12)
1288 1293
1289 HIGHBD_BFP(BLOCK_32X64, 1294 HIGHBD_BFP(BLOCK_32X64,
1290 vpx_highbd_sad32x64_bits12, 1295 vpx_highbd_sad32x64_bits12,
1291 vpx_highbd_sad32x64_avg_bits12, 1296 vpx_highbd_sad32x64_avg_bits12,
1292 vp9_highbd_12_variance32x64, 1297 vpx_highbd_12_variance32x64,
1293 vp9_highbd_12_sub_pixel_variance32x64, 1298 vp9_highbd_12_sub_pixel_variance32x64,
1294 vp9_highbd_12_sub_pixel_avg_variance32x64, 1299 vp9_highbd_12_sub_pixel_avg_variance32x64,
1295 NULL, 1300 NULL,
1296 NULL, 1301 NULL,
1297 vpx_highbd_sad32x64x4d_bits12) 1302 vpx_highbd_sad32x64x4d_bits12)
1298 1303
1299 HIGHBD_BFP(BLOCK_32X32, 1304 HIGHBD_BFP(BLOCK_32X32,
1300 vpx_highbd_sad32x32_bits12, 1305 vpx_highbd_sad32x32_bits12,
1301 vpx_highbd_sad32x32_avg_bits12, 1306 vpx_highbd_sad32x32_avg_bits12,
1302 vp9_highbd_12_variance32x32, 1307 vpx_highbd_12_variance32x32,
1303 vp9_highbd_12_sub_pixel_variance32x32, 1308 vp9_highbd_12_sub_pixel_variance32x32,
1304 vp9_highbd_12_sub_pixel_avg_variance32x32, 1309 vp9_highbd_12_sub_pixel_avg_variance32x32,
1305 vpx_highbd_sad32x32x3_bits12, 1310 vpx_highbd_sad32x32x3_bits12,
1306 vpx_highbd_sad32x32x8_bits12, 1311 vpx_highbd_sad32x32x8_bits12,
1307 vpx_highbd_sad32x32x4d_bits12) 1312 vpx_highbd_sad32x32x4d_bits12)
1308 1313
1309 HIGHBD_BFP(BLOCK_64X64, 1314 HIGHBD_BFP(BLOCK_64X64,
1310 vpx_highbd_sad64x64_bits12, 1315 vpx_highbd_sad64x64_bits12,
1311 vpx_highbd_sad64x64_avg_bits12, 1316 vpx_highbd_sad64x64_avg_bits12,
1312 vp9_highbd_12_variance64x64, 1317 vpx_highbd_12_variance64x64,
1313 vp9_highbd_12_sub_pixel_variance64x64, 1318 vp9_highbd_12_sub_pixel_variance64x64,
1314 vp9_highbd_12_sub_pixel_avg_variance64x64, 1319 vp9_highbd_12_sub_pixel_avg_variance64x64,
1315 vpx_highbd_sad64x64x3_bits12, 1320 vpx_highbd_sad64x64x3_bits12,
1316 vpx_highbd_sad64x64x8_bits12, 1321 vpx_highbd_sad64x64x8_bits12,
1317 vpx_highbd_sad64x64x4d_bits12) 1322 vpx_highbd_sad64x64x4d_bits12)
1318 1323
1319 HIGHBD_BFP(BLOCK_16X16, 1324 HIGHBD_BFP(BLOCK_16X16,
1320 vpx_highbd_sad16x16_bits12, 1325 vpx_highbd_sad16x16_bits12,
1321 vpx_highbd_sad16x16_avg_bits12, 1326 vpx_highbd_sad16x16_avg_bits12,
1322 vp9_highbd_12_variance16x16, 1327 vpx_highbd_12_variance16x16,
1323 vp9_highbd_12_sub_pixel_variance16x16, 1328 vp9_highbd_12_sub_pixel_variance16x16,
1324 vp9_highbd_12_sub_pixel_avg_variance16x16, 1329 vp9_highbd_12_sub_pixel_avg_variance16x16,
1325 vpx_highbd_sad16x16x3_bits12, 1330 vpx_highbd_sad16x16x3_bits12,
1326 vpx_highbd_sad16x16x8_bits12, 1331 vpx_highbd_sad16x16x8_bits12,
1327 vpx_highbd_sad16x16x4d_bits12) 1332 vpx_highbd_sad16x16x4d_bits12)
1328 1333
1329 HIGHBD_BFP(BLOCK_16X8, 1334 HIGHBD_BFP(BLOCK_16X8,
1330 vpx_highbd_sad16x8_bits12, 1335 vpx_highbd_sad16x8_bits12,
1331 vpx_highbd_sad16x8_avg_bits12, 1336 vpx_highbd_sad16x8_avg_bits12,
1332 vp9_highbd_12_variance16x8, 1337 vpx_highbd_12_variance16x8,
1333 vp9_highbd_12_sub_pixel_variance16x8, 1338 vp9_highbd_12_sub_pixel_variance16x8,
1334 vp9_highbd_12_sub_pixel_avg_variance16x8, 1339 vp9_highbd_12_sub_pixel_avg_variance16x8,
1335 vpx_highbd_sad16x8x3_bits12, 1340 vpx_highbd_sad16x8x3_bits12,
1336 vpx_highbd_sad16x8x8_bits12, 1341 vpx_highbd_sad16x8x8_bits12,
1337 vpx_highbd_sad16x8x4d_bits12) 1342 vpx_highbd_sad16x8x4d_bits12)
1338 1343
1339 HIGHBD_BFP(BLOCK_8X16, 1344 HIGHBD_BFP(BLOCK_8X16,
1340 vpx_highbd_sad8x16_bits12, 1345 vpx_highbd_sad8x16_bits12,
1341 vpx_highbd_sad8x16_avg_bits12, 1346 vpx_highbd_sad8x16_avg_bits12,
1342 vp9_highbd_12_variance8x16, 1347 vpx_highbd_12_variance8x16,
1343 vp9_highbd_12_sub_pixel_variance8x16, 1348 vp9_highbd_12_sub_pixel_variance8x16,
1344 vp9_highbd_12_sub_pixel_avg_variance8x16, 1349 vp9_highbd_12_sub_pixel_avg_variance8x16,
1345 vpx_highbd_sad8x16x3_bits12, 1350 vpx_highbd_sad8x16x3_bits12,
1346 vpx_highbd_sad8x16x8_bits12, 1351 vpx_highbd_sad8x16x8_bits12,
1347 vpx_highbd_sad8x16x4d_bits12) 1352 vpx_highbd_sad8x16x4d_bits12)
1348 1353
1349 HIGHBD_BFP(BLOCK_8X8, 1354 HIGHBD_BFP(BLOCK_8X8,
1350 vpx_highbd_sad8x8_bits12, 1355 vpx_highbd_sad8x8_bits12,
1351 vpx_highbd_sad8x8_avg_bits12, 1356 vpx_highbd_sad8x8_avg_bits12,
1352 vp9_highbd_12_variance8x8, 1357 vpx_highbd_12_variance8x8,
1353 vp9_highbd_12_sub_pixel_variance8x8, 1358 vp9_highbd_12_sub_pixel_variance8x8,
1354 vp9_highbd_12_sub_pixel_avg_variance8x8, 1359 vp9_highbd_12_sub_pixel_avg_variance8x8,
1355 vpx_highbd_sad8x8x3_bits12, 1360 vpx_highbd_sad8x8x3_bits12,
1356 vpx_highbd_sad8x8x8_bits12, 1361 vpx_highbd_sad8x8x8_bits12,
1357 vpx_highbd_sad8x8x4d_bits12) 1362 vpx_highbd_sad8x8x4d_bits12)
1358 1363
1359 HIGHBD_BFP(BLOCK_8X4, 1364 HIGHBD_BFP(BLOCK_8X4,
1360 vpx_highbd_sad8x4_bits12, 1365 vpx_highbd_sad8x4_bits12,
1361 vpx_highbd_sad8x4_avg_bits12, 1366 vpx_highbd_sad8x4_avg_bits12,
1362 vp9_highbd_12_variance8x4, 1367 vpx_highbd_12_variance8x4,
1363 vp9_highbd_12_sub_pixel_variance8x4, 1368 vp9_highbd_12_sub_pixel_variance8x4,
1364 vp9_highbd_12_sub_pixel_avg_variance8x4, 1369 vp9_highbd_12_sub_pixel_avg_variance8x4,
1365 NULL, 1370 NULL,
1366 vpx_highbd_sad8x4x8_bits12, 1371 vpx_highbd_sad8x4x8_bits12,
1367 vpx_highbd_sad8x4x4d_bits12) 1372 vpx_highbd_sad8x4x4d_bits12)
1368 1373
1369 HIGHBD_BFP(BLOCK_4X8, 1374 HIGHBD_BFP(BLOCK_4X8,
1370 vpx_highbd_sad4x8_bits12, 1375 vpx_highbd_sad4x8_bits12,
1371 vpx_highbd_sad4x8_avg_bits12, 1376 vpx_highbd_sad4x8_avg_bits12,
1372 vp9_highbd_12_variance4x8, 1377 vpx_highbd_12_variance4x8,
1373 vp9_highbd_12_sub_pixel_variance4x8, 1378 vp9_highbd_12_sub_pixel_variance4x8,
1374 vp9_highbd_12_sub_pixel_avg_variance4x8, 1379 vp9_highbd_12_sub_pixel_avg_variance4x8,
1375 NULL, 1380 NULL,
1376 vpx_highbd_sad4x8x8_bits12, 1381 vpx_highbd_sad4x8x8_bits12,
1377 vpx_highbd_sad4x8x4d_bits12) 1382 vpx_highbd_sad4x8x4d_bits12)
1378 1383
1379 HIGHBD_BFP(BLOCK_4X4, 1384 HIGHBD_BFP(BLOCK_4X4,
1380 vpx_highbd_sad4x4_bits12, 1385 vpx_highbd_sad4x4_bits12,
1381 vpx_highbd_sad4x4_avg_bits12, 1386 vpx_highbd_sad4x4_avg_bits12,
1382 vp9_highbd_12_variance4x4, 1387 vpx_highbd_12_variance4x4,
1383 vp9_highbd_12_sub_pixel_variance4x4, 1388 vp9_highbd_12_sub_pixel_variance4x4,
1384 vp9_highbd_12_sub_pixel_avg_variance4x4, 1389 vp9_highbd_12_sub_pixel_avg_variance4x4,
1385 vpx_highbd_sad4x4x3_bits12, 1390 vpx_highbd_sad4x4x3_bits12,
1386 vpx_highbd_sad4x4x8_bits12, 1391 vpx_highbd_sad4x4x8_bits12,
1387 vpx_highbd_sad4x4x4d_bits12) 1392 vpx_highbd_sad4x4x4d_bits12)
1388 break; 1393 break;
1389 1394
1390 default: 1395 default:
1391 assert(0 && "cm->bit_depth should be VPX_BITS_8, " 1396 assert(0 && "cm->bit_depth should be VPX_BITS_8, "
1392 "VPX_BITS_10 or VPX_BITS_12"); 1397 "VPX_BITS_10 or VPX_BITS_12");
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1795 cpi->fn_ptr[BT].sdf = SDF; \ 1800 cpi->fn_ptr[BT].sdf = SDF; \
1796 cpi->fn_ptr[BT].sdaf = SDAF; \ 1801 cpi->fn_ptr[BT].sdaf = SDAF; \
1797 cpi->fn_ptr[BT].vf = VF; \ 1802 cpi->fn_ptr[BT].vf = VF; \
1798 cpi->fn_ptr[BT].svf = SVF; \ 1803 cpi->fn_ptr[BT].svf = SVF; \
1799 cpi->fn_ptr[BT].svaf = SVAF; \ 1804 cpi->fn_ptr[BT].svaf = SVAF; \
1800 cpi->fn_ptr[BT].sdx3f = SDX3F; \ 1805 cpi->fn_ptr[BT].sdx3f = SDX3F; \
1801 cpi->fn_ptr[BT].sdx8f = SDX8F; \ 1806 cpi->fn_ptr[BT].sdx8f = SDX8F; \
1802 cpi->fn_ptr[BT].sdx4df = SDX4DF; 1807 cpi->fn_ptr[BT].sdx4df = SDX4DF;
1803 1808
1804 BFP(BLOCK_32X16, vpx_sad32x16, vpx_sad32x16_avg, 1809 BFP(BLOCK_32X16, vpx_sad32x16, vpx_sad32x16_avg,
1805 vp9_variance32x16, vp9_sub_pixel_variance32x16, 1810 vpx_variance32x16, vp9_sub_pixel_variance32x16,
1806 vp9_sub_pixel_avg_variance32x16, NULL, NULL, vpx_sad32x16x4d) 1811 vp9_sub_pixel_avg_variance32x16, NULL, NULL, vpx_sad32x16x4d)
1807 1812
1808 BFP(BLOCK_16X32, vpx_sad16x32, vpx_sad16x32_avg, 1813 BFP(BLOCK_16X32, vpx_sad16x32, vpx_sad16x32_avg,
1809 vp9_variance16x32, vp9_sub_pixel_variance16x32, 1814 vpx_variance16x32, vp9_sub_pixel_variance16x32,
1810 vp9_sub_pixel_avg_variance16x32, NULL, NULL, vpx_sad16x32x4d) 1815 vp9_sub_pixel_avg_variance16x32, NULL, NULL, vpx_sad16x32x4d)
1811 1816
1812 BFP(BLOCK_64X32, vpx_sad64x32, vpx_sad64x32_avg, 1817 BFP(BLOCK_64X32, vpx_sad64x32, vpx_sad64x32_avg,
1813 vp9_variance64x32, vp9_sub_pixel_variance64x32, 1818 vpx_variance64x32, vp9_sub_pixel_variance64x32,
1814 vp9_sub_pixel_avg_variance64x32, NULL, NULL, vpx_sad64x32x4d) 1819 vp9_sub_pixel_avg_variance64x32, NULL, NULL, vpx_sad64x32x4d)
1815 1820
1816 BFP(BLOCK_32X64, vpx_sad32x64, vpx_sad32x64_avg, 1821 BFP(BLOCK_32X64, vpx_sad32x64, vpx_sad32x64_avg,
1817 vp9_variance32x64, vp9_sub_pixel_variance32x64, 1822 vpx_variance32x64, vp9_sub_pixel_variance32x64,
1818 vp9_sub_pixel_avg_variance32x64, NULL, NULL, vpx_sad32x64x4d) 1823 vp9_sub_pixel_avg_variance32x64, NULL, NULL, vpx_sad32x64x4d)
1819 1824
1820 BFP(BLOCK_32X32, vpx_sad32x32, vpx_sad32x32_avg, 1825 BFP(BLOCK_32X32, vpx_sad32x32, vpx_sad32x32_avg,
1821 vp9_variance32x32, vp9_sub_pixel_variance32x32, 1826 vpx_variance32x32, vp9_sub_pixel_variance32x32,
1822 vp9_sub_pixel_avg_variance32x32, vpx_sad32x32x3, vpx_sad32x32x8, 1827 vp9_sub_pixel_avg_variance32x32, vpx_sad32x32x3, vpx_sad32x32x8,
1823 vpx_sad32x32x4d) 1828 vpx_sad32x32x4d)
1824 1829
1825 BFP(BLOCK_64X64, vpx_sad64x64, vpx_sad64x64_avg, 1830 BFP(BLOCK_64X64, vpx_sad64x64, vpx_sad64x64_avg,
1826 vp9_variance64x64, vp9_sub_pixel_variance64x64, 1831 vpx_variance64x64, vp9_sub_pixel_variance64x64,
1827 vp9_sub_pixel_avg_variance64x64, vpx_sad64x64x3, vpx_sad64x64x8, 1832 vp9_sub_pixel_avg_variance64x64, vpx_sad64x64x3, vpx_sad64x64x8,
1828 vpx_sad64x64x4d) 1833 vpx_sad64x64x4d)
1829 1834
1830 BFP(BLOCK_16X16, vpx_sad16x16, vpx_sad16x16_avg, 1835 BFP(BLOCK_16X16, vpx_sad16x16, vpx_sad16x16_avg,
1831 vp9_variance16x16, vp9_sub_pixel_variance16x16, 1836 vpx_variance16x16, vp9_sub_pixel_variance16x16,
1832 vp9_sub_pixel_avg_variance16x16, vpx_sad16x16x3, vpx_sad16x16x8, 1837 vp9_sub_pixel_avg_variance16x16, vpx_sad16x16x3, vpx_sad16x16x8,
1833 vpx_sad16x16x4d) 1838 vpx_sad16x16x4d)
1834 1839
1835 BFP(BLOCK_16X8, vpx_sad16x8, vpx_sad16x8_avg, 1840 BFP(BLOCK_16X8, vpx_sad16x8, vpx_sad16x8_avg,
1836 vp9_variance16x8, vp9_sub_pixel_variance16x8, 1841 vpx_variance16x8, vp9_sub_pixel_variance16x8,
1837 vp9_sub_pixel_avg_variance16x8, 1842 vp9_sub_pixel_avg_variance16x8,
1838 vpx_sad16x8x3, vpx_sad16x8x8, vpx_sad16x8x4d) 1843 vpx_sad16x8x3, vpx_sad16x8x8, vpx_sad16x8x4d)
1839 1844
1840 BFP(BLOCK_8X16, vpx_sad8x16, vpx_sad8x16_avg, 1845 BFP(BLOCK_8X16, vpx_sad8x16, vpx_sad8x16_avg,
1841 vp9_variance8x16, vp9_sub_pixel_variance8x16, 1846 vpx_variance8x16, vp9_sub_pixel_variance8x16,
1842 vp9_sub_pixel_avg_variance8x16, 1847 vp9_sub_pixel_avg_variance8x16,
1843 vpx_sad8x16x3, vpx_sad8x16x8, vpx_sad8x16x4d) 1848 vpx_sad8x16x3, vpx_sad8x16x8, vpx_sad8x16x4d)
1844 1849
1845 BFP(BLOCK_8X8, vpx_sad8x8, vpx_sad8x8_avg, 1850 BFP(BLOCK_8X8, vpx_sad8x8, vpx_sad8x8_avg,
1846 vp9_variance8x8, vp9_sub_pixel_variance8x8, 1851 vpx_variance8x8, vp9_sub_pixel_variance8x8,
1847 vp9_sub_pixel_avg_variance8x8, 1852 vp9_sub_pixel_avg_variance8x8,
1848 vpx_sad8x8x3, vpx_sad8x8x8, vpx_sad8x8x4d) 1853 vpx_sad8x8x3, vpx_sad8x8x8, vpx_sad8x8x4d)
1849 1854
1850 BFP(BLOCK_8X4, vpx_sad8x4, vpx_sad8x4_avg, 1855 BFP(BLOCK_8X4, vpx_sad8x4, vpx_sad8x4_avg,
1851 vp9_variance8x4, vp9_sub_pixel_variance8x4, 1856 vpx_variance8x4, vp9_sub_pixel_variance8x4,
1852 vp9_sub_pixel_avg_variance8x4, NULL, vpx_sad8x4x8, vpx_sad8x4x4d) 1857 vp9_sub_pixel_avg_variance8x4, NULL, vpx_sad8x4x8, vpx_sad8x4x4d)
1853 1858
1854 BFP(BLOCK_4X8, vpx_sad4x8, vpx_sad4x8_avg, 1859 BFP(BLOCK_4X8, vpx_sad4x8, vpx_sad4x8_avg,
1855 vp9_variance4x8, vp9_sub_pixel_variance4x8, 1860 vpx_variance4x8, vp9_sub_pixel_variance4x8,
1856 vp9_sub_pixel_avg_variance4x8, NULL, vpx_sad4x8x8, vpx_sad4x8x4d) 1861 vp9_sub_pixel_avg_variance4x8, NULL, vpx_sad4x8x8, vpx_sad4x8x4d)
1857 1862
1858 BFP(BLOCK_4X4, vpx_sad4x4, vpx_sad4x4_avg, 1863 BFP(BLOCK_4X4, vpx_sad4x4, vpx_sad4x4_avg,
1859 vp9_variance4x4, vp9_sub_pixel_variance4x4, 1864 vpx_variance4x4, vp9_sub_pixel_variance4x4,
1860 vp9_sub_pixel_avg_variance4x4, 1865 vp9_sub_pixel_avg_variance4x4,
1861 vpx_sad4x4x3, vpx_sad4x4x8, vpx_sad4x4x4d) 1866 vpx_sad4x4x3, vpx_sad4x4x8, vpx_sad4x4x4d)
1862 1867
1863 #if CONFIG_VP9_HIGHBITDEPTH 1868 #if CONFIG_VP9_HIGHBITDEPTH
1864 highbd_set_var_fns(cpi); 1869 highbd_set_var_fns(cpi);
1865 #endif 1870 #endif
1866 1871
1867 /* vp9_init_quantizer() is first called here. Add check in 1872 /* vp9_init_quantizer() is first called here. Add check in
1868 * vp9_frame_init_quantizer() so that vp9_init_quantizer is only 1873 * vp9_frame_init_quantizer() so that vp9_init_quantizer is only
1869 * called later when needed. This will avoid unnecessary calls of 1874 * called later when needed. This will avoid unnecessary calls of
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 variance(&a[(height - dh) * a_stride], a_stride, 2074 variance(&a[(height - dh) * a_stride], a_stride,
2070 &b[(height - dh) * b_stride], b_stride, 2075 &b[(height - dh) * b_stride], b_stride,
2071 width - dw, dh, &sse, &sum); 2076 width - dw, dh, &sse, &sum);
2072 total_sse += sse; 2077 total_sse += sse;
2073 } 2078 }
2074 2079
2075 for (y = 0; y < height / 16; ++y) { 2080 for (y = 0; y < height / 16; ++y) {
2076 const uint8_t *pa = a; 2081 const uint8_t *pa = a;
2077 const uint8_t *pb = b; 2082 const uint8_t *pb = b;
2078 for (x = 0; x < width / 16; ++x) { 2083 for (x = 0; x < width / 16; ++x) {
2079 vp9_mse16x16(pa, a_stride, pb, b_stride, &sse); 2084 vpx_mse16x16(pa, a_stride, pb, b_stride, &sse);
2080 total_sse += sse; 2085 total_sse += sse;
2081 2086
2082 pa += 16; 2087 pa += 16;
2083 pb += 16; 2088 pb += 16;
2084 } 2089 }
2085 2090
2086 a += 16 * a_stride; 2091 a += 16 * a_stride;
2087 b += 16 * b_stride; 2092 b += 16 * b_stride;
2088 } 2093 }
2089 2094
(...skipping 24 matching lines...) Expand all
2114 static int64_t highbd_get_sse(const uint8_t *a, int a_stride, 2119 static int64_t highbd_get_sse(const uint8_t *a, int a_stride,
2115 const uint8_t *b, int b_stride, 2120 const uint8_t *b, int b_stride,
2116 int width, int height) { 2121 int width, int height) {
2117 int64_t total_sse = 0; 2122 int64_t total_sse = 0;
2118 int x, y; 2123 int x, y;
2119 const int dw = width % 16; 2124 const int dw = width % 16;
2120 const int dh = height % 16; 2125 const int dh = height % 16;
2121 unsigned int sse = 0; 2126 unsigned int sse = 0;
2122 int sum = 0; 2127 int sum = 0;
2123 if (dw > 0) { 2128 if (dw > 0) {
2124 highbd_variance(&a[width - dw], a_stride, &b[width - dw], b_stride, 2129 highbd_8_variance(&a[width - dw], a_stride, &b[width - dw], b_stride,
2125 dw, height, &sse, &sum); 2130 dw, height, &sse, &sum);
2126 total_sse += sse; 2131 total_sse += sse;
2127 } 2132 }
2128 if (dh > 0) { 2133 if (dh > 0) {
2129 highbd_variance(&a[(height - dh) * a_stride], a_stride, 2134 highbd_8_variance(&a[(height - dh) * a_stride], a_stride,
2130 &b[(height - dh) * b_stride], b_stride, 2135 &b[(height - dh) * b_stride], b_stride,
2131 width - dw, dh, &sse, &sum); 2136 width - dw, dh, &sse, &sum);
2132 total_sse += sse; 2137 total_sse += sse;
2133 } 2138 }
2134 for (y = 0; y < height / 16; ++y) { 2139 for (y = 0; y < height / 16; ++y) {
2135 const uint8_t *pa = a; 2140 const uint8_t *pa = a;
2136 const uint8_t *pb = b; 2141 const uint8_t *pb = b;
2137 for (x = 0; x < width / 16; ++x) { 2142 for (x = 0; x < width / 16; ++x) {
2138 vp9_highbd_mse16x16(pa, a_stride, pb, b_stride, &sse); 2143 vpx_highbd_8_mse16x16(pa, a_stride, pb, b_stride, &sse);
2139 total_sse += sse; 2144 total_sse += sse;
2140 pa += 16; 2145 pa += 16;
2141 pb += 16; 2146 pb += 16;
2142 } 2147 }
2143 a += 16 * a_stride; 2148 a += 16 * a_stride;
2144 b += 16 * b_stride; 2149 b += 16 * b_stride;
2145 } 2150 }
2146 return total_sse; 2151 return total_sse;
2147 } 2152 }
2148 #endif // CONFIG_VP9_HIGHBITDEPTH 2153 #endif // CONFIG_VP9_HIGHBITDEPTH
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
2704 ref_frame); 2709 ref_frame);
2705 2710
2706 if (ref == NULL) { 2711 if (ref == NULL) {
2707 cpi->scaled_ref_idx[ref_frame - 1] = INVALID_IDX; 2712 cpi->scaled_ref_idx[ref_frame - 1] = INVALID_IDX;
2708 continue; 2713 continue;
2709 } 2714 }
2710 2715
2711 #if CONFIG_VP9_HIGHBITDEPTH 2716 #if CONFIG_VP9_HIGHBITDEPTH
2712 if (ref->y_crop_width != cm->width || ref->y_crop_height != cm->height) { 2717 if (ref->y_crop_width != cm->width || ref->y_crop_height != cm->height) {
2713 const int new_fb = get_free_fb(cm); 2718 const int new_fb = get_free_fb(cm);
2714 RefCntBuffer *const new_fb_ptr = &pool->frame_bufs[new_fb]; 2719 RefCntBuffer *new_fb_ptr = NULL;
2720 if (cm->new_fb_idx == INVALID_IDX)
2721 return;
2722 new_fb_ptr = &pool->frame_bufs[new_fb];
2715 cm->cur_frame = &pool->frame_bufs[new_fb]; 2723 cm->cur_frame = &pool->frame_bufs[new_fb];
2716 vp9_realloc_frame_buffer(&pool->frame_bufs[new_fb].buf, 2724 vp9_realloc_frame_buffer(&pool->frame_bufs[new_fb].buf,
2717 cm->width, cm->height, 2725 cm->width, cm->height,
2718 cm->subsampling_x, cm->subsampling_y, 2726 cm->subsampling_x, cm->subsampling_y,
2719 cm->use_highbitdepth, 2727 cm->use_highbitdepth,
2720 VP9_ENC_BORDER_IN_PIXELS, cm->byte_alignment, 2728 VP9_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
2721 NULL, NULL, NULL); 2729 NULL, NULL, NULL);
2722 scale_and_extend_frame(ref, &new_fb_ptr->buf, (int)cm->bit_depth); 2730 scale_and_extend_frame(ref, &new_fb_ptr->buf, (int)cm->bit_depth);
2723 #else 2731 #else
2724 if (ref->y_crop_width != cm->width || ref->y_crop_height != cm->height) { 2732 if (ref->y_crop_width != cm->width || ref->y_crop_height != cm->height) {
2725 const int new_fb = get_free_fb(cm); 2733 const int new_fb = get_free_fb(cm);
2726 RefCntBuffer *const new_fb_ptr = &pool->frame_bufs[new_fb]; 2734 RefCntBuffer *new_fb_ptr = NULL;
2735 if (cm->new_fb_idx == INVALID_IDX)
2736 return;
2737 new_fb_ptr = &pool->frame_bufs[new_fb];
2727 vp9_realloc_frame_buffer(&new_fb_ptr->buf, 2738 vp9_realloc_frame_buffer(&new_fb_ptr->buf,
2728 cm->width, cm->height, 2739 cm->width, cm->height,
2729 cm->subsampling_x, cm->subsampling_y, 2740 cm->subsampling_x, cm->subsampling_y,
2730 VP9_ENC_BORDER_IN_PIXELS, cm->byte_alignment, 2741 VP9_ENC_BORDER_IN_PIXELS, cm->byte_alignment,
2731 NULL, NULL, NULL); 2742 NULL, NULL, NULL);
2732 scale_and_extend_frame(ref, &new_fb_ptr->buf); 2743 scale_and_extend_frame(ref, &new_fb_ptr->buf);
2733 #endif // CONFIG_VP9_HIGHBITDEPTH 2744 #endif // CONFIG_VP9_HIGHBITDEPTH
2734 cpi->scaled_ref_idx[ref_frame - 1] = new_fb; 2745 cpi->scaled_ref_idx[ref_frame - 1] = new_fb;
2735 2746
2736 alloc_frame_mvs(cm, new_fb); 2747 alloc_frame_mvs(cm, new_fb);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2785 static void output_frame_level_debug_stats(VP9_COMP *cpi) { 2796 static void output_frame_level_debug_stats(VP9_COMP *cpi) {
2786 VP9_COMMON *const cm = &cpi->common; 2797 VP9_COMMON *const cm = &cpi->common;
2787 FILE *const f = fopen("tmp.stt", cm->current_video_frame ? "a" : "w"); 2798 FILE *const f = fopen("tmp.stt", cm->current_video_frame ? "a" : "w");
2788 int64_t recon_err; 2799 int64_t recon_err;
2789 2800
2790 vp9_clear_system_state(); 2801 vp9_clear_system_state();
2791 2802
2792 recon_err = vp9_get_y_sse(cpi->Source, get_frame_new_buffer(cm)); 2803 recon_err = vp9_get_y_sse(cpi->Source, get_frame_new_buffer(cm));
2793 2804
2794 if (cpi->twopass.total_left_stats.coded_error != 0.0) 2805 if (cpi->twopass.total_left_stats.coded_error != 0.0)
2795 fprintf(f, "%10u %dx%d %10d %10d %10d %10d" 2806 fprintf(f, "%10u %dx%d %d %d %10d %10d %10d %10d"
2796 "%10"PRId64" %10"PRId64" %10"PRId64" %10"PRId64" %10d " 2807 "%10"PRId64" %10"PRId64" %5d %5d %10"PRId64" "
2797 "%7.2lf %7.2lf %7.2lf %7.2lf %7.2lf" 2808 "%10"PRId64" %10"PRId64" %10d "
2809 "%7.2lf %7.2lf %7.2lf %7.2lf %7.2lf"
2798 "%6d %6d %5d %5d %5d " 2810 "%6d %6d %5d %5d %5d "
2799 "%10"PRId64" %10.3lf" 2811 "%10"PRId64" %10.3lf"
2800 "%10lf %8u %10"PRId64" %10d %10d\n", 2812 "%10lf %8u %10"PRId64" %10d %10d\n",
2801 cpi->common.current_video_frame, 2813 cpi->common.current_video_frame,
2802 cm->width, cm->height, 2814 cm->width, cm->height,
2815 cpi->rc.source_alt_ref_pending,
2816 cpi->rc.source_alt_ref_active,
2803 cpi->rc.this_frame_target, 2817 cpi->rc.this_frame_target,
2804 cpi->rc.projected_frame_size, 2818 cpi->rc.projected_frame_size,
2805 cpi->rc.projected_frame_size / cpi->common.MBs, 2819 cpi->rc.projected_frame_size / cpi->common.MBs,
2806 (cpi->rc.projected_frame_size - cpi->rc.this_frame_target), 2820 (cpi->rc.projected_frame_size - cpi->rc.this_frame_target),
2807 cpi->rc.vbr_bits_off_target, 2821 cpi->rc.vbr_bits_off_target,
2822 cpi->rc.vbr_bits_off_target_fast,
2823 cpi->twopass.extend_minq,
2824 cpi->twopass.extend_minq_fast,
2808 cpi->rc.total_target_vs_actual, 2825 cpi->rc.total_target_vs_actual,
2809 (cpi->rc.starting_buffer_level - cpi->rc.bits_off_target), 2826 (cpi->rc.starting_buffer_level - cpi->rc.bits_off_target),
2810 cpi->rc.total_actual_bits, cm->base_qindex, 2827 cpi->rc.total_actual_bits, cm->base_qindex,
2811 vp9_convert_qindex_to_q(cm->base_qindex, cm->bit_depth), 2828 vp9_convert_qindex_to_q(cm->base_qindex, cm->bit_depth),
2812 (double)vp9_dc_quant(cm->base_qindex, 0, cm->bit_depth) / 4.0, 2829 (double)vp9_dc_quant(cm->base_qindex, 0, cm->bit_depth) / 4.0,
2813 vp9_convert_qindex_to_q(cpi->twopass.active_worst_quality, 2830 vp9_convert_qindex_to_q(cpi->twopass.active_worst_quality,
2814 cm->bit_depth), 2831 cm->bit_depth),
2815 cpi->rc.avg_q, 2832 cpi->rc.avg_q,
2816 vp9_convert_qindex_to_q(cpi->oxcf.cq_level, cm->bit_depth), 2833 vp9_convert_qindex_to_q(cpi->oxcf.cq_level, cm->bit_depth),
2817 cpi->refresh_last_frame, cpi->refresh_golden_frame, 2834 cpi->refresh_last_frame, cpi->refresh_golden_frame,
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
2926 static void init_motion_estimation(VP9_COMP *cpi) { 2943 static void init_motion_estimation(VP9_COMP *cpi) {
2927 int y_stride = cpi->scaled_source.y_stride; 2944 int y_stride = cpi->scaled_source.y_stride;
2928 2945
2929 if (cpi->sf.mv.search_method == NSTEP) { 2946 if (cpi->sf.mv.search_method == NSTEP) {
2930 vp9_init3smotion_compensation(&cpi->ss_cfg, y_stride); 2947 vp9_init3smotion_compensation(&cpi->ss_cfg, y_stride);
2931 } else if (cpi->sf.mv.search_method == DIAMOND) { 2948 } else if (cpi->sf.mv.search_method == DIAMOND) {
2932 vp9_init_dsmotion_compensation(&cpi->ss_cfg, y_stride); 2949 vp9_init_dsmotion_compensation(&cpi->ss_cfg, y_stride);
2933 } 2950 }
2934 } 2951 }
2935 2952
2936 void set_frame_size(VP9_COMP *cpi) { 2953 static void set_frame_size(VP9_COMP *cpi) {
2937 int ref_frame; 2954 int ref_frame;
2938 VP9_COMMON *const cm = &cpi->common; 2955 VP9_COMMON *const cm = &cpi->common;
2939 VP9EncoderConfig *const oxcf = &cpi->oxcf; 2956 VP9EncoderConfig *const oxcf = &cpi->oxcf;
2940 MACROBLOCKD *const xd = &cpi->td.mb.e_mbd; 2957 MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
2941 2958
2942 if (oxcf->pass == 2 && 2959 if (oxcf->pass == 2 &&
2943 oxcf->rc_mode == VPX_VBR && 2960 oxcf->rc_mode == VPX_VBR &&
2944 ((oxcf->resize_mode == RESIZE_FIXED && cm->current_video_frame == 0) || 2961 ((oxcf->resize_mode == RESIZE_FIXED && cm->current_video_frame == 0) ||
2945 (oxcf->resize_mode == RESIZE_DYNAMIC && cpi->resize_pending))) { 2962 (oxcf->resize_mode == RESIZE_DYNAMIC && cpi->resize_pending))) {
2946 calculate_coded_size( 2963 calculate_coded_size(
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
3019 &cpi->scaled_last_source); 3036 &cpi->scaled_last_source);
3020 3037
3021 if (frame_is_intra_only(cm) == 0) { 3038 if (frame_is_intra_only(cm) == 0) {
3022 vp9_scale_references(cpi); 3039 vp9_scale_references(cpi);
3023 } 3040 }
3024 3041
3025 set_size_independent_vars(cpi); 3042 set_size_independent_vars(cpi);
3026 set_size_dependent_vars(cpi, &q, &bottom_index, &top_index); 3043 set_size_dependent_vars(cpi, &q, &bottom_index, &top_index);
3027 3044
3028 vp9_set_quantizer(cm, q); 3045 vp9_set_quantizer(cm, q);
3029 vp9_set_vbp_thresholds(cpi, q); 3046 vp9_set_variance_partition_thresholds(cpi, q);
3030 3047
3031 setup_frame(cpi); 3048 setup_frame(cpi);
3032 3049
3033 vp9_suppress_active_map(cpi); 3050 suppress_active_map(cpi);
3034 // Variance adaptive and in frame q adjustment experiments are mutually 3051 // Variance adaptive and in frame q adjustment experiments are mutually
3035 // exclusive. 3052 // exclusive.
3036 if (cpi->oxcf.aq_mode == VARIANCE_AQ) { 3053 if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
3037 vp9_vaq_frame_setup(cpi); 3054 vp9_vaq_frame_setup(cpi);
3038 } else if (cpi->oxcf.aq_mode == COMPLEXITY_AQ) { 3055 } else if (cpi->oxcf.aq_mode == COMPLEXITY_AQ) {
3039 vp9_setup_in_frame_q_adj(cpi); 3056 vp9_setup_in_frame_q_adj(cpi);
3040 } else if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) { 3057 } else if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) {
3041 vp9_cyclic_refresh_setup(cpi); 3058 vp9_cyclic_refresh_setup(cpi);
3042 } 3059 }
3043 vp9_apply_active_map(cpi); 3060 apply_active_map(cpi);
3044 3061
3045 // transform / motion compensation build reconstruction frame 3062 // transform / motion compensation build reconstruction frame
3046 vp9_encode_frame(cpi); 3063 vp9_encode_frame(cpi);
3047 3064
3048 // Update some stats from cyclic refresh, and check if we should not update 3065 // Update some stats from cyclic refresh, and check if we should not update
3049 // golden reference, for non-SVC 1 pass CBR. 3066 // golden reference, for non-SVC 1 pass CBR.
3050 if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ && 3067 if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ &&
3051 cm->frame_type != KEY_FRAME && 3068 cm->frame_type != KEY_FRAME &&
3052 !cpi->use_svc && 3069 !cpi->use_svc &&
3053 (cpi->oxcf.pass == 0 && cpi->oxcf.rc_mode == VPX_CBR)) 3070 (cpi->oxcf.pass == 0 && cpi->oxcf.rc_mode == VPX_CBR))
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
3387 arf_sign_bias = cpi->rc.source_alt_ref_active && 3404 arf_sign_bias = cpi->rc.source_alt_ref_active &&
3388 (!cpi->refresh_alt_ref_frame || 3405 (!cpi->refresh_alt_ref_frame ||
3389 (gf_group->rf_level[gf_group->index] == GF_ARF_LOW)); 3406 (gf_group->rf_level[gf_group->index] == GF_ARF_LOW));
3390 } else { 3407 } else {
3391 arf_sign_bias = 3408 arf_sign_bias =
3392 (cpi->rc.source_alt_ref_active && !cpi->refresh_alt_ref_frame); 3409 (cpi->rc.source_alt_ref_active && !cpi->refresh_alt_ref_frame);
3393 } 3410 }
3394 cm->ref_frame_sign_bias[ALTREF_FRAME] = arf_sign_bias; 3411 cm->ref_frame_sign_bias[ALTREF_FRAME] = arf_sign_bias;
3395 } 3412 }
3396 3413
3397 int setup_interp_filter_search_mask(VP9_COMP *cpi) { 3414 static int setup_interp_filter_search_mask(VP9_COMP *cpi) {
3398 INTERP_FILTER ifilter; 3415 INTERP_FILTER ifilter;
3399 int ref_total[MAX_REF_FRAMES] = {0}; 3416 int ref_total[MAX_REF_FRAMES] = {0};
3400 MV_REFERENCE_FRAME ref; 3417 MV_REFERENCE_FRAME ref;
3401 int mask = 0; 3418 int mask = 0;
3402 if (cpi->common.last_frame_type == KEY_FRAME || 3419 if (cpi->common.last_frame_type == KEY_FRAME ||
3403 cpi->refresh_alt_ref_frame) 3420 cpi->refresh_alt_ref_frame)
3404 return mask; 3421 return mask;
3405 for (ref = LAST_FRAME; ref <= ALTREF_FRAME; ++ref) 3422 for (ref = LAST_FRAME; ref <= ALTREF_FRAME; ++ref)
3406 for (ifilter = EIGHTTAP; ifilter <= EIGHTTAP_SHARP; ++ifilter) 3423 for (ifilter = EIGHTTAP; ifilter <= EIGHTTAP_SHARP; ++ifilter)
3407 ref_total[ref] += cpi->interp_filter_selected[ref][ifilter]; 3424 ref_total[ref] += cpi->interp_filter_selected[ref][ifilter];
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
3464 if (cm->error_resilient_mode) { 3481 if (cm->error_resilient_mode) {
3465 cm->frame_parallel_decoding_mode = 1; 3482 cm->frame_parallel_decoding_mode = 1;
3466 cm->reset_frame_context = 0; 3483 cm->reset_frame_context = 0;
3467 cm->refresh_frame_context = 0; 3484 cm->refresh_frame_context = 0;
3468 } else if (cm->intra_only) { 3485 } else if (cm->intra_only) {
3469 // Only reset the current context. 3486 // Only reset the current context.
3470 cm->reset_frame_context = 2; 3487 cm->reset_frame_context = 2;
3471 } 3488 }
3472 } 3489 }
3473 if (is_two_pass_svc(cpi) && cm->error_resilient_mode == 0) { 3490 if (is_two_pass_svc(cpi) && cm->error_resilient_mode == 0) {
3474 // Use the last frame context for the empty frame. 3491 // Use context 0 for intra only empty frame, but the last frame context
3492 // for other empty frames.
3493 if (cpi->svc.encode_empty_frame_state == ENCODING) {
3494 if (cpi->svc.encode_intra_empty_frame != 0)
3495 cm->frame_context_idx = 0;
3496 else
3497 cm->frame_context_idx = FRAME_CONTEXTS - 1;
3498 } else {
3475 cm->frame_context_idx = 3499 cm->frame_context_idx =
3476 (cpi->svc.encode_empty_frame_state == ENCODING) ? FRAME_CONTEXTS - 1 :
3477 cpi->svc.spatial_layer_id * cpi->svc.number_temporal_layers + 3500 cpi->svc.spatial_layer_id * cpi->svc.number_temporal_layers +
3478 cpi->svc.temporal_layer_id; 3501 cpi->svc.temporal_layer_id;
3502 }
3503
3504 cm->frame_parallel_decoding_mode = oxcf->frame_parallel_decoding_mode;
3479 3505
3480 // The probs will be updated based on the frame type of its previous 3506 // The probs will be updated based on the frame type of its previous
3481 // frame if frame_parallel_decoding_mode is 0. The type may vary for 3507 // frame if frame_parallel_decoding_mode is 0. The type may vary for
3482 // the frame after a key frame in base layer since we may drop enhancement 3508 // the frame after a key frame in base layer since we may drop enhancement
3483 // layers. So set frame_parallel_decoding_mode to 1 in this case. 3509 // layers. So set frame_parallel_decoding_mode to 1 in this case.
3484 if (cpi->svc.number_temporal_layers == 1) { 3510 if (cm->frame_parallel_decoding_mode == 0) {
3485 if (cpi->svc.spatial_layer_id == 0 && 3511 if (cpi->svc.number_temporal_layers == 1) {
3486 cpi->svc.layer_context[0].last_frame_type == KEY_FRAME) 3512 if (cpi->svc.spatial_layer_id == 0 &&
3487 cm->frame_parallel_decoding_mode = 1; 3513 cpi->svc.layer_context[0].last_frame_type == KEY_FRAME)
3488 else
3489 cm->frame_parallel_decoding_mode = 0;
3490 } else if (cpi->svc.spatial_layer_id == 0) {
3491 // Find the 2nd frame in temporal base layer and 1st frame in temporal
3492 // enhancement layers from the key frame.
3493 int i;
3494 for (i = 0; i < cpi->svc.number_temporal_layers; ++i) {
3495 if (cpi->svc.layer_context[0].frames_from_key_frame == 1 << i) {
3496 cm->frame_parallel_decoding_mode = 1; 3514 cm->frame_parallel_decoding_mode = 1;
3497 break; 3515 } else if (cpi->svc.spatial_layer_id == 0) {
3516 // Find the 2nd frame in temporal base layer and 1st frame in temporal
3517 // enhancement layers from the key frame.
3518 int i;
3519 for (i = 0; i < cpi->svc.number_temporal_layers; ++i) {
3520 if (cpi->svc.layer_context[0].frames_from_key_frame == 1 << i) {
3521 cm->frame_parallel_decoding_mode = 1;
3522 break;
3523 }
3498 } 3524 }
3499 } 3525 }
3500 if (i == cpi->svc.number_temporal_layers)
3501 cm->frame_parallel_decoding_mode = 0;
3502 } 3526 }
3503 } 3527 }
3504 3528
3505 // For 1 pass CBR, check if we are dropping this frame. 3529 // For 1 pass CBR, check if we are dropping this frame.
3506 // Never drop on key frame. 3530 // Never drop on key frame.
3507 if (oxcf->pass == 0 && 3531 if (oxcf->pass == 0 &&
3508 oxcf->rc_mode == VPX_CBR && 3532 oxcf->rc_mode == VPX_CBR &&
3509 cm->frame_type != KEY_FRAME) { 3533 cm->frame_type != KEY_FRAME) {
3510 if (vp9_rc_drop_frame(cpi)) { 3534 if (vp9_rc_drop_frame(cpi)) {
3511 vp9_rc_postencode_update_drop_frame(cpi); 3535 vp9_rc_postencode_update_drop_frame(cpi);
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
3781 return cm->frame_type == KEY_FRAME || 3805 return cm->frame_type == KEY_FRAME ||
3782 cpi->refresh_last_frame || 3806 cpi->refresh_last_frame ||
3783 cpi->refresh_golden_frame || 3807 cpi->refresh_golden_frame ||
3784 cpi->refresh_alt_ref_frame || 3808 cpi->refresh_alt_ref_frame ||
3785 cm->refresh_frame_context || 3809 cm->refresh_frame_context ||
3786 cm->lf.mode_ref_delta_update || 3810 cm->lf.mode_ref_delta_update ||
3787 cm->seg.update_map || 3811 cm->seg.update_map ||
3788 cm->seg.update_data; 3812 cm->seg.update_data;
3789 } 3813 }
3790 3814
3791 void adjust_frame_rate(VP9_COMP *cpi, 3815 static void adjust_frame_rate(VP9_COMP *cpi,
3792 const struct lookahead_entry *source) { 3816 const struct lookahead_entry *source) {
3793 int64_t this_duration; 3817 int64_t this_duration;
3794 int step = 0; 3818 int step = 0;
3795 3819
3796 if (source->ts_start == cpi->first_time_stamp_ever) { 3820 if (source->ts_start == cpi->first_time_stamp_ever) {
3797 this_duration = source->ts_end - source->ts_start; 3821 this_duration = source->ts_end - source->ts_start;
3798 step = 1; 3822 step = 1;
3799 } else { 3823 } else {
3800 int64_t last_duration = cpi->last_end_time_stamp_seen 3824 int64_t last_duration = cpi->last_end_time_stamp_seen
3801 - cpi->last_time_stamp_seen; 3825 - cpi->last_time_stamp_seen;
3802 3826
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
3867 cpi->refresh_last_frame = 0; 3891 cpi->refresh_last_frame = 0;
3868 } 3892 }
3869 } 3893 }
3870 3894
3871 #if CONFIG_INTERNAL_STATS 3895 #if CONFIG_INTERNAL_STATS
3872 extern double vp9_get_blockiness(const unsigned char *img1, int img1_pitch, 3896 extern double vp9_get_blockiness(const unsigned char *img1, int img1_pitch,
3873 const unsigned char *img2, int img2_pitch, 3897 const unsigned char *img2, int img2_pitch,
3874 int width, int height); 3898 int width, int height);
3875 #endif 3899 #endif
3876 3900
3877 void adjust_image_stat(double y, double u, double v, double all, ImageStat *s) { 3901 static void adjust_image_stat(double y, double u, double v, double all,
3902 ImageStat *s) {
3878 s->stat[Y] += y; 3903 s->stat[Y] += y;
3879 s->stat[U] += u; 3904 s->stat[U] += u;
3880 s->stat[V] += v; 3905 s->stat[V] += v;
3881 s->stat[ALL] += all; 3906 s->stat[ALL] += all;
3882 s->worst = MIN(s->worst, all); 3907 s->worst = MIN(s->worst, all);
3883 } 3908 }
3884 3909
3885 int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, 3910 int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
3886 size_t *size, uint8_t *dest, 3911 size_t *size, uint8_t *dest,
3887 int64_t *time_stamp, int64_t *time_end, int flush) { 3912 int64_t *time_stamp, int64_t *time_end, int flush) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
3955 #endif 3980 #endif
3956 3981
3957 if (oxcf->arnr_max_frames > 0) { 3982 if (oxcf->arnr_max_frames > 0) {
3958 // Produce the filtered ARF frame. 3983 // Produce the filtered ARF frame.
3959 vp9_temporal_filter(cpi, arf_src_index); 3984 vp9_temporal_filter(cpi, arf_src_index);
3960 vp9_extend_frame_borders(&cpi->alt_ref_buffer); 3985 vp9_extend_frame_borders(&cpi->alt_ref_buffer);
3961 force_src_buffer = &cpi->alt_ref_buffer; 3986 force_src_buffer = &cpi->alt_ref_buffer;
3962 } 3987 }
3963 3988
3964 cm->show_frame = 0; 3989 cm->show_frame = 0;
3990 cm->intra_only = 0;
3965 cpi->refresh_alt_ref_frame = 1; 3991 cpi->refresh_alt_ref_frame = 1;
3966 cpi->refresh_golden_frame = 0; 3992 cpi->refresh_golden_frame = 0;
3967 cpi->refresh_last_frame = 0; 3993 cpi->refresh_last_frame = 0;
3968 rc->is_src_frame_alt_ref = 0; 3994 rc->is_src_frame_alt_ref = 0;
3969 rc->source_alt_ref_pending = 0; 3995 rc->source_alt_ref_pending = 0;
3970 } else { 3996 } else {
3971 rc->source_alt_ref_pending = 0; 3997 rc->source_alt_ref_pending = 0;
3972 } 3998 }
3973 } 3999 }
3974 4000
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
4173 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, 4199 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
4174 "Failed to allocate post processing buffer"); 4200 "Failed to allocate post processing buffer");
4175 } 4201 }
4176 4202
4177 vp9_deblock(cm->frame_to_show, &cm->post_proc_buffer, 4203 vp9_deblock(cm->frame_to_show, &cm->post_proc_buffer,
4178 cm->lf.filter_level * 10 / 6); 4204 cm->lf.filter_level * 10 / 6);
4179 #endif 4205 #endif
4180 vp9_clear_system_state(); 4206 vp9_clear_system_state();
4181 4207
4182 #if CONFIG_VP9_HIGHBITDEPTH 4208 #if CONFIG_VP9_HIGHBITDEPTH
4183 calc_highbd_psnr(orig, pp, &psnr, cpi->td.mb.e_mbd.bd, 4209 calc_highbd_psnr(orig, pp, &psnr2, cpi->td.mb.e_mbd.bd,
4184 cpi->oxcf.input_bit_depth); 4210 cpi->oxcf.input_bit_depth);
4185 #else 4211 #else
4186 calc_psnr(orig, pp, &psnr2); 4212 calc_psnr(orig, pp, &psnr2);
4187 #endif // CONFIG_VP9_HIGHBITDEPTH 4213 #endif // CONFIG_VP9_HIGHBITDEPTH
4188 4214
4189 cpi->totalp_sq_error += psnr2.sse[0]; 4215 cpi->totalp_sq_error += psnr2.sse[0];
4190 cpi->totalp_samples += psnr2.samples[0]; 4216 cpi->totalp_samples += psnr2.samples[0];
4191 adjust_image_stat(psnr2.psnr[1], psnr2.psnr[2], psnr2.psnr[3], 4217 adjust_image_stat(psnr2.psnr[1], psnr2.psnr[2], psnr2.psnr[3],
4192 psnr2.psnr[0], &cpi->psnrp); 4218 psnr2.psnr[0], &cpi->psnrp);
4193 4219
(...skipping 30 matching lines...) Expand all
4224 FILE *f = fopen("q_used.stt", "a"); 4250 FILE *f = fopen("q_used.stt", "a");
4225 fprintf(f, "%5d : Y%f7.3:U%f7.3:V%f7.3:F%f7.3:S%7.3f\n", 4251 fprintf(f, "%5d : Y%f7.3:U%f7.3:V%f7.3:F%f7.3:S%7.3f\n",
4226 cpi->common.current_video_frame, y2, u2, v2, 4252 cpi->common.current_video_frame, y2, u2, v2,
4227 frame_psnr2, frame_ssim2); 4253 frame_psnr2, frame_ssim2);
4228 fclose(f); 4254 fclose(f);
4229 } 4255 }
4230 #endif 4256 #endif
4231 } 4257 }
4232 } 4258 }
4233 if (cpi->b_calculate_blockiness) { 4259 if (cpi->b_calculate_blockiness) {
4234 double frame_blockiness = vp9_get_blockiness( 4260 #if CONFIG_VP9_HIGHBITDEPTH
4235 cpi->Source->y_buffer, cpi->Source->y_stride, 4261 if (!cm->use_highbitdepth)
4236 cm->frame_to_show->y_buffer, cm->frame_to_show->y_stride, 4262 #endif
4237 cpi->Source->y_width, cpi->Source->y_height); 4263 {
4238 cpi->worst_blockiness = MAX(cpi->worst_blockiness, frame_blockiness); 4264 double frame_blockiness = vp9_get_blockiness(
4239 cpi->total_blockiness += frame_blockiness; 4265 cpi->Source->y_buffer, cpi->Source->y_stride,
4266 cm->frame_to_show->y_buffer, cm->frame_to_show->y_stride,
4267 cpi->Source->y_width, cpi->Source->y_height);
4268 cpi->worst_blockiness = MAX(cpi->worst_blockiness, frame_blockiness);
4269 cpi->total_blockiness += frame_blockiness;
4270 }
4240 } 4271 }
4241 4272
4242 if (cpi->b_calculate_consistency) { 4273 if (cpi->b_calculate_consistency) {
4243 double this_inconsistency = vp9_get_ssim_metrics( 4274 #if CONFIG_VP9_HIGHBITDEPTH
4244 cpi->Source->y_buffer, cpi->Source->y_stride, 4275 if (!cm->use_highbitdepth)
4245 cm->frame_to_show->y_buffer, cm->frame_to_show->y_stride, 4276 #endif
4246 cpi->Source->y_width, cpi->Source->y_height, cpi->ssim_vars, 4277 {
4247 &cpi->metrics, 1); 4278 double this_inconsistency = vp9_get_ssim_metrics(
4279 cpi->Source->y_buffer, cpi->Source->y_stride,
4280 cm->frame_to_show->y_buffer, cm->frame_to_show->y_stride,
4281 cpi->Source->y_width, cpi->Source->y_height, cpi->ssim_vars,
4282 &cpi->metrics, 1);
4248 4283
4249 const double peak = (double)((1 << cpi->oxcf.input_bit_depth) - 1); 4284 const double peak = (double)((1 << cpi->oxcf.input_bit_depth) - 1);
4250 4285 double consistency = vpx_sse_to_psnr(samples, peak,
4251
4252 double consistency = vpx_sse_to_psnr(samples, peak,
4253 (double)cpi->total_inconsistency); 4286 (double)cpi->total_inconsistency);
4254 4287 if (consistency > 0.0)
4255 if (consistency > 0.0) 4288 cpi->worst_consistency = MIN(cpi->worst_consistency,
4256 cpi->worst_consistency = MIN(cpi->worst_consistency, 4289 consistency);
4257 consistency); 4290 cpi->total_inconsistency += this_inconsistency;
4258 cpi->total_inconsistency += this_inconsistency; 4291 }
4259 } 4292 }
4260 4293
4261 if (cpi->b_calculate_ssimg) { 4294 if (cpi->b_calculate_ssimg) {
4262 double y, u, v, frame_all; 4295 double y, u, v, frame_all;
4263 #if CONFIG_VP9_HIGHBITDEPTH 4296 #if CONFIG_VP9_HIGHBITDEPTH
4264 if (cm->use_highbitdepth) { 4297 if (cm->use_highbitdepth) {
4265 frame_all = vp9_highbd_calc_ssimg(cpi->Source, cm->frame_to_show, &y, 4298 frame_all = vp9_highbd_calc_ssimg(cpi->Source, cm->frame_to_show, &y,
4266 &u, &v, (int)cm->bit_depth); 4299 &u, &v, (int)cm->bit_depth);
4267 } else { 4300 } else {
4268 frame_all = vp9_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, 4301 frame_all = vp9_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u,
4269 &v); 4302 &v);
4270 } 4303 }
4271 #else 4304 #else
4272 frame_all = vp9_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, &v); 4305 frame_all = vp9_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, &v);
4273 #endif // CONFIG_VP9_HIGHBITDEPTH 4306 #endif // CONFIG_VP9_HIGHBITDEPTH
4274 adjust_image_stat(y, u, v, frame_all, &cpi->ssimg); 4307 adjust_image_stat(y, u, v, frame_all, &cpi->ssimg);
4275 } 4308 }
4309 #if CONFIG_VP9_HIGHBITDEPTH
4310 if (!cm->use_highbitdepth)
4311 #endif
4276 { 4312 {
4277 double y, u, v, frame_all; 4313 double y, u, v, frame_all;
4278 frame_all = vp9_calc_fastssim(cpi->Source, cm->frame_to_show, &y, &u, 4314 frame_all = vp9_calc_fastssim(cpi->Source, cm->frame_to_show, &y, &u,
4279 &v); 4315 &v);
4280 adjust_image_stat(y, u, v, frame_all, &cpi->fastssim); 4316 adjust_image_stat(y, u, v, frame_all, &cpi->fastssim);
4281 /* TODO(JBB): add 10/12 bit support */ 4317 /* TODO(JBB): add 10/12 bit support */
4282 } 4318 }
4319 #if CONFIG_VP9_HIGHBITDEPTH
4320 if (!cm->use_highbitdepth)
4321 #endif
4283 { 4322 {
4284 double y, u, v, frame_all; 4323 double y, u, v, frame_all;
4285 frame_all = vp9_psnrhvs(cpi->Source, cm->frame_to_show, &y, &u, &v); 4324 frame_all = vp9_psnrhvs(cpi->Source, cm->frame_to_show, &y, &u, &v);
4286 adjust_image_stat(y, u, v, frame_all, &cpi->psnrhvs); 4325 adjust_image_stat(y, u, v, frame_all, &cpi->psnrhvs);
4287 } 4326 }
4288 } 4327 }
4289 } 4328 }
4290 4329
4291 #endif 4330 #endif
4292 4331
4293 if (is_two_pass_svc(cpi)) { 4332 if (is_two_pass_svc(cpi)) {
4294 if (cpi->svc.encode_empty_frame_state == ENCODING) 4333 if (cpi->svc.encode_empty_frame_state == ENCODING) {
4295 cpi->svc.encode_empty_frame_state = ENCODED; 4334 cpi->svc.encode_empty_frame_state = ENCODED;
4335 cpi->svc.encode_intra_empty_frame = 0;
4336 }
4296 4337
4297 if (cm->show_frame) { 4338 if (cm->show_frame) {
4298 ++cpi->svc.spatial_layer_to_encode; 4339 ++cpi->svc.spatial_layer_to_encode;
4299 if (cpi->svc.spatial_layer_to_encode >= cpi->svc.number_spatial_layers) 4340 if (cpi->svc.spatial_layer_to_encode >= cpi->svc.number_spatial_layers)
4300 cpi->svc.spatial_layer_to_encode = 0; 4341 cpi->svc.spatial_layer_to_encode = 0;
4301 4342
4302 // May need the empty frame after an visible frame. 4343 // May need the empty frame after an visible frame.
4303 cpi->svc.encode_empty_frame_state = NEED_TO_ENCODE; 4344 cpi->svc.encode_empty_frame_state = NEED_TO_ENCODE;
4304 } 4345 }
4305 } 4346 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
4456 if (flags & VP8_EFLAG_NO_UPD_ARF) 4497 if (flags & VP8_EFLAG_NO_UPD_ARF)
4457 upd ^= VP9_ALT_FLAG; 4498 upd ^= VP9_ALT_FLAG;
4458 4499
4459 vp9_update_reference(cpi, upd); 4500 vp9_update_reference(cpi, upd);
4460 } 4501 }
4461 4502
4462 if (flags & VP8_EFLAG_NO_UPD_ENTROPY) { 4503 if (flags & VP8_EFLAG_NO_UPD_ENTROPY) {
4463 vp9_update_entropy(cpi, 0); 4504 vp9_update_entropy(cpi, 0);
4464 } 4505 }
4465 } 4506 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_encodemv.c ('k') | source/libvpx/vp9/encoder/vp9_extend.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698