1 /* 2 * Copyright (c) 2023, Alliance for Open Media. All rights reserved 3 * 4 * This source code is subject to the terms of the BSD 3-Clause Clear License 5 * and the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear 6 * License was not distributed with this source code in the LICENSE file, you 7 * can obtain it at www.aomedia.org/license/software-license/bsd-3-c-c. If the 8 * Alliance for Open Media Patent License 1.0 was not distributed with this 9 * source code in the PATENTS file, you can obtain it at 10 * www.aomedia.org/license/patent. 11 */ 12 13 #ifndef CLI_RECON_GAIN_GENERATOR_H_ 14 #define CLI_RECON_GAIN_GENERATOR_H_ 15 16 #include "absl/status/status.h" 17 #include "iamf/cli/channel_label.h" 18 #include "iamf/cli/demixing_module.h" 19 20 namespace iamf_tools { 21 22 class ReconGainGenerator { 23 public: 24 /*!\brief Computes the recon gain for the input channel. 25 * 26 * \param label Label of the channel to compute. 27 * \param label_to_samples Mapping from channel labels to original samples. 28 * \param label_to_decoded_samples Mapping from channel labels to decoded 29 * samples. 30 * \param additional_logging Whether to enable additinal logging. 31 * \param recon_gain Result in the range [0, 1]. 32 * \return `absl::OkStatus()` on success. A specific status on failure. 33 */ 34 static absl::Status ComputeReconGain( 35 ChannelLabel::Label label, const LabelSamplesMap& label_to_samples, 36 const LabelSamplesMap& label_to_decoded_samples, bool additional_logging, 37 double& recon_gain); 38 }; 39 40 } // namespace iamf_tools 41 42 #endif // CLI_RECON_GAIN_GENERATOR_H_ 43