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

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

Issue 394353005: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
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
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 vp9_model_to_full_probs(p[t][i][j][k][l], probs); 85 vp9_model_to_full_probs(p[t][i][j][k][l], probs);
86 vp9_cost_tokens((int *)c[t][i][j][k][0][l], probs, 86 vp9_cost_tokens((int *)c[t][i][j][k][0][l], probs,
87 vp9_coef_tree); 87 vp9_coef_tree);
88 vp9_cost_tokens_skip((int *)c[t][i][j][k][1][l], probs, 88 vp9_cost_tokens_skip((int *)c[t][i][j][k][1][l], probs,
89 vp9_coef_tree); 89 vp9_coef_tree);
90 assert(c[t][i][j][k][0][l][EOB_TOKEN] == 90 assert(c[t][i][j][k][0][l][EOB_TOKEN] ==
91 c[t][i][j][k][1][l][EOB_TOKEN]); 91 c[t][i][j][k][1][l][EOB_TOKEN]);
92 } 92 }
93 } 93 }
94 94
95 static const uint8_t rd_iifactor[32] = {
96 4, 4, 3, 2, 1, 0, 0, 0,
97 0, 0, 0, 0, 0, 0, 0, 0,
98 0, 0, 0, 0, 0, 0, 0, 0,
99 0, 0, 0, 0, 0, 0, 0, 0,
100 };
101
102 // Values are now correlated to quantizer. 95 // Values are now correlated to quantizer.
103 static int sad_per_bit16lut[QINDEX_RANGE]; 96 static int sad_per_bit16lut[QINDEX_RANGE];
104 static int sad_per_bit4lut[QINDEX_RANGE]; 97 static int sad_per_bit4lut[QINDEX_RANGE];
105 98
106 void vp9_init_me_luts() { 99 void vp9_init_me_luts() {
107 int i; 100 int i;
108 101
109 // Initialize the sad lut tables using a formulaic calculation for now. 102 // Initialize the sad lut tables using a formulaic calculation for now.
110 // This is to make it easier to resolve the impact of experimental changes 103 // This is to make it easier to resolve the impact of experimental changes
111 // to the quantizer tables. 104 // to the quantizer tables.
112 for (i = 0; i < QINDEX_RANGE; ++i) { 105 for (i = 0; i < QINDEX_RANGE; ++i) {
113 const double q = vp9_convert_qindex_to_q(i); 106 const double q = vp9_convert_qindex_to_q(i);
114 sad_per_bit16lut[i] = (int)(0.0418 * q + 2.4107); 107 sad_per_bit16lut[i] = (int)(0.0418 * q + 2.4107);
115 sad_per_bit4lut[i] = (int)(0.063 * q + 2.742); 108 sad_per_bit4lut[i] = (int)(0.063 * q + 2.742);
116 } 109 }
117 } 110 }
118 111
112 static const int rd_boost_factor[16] = {
113 64, 32, 32, 32, 24, 16, 12, 12,
114 8, 8, 4, 4, 2, 2, 1, 0
115 };
116 static const int rd_frame_type_factor[FRAME_UPDATE_TYPES] = {
117 128, 144, 128, 128, 144
118 };
119
119 int vp9_compute_rd_mult(const VP9_COMP *cpi, int qindex) { 120 int vp9_compute_rd_mult(const VP9_COMP *cpi, int qindex) {
120 const int q = vp9_dc_quant(qindex, 0); 121 const int q = vp9_dc_quant(qindex, 0);
121 // TODO(debargha): Adjust the function below. 122 int rdmult = 88 * q * q / 24;
122 int rdmult = 88 * q * q / 25; 123
123 if (cpi->pass == 2 && (cpi->common.frame_type != KEY_FRAME)) { 124 if (cpi->pass == 2 && (cpi->common.frame_type != KEY_FRAME)) {
124 if (cpi->twopass.next_iiratio > 31) 125 const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
125 rdmult += (rdmult * rd_iifactor[31]) >> 4; 126 const FRAME_UPDATE_TYPE frame_type = gf_group->update_type[gf_group->index];
126 else 127 const int boost_index = MIN(15, (cpi->rc.gfu_boost / 100));
127 rdmult += (rdmult * rd_iifactor[cpi->twopass.next_iiratio]) >> 4; 128
129 rdmult = (rdmult * rd_frame_type_factor[frame_type]) >> 7;
130 rdmult += ((rdmult * rd_boost_factor[boost_index]) >> 7);
128 } 131 }
129 return rdmult; 132 return rdmult;
130 } 133 }
131 134
132 static int compute_rd_thresh_factor(int qindex) { 135 static int compute_rd_thresh_factor(int qindex) {
133 // TODO(debargha): Adjust the function below. 136 // TODO(debargha): Adjust the function below.
134 const int q = (int)(pow(vp9_dc_quant(qindex, 0) / 4.0, RD_THRESH_POW) * 5.12); 137 const int q = (int)(pow(vp9_dc_quant(qindex, 0) / 4.0, RD_THRESH_POW) * 5.12);
135 return MAX(q, 8); 138 return MAX(q, 8);
136 } 139 }
137 140
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 rd->thresh_mult_sub8x8[THR_GOLD] = INT_MAX; 574 rd->thresh_mult_sub8x8[THR_GOLD] = INT_MAX;
572 if (!(cpi->ref_frame_flags & VP9_ALT_FLAG)) 575 if (!(cpi->ref_frame_flags & VP9_ALT_FLAG))
573 rd->thresh_mult_sub8x8[THR_ALTR] = INT_MAX; 576 rd->thresh_mult_sub8x8[THR_ALTR] = INT_MAX;
574 if ((cpi->ref_frame_flags & (VP9_LAST_FLAG | VP9_ALT_FLAG)) != 577 if ((cpi->ref_frame_flags & (VP9_LAST_FLAG | VP9_ALT_FLAG)) !=
575 (VP9_LAST_FLAG | VP9_ALT_FLAG)) 578 (VP9_LAST_FLAG | VP9_ALT_FLAG))
576 rd->thresh_mult_sub8x8[THR_COMP_LA] = INT_MAX; 579 rd->thresh_mult_sub8x8[THR_COMP_LA] = INT_MAX;
577 if ((cpi->ref_frame_flags & (VP9_GOLD_FLAG | VP9_ALT_FLAG)) != 580 if ((cpi->ref_frame_flags & (VP9_GOLD_FLAG | VP9_ALT_FLAG)) !=
578 (VP9_GOLD_FLAG | VP9_ALT_FLAG)) 581 (VP9_GOLD_FLAG | VP9_ALT_FLAG))
579 rd->thresh_mult_sub8x8[THR_COMP_GA] = INT_MAX; 582 rd->thresh_mult_sub8x8[THR_COMP_GA] = INT_MAX;
580 } 583 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_ratectrl.c ('k') | source/libvpx/vp9/encoder/vp9_speed_features.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698