1 /* 2 * Copyright (C) 2025 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 __AVC_ENC_TYPE_DEF_H__ /* Macro sentry to avoid redundant including */ 17 #define __AVC_ENC_TYPE_DEF_H__ 18 19 #define IV_MAX_RAW_COMPONENTS 4 20 typedef void *AVC_ENC_HANDLE; 21 22 // Log level 23 typedef enum { 24 IHW264VIDEO_ALG_LOG_DEBUG = 0, // print debug info, used for developer debug 25 IHW264VIDEO_ALG_LOG_INFO, // log for help 26 IHW264VIDEO_ALG_LOG_WARNING, // log for warning 27 IHW264VIDEO_ALG_LOG_ERROR, // log for error 28 } IHW264VIDEO_ALG_LOG_LEVEL; 29 30 typedef void (*IHW264E_VIDEO_ALG_LOG_FXN)(uint32_t uiChannelID, IHW264VIDEO_ALG_LOG_LEVEL eLevel, uint8_t *pszMsg, ...); 31 32 typedef enum { 33 YUV_420P = 0x0, 34 YUV_420SP_UV = 0x1, 35 YUV_420SP_VU = 0x2, 36 } COLOR_FORMAT; 37 38 typedef enum { 39 MODE_CQP = 0x0, 40 MODE_CBR = 0x1, 41 MODE_VBR = 0x2, 42 } ENC_MODE; 43 44 typedef enum { 45 PROFILE_BASE = 0x0, 46 PROFILE_MAIN = 0x1, 47 PROFILE_HIGH = 0x2, 48 PROFILE_SIMPLE = 0x3, 49 PROFILE_ADVSIMPLE = 0x4, 50 } ENC_PROFILE; 51 52 typedef struct TagAvcEncInitParam { 53 uint32_t uiChannelID; 54 IHW264E_VIDEO_ALG_LOG_FXN logFxn; 55 uint32_t width; 56 uint32_t height; 57 ENC_MODE encMode; 58 uint32_t frameRate; 59 uint32_t bitrate; 60 uint32_t qp; 61 uint32_t qpMax; 62 uint32_t qpMin; 63 uint32_t iperiod; 64 COLOR_FORMAT colorFmt; 65 uint8_t range; 66 uint8_t primaries; 67 uint8_t transfer; 68 uint8_t matrix; 69 uint32_t level; 70 ENC_PROFILE profile; 71 } AVC_ENC_INIT_PARAM; 72 73 typedef struct ReconfigArgs { 74 uint32_t bitrate; 75 uint32_t idrRequest; 76 } RECONFIG_ARGS; 77 78 typedef struct TagAvcEncInArgs { 79 COLOR_FORMAT colorFmt; 80 uint64_t timestamp; 81 void *inputBufs[IV_MAX_RAW_COMPONENTS]; // YUV address, store YUV in order 82 uint32_t width[IV_MAX_RAW_COMPONENTS]; 83 uint32_t height[IV_MAX_RAW_COMPONENTS]; 84 uint32_t stride[IV_MAX_RAW_COMPONENTS]; 85 RECONFIG_ARGS configArgs; 86 } AVC_ENC_INARGS; 87 88 typedef struct TagAvcEncOutArgs { 89 uint32_t encodedFrameType; 90 uint32_t isLast; 91 void *streamBuf; 92 uint32_t size; 93 uint32_t bytes; 94 uint64_t timestamp; 95 } AVC_ENC_OUTARGS; 96 #endif // __AVC_ENC_TYPE_DEF_H__ 97