1*77c1e3ccSAndroid Build Coastguard Worker /* 2*77c1e3ccSAndroid Build Coastguard Worker * Copyright (c) 2021, Alliance for Open Media. All rights reserved. 3*77c1e3ccSAndroid Build Coastguard Worker * 4*77c1e3ccSAndroid Build Coastguard Worker * This source code is subject to the terms of the BSD 2 Clause License and 5*77c1e3ccSAndroid Build Coastguard Worker * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6*77c1e3ccSAndroid Build Coastguard Worker * was not distributed with this source code in the LICENSE file, you can 7*77c1e3ccSAndroid Build Coastguard Worker * obtain it at www.aomedia.org/license/software. If the Alliance for Open 8*77c1e3ccSAndroid Build Coastguard Worker * Media Patent License 1.0 was not distributed with this source code in the 9*77c1e3ccSAndroid Build Coastguard Worker * PATENTS file, you can obtain it at www.aomedia.org/license/patent. 10*77c1e3ccSAndroid Build Coastguard Worker */ 11*77c1e3ccSAndroid Build Coastguard Worker 12*77c1e3ccSAndroid Build Coastguard Worker #ifndef AOM_AV1_ENCODER_TUNE_BUTTERAUGLI_H_ 13*77c1e3ccSAndroid Build Coastguard Worker #define AOM_AV1_ENCODER_TUNE_BUTTERAUGLI_H_ 14*77c1e3ccSAndroid Build Coastguard Worker 15*77c1e3ccSAndroid Build Coastguard Worker #include "aom_scale/yv12config.h" 16*77c1e3ccSAndroid Build Coastguard Worker #include "av1/common/enums.h" 17*77c1e3ccSAndroid Build Coastguard Worker #include "av1/encoder/ratectrl.h" 18*77c1e3ccSAndroid Build Coastguard Worker #include "av1/encoder/block.h" 19*77c1e3ccSAndroid Build Coastguard Worker 20*77c1e3ccSAndroid Build Coastguard Worker typedef struct { 21*77c1e3ccSAndroid Build Coastguard Worker // Stores the scaling factors for rdmult when tuning for Butteraugli. 22*77c1e3ccSAndroid Build Coastguard Worker // rdmult_scaling_factors[row * num_cols + col] stores the scaling factors for 23*77c1e3ccSAndroid Build Coastguard Worker // 4x4 block at (row, col). 24*77c1e3ccSAndroid Build Coastguard Worker double *rdmult_scaling_factors; 25*77c1e3ccSAndroid Build Coastguard Worker YV12_BUFFER_CONFIG source, resized_source; 26*77c1e3ccSAndroid Build Coastguard Worker bool recon_set; 27*77c1e3ccSAndroid Build Coastguard Worker } TuneButteraugliInfo; 28*77c1e3ccSAndroid Build Coastguard Worker 29*77c1e3ccSAndroid Build Coastguard Worker struct AV1_COMP; 30*77c1e3ccSAndroid Build Coastguard Worker static const BLOCK_SIZE butteraugli_rdo_bsize = BLOCK_16X16; 31*77c1e3ccSAndroid Build Coastguard Worker 32*77c1e3ccSAndroid Build Coastguard Worker void av1_set_butteraugli_rdmult(const struct AV1_COMP *cpi, MACROBLOCK *x, 33*77c1e3ccSAndroid Build Coastguard Worker BLOCK_SIZE bsize, int mi_row, int mi_col, 34*77c1e3ccSAndroid Build Coastguard Worker int *rdmult); 35*77c1e3ccSAndroid Build Coastguard Worker 36*77c1e3ccSAndroid Build Coastguard Worker void av1_setup_butteraugli_source(struct AV1_COMP *cpi); 37*77c1e3ccSAndroid Build Coastguard Worker 38*77c1e3ccSAndroid Build Coastguard Worker // 'K' is used to balance the rate-distortion distribution between PSNR 39*77c1e3ccSAndroid Build Coastguard Worker // and Butteraugli. 40*77c1e3ccSAndroid Build Coastguard Worker void av1_setup_butteraugli_rdmult_and_restore_source(struct AV1_COMP *cpi, 41*77c1e3ccSAndroid Build Coastguard Worker double K); 42*77c1e3ccSAndroid Build Coastguard Worker 43*77c1e3ccSAndroid Build Coastguard Worker void av1_setup_butteraugli_rdmult(struct AV1_COMP *cpi); 44*77c1e3ccSAndroid Build Coastguard Worker 45*77c1e3ccSAndroid Build Coastguard Worker #endif // AOM_AV1_ENCODER_TUNE_BUTTERAUGLI_H_ 46