1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 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 AI_IMAGE_H 17 #define AI_IMAGE_H 18 19 #include <cstddef> 20 #include <cstdint> 21 22 namespace OHOS { 23 namespace AI { 24 typedef enum { 25 YUV_CHANNEL_Y = 0, 26 YUV_CHANNEL_U = 1, 27 YUV_CHANNEL_V = 2, 28 YUV_CHANNEL_COUNT = 3 29 } YuvChannels; // for AI_IMAGE_TYPE_YUV422SP format 30 31 typedef enum { 32 // not supported for now. 33 AI_IMAGE_BINARY = 0, 34 35 // only 1 channel 36 // memory length = width * height 37 // no stride 38 AI_IMAGE_GRAY = 1, 39 40 // not supported for now. 41 AI_IMAGE_TYPE_BGR = 2, 42 43 // not supported for now. 44 AI_IMAGE_TYPE_YUV420SP = 3, 45 46 // 3 channels memory length: Y:1 / U:0.5 / V0.5 47 // where width * height = Y 48 // format: YYUV for every 2 pixels 49 // where Y must be an even number. 50 AI_IMAGE_TYPE_YUV422SP = 4 51 } AiImageType; 52 53 typedef struct { 54 AiImageType type; 55 unsigned char *phyAddr[YUV_CHANNEL_COUNT]; 56 unsigned int stride[YUV_CHANNEL_COUNT]; 57 unsigned int width; 58 unsigned int height; 59 unsigned long long pts; 60 } AiImage; 61 62 typedef struct { 63 int topLeftX; 64 int topLeftY; 65 int topRightX; 66 int topRightY; 67 int bottomRightX; 68 int bottomRightY; 69 int bottomLeftX; 70 int bottomLeftY; 71 } FourVertex; 72 } // namespace AI 73 } // namespace OHOS 74 75 #endif // AI_IMAGE_H 76