1 /** 2 * Copyright 2022-2023 Huawei Technologies Co., Ltd 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 8 * http://www.apache.org/licenses/LICENSE-2.0 9 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_UTILS_ACL_LITE_TYPE_H_ 17 #define MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_UTILS_ACL_LITE_TYPE_H_ 18 19 #include <unistd.h> 20 21 #include <memory> 22 #include <string> 23 24 #include "acl/acl.h" 25 #include "acl/ops/acl_dvpp.h" 26 27 enum class MemoryType { MEMORY_NORMAL = 0, MEMORY_HOST, MEMORY_DEVICE, MEMORY_DVPP, MEMORY_INVALID_TYPE }; 28 29 enum class CopyDirection { TO_DEVICE = 0, TO_HOST, INVALID_COPY_DIRECT }; 30 31 enum class CameraId { 32 CAMERA_ID_0 = 0, 33 CAMERA_ID_1, 34 CAMERA_ID_INVALID, 35 }; 36 37 enum VencStatus { STATUS_VENC_INIT = 0, STATUS_VENC_WORK, STATUS_VENC_FINISH, STATUS_VENC_EXIT, STATUS_VENC_ERROR }; 38 39 struct VencConfig { 40 uint32_t maxWidth = 0; 41 uint32_t maxHeight = 0; 42 std::string outFile; 43 acldvppPixelFormat format = PIXEL_FORMAT_YUV_SEMIPLANAR_420; 44 acldvppStreamFormat enType = H264_MAIN_LEVEL; 45 aclrtContext context = nullptr; 46 aclrtRunMode runMode = ACL_HOST; 47 }; 48 49 struct ImageData { 50 acldvppPixelFormat format; 51 uint32_t width = 0; 52 uint32_t height = 0; 53 uint32_t alignWidth = 0; 54 uint32_t alignHeight = 0; 55 uint32_t size = 0; 56 std::shared_ptr<uint8_t> data = nullptr; 57 }; 58 59 struct FrameData { 60 bool isFinished = false; 61 uint32_t frameId = 0; 62 uint32_t size = 0; 63 void *data = nullptr; 64 }; 65 66 struct Resolution { 67 uint32_t width = 0; 68 uint32_t height = 0; 69 }; 70 71 struct Rect { 72 uint32_t ltX = 0; 73 uint32_t ltY = 0; 74 uint32_t rbX = 0; 75 uint32_t rbY = 0; 76 }; 77 78 struct BBox { 79 Rect rect; 80 uint32_t score = 0; 81 std::string text; 82 }; 83 84 struct AclLiteMessage { 85 int dest; 86 int msgId; 87 std::shared_ptr<void> data = nullptr; 88 }; 89 90 struct DataInfo { 91 void *data; 92 uint32_t size; 93 }; 94 95 struct InferenceOutput { 96 std::shared_ptr<void> data = nullptr; 97 uint32_t size; 98 }; 99 100 #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_UTILS_ACL_LITE_TYPE_H_ 101