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 /* 29 * RGB888常用的颜色 30 * RGB888 commonly used colors 31 */ 32 #define RGB888_RED ((uint32_t)0xFF0000) 33 #define RGB888_GREEN ((uint32_t)0x00FF00) 34 #define RGB888_BLUE ((uint32_t)0x0000FF) 35 #define RGB888_YELLOW ((uint32_t)0xFFFF00) 36 #define RGB888_WHITE ((uint32_t)0xFFFFFF) 37 #define RGB888_BLACK ((uint32_t)0x000000) 38 39 /* 40 * 将整数放大到给定的倍数范围 41 * Amplify the integer to the given multiple range 42 */ 43 int IntZoomTo(int n, double rate, double rateMin, double rateMax); 44 45 /* 46 * 按比例转换坐标 47 * Convert coordinates proportionally 48 */ 49 void RectBoxTran(RectBox* box, int srcWidth, int srcHeight, int dstWidth, int dstHeight); 50 51 #ifdef __cplusplus 52 } 53 #endif 54 #endif 55