/* * Copyright (c) 2016, Alliance for Open Media. All rights reserved. * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License * was not distributed with this source code in the LICENSE file, you can * obtain it at www.aomedia.org/license/software. If the Alliance for Open * Media Patent License 1.0 was not distributed with this source code in the * PATENTS file, you can obtain it at www.aomedia.org/license/patent. */ #include <assert.h> #include <limits.h> #include "config/aom_scale_rtcd.h" #include "aom_dsp/aom_dsp_common.h" #include "aom_dsp/psnr.h" #include "aom_mem/aom_mem.h" #include "aom_ports/mem.h" #include "av1/common/av1_common_int.h" #include "av1/common/av1_loopfilter.h" #include "av1/common/quant_common.h" #include "av1/encoder/av1_quantize.h" #include "av1/encoder/encoder.h" #include "av1/encoder/picklpf.h" // AV1 loop filter applies to the whole frame according to mi_rows and mi_cols, // which are calculated based on aligned width and aligned height, // In addition, if super res is enabled, it copies the whole frame // according to the aligned width and height (av1_superres_upscale()). // So we need to copy the whole filtered region, instead of the cropped region. // For example, input image size is: 160x90. // Then src->y_crop_width = 160, src->y_crop_height = 90. // The aligned frame size is: src->y_width = 160, src->y_height = 96. // AV1 aligns frame size to a multiple of 8, if there is // chroma subsampling, it is able to ensure the chroma is also // an integer number of mi units. mi unit is 4x4, 8 = 4 * 2, and 2 luma mi // units correspond to 1 chroma mi unit if there is subsampling. // See: aom_realloc_frame_buffer() in yv12config.c. static void yv12_copy_plane(const YV12_BUFFER_CONFIG *src_bc, YV12_BUFFER_CONFIG *dst_bc, int plane) { … } static int get_max_filter_level(const AV1_COMP *cpi) { … } static int64_t try_filter_frame(const YV12_BUFFER_CONFIG *sd, AV1_COMP *const cpi, int filt_level, int partial_frame, int plane, int dir) { … } static int search_filter_level(const YV12_BUFFER_CONFIG *sd, AV1_COMP *cpi, int partial_frame, const int *last_frame_filter_level, int plane, int dir) { … } void av1_pick_filter_level(const YV12_BUFFER_CONFIG *sd, AV1_COMP *cpi, LPF_PICK_METHOD method) { … }