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

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

Issue 592203002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 3 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) 2013 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 base_ratio = 1.5; 68 base_ratio = 1.5;
69 69
70 for (i = ENERGY_MIN; i <= ENERGY_MAX; i++) { 70 for (i = ENERGY_MIN; i <= ENERGY_MAX; i++) {
71 Q_RATIO(i) = pow(base_ratio, i/3.0); 71 Q_RATIO(i) = pow(base_ratio, i/3.0);
72 } 72 }
73 } 73 }
74 74
75 void vp9_vaq_frame_setup(VP9_COMP *cpi) { 75 void vp9_vaq_frame_setup(VP9_COMP *cpi) {
76 VP9_COMMON *cm = &cpi->common; 76 VP9_COMMON *cm = &cpi->common;
77 struct segmentation *seg = &cm->seg; 77 struct segmentation *seg = &cm->seg;
78 const double base_q = vp9_convert_qindex_to_q(cm->base_qindex); 78 const double base_q = vp9_convert_qindex_to_q(cm->base_qindex, cm->bit_depth);
79 const int base_rdmult = vp9_compute_rd_mult(cpi, cm->base_qindex + 79 const int base_rdmult = vp9_compute_rd_mult(cpi, cm->base_qindex +
80 cm->y_dc_delta_q); 80 cm->y_dc_delta_q);
81 int i; 81 int i;
82 82
83 if (cm->frame_type == KEY_FRAME || 83 if (cm->frame_type == KEY_FRAME ||
84 cpi->refresh_alt_ref_frame || 84 cpi->refresh_alt_ref_frame ||
85 (cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref)) { 85 (cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref)) {
86 vp9_enable_segmentation(seg); 86 vp9_enable_segmentation(seg);
87 vp9_clearall_segfeatures(seg); 87 vp9_clearall_segfeatures(seg);
88 88
89 seg->abs_delta = SEGMENT_DELTADATA; 89 seg->abs_delta = SEGMENT_DELTADATA;
90 90
91 vp9_clear_system_state(); 91 vp9_clear_system_state();
92 92
93 for (i = ENERGY_MIN; i <= ENERGY_MAX; i++) { 93 for (i = ENERGY_MIN; i <= ENERGY_MAX; i++) {
94 int qindex_delta, segment_rdmult; 94 int qindex_delta, segment_rdmult;
95 95
96 if (Q_RATIO(i) == 1) { 96 if (Q_RATIO(i) == 1) {
97 // No need to enable SEG_LVL_ALT_Q for this segment 97 // No need to enable SEG_LVL_ALT_Q for this segment
98 RDMULT_RATIO(i) = 1; 98 RDMULT_RATIO(i) = 1;
99 continue; 99 continue;
100 } 100 }
101 101
102 qindex_delta = vp9_compute_qdelta(&cpi->rc, base_q, base_q * Q_RATIO(i)); 102 qindex_delta = vp9_compute_qdelta(&cpi->rc, base_q, base_q * Q_RATIO(i),
103 cm->bit_depth);
103 vp9_set_segdata(seg, SEGMENT_ID(i), SEG_LVL_ALT_Q, qindex_delta); 104 vp9_set_segdata(seg, SEGMENT_ID(i), SEG_LVL_ALT_Q, qindex_delta);
104 vp9_enable_segfeature(seg, SEGMENT_ID(i), SEG_LVL_ALT_Q); 105 vp9_enable_segfeature(seg, SEGMENT_ID(i), SEG_LVL_ALT_Q);
105 106
106 segment_rdmult = vp9_compute_rd_mult(cpi, cm->base_qindex + qindex_delta + 107 segment_rdmult = vp9_compute_rd_mult(cpi, cm->base_qindex + qindex_delta +
107 cm->y_dc_delta_q); 108 cm->y_dc_delta_q);
108 109
109 RDMULT_RATIO(i) = (double) segment_rdmult / base_rdmult; 110 RDMULT_RATIO(i) = (double) segment_rdmult / base_rdmult;
110 } 111 }
111 } 112 }
112 } 113 }
(...skipping 26 matching lines...) Expand all
139 140
140 int vp9_block_energy(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs) { 141 int vp9_block_energy(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs) {
141 double energy; 142 double energy;
142 unsigned int var = block_variance(cpi, x, bs); 143 unsigned int var = block_variance(cpi, x, bs);
143 144
144 vp9_clear_system_state(); 145 vp9_clear_system_state();
145 146
146 energy = 0.9 * (log(var + 1.0) - 10.0); 147 energy = 0.9 * (log(var + 1.0) - 10.0);
147 return clamp((int)round(energy), ENERGY_MIN, ENERGY_MAX); 148 return clamp((int)round(energy), ENERGY_MIN, ENERGY_MAX);
148 } 149 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_aq_cyclicrefresh.c ('k') | source/libvpx/vp9/encoder/vp9_bitstream.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698