From 18a85b668866b6c46d3aae17b530478405fc6524 Mon Sep 17 00:00:00 2001 From: zhaonan287 Date: Mon, 17 Mar 2025 16:21:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EASTC=E5=B9=B6=E8=A1=8C?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E6=9E=84=E5=BB=BA=E6=89=80=E9=9C=80=E6=BA=90?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=92=8C=E4=BF=AE=E6=94=B9astc-customized=20?= =?UTF-8?q?so=E6=89=93=E5=8D=B0=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhaonan287 --- BUILD.gn | 4 +- Source/astcenc_internal.h | 83 ++++++++++++--------------------------- bundle.json | 2 +- 3 files changed, 29 insertions(+), 60 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 5465f72..36480fd 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -47,6 +47,9 @@ ohos_source_set("astc_encoder_static") { (defined(global_parts_info.graphic_graphic_2d_ext) || defined(global_parts_info.product_hmos_sdk_product_hmos_sdk))) { defines = [ "ASTC_CUSTOMIZED_ENABLE" ] + sources += [ + "//third_party/astc-encoder/Source/astcenccli_platform_dependents.cpp", + ] if (target_cpu == "arm64" || is_emulator) { defines += [ "SUT_PATH_X64" ] } @@ -55,7 +58,6 @@ ohos_source_set("astc_encoder_static") { defined(global_parts_info.product_hmos_sdk_product_hmos_sdk)) { defines += [ "BUILD_HMOS_SDK" ] } - external_deps = [ "hilog:libhilog" ] part_name = "astc-encoder" subsystem_name = "thirdparty" } diff --git a/Source/astcenc_internal.h b/Source/astcenc_internal.h index c6f5153..0a8a8ee 100644 --- a/Source/astcenc_internal.h +++ b/Source/astcenc_internal.h @@ -35,37 +35,6 @@ #ifdef ASTC_CUSTOMIZED_ENABLE #include #include -#include "hilog/log.h" -#define ASTCENC_LOG_DOMAIN 0x2102 -#define ASTCENC_OHOS_LOG_TAG "astcenc" - -#ifdef MS_COMPILE_WITH_OHOS_NDK -#define ASTCENC_DEBUG(content, args...) \ - { OH_LOG_Print(LOG_APP, LOG_DEBUG, ASTCENC_LOG_DOMAIN, ASTCENC_OHOS_LOG_TAG, \ - "%s:%d " #content, __func__, __LINE__, ##args); } -#define ASTCENC_WARN(content, args...) \ - { OH_LOG_Print(LOG_APP, LOG_WARN, ASTCENC_LOG_DOMAIN, ASTCENC_OHOS_LOG_TAG, \ - "%s:%d " #content, __func__, __LINE__, ##args); } -#define ASTCENC_INFO(content, args...) \ - { OH_LOG_Print(LOG_APP, LOG_INFO, ASTCENC_LOG_DOMAIN, ASTCENC_OHOS_LOG_TAG, \ - "%s:%d " #content, __func__, __LINE__, ##args); } -#define ASTCENC_ERROR(content, args...) \ - { OH_LOG_Print(LOG_APP, LOG_ERROR, ASTCENC_LOG_DOMAIN, ASTCENC_OHOS_LOG_TAG, \ - "%s:%d " #content, __func__, __LINE__, ##args); } -#else -#define ASTCENC_DEBUG(content, args...) \ - { HiLogPrint(LOG_APP, LOG_DEBUG, ASTCENC_LOG_DOMAIN, ASTCENC_OHOS_LOG_TAG, \ - "%s:%d " #content, __func__, __LINE__, ##args); } -#define ASTCENC_WARN(content, args...) \ - { HiLogPrint(LOG_APP, LOG_WARN, ASTCENC_LOG_DOMAIN, ASTCENC_OHOS_LOG_TAG, \ - "%s:%d " #content, __func__, __LINE__, ##args); } -#define ASTCENC_INFO(content, args...) \ - { HiLogPrint(LOG_APP, LOG_INFO, ASTCENC_LOG_DOMAIN, ASTCENC_OHOS_LOG_TAG, \ - "%s:%d " #content, __func__, __LINE__, ##args); } -#define ASTCENC_ERROR(content, args...) \ - { HiLogPrint(LOG_APP, LOG_ERROR, ASTCENC_LOG_DOMAIN, ASTCENC_OHOS_LOG_TAG, \ - "%s:%d " #content, __func__, __LINE__, ##args); } -#endif #if defined(_WIN32) && !defined(__CYGWIN__) #define NOMINMAX #include @@ -2319,22 +2288,20 @@ public: } ~AstcCustomizedSoManager() { - if (!astcCustomizedSoOpened_ || astcCustomizedSoHandle_ == nullptr) + if (astcCustomizedSoOpened_ && astcCustomizedSoHandle_ != nullptr) { - ASTCENC_DEBUG("astcenc customized so is not opened when dlclose!"); - return; - } #if defined(_WIN32) && !defined(__CYGWIN__) - if (!FreeLibrary(astcCustomizedSoHandle_)) - { - ASTCENC_ERROR("astc dll FreeLibrary failed: %{public}s", g_astcCustomizedSo); - } + if (!FreeLibrary(astcCustomizedSoHandle_)) + { + printf("astc dll FreeLibrary failed: %s\n", g_astcCustomizedSo); + } #else - if (dlclose(astcCustomizedSoHandle_) != 0) - { - ASTCENC_ERROR("astcenc so dlclose failed: %{public}s", g_astcCustomizedSo.c_str()); - } + if (dlclose(astcCustomizedSoHandle_) != 0) + { + printf("astcenc so dlclose failed: %s\n", g_astcCustomizedSo.c_str()); + } #endif + } } IsCustomizedBlockMode isCustomizedBlockModeFunc_; CustomizedMaxPartitions customizedMaxPartitionsFunc_; @@ -2347,13 +2314,13 @@ public: #if defined(_WIN32) && !defined(__CYGWIN__) if ((_access(g_astcCustomizedSo, 0) == -1)) { - ASTCENC_WARN("astc customized dll(%{public}s) is not found!", g_astcCustomizedSo); + printf("astc customized dll(%s) is not found!\n", g_astcCustomizedSo); return false; } astcCustomizedSoHandle_ = LoadLibrary(g_astcCustomizedSo); if (astcCustomizedSoHandle_ == nullptr) { - ASTCENC_ERROR("astc libAstcCustomizedEnc LoadLibrary failed!"); + printf("astc libAstcCustomizedEnc LoadLibrary failed!\n"); return false; } isCustomizedBlockModeFunc_ = @@ -2361,10 +2328,10 @@ public: "IsCustomizedBlockMode")); if (isCustomizedBlockModeFunc_ == nullptr) { - ASTCENC_ERROR("astc isCustomizedBlockModeFunc_ GetProcAddress failed!"); + printf("astc isCustomizedBlockModeFunc_ GetProcAddress failed!\n"); if (!FreeLibrary(astcCustomizedSoHandle_)) { - ASTCENC_ERROR("astc isCustomizedBlockModeFunc_ FreeLibrary failed!"); + printf("astc isCustomizedBlockModeFunc_ FreeLibrary failed!\n"); } return false; } @@ -2373,10 +2340,10 @@ public: "CustomizedMaxPartitions")); if (customizedMaxPartitionsFunc_ == nullptr) { - ASTCENC_ERROR("astc customizedMaxPartitionsFunc_ GetProcAddress failed!"); + printf("astc customizedMaxPartitionsFunc_ GetProcAddress failed!\n"); if (!FreeLibrary(astcCustomizedSoHandle_)) { - ASTCENC_ERROR("astc customizedMaxPartitionsFunc_ FreeLibrary failed!"); + printf("astc customizedMaxPartitionsFunc_ FreeLibrary failed!\n"); } return false; } @@ -2385,24 +2352,24 @@ public: "CustomizedBlockMode")); if (customizedBlockModeFunc_ == nullptr) { - ASTCENC_ERROR("astc customizedBlockModeFunc_ GetProcAddress failed!"); + printf("astc customizedBlockModeFunc_ GetProcAddress failed!\n"); if (!FreeLibrary(astcCustomizedSoHandle_)) { - ASTCENC_ERROR("astc customizedBlockModeFunc_ FreeLibrary failed!"); + printf("astc customizedBlockModeFunc_ FreeLibrary failed!\n"); } return false; } - ASTCENC_INFO("astcenc customized dll load success: %{public}s!", g_astcCustomizedSo); + printf("astcenc customized dll load success: %s!\n", g_astcCustomizedSo); #else if (access(g_astcCustomizedSo.c_str(), F_OK) == -1) { - ASTCENC_WARN("astc customized so(%{public}s) is not found!", g_astcCustomizedSo.c_str()); + printf("astc customized so(%s) is not found!\n", g_astcCustomizedSo.c_str()); return false; } astcCustomizedSoHandle_ = dlopen(g_astcCustomizedSo.c_str(), 1); if (astcCustomizedSoHandle_ == nullptr) { - ASTCENC_ERROR("astc libAstcCustomizedEnc dlopen failed!"); + printf("astc libAstcCustomizedEnc dlopen failed!\n"); return false; } isCustomizedBlockModeFunc_ = @@ -2410,7 +2377,7 @@ public: "IsCustomizedBlockMode")); if (isCustomizedBlockModeFunc_ == nullptr) { - ASTCENC_ERROR("astc isCustomizedBlockModeFunc_ dlsym failed!"); + printf("astc isCustomizedBlockModeFunc_ dlsym failed!\n"); dlclose(astcCustomizedSoHandle_); astcCustomizedSoHandle_ = nullptr; return false; @@ -2420,7 +2387,7 @@ public: "CustomizedMaxPartitions")); if (customizedMaxPartitionsFunc_ == nullptr) { - ASTCENC_ERROR("astc customizedMaxPartitionsFunc_ dlsym failed!"); + printf("astc customizedMaxPartitionsFunc_ dlsym failed!\n"); dlclose(astcCustomizedSoHandle_); astcCustomizedSoHandle_ = nullptr; return false; @@ -2430,12 +2397,12 @@ public: "CustomizedBlockMode")); if (customizedBlockModeFunc_ == nullptr) { - ASTCENC_ERROR("astc customizedBlockModeFunc_ dlsym failed!"); + printf("astc customizedBlockModeFunc_ dlsym failed!\n"); dlclose(astcCustomizedSoHandle_); astcCustomizedSoHandle_ = nullptr; return false; } - ASTCENC_INFO("astcenc customized so dlopen success: %{public}s", g_astcCustomizedSo.c_str()); + printf("astcenc customized so dlopen success: %s\n", g_astcCustomizedSo.c_str()); #endif astcCustomizedSoOpened_ = true; } diff --git a/bundle.json b/bundle.json index e3fe09c..6432ff2 100644 --- a/bundle.json +++ b/bundle.json @@ -19,7 +19,7 @@ "rom": "", "ram": "", "deps": { - "components": [ "hilog" ], + "components": [], "third_party": [] }, "build": { -- Gitee