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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 /* Copy extra 4 so that full filter context is available if filtering done | 42 /* Copy extra 4 so that full filter context is available if filtering done |
43 * on the copied partial frame and not original. Partial filter does mb | 43 * on the copied partial frame and not original. Partial filter does mb |
44 * filtering for top row also, which can modify3 pixels above. | 44 * filtering for top row also, which can modify3 pixels above. |
45 */ | 45 */ |
46 linestocopy += 4; | 46 linestocopy += 4; |
47 /* partial image starts at ~middle of frame (macroblock border)*/ | 47 /* partial image starts at ~middle of frame (macroblock border)*/ |
48 yoffset = ystride * (((yheight >> 5) * 16) - 4); | 48 yoffset = ystride * (((yheight >> 5) * 16) - 4); |
49 src_y = src_ybc->y_buffer + yoffset; | 49 src_y = src_ybc->y_buffer + yoffset; |
50 dst_y = dst_ybc->y_buffer + yoffset; | 50 dst_y = dst_ybc->y_buffer + yoffset; |
51 | 51 |
52 vpx_memcpy(dst_y, src_y, ystride * linestocopy); | 52 memcpy(dst_y, src_y, ystride * linestocopy); |
53 } | 53 } |
54 | 54 |
55 static int calc_partial_ssl_err(YV12_BUFFER_CONFIG *source, | 55 static int calc_partial_ssl_err(YV12_BUFFER_CONFIG *source, |
56 YV12_BUFFER_CONFIG *dest) | 56 YV12_BUFFER_CONFIG *dest) |
57 { | 57 { |
58 int i, j; | 58 int i, j; |
59 int Total = 0; | 59 int Total = 0; |
60 int srcoffset, dstoffset; | 60 int srcoffset, dstoffset; |
61 unsigned char *src = source->y_buffer; | 61 unsigned char *src = source->y_buffer; |
62 unsigned char *dst = dest->y_buffer; | 62 unsigned char *dst = dest->y_buffer; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 void vp8cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) | 136 void vp8cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) |
137 { | 137 { |
138 VP8_COMMON *cm = &cpi->common; | 138 VP8_COMMON *cm = &cpi->common; |
139 | 139 |
140 int best_err = 0; | 140 int best_err = 0; |
141 int filt_err = 0; | 141 int filt_err = 0; |
142 int min_filter_level = get_min_filter_level(cpi, cm->base_qindex); | 142 int min_filter_level = get_min_filter_level(cpi, cm->base_qindex); |
143 int max_filter_level = get_max_filter_level(cpi, cm->base_qindex); | 143 int max_filter_level = get_max_filter_level(cpi, cm->base_qindex); |
144 int filt_val; | 144 int filt_val; |
145 int best_filt_val = cm->filter_level; | 145 int best_filt_val; |
146 YV12_BUFFER_CONFIG * saved_frame = cm->frame_to_show; | 146 YV12_BUFFER_CONFIG * saved_frame = cm->frame_to_show; |
147 | 147 |
148 /* Replace unfiltered frame buffer with a new one */ | 148 /* Replace unfiltered frame buffer with a new one */ |
149 cm->frame_to_show = &cpi->pick_lf_lvl_frame; | 149 cm->frame_to_show = &cpi->pick_lf_lvl_frame; |
150 | 150 |
151 if (cm->frame_type == KEY_FRAME) | 151 if (cm->frame_type == KEY_FRAME) |
152 cm->sharpness_level = 0; | 152 cm->sharpness_level = 0; |
153 else | 153 else |
154 cm->sharpness_level = cpi->oxcf.Sharpness; | 154 cm->sharpness_level = cpi->oxcf.Sharpness; |
155 | 155 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 { | 267 { |
268 VP8_COMMON *cm = &cpi->common; | 268 VP8_COMMON *cm = &cpi->common; |
269 | 269 |
270 int best_err = 0; | 270 int best_err = 0; |
271 int filt_err = 0; | 271 int filt_err = 0; |
272 int min_filter_level = get_min_filter_level(cpi, cm->base_qindex); | 272 int min_filter_level = get_min_filter_level(cpi, cm->base_qindex); |
273 int max_filter_level = get_max_filter_level(cpi, cm->base_qindex); | 273 int max_filter_level = get_max_filter_level(cpi, cm->base_qindex); |
274 | 274 |
275 int filter_step; | 275 int filter_step; |
276 int filt_high = 0; | 276 int filt_high = 0; |
277 /* Start search at previous frame filter level */ | 277 int filt_mid; |
278 int filt_mid = cm->filter_level; | |
279 int filt_low = 0; | 278 int filt_low = 0; |
280 int filt_best; | 279 int filt_best; |
281 int filt_direction = 0; | 280 int filt_direction = 0; |
282 | 281 |
283 /* Bias against raising loop filter and in favor of lowering it */ | 282 /* Bias against raising loop filter and in favor of lowering it */ |
284 int Bias = 0; | 283 int Bias = 0; |
285 | 284 |
286 int ss_err[MAX_LOOP_FILTER + 1]; | 285 int ss_err[MAX_LOOP_FILTER + 1]; |
287 | 286 |
288 YV12_BUFFER_CONFIG * saved_frame = cm->frame_to_show; | 287 YV12_BUFFER_CONFIG * saved_frame = cm->frame_to_show; |
289 | 288 |
290 vpx_memset(ss_err, 0, sizeof(ss_err)); | 289 memset(ss_err, 0, sizeof(ss_err)); |
291 | 290 |
292 /* Replace unfiltered frame buffer with a new one */ | 291 /* Replace unfiltered frame buffer with a new one */ |
293 cm->frame_to_show = &cpi->pick_lf_lvl_frame; | 292 cm->frame_to_show = &cpi->pick_lf_lvl_frame; |
294 | 293 |
295 if (cm->frame_type == KEY_FRAME) | 294 if (cm->frame_type == KEY_FRAME) |
296 cm->sharpness_level = 0; | 295 cm->sharpness_level = 0; |
297 else | 296 else |
298 cm->sharpness_level = cpi->oxcf.Sharpness; | 297 cm->sharpness_level = cpi->oxcf.Sharpness; |
299 | 298 |
300 /* Start the search at the previous frame filter level unless it is | 299 /* Start the search at the previous frame filter level unless it is |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 filt_direction = (filt_best < filt_mid) ? -1 : 1; | 397 filt_direction = (filt_best < filt_mid) ? -1 : 1; |
399 filt_mid = filt_best; | 398 filt_mid = filt_best; |
400 } | 399 } |
401 } | 400 } |
402 | 401 |
403 cm->filter_level = filt_best; | 402 cm->filter_level = filt_best; |
404 | 403 |
405 /* restore unfiltered frame pointer */ | 404 /* restore unfiltered frame pointer */ |
406 cm->frame_to_show = saved_frame; | 405 cm->frame_to_show = saved_frame; |
407 } | 406 } |
OLD | NEW |