1// Copyright (C) 2024 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto2";
16
17// Changes to this file require manaul update of the AOSP Go code.
18// update the go code with:
19//   aprotoc --go_out=paths=source_relative:. \
20//     cts/tests/mediapc/requirements/mpc.proto \
21//     cts/tests/mediapc/requirements/requirements.proto
22
23package android.media.performanceclass.requirements;
24
25import "cts/tests/mediapc/requirements/mpc.proto";
26
27option java_multiple_files = true;
28
29option go_package = "cts/test/mediapc/requirements/requirements_go_proto";
30
31// A list of requirements.
32message RequirementList {
33  repeated Requirement requirements = 1;
34  // All valid MPC levels
35  repeated int64 all_mpcs = 2 [packed = true];
36}
37
38// A Media Performance Class Requirement with required measurements and
39// specifications including required values for each relevant MPC level.
40message Requirement {
41  // ID exactly as shown in the CDD
42  optional string id = 1;
43  // Short human readable name. Must be unique.
44  optional string name = 2;
45  optional string description = 3;
46  optional Group group = 4;
47
48  map<int64, RequirementSpec> specs = 5;
49
50  // measurement_id to RequiredMeasurements
51  // The measurement_id is a field name safe string.
52  map<string, RequiredMeasurement> measurements = 6;
53
54  // Whether this requirement is a non-CTS test. Cts tests require fields in the
55  // test cases proto to be repeated fields. Non-Cts tests need optional fields.
56  optional bool is_non_cts_test = 7 [default = false];
57
58  // variant_id to Variant
59  //
60  // The variant_id is a field name safe string.
61  map<string, Variant> variants = 57;
62}
63
64message RequirementSpec {
65  optional android.media.performanceclass.MediaPerformanceClass mpc =
66      1;
67  // The specification of the requirement at the given MPC level exactly as
68  // described in the CDD.
69  optional string specification = 3;
70
71  // measurement_id to RequiredMeasurements
72  //
73  // The measurement_id is a field name safe string.
74  // The measurement_id must match the id of a RequiredMeasurement in the parent
75  // Requirement.
76  map<string, RequiredValue> required_values = 4;
77
78  // variant_id to VariantSpec
79  // The variant_id is a field name safe string.
80  map<string, VariantSpec> variant_specs = 5;
81}
82
83enum Group {
84  GROUP_UNSPECIFIED = 0;
85  GROUP_MEDIA = 1;
86  GROUP_CAMERA = 2;
87  GROUP_HARDWARE = 3;
88  GROUP_PERFORMANCE = 4;
89}
90
91// A required measurement needed verifiy a MPC requirement.
92message RequiredMeasurement {
93  // The id is a field name safe string.
94  optional string id = 1;
95  optional string description = 2;
96  optional MeasurementType measurement_type = 3;
97  optional Comparison comparison = 4;
98
99  // Whether this measurement is used to differentiate between tests. Some
100  // requirements have multiple tests that test for different performance
101  // classes. ex: 5.1/H-1-2.
102  optional bool is_test_differentiator = 5 [default = false];
103}
104
105// A required value for a RequiredMeasurement at a given MPC level.
106message RequiredValue {
107  // The id is a field name safe string.
108  optional string id = 1;
109  reserved 2;  // comparison
110  oneof value {
111    string string_value = 3;
112    int64 int_value = 4;
113    double double_value = 5;
114    bool bool_value = 6;
115    int64 long_value = 7;
116  }
117}
118
119// Variants are used when an alternative set of required values should apply
120message Variant {
121  // When the variant should be used.
122  optional string description = 1;
123}
124
125// The set values required for a variant
126message VariantSpec {
127  // measurement_id to RequiredMeasurements
128  //
129  // The measurement_id is a field name safe string.
130  // The measurement_id must match the id of a RequiredMeasurement in the parent
131  // Requirement.
132  map<string, RequiredValue> required_values = 4;
133}
134
135enum Comparison {
136  COMPARISON_UNSPECIFIED = 0;
137  COMPARISON_EQUAL = 1;
138  COMPARISON_LESS_THAN = 2;
139  COMPARISON_LESS_THAN_OR_EQUAL = 3;
140  COMPARISON_GREATER_THAN = 4;
141  COMPARISON_GREATER_THAN_OR_EQUAL = 5;
142  COMPARISON_INFO_ONLY = 6;
143}
144
145enum MeasurementType {
146  MEASUREMENT_TYPE_UNSPECIFIED = 0;
147  MEASUREMENT_TYPE_BOOL = 1;
148  MEASUREMENT_TYPE_DOUBLE = 2;
149  MEASUREMENT_TYPE_INT = 3;
150  MEASUREMENT_TYPE_STRING = 4;
151  MEASUREMENT_TYPE_LONG = 5;
152}
153