1 /* 2 * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED. 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 */ 15 16 #ifndef MISC_UTIL_H 17 #define MISC_UTIL_H 18 19 #include <stdbool.h> 20 #include <stdint.h> 21 22 #include "ai_infer_process.h" 23 24 #if __cplusplus 25 extern "C" { 26 #endif 27 28 /* RGB888 commonly used colors */ 29 #define RGB888_RED ((uint32_t)0xFF0000) 30 #define RGB888_GREEN ((uint32_t)0x00FF00) 31 #define RGB888_BLUE ((uint32_t)0x0000FF) 32 #define RGB888_YELLOW ((uint32_t)0xFFFF00) 33 #define RGB888_WHITE ((uint32_t)0xFFFFFF) 34 #define RGB888_BLACK ((uint32_t)0x000000) 35 36 /* Amplify the integer to the given multiple range */ 37 int IntZoomTo(int n, double rate, double rateMin, double rateMax); 38 39 /* Convert coordinates proportionally */ 40 void RectBoxTran(RectBox* box, int srcWidth, int srcHeight, int dstWidth, int dstHeight); 41 42 #ifdef __cplusplus 43 } 44 #endif 45 #endif 46