From 153d7a5c39c9156c52b24ddf1d9ce4ddf97b9ae1 Mon Sep 17 00:00:00 2001 From: zhubingwei Date: Wed, 31 Jan 2024 16:46:37 +0800 Subject: [PATCH 1/5] =?UTF-8?q?[=E5=9B=BE=E7=89=87=E7=BC=96=E8=A7=A3?= =?UTF-8?q?=E7=A0=81]sdk=E6=96=B0=E5=A2=9E=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhubingwei --- multimedia/image_framework/BUILD.gn | 10 +++ .../include/image_format_convert_mdk.h | 88 +++++++++++++++++++ .../libimage_format_convert_ndk.ndk.json | 18 ++++ 3 files changed, 116 insertions(+) create mode 100644 multimedia/image_framework/include/image_format_convert_mdk.h create mode 100644 multimedia/image_framework/libimage_format_convert_ndk.ndk.json diff --git a/multimedia/image_framework/BUILD.gn b/multimedia/image_framework/BUILD.gn index 22c7d1fb9..2043db912 100644 --- a/multimedia/image_framework/BUILD.gn +++ b/multimedia/image_framework/BUILD.gn @@ -72,3 +72,13 @@ ohos_ndk_headers("image_packer_ndk_header") { dest_dir = "$ndk_headers_out_dir/multimedia/image_framework" sources = [ "./include/image_packer_mdk.h" ] } + +ohos_ndk_library("libimage_format_convert_ndk") { + ndk_description_file = "./libimage_format_convert_ndk.ndk.json" + output_name = "image_format_convert_ndk" +} + +ohos_ndk_headers("image_format_convert_ndk_header") { + dest_dir = "$ndk_headers_out_dir/multimedia/image_framework" + sources = [ "./include/image_format_convert_mdk.h" ] +} \ No newline at end of file diff --git a/multimedia/image_framework/include/image_format_convert_mdk.h b/multimedia/image_framework/include/image_format_convert_mdk.h new file mode 100644 index 000000000..541a47cad --- /dev/null +++ b/multimedia/image_framework/include/image_format_convert_mdk.h @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup image + * @{ + * + * @brief Provides native APIs to convert image format. + * + * @Syscap SystemCapability.Multimedia.Image + */ + +/** + * @file image_format_convert_mdk.h + * + * @brief Declares APIs to convert image fromat. + * + * @Syscap SystemCapability.Multimedia.Image + */ + +#ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_FORMAT_CONVERT_MDK_H +#define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_FORMAT_CONVERT_MDK_H +#include +#include "pixel_map.h" +#include "image_mdk_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates an ImageFormatConvert object at the JavaScript native layer. + * + * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + */ +int32_t OH_ImageConvert_Create(); + +/** + * @brief Convert image format from RGB to YUV by PixelMap. + * + * @param srcPixelMap Source Image PixelMap + * @param destPixelMap Destination Image PixelMap + * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * + * @Syscap SystemCapability.Multimedia.Image + */ +int32_t OH_ImageConvert_YuvToRgb(OHOS::Media::PixelMap *srcPixelMap, OHOS::Media::PixelMap **destPixelMap, + OHOS::Media::PixelFormat destPixelFormat); + +/** + * @brief Convert image format from RGB to YUV by PixelMap. + * + * @param srcPixelMap Source Image PixelMap + * @param destPixelMap Destination Image PixelMap + * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * + * @Syscap SystemCapability.Multimedia.Image + */ +int32_t OH_ImageConvert_RgbToYuv(OHOS::Media::PixelMap *srcPixelMap, OHOS::Media::PixelMap **destPixelMap, + OHOS::Media::PixelFormat destPixelFormat); + +/** + * @brief Releases an ImageFormatConvertNative object. + * + * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * + * @Syscap SystemCapability.Multimedia.Image + * @since 10 + * @version 4.0 + */ +int32_t OH_ImageConvert_Release(); + +#ifdef __cplusplus +}; +#endif +#endif // INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_FORMAT_CONVERT_MDK_H \ No newline at end of file diff --git a/multimedia/image_framework/libimage_format_convert_ndk.ndk.json b/multimedia/image_framework/libimage_format_convert_ndk.ndk.json new file mode 100644 index 000000000..40ad1e228 --- /dev/null +++ b/multimedia/image_framework/libimage_format_convert_ndk.ndk.json @@ -0,0 +1,18 @@ +[ + { + "first_introduced": "12", + "name": "OH_ImageConvert_Create" + }, + { + "first_introduced": "12", + "name": "OH_ImageConvert_YuvToRgb" + }, + { + "first_introduced": "12", + "name": "OH_ImageConvert_RgbToYuv" + }, + { + "first_introduced": "12", + "name": "OH_ImageConvert_Release" + } +] \ No newline at end of file -- Gitee From 304b1f4f11bbdd5156dd7a433d2d1bf7d9691f67 Mon Sep 17 00:00:00 2001 From: zhubingwei Date: Mon, 5 Feb 2024 06:51:18 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E3=80=90=E5=9B=BE=E7=89=87=E7=BC=96?= =?UTF-8?q?=E8=A7=A3=E7=A0=81=E3=80=91=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhubingwei --- .../include/image_format_convert_mdk.h | 36 +++++++++++++++---- .../libimage_format_convert_ndk.ndk.json | 8 +++++ 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/multimedia/image_framework/include/image_format_convert_mdk.h b/multimedia/image_framework/include/image_format_convert_mdk.h index 541a47cad..9328b1f0e 100644 --- a/multimedia/image_framework/include/image_format_convert_mdk.h +++ b/multimedia/image_framework/include/image_format_convert_mdk.h @@ -32,8 +32,8 @@ #ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_FORMAT_CONVERT_MDK_H #define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_FORMAT_CONVERT_MDK_H -#include -#include "pixel_map.h" + +#include "napi/native_api.h" #include "image_mdk_common.h" #ifdef __cplusplus @@ -56,8 +56,7 @@ int32_t OH_ImageConvert_Create(); * * @Syscap SystemCapability.Multimedia.Image */ -int32_t OH_ImageConvert_YuvToRgb(OHOS::Media::PixelMap *srcPixelMap, OHOS::Media::PixelMap **destPixelMap, - OHOS::Media::PixelFormat destPixelFormat); +int32_t OH_ImageConvert_YuvToRgb(void *srcPixelMap, void **destPixelMap, int32_t destPixelFormat); /** * @brief Convert image format from RGB to YUV by PixelMap. @@ -68,8 +67,7 @@ int32_t OH_ImageConvert_YuvToRgb(OHOS::Media::PixelMap *srcPixelMap, OHOS::Media * * @Syscap SystemCapability.Multimedia.Image */ -int32_t OH_ImageConvert_RgbToYuv(OHOS::Media::PixelMap *srcPixelMap, OHOS::Media::PixelMap **destPixelMap, - OHOS::Media::PixelFormat destPixelFormat); +int32_t OH_ImageConvert_RgbToYuv(void *srcPixelMap, void **destPixelMap, int32_t destPixelFormat); /** * @brief Releases an ImageFormatConvertNative object. @@ -82,6 +80,32 @@ int32_t OH_ImageConvert_RgbToYuv(OHOS::Media::PixelMap *srcPixelMap, OHOS::Media */ int32_t OH_ImageConvert_Release(); +/** + * @brief Convert Js objects to C pointers. + **@param env Indicates the pointer to the JavaScript Native Interface (JNI) environment + * @param pixelMapValue Indicates a JavaScript native API PixelMapNapi object + * @param pixelMap Indicates the result after conversion + * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * + * @Syscap SystemCapability.Multimedia.Image + * @since 12 + * @version 4.0 + */ +int32_t OH_ImageConvert_JsToC_PixelMap(napi_env env, napi_value pixelMapValue, void **pixelMap); + +/** + * @brief Convert Js objects to C pointers. + **@param env Indicates the pointer to the JavaScript Native Interface (JNI) environment + * @param pixelMap Indicates a C native API PixelMap object pointer + * @param result Indicates the result after conversion + * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. + * + * @Syscap SystemCapability.Multimedia.Image + * @since 12 + * @version 4.0 + */ +int32_t OH_ImageConvert_CToJs_PixelMap(napi_env env, void *pixelMap, napi_value *result); + #ifdef __cplusplus }; #endif diff --git a/multimedia/image_framework/libimage_format_convert_ndk.ndk.json b/multimedia/image_framework/libimage_format_convert_ndk.ndk.json index 40ad1e228..e829047ef 100644 --- a/multimedia/image_framework/libimage_format_convert_ndk.ndk.json +++ b/multimedia/image_framework/libimage_format_convert_ndk.ndk.json @@ -14,5 +14,13 @@ { "first_introduced": "12", "name": "OH_ImageConvert_Release" + }, + { + "first_introduced": "12", + "name": "OH_ImageConvert_JsToC_PixelMap" + }, + { + "first_introduced": "12", + "name": "OH_ImageConvert_CToJs_PixelMap" } ] \ No newline at end of file -- Gitee From a22d705d1b5def833e758a3b67b1ce3a83abf364 Mon Sep 17 00:00:00 2001 From: zhubingwei Date: Wed, 21 Feb 2024 12:40:55 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E3=80=90=E5=9B=BE=E7=89=87=E7=BC=96?= =?UTF-8?q?=E8=A7=A3=E7=A0=81=E3=80=91=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhubingwei --- .../include/image_format_convert_mdk.h | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/multimedia/image_framework/include/image_format_convert_mdk.h b/multimedia/image_framework/include/image_format_convert_mdk.h index 9328b1f0e..85b651bd7 100644 --- a/multimedia/image_framework/include/image_format_convert_mdk.h +++ b/multimedia/image_framework/include/image_format_convert_mdk.h @@ -40,6 +40,22 @@ extern "C" { #endif +/** + * @brief Defines a native image format convert object for the image format convert APIs. + * + * @Syscap SystemCapability.Multimedia.Image + * @since 12 + */ +struct ImageFormatConvertNative_; + +/** + * @brief Defines a native image format convert object for the image format convert APIs. + * + * @Syscap SystemCapability.Multimedia.Image + * @since 12 + */ +typedef struct ImageFormatConvertNative_ ImageFormatCovnertNative; + /** * @brief Creates an ImageFormatConvert object at the JavaScript native layer. * @@ -56,7 +72,8 @@ int32_t OH_ImageConvert_Create(); * * @Syscap SystemCapability.Multimedia.Image */ -int32_t OH_ImageConvert_YuvToRgb(void *srcPixelMap, void **destPixelMap, int32_t destPixelFormat); +int32_t OH_ImageConvert_YuvToRgb(ImageFormatCovnertNative *srcPixelMap, ImageFormatCovnertNative *destPixelMap, + int32_t destPixelFormat); /** * @brief Convert image format from RGB to YUV by PixelMap. @@ -67,7 +84,8 @@ int32_t OH_ImageConvert_YuvToRgb(void *srcPixelMap, void **destPixelMap, int32_t * * @Syscap SystemCapability.Multimedia.Image */ -int32_t OH_ImageConvert_RgbToYuv(void *srcPixelMap, void **destPixelMap, int32_t destPixelFormat); +int32_t OH_ImageConvert_RgbToYuv(ImageFormatCovnertNative *srcPixelMap, ImageFormatCovnertNative *destPixelMap, + int32_t destPixelFormat); /** * @brief Releases an ImageFormatConvertNative object. @@ -91,7 +109,7 @@ int32_t OH_ImageConvert_Release(); * @since 12 * @version 4.0 */ -int32_t OH_ImageConvert_JsToC_PixelMap(napi_env env, napi_value pixelMapValue, void **pixelMap); +int32_t OH_ImageConvert_JsToC_PixelMap(napi_env env, napi_value pixelMapValue, ImageFormatCovnertNative *pixelMap); /** * @brief Convert Js objects to C pointers. @@ -104,7 +122,7 @@ int32_t OH_ImageConvert_JsToC_PixelMap(napi_env env, napi_value pixelMapValue, v * @since 12 * @version 4.0 */ -int32_t OH_ImageConvert_CToJs_PixelMap(napi_env env, void *pixelMap, napi_value *result); +int32_t OH_ImageConvert_CToJs_PixelMap(napi_env env, ImageFormatCovnertNative *pixelMap, napi_value *result); #ifdef __cplusplus }; -- Gitee From fe4b3448892bb6edf0eb934e935fbcbf4fdff46a Mon Sep 17 00:00:00 2001 From: zhubingwei Date: Wed, 28 Feb 2024 09:20:46 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E3=80=90=E5=9B=BE=E7=89=87=E7=BC=96?= =?UTF-8?q?=E8=A7=A3=E7=A0=81=E3=80=91=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhubingwei --- .../image_framework/include/image_format_convert_mdk.h | 4 ++-- .../image_framework/libimage_format_convert_ndk.ndk.json | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/multimedia/image_framework/include/image_format_convert_mdk.h b/multimedia/image_framework/include/image_format_convert_mdk.h index 85b651bd7..f3acc98d1 100644 --- a/multimedia/image_framework/include/image_format_convert_mdk.h +++ b/multimedia/image_framework/include/image_format_convert_mdk.h @@ -47,7 +47,6 @@ extern "C" { * @since 12 */ struct ImageFormatConvertNative_; - /** * @brief Defines a native image format convert object for the image format convert APIs. * @@ -55,7 +54,8 @@ struct ImageFormatConvertNative_; * @since 12 */ typedef struct ImageFormatConvertNative_ ImageFormatCovnertNative; - +ImageFormatCovnertNative* OH_ImageCovnertNative_InitNative(); +int32_t OH_ImageCovnertNative_ReleaseNative(ImageFormatCovnertNative* native); /** * @brief Creates an ImageFormatConvert object at the JavaScript native layer. * diff --git a/multimedia/image_framework/libimage_format_convert_ndk.ndk.json b/multimedia/image_framework/libimage_format_convert_ndk.ndk.json index e829047ef..574f0952e 100644 --- a/multimedia/image_framework/libimage_format_convert_ndk.ndk.json +++ b/multimedia/image_framework/libimage_format_convert_ndk.ndk.json @@ -1,19 +1,19 @@ [ { "first_introduced": "12", - "name": "OH_ImageConvert_Create" + "name": "OH_ImageCovnertNative_InitNative" }, { "first_introduced": "12", - "name": "OH_ImageConvert_YuvToRgb" + "name": "OH_ImageCovnertNative_ReleaseNative" }, { "first_introduced": "12", - "name": "OH_ImageConvert_RgbToYuv" + "name": "OH_ImageConvert_YuvToRgb" }, { "first_introduced": "12", - "name": "OH_ImageConvert_Release" + "name": "OH_ImageConvert_RgbToYuv" }, { "first_introduced": "12", -- Gitee From 12d1e9d035d72b10f88267725d55b53316b8ec34 Mon Sep 17 00:00:00 2001 From: zhubingwei Date: Thu, 14 Mar 2024 15:38:42 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E3=80=90=E5=9B=BE=E7=89=87=E7=BC=96?= =?UTF-8?q?=E8=A7=A3=E7=A0=81=E3=80=91=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhubingwei --- .../include/image_format_convert_mdk.h | 67 +------------------ .../libimage_format_convert_ndk.ndk.json | 16 ----- 2 files changed, 3 insertions(+), 80 deletions(-) diff --git a/multimedia/image_framework/include/image_format_convert_mdk.h b/multimedia/image_framework/include/image_format_convert_mdk.h index f3acc98d1..4562e01b7 100644 --- a/multimedia/image_framework/include/image_format_convert_mdk.h +++ b/multimedia/image_framework/include/image_format_convert_mdk.h @@ -35,34 +35,12 @@ #include "napi/native_api.h" #include "image_mdk_common.h" +#include "pixelmap2_impl.h" #ifdef __cplusplus extern "C" { #endif -/** - * @brief Defines a native image format convert object for the image format convert APIs. - * - * @Syscap SystemCapability.Multimedia.Image - * @since 12 - */ -struct ImageFormatConvertNative_; -/** - * @brief Defines a native image format convert object for the image format convert APIs. - * - * @Syscap SystemCapability.Multimedia.Image - * @since 12 - */ -typedef struct ImageFormatConvertNative_ ImageFormatCovnertNative; -ImageFormatCovnertNative* OH_ImageCovnertNative_InitNative(); -int32_t OH_ImageCovnertNative_ReleaseNative(ImageFormatCovnertNative* native); -/** - * @brief Creates an ImageFormatConvert object at the JavaScript native layer. - * - * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. - */ -int32_t OH_ImageConvert_Create(); - /** * @brief Convert image format from RGB to YUV by PixelMap. * @@ -72,8 +50,7 @@ int32_t OH_ImageConvert_Create(); * * @Syscap SystemCapability.Multimedia.Image */ -int32_t OH_ImageConvert_YuvToRgb(ImageFormatCovnertNative *srcPixelMap, ImageFormatCovnertNative *destPixelMap, - int32_t destPixelFormat); +int32_t OH_ImageConvert_YuvToRgb(OH_PixelMap2 *srcPixelMap, OH_PixelMap2 **destPixelMap, int32_t destPixelFormat); /** * @brief Convert image format from RGB to YUV by PixelMap. @@ -84,45 +61,7 @@ int32_t OH_ImageConvert_YuvToRgb(ImageFormatCovnertNative *srcPixelMap, ImageFor * * @Syscap SystemCapability.Multimedia.Image */ -int32_t OH_ImageConvert_RgbToYuv(ImageFormatCovnertNative *srcPixelMap, ImageFormatCovnertNative *destPixelMap, - int32_t destPixelFormat); - -/** - * @brief Releases an ImageFormatConvertNative object. - * - * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. - * - * @Syscap SystemCapability.Multimedia.Image - * @since 10 - * @version 4.0 - */ -int32_t OH_ImageConvert_Release(); - -/** - * @brief Convert Js objects to C pointers. - **@param env Indicates the pointer to the JavaScript Native Interface (JNI) environment - * @param pixelMapValue Indicates a JavaScript native API PixelMapNapi object - * @param pixelMap Indicates the result after conversion - * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. - * - * @Syscap SystemCapability.Multimedia.Image - * @since 12 - * @version 4.0 - */ -int32_t OH_ImageConvert_JsToC_PixelMap(napi_env env, napi_value pixelMapValue, ImageFormatCovnertNative *pixelMap); - -/** - * @brief Convert Js objects to C pointers. - **@param env Indicates the pointer to the JavaScript Native Interface (JNI) environment - * @param pixelMap Indicates a C native API PixelMap object pointer - * @param result Indicates the result after conversion - * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. - * - * @Syscap SystemCapability.Multimedia.Image - * @since 12 - * @version 4.0 - */ -int32_t OH_ImageConvert_CToJs_PixelMap(napi_env env, ImageFormatCovnertNative *pixelMap, napi_value *result); +int32_t OH_ImageConvert_RgbToYuv(OH_PixelMap2 *srcPixelMap, OH_PixelMap2 **destPixelMap, int32_t destPixelFormat); #ifdef __cplusplus }; diff --git a/multimedia/image_framework/libimage_format_convert_ndk.ndk.json b/multimedia/image_framework/libimage_format_convert_ndk.ndk.json index 574f0952e..b3f77c92e 100644 --- a/multimedia/image_framework/libimage_format_convert_ndk.ndk.json +++ b/multimedia/image_framework/libimage_format_convert_ndk.ndk.json @@ -1,12 +1,4 @@ [ - { - "first_introduced": "12", - "name": "OH_ImageCovnertNative_InitNative" - }, - { - "first_introduced": "12", - "name": "OH_ImageCovnertNative_ReleaseNative" - }, { "first_introduced": "12", "name": "OH_ImageConvert_YuvToRgb" @@ -14,13 +6,5 @@ { "first_introduced": "12", "name": "OH_ImageConvert_RgbToYuv" - }, - { - "first_introduced": "12", - "name": "OH_ImageConvert_JsToC_PixelMap" - }, - { - "first_introduced": "12", - "name": "OH_ImageConvert_CToJs_PixelMap" } ] \ No newline at end of file -- Gitee