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 #ifndef AVC_ENCODER_UTIL_H 16 #define AVC_ENCODER_UTIL_H 17 18 #include "AvcEnc_Typedef.h" 19 #include "surface.h" 20 #include "avcodec_common.h" 21 #include "avcodec_info.h" 22 #include "media_description.h" 23 #include "avc_encoder_convert.h" 24 25 namespace OHOS { 26 namespace MediaAVCodec { 27 namespace Codec { 28 29 enum H264Level : int32_t { 30 H264_LEVEL_10 = 10, 31 H264_LEVEL_1B = 9, 32 H264_LEVEL_11 = 11, 33 H264_LEVEL_12 = 12, 34 H264_LEVEL_13 = 13, 35 H264_LEVEL_20 = 20, 36 H264_LEVEL_21 = 21, 37 H264_LEVEL_22 = 22, 38 H264_LEVEL_30 = 30, 39 H264_LEVEL_31 = 31, 40 H264_LEVEL_32 = 32, 41 H264_LEVEL_40 = 40, 42 H264_LEVEL_41 = 41, 43 H264_LEVEL_42 = 42, 44 H264_LEVEL_50 = 50, 45 H264_LEVEL_51 = 51, 46 H264_LEVEL_52 = 52, 47 H264_LEVEL_60 = 60, 48 H264_LEVEL_61 = 61, 49 H264_LEVEL_62 = 62, 50 }; 51 52 AVCodecBufferFlag AvcFrameTypeToBufferFlag(uint32_t frameType); 53 VideoPixelFormat TranslateVideoPixelFormat(GraphicPixelFormat surfaceFormat); 54 COLOR_FORMAT TranslateVideoFormatToAvc(const VideoPixelFormat &pixelFormat); 55 COLOR_MATRIX TranslateMatrix(MatrixCoefficient matrixFormat); 56 COLOR_RANGE TranslateRange(uint8_t range); 57 ENC_MODE TranslateEncMode(VideoEncodeBitrateMode mode); 58 ENC_PROFILE TranslateEncProfile(AVCProfile profile); 59 H264Level TranslateEncLevel(AVCLevel level); 60 61 } // namespace Codec 62 } // namespace MediaAVCodec 63 } // namespace OHOS 64 #endif // AVC_ENCODER_UTIL_H