1 /* 2 * Copyright (c) 2024 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 OHOS_OPEN_SOURCE_LIBYUV_IMAGE_CONVERTER_H 17 #define OHOS_OPEN_SOURCE_LIBYUV_IMAGE_CONVERTER_H 18 19 #include <stdint.h> 20 21 namespace OHOS { 22 namespace OpenSourceLibyuv { 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 typedef enum FilterMode { 28 kFilterNone = 0, 29 kFilterLinear = 1, 30 kFilterBilinear = 2, 31 kFilterBox = 3 32 } FilterModeEnum; 33 34 struct ImageConverter { 35 int32_t (*NV12ToI420)(const uint8_t* src_y, int src_stride_y, const uint8_t* src_uv, int src_stride_uv, 36 uint8_t* dst_y, int dst_stride_y, uint8_t* dst_u, int dst_stride_u, 37 uint8_t* dst_v, int dst_stride_v, int width, int height); 38 int32_t (*I420Scale)(const uint8_t* src_y, int src_stride_y, const uint8_t* src_u, int src_stride_u, 39 const uint8_t* src_v, int src_stride_v, int src_width, int src_height, 40 uint8_t* dst_y, int dst_stride_y, uint8_t* dst_u, int dst_stride_u, 41 uint8_t* dst_v, int dst_stride_v, int dst_width, int dst_height, 42 enum FilterMode filtering); 43 int32_t (*I420ToNV21)(const uint8_t* src_y, int src_stride_y, const uint8_t* src_u, int src_stride_u, 44 const uint8_t* src_v, int src_stride_v, uint8_t* dst_y, int dst_stride_y, 45 uint8_t* dst_vu, int dst_stride_vu, int width, int height); 46 int32_t (*I420ToRGBA)(const uint8_t* src_y, int src_stride_y, const uint8_t* src_u, int src_stride_u, 47 const uint8_t* src_v, int src_stride_v, uint8_t* dst_rgba, int dst_stride_rgba, 48 int width, int height); 49 int32_t (*ARGBToNV12)(const uint8_t* src_argb, int src_stride_argb, uint8_t* dst_y, int dst_stride_y, 50 uint8_t* dst_uv, int dst_stride_uv, int width, int height); 51 }; 52 53 struct ImageConverter GetImageConverter(void); 54 55 #ifdef __cplusplus 56 } 57 #endif 58 59 } // namespace OpenSourceLibyuv 60 } // namespace OHOS 61 #endif // OHOS_OPEN_SOURCE_LIBYUV_IMAGE_CONVERTER_H 62