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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 struct scale_factors sf; | 425 struct scale_factors sf; |
426 | 426 |
427 // Apply context specific adjustments to the arnr filter parameters. | 427 // Apply context specific adjustments to the arnr filter parameters. |
428 adjust_arnr_filter(cpi, distance, rc->gfu_boost); | 428 adjust_arnr_filter(cpi, distance, rc->gfu_boost); |
429 strength = cpi->active_arnr_strength; | 429 strength = cpi->active_arnr_strength; |
430 frames_to_blur = cpi->active_arnr_frames; | 430 frames_to_blur = cpi->active_arnr_frames; |
431 frames_to_blur_backward = (frames_to_blur / 2); | 431 frames_to_blur_backward = (frames_to_blur / 2); |
432 frames_to_blur_forward = ((frames_to_blur - 1) / 2); | 432 frames_to_blur_forward = ((frames_to_blur - 1) / 2); |
433 start_frame = distance + frames_to_blur_forward; | 433 start_frame = distance + frames_to_blur_forward; |
434 | 434 |
435 // Setup scaling factors. Scaling on each of the arnr frames not supported. | |
436 vp9_setup_scale_factors_for_frame(&sf, | |
437 get_frame_new_buffer(cm)->y_crop_width, | |
438 get_frame_new_buffer(cm)->y_crop_height, | |
439 cm->width, cm->height); | |
440 | |
441 // Setup frame pointers, NULL indicates frame not included in filter. | 435 // Setup frame pointers, NULL indicates frame not included in filter. |
442 vp9_zero(cpi->frames); | 436 vp9_zero(cpi->frames); |
443 for (frame = 0; frame < frames_to_blur; ++frame) { | 437 for (frame = 0; frame < frames_to_blur; ++frame) { |
444 const int which_buffer = start_frame - frame; | 438 const int which_buffer = start_frame - frame; |
445 struct lookahead_entry *buf = vp9_lookahead_peek(cpi->lookahead, | 439 struct lookahead_entry *buf = vp9_lookahead_peek(cpi->lookahead, |
446 which_buffer); | 440 which_buffer); |
447 cpi->frames[frames_to_blur - 1 - frame] = &buf->img; | 441 cpi->frames[frames_to_blur - 1 - frame] = &buf->img; |
448 } | 442 } |
449 | 443 |
| 444 // Setup scaling factors. Scaling on each of the arnr frames is not supported |
| 445 if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) { |
| 446 // In spatial svc the scaling factors might be less then 1/2. So we will use |
| 447 // non-normative scaling. |
| 448 int frame_used = 0; |
| 449 vp9_setup_scale_factors_for_frame(&sf, |
| 450 get_frame_new_buffer(cm)->y_crop_width, |
| 451 get_frame_new_buffer(cm)->y_crop_height, |
| 452 get_frame_new_buffer(cm)->y_crop_width, |
| 453 get_frame_new_buffer(cm)->y_crop_height); |
| 454 |
| 455 for (frame = 0; frame < frames_to_blur; ++frame) { |
| 456 if (cm->mi_cols * MI_SIZE != cpi->frames[frame]->y_width || |
| 457 cm->mi_rows * MI_SIZE != cpi->frames[frame]->y_height) { |
| 458 if (vp9_realloc_frame_buffer(&cpi->svc.scaled_frames[frame_used], |
| 459 cm->width, cm->height, |
| 460 cm->subsampling_x, cm->subsampling_y, |
| 461 VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, |
| 462 NULL)) |
| 463 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, |
| 464 "Failed to reallocate alt_ref_buffer"); |
| 465 |
| 466 cpi->frames[frame] = |
| 467 vp9_scale_if_required(cm, cpi->frames[frame], |
| 468 &cpi->svc.scaled_frames[frame_used]); |
| 469 ++frame_used; |
| 470 } |
| 471 } |
| 472 } else { |
| 473 vp9_setup_scale_factors_for_frame(&sf, |
| 474 get_frame_new_buffer(cm)->y_crop_width, |
| 475 get_frame_new_buffer(cm)->y_crop_height, |
| 476 cm->width, cm->height); |
| 477 } |
| 478 |
450 temporal_filter_iterate_c(cpi, frames_to_blur, frames_to_blur_backward, | 479 temporal_filter_iterate_c(cpi, frames_to_blur, frames_to_blur_backward, |
451 strength, &sf); | 480 strength, &sf); |
452 } | 481 } |
OLD | NEW |