1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the Licnse. 15 */ 16 17 package android.mediapc.cts.common; 18 19 import java.util.function.BiPredicate; 20 21 public class RequirementConstants { 22 private static final String TAG = RequirementConstants.class.getSimpleName(); 23 24 public static final String REPORT_LOG_NAME = "CtsMediaPerformanceClassTestCases"; 25 public static final String TN_FIELD_NAME = "test_name"; 26 public static final String PC_FIELD_NAME = "performance_class"; 27 28 public static final String R5_1__H_1_1 = "r5_1__h_1_1"; // 5.1/H-1-1 29 public static final String R5_1__H_1_2 = "r5_1__h_1_2"; // 5.1/H-1-2 30 public static final String R5_1__H_1_3 = "r5_1__h_1_3"; // 5.1/H-1-3 31 public static final String R5_1__H_1_4 = "r5_1__h_1_4"; // 5.1/H-1-4 32 public static final String R5_1__H_1_5 = "r5_1__h_1_5"; // 5.1/H-1-5 33 public static final String R5_1__H_1_6 = "r5_1__h_1_6"; // 5.1/H-1-6 34 public static final String R5_1__H_1_7 = "r5_1__h_1_7"; // 5.1/H-1-7 35 public static final String R5_1__H_1_8 = "r5_1__h_1_8"; // 5.1/H-1-8 36 public static final String R5_1__H_1_9 = "r5_1__h_1_9"; // 5.1/H-1-9 37 public static final String R5_1__H_1_10 = "r5_1__h_1_10"; // 5.1/H-1-10 38 public static final String R5_1__H_1_11 = "r5_1__h_1_11"; // 5.1/H-1-11 39 public static final String R5_1__H_1_12 = "r5_1__h_1_12"; // 5.1/H-1-12 40 public static final String R5_1__H_1_13 = "r5_1__h_1_13"; // 5.1/H-1-13 41 public static final String R5_1__H_1_14 = "r5_1__h_1_14"; // 5.1/H-1-14 42 public static final String R5_1__H_1_15 = "r5_1__h_1_15"; // 5.1/H-1-16 43 public static final String R5_1__H_1_16 = "r5_1__h_1_16"; // 5.1/H-1-16 44 public static final String R5_3__H_1_1 = "r5_3__h_1_1"; // 5.3/H-1-1 45 public static final String R5_3__H_1_2 = "r5_3__h_1_2"; // 5.3/H-1-2 46 public static final String R5_6__H_1_1 = "r5_6__h_1_1"; // 5.6/H-1-1 47 public static final String R5_7__H_1_1 = "r5_7__h_1_1"; // 5.7/H-1-1 48 public static final String R5_7__H_1_2 = "r5_7__h_1_2"; // 5.7/H-1-2 49 public static final String R7_5__H_1_1 = "r7_5__h_1_1"; // 7.5/H-1-1 50 public static final String R7_5__H_1_2 = "r7_5__h_1_2"; // 7.5/H-1-2 51 public static final String R7_5__H_1_3 = "r7_5__h_1_3"; // 7.5/H-1-3 52 public static final String R7_5__H_1_4 = "r7_5__h_1_4"; // 7.5/H-1-4 53 54 // these includes "its" because the proto in google3 was originally implemented incorrectly 55 public static final String R7_5__H_1_5 = "r7_5__h_1_5__its"; // 7.5/H-1-5 56 public static final String R7_5__H_1_6 = "r7_5__h_1_6__its"; // 7.5/H-1-6 57 58 public static final String R7_5__H_1_8 = "r7_5__h_1_8"; // 7.5/H-1-8 59 public static final String R7_5__H_1_9 = "r7_5__h_1_9"; // 7.5/H-1-9 60 public static final String R7_5__H_1_10 = "r7_5__h_1_10"; // 7.5/H-1-10 61 public static final String R7_5__H_1_11 = "r7_5__h_1_11"; // 7.5/H-1-11 62 public static final String R7_5__H_1_12 = "r7_5__h_1_12"; // 7.5/H-1-12 63 public static final String R7_5__H_1_13 = "r7_5__h_1_13"; // 7.5/H-1-13 64 public static final String R7_5__H_1_14 = "r7_5__h_1_14"; // 7.5/H-1-14 65 public static final String R7_1_1_1__H_1_1 = "r7_1_1_1__h_1_1"; // 7.1.1.1/H-1-1 66 public static final String R7_1_1_3__H_1_1 = "r7_1_1_3__h_1_1"; // 7.1.1.3/H-1-1 67 public static final String R7_6_1__H_1_1 = "r7_6_1__h_1_1"; // 7.6.1/H-1-1 68 public static final String R7_1_1_1__H_2_1 = "r7_1_1_1__h_2_1"; // 7.1.1.1/H-2-1 69 public static final String R7_1_1_3__H_2_1 = "r7_1_1_3__h_2_1"; // 7.1.1.3/H-2-1 70 public static final String R7_6_1__H_2_1 = "r7_6_1__h_2_1"; // 7.6.1/H-2-1 71 public static final String R7_6_1__H_3_1 = "r7_6_1__h_3_1"; // 7.6.1/H-3-1 72 public static final String R8_2__H_1_1 = "r8_2__h_1_1"; // 8.2/H-1-1 73 public static final String R8_2__H_1_2 = "r8_2__h_1_2"; // 8.2/H-1-2 74 public static final String R8_2__H_1_3 = "r8_2__h_1_3"; // 8.2/H-1-3 75 public static final String R8_2__H_1_4 = "r8_2__h_1_4"; // 8.2/H-1-4 76 public static final String R8_2__H_2_1 = "r8_2__h_2_1"; // 8.2/H-2-1 77 public static final String R8_2__H_2_2 = "r8_2__h_2_2"; // 8.2/H-2-2 78 public static final String R8_2__H_2_3 = "r8_2__h_2_3"; // 8.2/H-2-3 79 public static final String R8_2__H_2_4 = "r8_2__h_2_4"; // 8.2/H-2-4 80 public static final String RTBD = "tbd"; // placeholder for requirements without a set id 81 82 public static final String CONCURRENT_SESSIONS = "concurrent_sessions"; 83 public static final String TEST_RESOLUTION = "resolution"; 84 public static final String CONCURRENT_FPS = "concurrent_fps"; 85 public static final String SUPPORTED_PERFORMANCE_POINTS = "supported_performance_points"; 86 public static final String FRAMES_DROPPED = "frame_drops_per_30sec"; 87 public static final String FRAME_RATE = "frame_rate"; 88 public static final String LONG_RESOLUTION = "long_resolution_pixels"; 89 public static final String SHORT_RESOLUTION = "short_resolution_pixels"; 90 public static final String DISPLAY_DENSITY = "display_density_dpi"; 91 public static final String PHYSICAL_MEMORY = "physical_memory_mb"; 92 public static final String CODEC_INIT_LATENCY = "codec_initialization_latency_ms"; 93 public static final String AV1_DEC_REQ = "av1_decoder_requirement_boolean"; 94 public static final String NUM_4k_HW_DEC = "number_4k_hw_decoders"; 95 public static final String NUM_4k_HW_ENC = "number_4k_hw_encoders"; 96 public static final String SECURE_REQ_SATISFIED = "secure_requirement_satisfied_boolean"; 97 public static final String NUM_CRYPTO_HW_SECURE_ALL_SUPPORT = 98 "number_crypto_hw_secure_all_support"; 99 public static final String FILESYSTEM_IO_RATE = "filesystem_io_rate_mbps"; 100 101 public static final String PRIMARY_CAMERA_AVAILABLE = "primary_camera_available"; 102 public static final String PRIMARY_CAMERA_RESOLUTION = "primary_camera_resolution"; 103 public static final String PRIMARY_CAMERA_VIDEO_SIZE_REQ_SATISFIED = 104 "primary_camera_video_size_req_satisfied"; 105 public static final String PRIMARY_CAMERA_VIDEO_FPS = 106 "primary_camera_video_fps"; 107 public static final String REAR_CAMERA_HWL_LEVEL = "rear_primary_camera_hwl_level"; 108 public static final String FRONT_CAMERA_HWL_LEVEL = "front_primary_camera_hwl_level"; 109 public static final String REAR_CAMERA_TIMESTAMP_SOURCE = 110 "rear_primary_camera_timestamp_source"; 111 public static final String FRONT_CAMERA_TIMESTAMP_SOURCE = 112 "front_primary_camera_timestamp_source"; 113 public static final String REAR_CAMERA_LATENCY = "rear_camera_latency"; 114 public static final String FRONT_CAMERA_LATENCY = "front_camera_latency"; 115 public static final String REAR_CAMERA_RAW_SUPPORTED = "rear_camera_raw_supported"; 116 public static final String REAR_CAMERA_240FPS_SUPPORTED = "rear_camera_240fps_supported"; 117 public static final String REAR_CAMERA_ULTRAWIDE_ZOOMRATIO_REQ_MET = 118 "rear_camera_ultrawide_zoom_req_met"; 119 public static final String FRONT_CAMERA_ULTRAWIDE_ZOOMRATIO_REQ_MET = 120 "front_camera_ultrawide_zoom_req_met"; 121 public static final String CONCURRENT_REAR_FRONT_SUPPORTED = "rear_front_concurrent_camera"; 122 public static final String REAR_CAMERA_PREVIEW_STABILIZATION_SUPPORTED = 123 "rear_camera_preview_stabilization_supported"; 124 public static final String FRONT_CAMERA_PREVIEW_STABILIZATION_SUPPORTED = 125 "front_camera_preview_stabilization_supported"; 126 public static final String REAR_CAMERA_LOGICAL_MULTI_CAMERA_REQ_MET = 127 "rear_camera_logical_multi_camera_req_met"; 128 public static final String FRONT_CAMERA_LOGICAL_MULTI_CAMERA_REQ_MET = 129 "front_camera_logical_multi_camera_req_met"; 130 public static final String REAR_CAMERA_STREAM_USECASE_SUPPORTED = 131 "rear_camera_stream_usecase_supported"; 132 public static final String FRONT_CAMERA_STREAM_USECASE_SUPPORTED = 133 "front_camera_stream_usecase_supported"; 134 public static final String API_NATIVE_LATENCY = "native_latency_ms"; 135 public static final String API_JAVA_LATENCY = "java_latency_ms"; 136 137 public enum Result { 138 NA, MET, UNMET 139 } 140 141 public static final BiPredicate<Long, Long> LONG_GTE = RequirementConstants.gte(); 142 public static final BiPredicate<Long, Long> LONG_LTE = RequirementConstants.lte(); 143 public static final BiPredicate<Float, Float> FLOAT_LTE = RequirementConstants.lte(); 144 public static final BiPredicate<Integer, Integer> INTEGER_GTE = RequirementConstants.gte(); 145 public static final BiPredicate<Integer, Integer> INTEGER_LTE = RequirementConstants.lte(); 146 public static final BiPredicate<Integer, Integer> INTEGER_EQ = RequirementConstants.eq(); 147 public static final BiPredicate<Double, Double> DOUBLE_GTE = RequirementConstants.gte(); 148 public static final BiPredicate<Double, Double> DOUBLE_LTE = RequirementConstants.lte(); 149 public static final BiPredicate<Double, Double> DOUBLE_EQ = RequirementConstants.eq(); 150 public static final BiPredicate<Boolean, Boolean> BOOLEAN_EQ = RequirementConstants.eq(); 151 152 /** 153 * Creates a >= predicate. 154 * 155 * This is convenience method to get the types right. 156 */ gte()157 private static <T, S extends Comparable<T>> BiPredicate<S, T> gte() { 158 return new BiPredicate<S, T>() { 159 @Override 160 public boolean test(S actual, T expected) { 161 return actual.compareTo(expected) >= 0; 162 } 163 164 @Override 165 public String toString() { 166 return "Greater than or equal to"; 167 } 168 }; 169 } 170 171 /** 172 * Creates a <= predicate. 173 */ 174 private static <T, S extends Comparable<T>> BiPredicate<S, T> lte() { 175 return new BiPredicate<S, T>() { 176 @Override 177 public boolean test(S actual, T expected) { 178 return actual.compareTo(expected) <= 0; 179 } 180 181 @Override 182 public String toString() { 183 return "Less than or equal to"; 184 } 185 }; 186 } 187 188 /** 189 * Creates an == predicate. 190 */ 191 private static <T, S extends Comparable<T>> BiPredicate<S, T> eq() { 192 return new BiPredicate<S, T>() { 193 @Override 194 public boolean test(S actual, T expected) { 195 return actual.compareTo(expected) == 0; 196 } 197 198 @Override 199 public String toString() { 200 return "Equal to"; 201 } 202 }; 203 } 204 205 private RequirementConstants() {} // class should not be instantiated 206 } 207