10485dae0Sopenharmony_ci/*
20485dae0Sopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
30485dae0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
40485dae0Sopenharmony_ci * you may not use this file except in compliance with the License.
50485dae0Sopenharmony_ci * You may obtain a copy of the License at
60485dae0Sopenharmony_ci *
70485dae0Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
80485dae0Sopenharmony_ci *
90485dae0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
100485dae0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
110485dae0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
120485dae0Sopenharmony_ci * See the License for the specific language governing permissions and
130485dae0Sopenharmony_ci * limitations under the License.
140485dae0Sopenharmony_ci */
150485dae0Sopenharmony_ci
160485dae0Sopenharmony_ci#ifndef AI_IMAGE_H
170485dae0Sopenharmony_ci#define AI_IMAGE_H
180485dae0Sopenharmony_ci
190485dae0Sopenharmony_ci#include <cstddef>
200485dae0Sopenharmony_ci#include <cstdint>
210485dae0Sopenharmony_ci
220485dae0Sopenharmony_cinamespace OHOS {
230485dae0Sopenharmony_cinamespace AI {
240485dae0Sopenharmony_citypedef enum {
250485dae0Sopenharmony_ci    YUV_CHANNEL_Y = 0,
260485dae0Sopenharmony_ci    YUV_CHANNEL_U = 1,
270485dae0Sopenharmony_ci    YUV_CHANNEL_V = 2,
280485dae0Sopenharmony_ci    YUV_CHANNEL_COUNT = 3
290485dae0Sopenharmony_ci} YuvChannels; // for AI_IMAGE_TYPE_YUV422SP format
300485dae0Sopenharmony_ci
310485dae0Sopenharmony_citypedef enum {
320485dae0Sopenharmony_ci    // not supported for now.
330485dae0Sopenharmony_ci    AI_IMAGE_BINARY = 0,
340485dae0Sopenharmony_ci
350485dae0Sopenharmony_ci    // only 1 channel
360485dae0Sopenharmony_ci    // memory length = width * height
370485dae0Sopenharmony_ci    // no stride
380485dae0Sopenharmony_ci    AI_IMAGE_GRAY = 1,
390485dae0Sopenharmony_ci
400485dae0Sopenharmony_ci    // not supported for now.
410485dae0Sopenharmony_ci    AI_IMAGE_TYPE_BGR = 2,
420485dae0Sopenharmony_ci
430485dae0Sopenharmony_ci    // not supported for now.
440485dae0Sopenharmony_ci    AI_IMAGE_TYPE_YUV420SP = 3,
450485dae0Sopenharmony_ci
460485dae0Sopenharmony_ci    // 3 channels memory length: Y:1 / U:0.5 / V0.5
470485dae0Sopenharmony_ci    // where width * height = Y
480485dae0Sopenharmony_ci    // format: YYUV for every 2 pixels
490485dae0Sopenharmony_ci    // where Y must be an even number.
500485dae0Sopenharmony_ci    AI_IMAGE_TYPE_YUV422SP = 4
510485dae0Sopenharmony_ci} AiImageType;
520485dae0Sopenharmony_ci
530485dae0Sopenharmony_citypedef struct {
540485dae0Sopenharmony_ci    AiImageType type;
550485dae0Sopenharmony_ci    unsigned char *phyAddr[YUV_CHANNEL_COUNT];
560485dae0Sopenharmony_ci    unsigned int stride[YUV_CHANNEL_COUNT];
570485dae0Sopenharmony_ci    unsigned int width;
580485dae0Sopenharmony_ci    unsigned int height;
590485dae0Sopenharmony_ci    unsigned long long pts;
600485dae0Sopenharmony_ci} AiImage;
610485dae0Sopenharmony_ci
620485dae0Sopenharmony_citypedef struct {
630485dae0Sopenharmony_ci    int topLeftX;
640485dae0Sopenharmony_ci    int topLeftY;
650485dae0Sopenharmony_ci    int topRightX;
660485dae0Sopenharmony_ci    int topRightY;
670485dae0Sopenharmony_ci    int bottomRightX;
680485dae0Sopenharmony_ci    int bottomRightY;
690485dae0Sopenharmony_ci    int bottomLeftX;
700485dae0Sopenharmony_ci    int bottomLeftY;
710485dae0Sopenharmony_ci} FourVertex;
720485dae0Sopenharmony_ci} // namespace AI
730485dae0Sopenharmony_ci} // namespace OHOS
740485dae0Sopenharmony_ci
750485dae0Sopenharmony_ci#endif // AI_IMAGE_H
76