• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 CNN_TRASH_CLASSIFY_H
17 #define CNN_TRASH_CLASSIFY_H
18 
19 #include <stdlib.h>
20 #include <string.h>
21 #include <stdio.h>
22 #include <errno.h>
23 #include "hi_comm_video.h"
24 #include "osd_img.h"
25 
26 #if __cplusplus
27 extern "C" {
28 #endif
29 
30 #define TINY_BUF_SIZE       64 // tiny buf size
31 #define SMALL_BUF_SIZE      128 // small buf size
32 #define NORM_BUF_SIZE       256 // normal buf size
33 #define LARGE_BUF_SIZE      1024 // normal buf size
34 #define HUGE_BUF_SIZE       9120 // huge buf size
35 
36 /*
37  * ARGB1555 common colors
38  * ARGB1555常用颜色
39  */
40 #define ARGB1555_RED        0xFC00 // 1 11111 00000 00000
41 #define ARGB1555_GREEN      0x83E0 // 1 00000 11111 00000
42 #define ARGB1555_BLUE       0x801F // 1 00000 00000 11111
43 #define ARGB1555_YELLOW     0xFFE0 // 1 11111 11111 00000
44 #define ARGB1555_YELLOW2    0xFF00 // 1 11111 11111 00000
45 #define ARGB1555_WHITE      0xFFFF // 1 11111 11111 11111
46 #define ARGB1555_BLACK      0x8000 // 1 00000 00000 00000
47 
48 /*
49  * 加载垃圾分类wk模型
50  * Load the trash classification wk model
51  */
52 HI_S32 CnnTrashClassifyLoadModel(uintptr_t* model, OsdSet* osds);
53 
54 /*
55  * 卸载垃圾分类wk模型
56  * Unload the trash classification wk model
57  */
58 HI_S32 CnnTrashClassifyUnloadModel(uintptr_t model);
59 
60 /*
61  * 先进行预处理,再使用NNIE进行硬件加速推理,不支持层通过AI CPU进行计算
62  *
63  * Perform preprocessing first, and then use NNIE for hardware accelerated inference,
64  * and do not support layers to be calculated by AI CPU
65  */
66 HI_S32 CnnTrashClassifyCal(uintptr_t model, VIDEO_FRAME_INFO_S *srcFrm, VIDEO_FRAME_INFO_S *resFrm);
67 
68 #ifdef __cplusplus
69 }
70 #endif
71 #endif
72