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