OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 | 138 |
139 void vp9_pick_filter_level(const YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi, | 139 void vp9_pick_filter_level(const YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi, |
140 LPF_PICK_METHOD method) { | 140 LPF_PICK_METHOD method) { |
141 VP9_COMMON *const cm = &cpi->common; | 141 VP9_COMMON *const cm = &cpi->common; |
142 struct loopfilter *const lf = &cm->lf; | 142 struct loopfilter *const lf = &cm->lf; |
143 | 143 |
144 lf->sharpness_level = cm->frame_type == KEY_FRAME ? 0 | 144 lf->sharpness_level = cm->frame_type == KEY_FRAME ? 0 |
145 : cpi->oxcf.sharpness; | 145 : cpi->oxcf.sharpness; |
146 | 146 |
147 if (method == LPF_PICK_FROM_Q) { | 147 if (method == LPF_PICK_MINIMAL_LPF && lf->filter_level) { |
| 148 lf->filter_level = 0; |
| 149 } else if (method >= LPF_PICK_FROM_Q) { |
148 const int min_filter_level = 0; | 150 const int min_filter_level = 0; |
149 const int max_filter_level = get_max_filter_level(cpi); | 151 const int max_filter_level = get_max_filter_level(cpi); |
150 const int q = vp9_ac_quant(cm->base_qindex, 0); | 152 const int q = vp9_ac_quant(cm->base_qindex, 0); |
151 // These values were determined by linear fitting the result of the | 153 // These values were determined by linear fitting the result of the |
152 // searched level, filt_guess = q * 0.316206 + 3.87252 | 154 // searched level, filt_guess = q * 0.316206 + 3.87252 |
153 int filt_guess = ROUND_POWER_OF_TWO(q * 20723 + 1015158, 18); | 155 int filt_guess = ROUND_POWER_OF_TWO(q * 20723 + 1015158, 18); |
154 if (cm->frame_type == KEY_FRAME) | 156 if (cm->frame_type == KEY_FRAME) |
155 filt_guess -= 4; | 157 filt_guess -= 4; |
156 lf->filter_level = clamp(filt_guess, min_filter_level, max_filter_level); | 158 lf->filter_level = clamp(filt_guess, min_filter_level, max_filter_level); |
157 } else { | 159 } else { |
158 lf->filter_level = search_filter_level(sd, cpi, | 160 lf->filter_level = search_filter_level(sd, cpi, |
159 method == LPF_PICK_FROM_SUBIMAGE); | 161 method == LPF_PICK_FROM_SUBIMAGE); |
160 } | 162 } |
161 } | 163 } |
OLD | NEW |