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

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

Issue 668403002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_mcomp.c ('k') | source/libvpx/vp9/encoder/vp9_pickmode.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
(...skipping 22 matching lines...) Expand all
33 } 33 }
34 34
35 35
36 static int try_filter_frame(const YV12_BUFFER_CONFIG *sd, VP9_COMP *const cpi, 36 static int try_filter_frame(const YV12_BUFFER_CONFIG *sd, VP9_COMP *const cpi,
37 int filt_level, int partial_frame) { 37 int filt_level, int partial_frame) {
38 VP9_COMMON *const cm = &cpi->common; 38 VP9_COMMON *const cm = &cpi->common;
39 int filt_err; 39 int filt_err;
40 40
41 vp9_loop_filter_frame(cm->frame_to_show, cm, &cpi->mb.e_mbd, filt_level, 1, 41 vp9_loop_filter_frame(cm->frame_to_show, cm, &cpi->mb.e_mbd, filt_level, 1,
42 partial_frame); 42 partial_frame);
43 #if CONFIG_VP9_HIGHBITDEPTH
44 if (cm->use_highbitdepth) {
45 filt_err = vp9_highbd_get_y_sse(sd, cm->frame_to_show, cm->bit_depth);
46 } else {
47 filt_err = vp9_get_y_sse(sd, cm->frame_to_show);
48 }
49 #else
43 filt_err = vp9_get_y_sse(sd, cm->frame_to_show); 50 filt_err = vp9_get_y_sse(sd, cm->frame_to_show);
51 #endif // CONFIG_VP9_HIGHBITDEPTH
44 52
45 // Re-instate the unfiltered frame 53 // Re-instate the unfiltered frame
46 vpx_yv12_copy_y(&cpi->last_frame_uf, cm->frame_to_show); 54 vpx_yv12_copy_y(&cpi->last_frame_uf, cm->frame_to_show);
47 55
48 return filt_err; 56 return filt_err;
49 } 57 }
50 58
51 static int search_filter_level(const YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi, 59 static int search_filter_level(const YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi,
52 int partial_frame) { 60 int partial_frame) {
53 const VP9_COMMON *const cm = &cpi->common; 61 const VP9_COMMON *const cm = &cpi->common;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 : cpi->oxcf.sharpness; 146 : cpi->oxcf.sharpness;
139 147
140 if (method == LPF_PICK_MINIMAL_LPF && lf->filter_level) { 148 if (method == LPF_PICK_MINIMAL_LPF && lf->filter_level) {
141 lf->filter_level = 0; 149 lf->filter_level = 0;
142 } else if (method >= LPF_PICK_FROM_Q) { 150 } else if (method >= LPF_PICK_FROM_Q) {
143 const int min_filter_level = 0; 151 const int min_filter_level = 0;
144 const int max_filter_level = get_max_filter_level(cpi); 152 const int max_filter_level = get_max_filter_level(cpi);
145 const int q = vp9_ac_quant(cm->base_qindex, 0, cm->bit_depth); 153 const int q = vp9_ac_quant(cm->base_qindex, 0, cm->bit_depth);
146 // These values were determined by linear fitting the result of the 154 // These values were determined by linear fitting the result of the
147 // searched level, filt_guess = q * 0.316206 + 3.87252 155 // searched level, filt_guess = q * 0.316206 + 3.87252
156 #if CONFIG_VP9_HIGHDEPTH
157 int filt_guess;
158 switch (cm->bit_depth) {
159 case VPX_BITS_8:
160 filt_guess = ROUND_POWER_OF_TWO(q * 20723 + 1015158, 18);
161 break;
162 case VPX_BITS_10:
163 filt_guess = ROUND_POWER_OF_TWO(q * 20723 + 4060632, 20);
164 break;
165 case VPX_BITS_12:
166 filt_guess = ROUND_POWER_OF_TWO(q * 20723 + 16242526, 22);
167 break;
168 default:
169 assert(0 && "bit_depth should be VPX_BITS_8, VPX_BITS_10 "
170 "or VPX_BITS_12");
171 return;
172 }
173 #else
148 int filt_guess = ROUND_POWER_OF_TWO(q * 20723 + 1015158, 18); 174 int filt_guess = ROUND_POWER_OF_TWO(q * 20723 + 1015158, 18);
175 #endif // CONFIG_VP9_HIGHBITDEPTH
149 if (cm->frame_type == KEY_FRAME) 176 if (cm->frame_type == KEY_FRAME)
150 filt_guess -= 4; 177 filt_guess -= 4;
151 lf->filter_level = clamp(filt_guess, min_filter_level, max_filter_level); 178 lf->filter_level = clamp(filt_guess, min_filter_level, max_filter_level);
152 } else { 179 } else {
153 lf->filter_level = search_filter_level(sd, cpi, 180 lf->filter_level = search_filter_level(sd, cpi,
154 method == LPF_PICK_FROM_SUBIMAGE); 181 method == LPF_PICK_FROM_SUBIMAGE);
155 } 182 }
156 } 183 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_mcomp.c ('k') | source/libvpx/vp9/encoder/vp9_pickmode.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698