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 PLUGINS_COMMON_LIBS_IMAGE_LIBEXTPLUGIN_INCLUDE_JPEG_YUVDATA_CONVERTER_H 17 #define PLUGINS_COMMON_LIBS_IMAGE_LIBEXTPLUGIN_INCLUDE_JPEG_YUVDATA_CONVERTER_H 18 19 #include <cstdint> 20 21 namespace OHOS { 22 namespace ImagePlugin { 23 24 #define YUVCOMPONENT_MAX 4 25 enum YuvComponentIndex { 26 YCOM = 0, 27 UCOM = 1, 28 VCOM = 2, 29 UVCOM = 3 30 }; 31 32 struct YuvPlaneInfo { 33 uint32_t imageWidth = 0; 34 uint32_t imageHeight = 0; 35 uint32_t planeWidth[YUVCOMPONENT_MAX] = { 0 }; 36 uint32_t planeHeight[YUVCOMPONENT_MAX] = { 0 }; 37 uint32_t strides[YUVCOMPONENT_MAX] = { 0 }; 38 unsigned char *planes[YUVCOMPONENT_MAX] = { 0 }; 39 }; 40 41 int I444ToI420_wrapper(const YuvPlaneInfo &src, const YuvPlaneInfo &dest); 42 int I444ToNV21_wrapper(const YuvPlaneInfo &src, const YuvPlaneInfo &dest); 43 int I422ToI420_wrapper(const YuvPlaneInfo &src, const YuvPlaneInfo &dest); 44 int I422ToNV21_wrapper(const YuvPlaneInfo &src, const YuvPlaneInfo &dest); 45 int I420ToI420_wrapper(const YuvPlaneInfo &src, const YuvPlaneInfo &dest); 46 int I420ToNV21_wrapper(const YuvPlaneInfo &src, const YuvPlaneInfo &dest); 47 int I440ToI420_wrapper(const YuvPlaneInfo &src, const YuvPlaneInfo &dest); 48 int I440ToNV21_wrapper(const YuvPlaneInfo &src, const YuvPlaneInfo &dest); 49 int I411ToI420_wrapper(const YuvPlaneInfo &src, const YuvPlaneInfo &dest); 50 int I411ToNV21_wrapper(const YuvPlaneInfo &src, const YuvPlaneInfo &dest); 51 52 int I400ToI420_wrapper(const YuvPlaneInfo &src, const YuvPlaneInfo &dest); 53 } 54 } 55 #endif