// Copyright (c) 2023, Alliance for Open Media. All rights reserved
//
// This source code is subject to the terms of the BSD 3-Clause Clear License
// and the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear
// License was not distributed with this source code in the LICENSE file, you
// can obtain it at www.aomedia.org/license/software-license/bsd-3-c-c. 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.

edition = "2023";

package iamf_tools_cli_proto;

import "iamf/cli/proto/parameter_data.proto";

// Valid proto enums start at index 1, which are different from the
// corresponding enums in C++, e.g. kParameterDefinitionMixGain = 0.
enum ParamDefinitionType {
  option features.enum_type = CLOSED;

  PARAM_DEFINITION_TYPE_INVALID = 0;
  PARAM_DEFINITION_TYPE_MIX_GAIN = 1;
  PARAM_DEFINITION_TYPE_DEMIXING = 2;
  PARAM_DEFINITION_TYPE_RECON_GAIN = 3;
  PARAM_DEFINITION_TYPE_RESERVED_3 = 4;
}

message ParamDefinition {
  uint32 parameter_id = 1;
  uint32 parameter_rate = 2;
  bool param_definition_mode = 3;
  uint32 reserved = 4;
  uint32 duration = 5;
  uint32 constant_subblock_duration = 7;
  // `num_subblocks` is ignored. The value in the bitstream is inferred based on
  // the number of `subblock_durations`.
  uint32 num_subblocks = 6 [deprecated = true];
  repeated uint32 subblock_durations = 8;
}

// Values are represented to align with the IAMF spec.
//
// See
// https://aomediacodec.github.io/iamf/v1.1.0.html#syntax-mixgain-parameter-definition
// for further details.
//
// To convert from dB to Q7.8, multiply by 256. Example:
//  - For -3 dB, set the proto value to 256 * -3 = -768.
//  - For +6 dB, set the proto value to 256 * 6 = 1536.
message MixGainParamDefinition {
  ParamDefinition param_definition = 1;
  int32 default_mix_gain = 2;  // Q7.8.
}

message DemixingParamDefinition {
  ParamDefinition param_definition = 1;
  DemixingInfoParameterData default_demixing_info_parameter_data = 2;
  uint32 default_w = 3;
  uint32 reserved = 4;
}

message ReconGainParamDefinition {
  ParamDefinition param_definition = 1;
}
