mirror of
https://github.com/openharmony/multimedia_video_processing_engine.git
synced 2026-07-24 14:15:57 -04:00
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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.
|
||||
*/
|
||||
|
||||
#ifndef ALGORITHM_TYPES_H
|
||||
#define ALGORITHM_TYPES_H
|
||||
|
||||
namespace OHOS {
|
||||
namespace Media {
|
||||
namespace VideoProcessingEngine {
|
||||
enum AlgoErrorCode {
|
||||
ALGO_SUCCESS,
|
||||
ALGO_ERROR_INVALID_PARAMETER,
|
||||
ALGO_ERROR_UNKNOWN,
|
||||
ALGO_ERROR_INITIALIZE_FAILED,
|
||||
ALGO_ERROR_CREATE_FAILED,
|
||||
ALGO_ERROR_PROCESS_FAILED,
|
||||
ALGO_ERROR_UNSUPPORTED_PROCESSING,
|
||||
ALGO_ERROR_OPERATION_NOT_PERMITTED,
|
||||
ALGO_ERROR_NO_MEMORY,
|
||||
ALGO_ERROR_INVALID_INSTANCE,
|
||||
ALGO_ERROR_INVALID_VALUE
|
||||
};
|
||||
} // namespace VideoProcessingEngine
|
||||
} // namespace Media
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // ALGORITHM_TYPES_H
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "algorithm_errors.h"
|
||||
#include "algorithm_video_common.h"
|
||||
#include "surface_buffer.h"
|
||||
#include "graphic_common_c.h"
|
||||
|
||||
#define VPE_TO_STR(val) (std::string(#val) + "(" + std::to_string(static_cast<int>(val)) + ")")
|
||||
|
||||
@@ -29,6 +30,7 @@ namespace Media {
|
||||
namespace VideoProcessingEngine {
|
||||
class AlgorithmUtils {
|
||||
public:
|
||||
static std::string ToString(GSError errorCode);
|
||||
static std::string ToString(VPEAlgoErrCode errorCode);
|
||||
static std::string ToString(VPEAlgoState state);
|
||||
static bool CopySurfaceBufferToSurfaceBuffer(const sptr<SurfaceBuffer>& srcBuffer,
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#define ALGORITHM_VIDEO_IMPL_H
|
||||
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <cinttypes>
|
||||
#include <condition_variable>
|
||||
#include <functional>
|
||||
@@ -30,9 +31,12 @@
|
||||
|
||||
#include "refbase.h"
|
||||
#include "surface.h"
|
||||
#include "surface_buffer.h"
|
||||
#include "sync_fence.h"
|
||||
|
||||
#include "algorithm_errors.h"
|
||||
#include "algorithm_video.h"
|
||||
#include "vpe_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Media {
|
||||
@@ -60,16 +64,23 @@ protected:
|
||||
VpeVideoImpl(VpeVideoImpl&&) = delete;
|
||||
VpeVideoImpl& operator=(VpeVideoImpl&&) = delete;
|
||||
|
||||
// These funcions may be called by derived class as necessary.
|
||||
bool IsInitialized() const;
|
||||
VPEAlgoErrCode Initialize();
|
||||
VPEAlgoErrCode Deinitialize();
|
||||
void RefreshBuffers();
|
||||
void OnOutputFormatChanged(const Format& format);
|
||||
|
||||
// These funcions may be overried by derived class as necessary.
|
||||
virtual VPEAlgoErrCode OnInitialize();
|
||||
virtual VPEAlgoErrCode OnDeinitialize();
|
||||
virtual VPEAlgoErrCode Process(const sptr<SurfaceBuffer>& sourceImage, sptr<SurfaceBuffer>& destinationImage);
|
||||
// This function will be called after disable, you may reset such as timeout protection status in derived class.
|
||||
// if you do NOT reset the protection status, the feature may not response properly when user call Enable() again.
|
||||
virtual VPEAlgoErrCode ResetAfterDisable();
|
||||
virtual bool IsDisableAfterProcessFail();
|
||||
virtual bool IsProducerSurfaceValid(const sptr<Surface>& surface);
|
||||
virtual bool IsConsumerBufferValid(const sptr<SurfaceBuffer>& buffer);
|
||||
virtual VPEAlgoErrCode UpdateRequestCfg(const sptr<Surface>& surface, BufferRequestConfig& requestCfg);
|
||||
virtual void UpdateRequestCfg(const sptr<SurfaceBuffer>& consumerBuffer, BufferRequestConfig& requestCfg);
|
||||
|
||||
@@ -82,8 +93,11 @@ private:
|
||||
|
||||
struct SurfaceBufferInfo {
|
||||
sptr<SurfaceBuffer> buffer{};
|
||||
sptr<SyncFence> fence{};
|
||||
VpeBufferFlag bufferFlag{VPE_BUFFER_FLAG_NONE};
|
||||
int64_t timestamp{};
|
||||
bool isFlushed{};
|
||||
std::chrono::time_point<std::chrono::steady_clock> flushedTime{};
|
||||
};
|
||||
|
||||
class ConsumerListener : public IBufferConsumerListener {
|
||||
@@ -109,23 +123,27 @@ private:
|
||||
GSError OnConsumerBufferAvailable();
|
||||
GSError OnProducerBufferReleased();
|
||||
|
||||
bool CheckEnableNotifyStatus(bool isEnable, const std::string& status);
|
||||
VPEAlgoErrCode DisableLocked();
|
||||
VPEAlgoErrCode UpdateProducerLocked();
|
||||
VPEAlgoErrCode RenderOutputBuffer(uint32_t index, int64_t renderTimestamp, bool render);
|
||||
sptr<Surface> CreateConsumerSurfaceLocked();
|
||||
bool RequestBuffer(SurfaceBufferInfo& bufferInfo, GSError& errorCode);
|
||||
bool RequestBuffer(SurfaceBufferInfo& bufferInfo, GSError& errorCode, const LogInfoEx& logInfos);
|
||||
void PrepareBuffers();
|
||||
void AttachAndRefreshProducerBuffers(const sptr<Surface>& producer);
|
||||
void AttachBuffers(const sptr<Surface>& producer, std::queue<SurfaceBufferInfo>& bufferQueue);
|
||||
void RefreshProducerBuffers(std::queue<SurfaceBufferInfo>& bufferQueue,
|
||||
std::function<bool(SurfaceBufferInfo&)>&& refresher);
|
||||
bool AttachAndRefreshProducerBuffers(const sptr<Surface>& producer);
|
||||
void AddProducerBuffers(std::queue<SurfaceBufferInfo>& bufferQueue, std::set<uint32_t>& producerBufferIDs);
|
||||
void AddBufferToCache(const SurfaceBufferInfo& bufferInfo);
|
||||
void DelBufferFromCache(const SurfaceBufferInfo& bufferInfo);
|
||||
void CheckAndUpdateProducerCache();
|
||||
void ProcessBuffers();
|
||||
bool GetConsumerAndProducerBuffer(SurfaceBufferInfo& srcBufferInfo, SurfaceBufferInfo& dstBufferInfo);
|
||||
bool ProcessBuffer(SurfaceBufferInfo& srcBufferInfo, SurfaceBufferInfo& dstBufferInfo);
|
||||
void BypassBuffer(SurfaceBufferInfo& srcBufferInfo, SurfaceBufferInfo& dstBufferInfo);
|
||||
void OutputBuffer(const SurfaceBufferInfo& bufferInfo, const SurfaceBufferInfo& bufferImage,
|
||||
std::function<void(void)>&& getReadyToRender);
|
||||
std::function<void(void)>&& getReadyToRender, const LogInfo& logInfo);
|
||||
void NotifyEnableStatus(uint32_t type, const std::string& status);
|
||||
bool PopBuffer(std::queue<SurfaceBufferInfo>& bufferQueue, uint32_t index, SurfaceBufferInfo& bufferInfo,
|
||||
std::function<void(sptr<SurfaceBuffer>&)>&& func);
|
||||
std::function<void(sptr<SurfaceBuffer>&)>&& func, const LogInfoEx& logInfos);
|
||||
void PrintBufferSize() const;
|
||||
void SetRequestCfgLocked(const sptr<SurfaceBuffer>& buffer);
|
||||
bool WaitTrigger();
|
||||
@@ -136,11 +154,14 @@ private:
|
||||
void ClearConsumerLocked(std::queue<SurfaceBufferInfo>& bufferQueue);
|
||||
void ClearBufferQueues();
|
||||
|
||||
VPEAlgoErrCode ExecuteWhenIdle(std::function<VPEAlgoErrCode(void)>&& operation, const std::string& errorMessage);
|
||||
VPEAlgoErrCode ExecuteWhenNotIdle(std::function<VPEAlgoErrCode(void)>&& operation, const std::string& errorMessage);
|
||||
VPEAlgoErrCode ExecuteWhenRunning(std::function<VPEAlgoErrCode(void)>&& operation, const std::string& errorMessage);
|
||||
VPEAlgoErrCode ExecuteWhenIdle(std::function<VPEAlgoErrCode(void)>&& operation, const std::string& errorMessage,
|
||||
const LogInfo& logInfo);
|
||||
VPEAlgoErrCode ExecuteWhenNotIdle(std::function<VPEAlgoErrCode(void)>&& operation, const std::string& errorMessage,
|
||||
const LogInfo& logInfo);
|
||||
VPEAlgoErrCode ExecuteWhenRunning(std::function<VPEAlgoErrCode(void)>&& operation, const std::string& errorMessage,
|
||||
const LogInfo& logInfo);
|
||||
VPEAlgoErrCode ExecuteWithCheck(std::function<bool(void)>&& checker,
|
||||
std::function<VPEAlgoErrCode(void)>&& operation, const std::string& errorMessage);
|
||||
std::function<VPEAlgoErrCode(void)>&& operation, const std::string& errorMessage, const LogInfo& logInfo);
|
||||
|
||||
// Common
|
||||
uint32_t type_{};
|
||||
@@ -149,6 +170,15 @@ private:
|
||||
std::condition_variable cvTrigger_{};
|
||||
std::condition_variable cvDone_{};
|
||||
|
||||
// [WARNING]
|
||||
// The lock must be held in the following order:
|
||||
// waitLock_
|
||||
// lock_
|
||||
// taskLock_
|
||||
// producerLock_
|
||||
// consumerBufferLock_
|
||||
// bufferLock_
|
||||
mutable std::mutex waitLock_{};
|
||||
mutable std::mutex lock_{};
|
||||
// Guarded by lock_ begin
|
||||
std::atomic<bool> isInitialized_{false};
|
||||
@@ -184,9 +214,11 @@ private:
|
||||
|
||||
mutable std::mutex bufferLock_{};
|
||||
// Guarded by bufferLock_ begin
|
||||
std::atomic<bool> needPrepareBuffersForNewProducer_{false};
|
||||
std::queue<SurfaceBufferInfo> producerBufferQueue_{};
|
||||
std::unordered_map<uint32_t, SurfaceBufferInfo> renderBufferQueue_{};
|
||||
std::queue<SurfaceBufferInfo> flushBufferQueue_{};
|
||||
std::unordered_map<uint32_t, SurfaceBufferInfo> producerBufferCache_{};
|
||||
std::queue<SurfaceBufferInfo> attachBufferQueue_{};
|
||||
std::set<uint32_t> attachBufferIDs_{};
|
||||
// Guarded by bufferLock_ end
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Copyright (c) 2025 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.
|
||||
*/
|
||||
|
||||
#ifndef VPE_MODEL_PATH_H
|
||||
#define VPE_MODEL_PATH_H
|
||||
|
||||
namespace OHOS {
|
||||
namespace Media {
|
||||
namespace VideoProcessingEngine {
|
||||
enum VpeModelKey {
|
||||
VPE_MODE_KEY_INVALID = -1,
|
||||
AILIGHT_NORMAL,
|
||||
AILIGHT_STRONG,
|
||||
AILIGHT_CLS,
|
||||
AIHDR_PIC,
|
||||
HDR_COMPOSE,
|
||||
SDR_CONVERT,
|
||||
HDR_DECOMPOSE,
|
||||
IMAGE_AISR_ALGO_CONFIG,
|
||||
IMAGE_SR_MODEL_0,
|
||||
IMAGE_SR_MODEL_1,
|
||||
IMAGE_SR_MODEL_2,
|
||||
IMAGE_SR_MODEL_3,
|
||||
IMAGE_SR_MODEL_4,
|
||||
CALC_HIST_COMP_SHADER_0,
|
||||
CALC_HIST_COMP_RGB_SHADER_1,
|
||||
CALC_HIST_COMP_LIMIT_SHADER_1,
|
||||
CALC_HIST_COMP_FULL_SHADER_1,
|
||||
SDR2SDR_VIDEO_CONVERT_EBU_Y2Y,
|
||||
SDR2SDR_VIDEO_CONVERT_EBU_Y2R,
|
||||
SDR2SDR_VIDEO_CONVERT_EBU_R2Y,
|
||||
SDR2SDR_VIDEO_CONVERT_EBU_R2R,
|
||||
SDR2SDR_VIDEO_CONVERT_SMPTE_Y2Y,
|
||||
SDR2SDR_VIDEO_CONVERT_SMPTE_Y2R,
|
||||
SDR2SDR_VIDEO_CONVERT_SMPTE_R2Y,
|
||||
SDR2SDR_VIDEO_CONVERT_SMPTE_R2R,
|
||||
HDR2HDR_VIDEO_PQ2HLG_Y2Y,
|
||||
HDR2HDR_VIDEO_PQ2HLG_Y2R,
|
||||
HDR2HDR_VIDEO_PQ2HLG_R2Y,
|
||||
HDR2HDR_VIDEO_PQ2HLG_R2R,
|
||||
HDR2HDR_VIDEO_HLG2PQ_Y2Y,
|
||||
HDR2HDR_VIDEO_HLG2PQ_Y2R,
|
||||
HDR2HDR_VIDEO_HLG2PQ_R2Y,
|
||||
HDR2HDR_VIDEO_HLG2PQ_R2R,
|
||||
HDR2SDR_VIDEO_CONVERT_HLG_Y2Y,
|
||||
HDR2SDR_VIDEO_CONVERT_HLG_Y2R,
|
||||
HDR2SDR_VIDEO_CONVERT_HLG_R2Y,
|
||||
HDR2SDR_VIDEO_CONVERT_HLG_R2R,
|
||||
HDR2SDR_VIDEO_CONVERT_HLG_Y2Y_DEFAULT,
|
||||
HDR2SDR_VIDEO_CONVERT_HLG_Y2R_DEFAULT,
|
||||
HDR2SDR_VIDEO_CONVERT_HLG_R2Y_DEFAULT,
|
||||
HDR2SDR_VIDEO_CONVERT_HLG_R2R_DEFAULT,
|
||||
HDR2SDR_VIDEO_CONVERT_PQ_Y2Y,
|
||||
HDR2SDR_VIDEO_CONVERT_PQ_Y2R,
|
||||
HDR2SDR_VIDEO_CONVERT_PQ_R2Y,
|
||||
HDR2SDR_VIDEO_CONVERT_PQ_R2R,
|
||||
VIDEO_AISR_ALGO_CONFIG,
|
||||
VIDEO_SR_MODEL_0,
|
||||
VIDEO_SR_MODEL_1,
|
||||
VIDEO_SR_MODEL_2,
|
||||
VIDEO_SR_MODEL_3,
|
||||
VIDEO_SR_MODEL_4,
|
||||
VIDEO_SR_MODEL_5,
|
||||
VIDEO_SR_MODEL_6,
|
||||
VIDEO_SR_MODEL_7,
|
||||
VIDEO_SR_BILINEAR_CL_KERNEL,
|
||||
VIDEO_SR_BICUBIC_CL_KERNEL,
|
||||
VIDEO_SR_SR_CL_KERNEL,
|
||||
EVE_10bit_SCALE_KERNEL,
|
||||
VIDEO_AIHDR_ALGO_CONFIG,
|
||||
VIDEO_AIHDR_MODEL,
|
||||
IMAGE_SR_10bit_CONVERT_KERNEL,
|
||||
VPE_MODEL_KEY_NUM,
|
||||
};
|
||||
|
||||
const std::array<std::string, VPE_MODEL_KEY_NUM> VPE_MODEL_PATHS = {
|
||||
"/sys_prod/etc/VideoProcessingEngine/AILIGHT_normal.omc",
|
||||
"/sys_prod/etc/VideoProcessingEngine/AILIGHT_strong.omc",
|
||||
"/sys_prod/etc/VideoProcessingEngine/AILIGHT_cls.omc",
|
||||
"/sys_prod/etc/VideoProcessingEngine/aihdr_pic.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr_compose.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/sdr_convert.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr_decompose.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/image_aisr_algo_config.xml",
|
||||
"/sys_prod/etc/VideoProcessingEngine/Image_SR_Model_576x576_20240402.omc",
|
||||
"/sys_prod/etc/VideoProcessingEngine/Image_SR_Model_848x1104_20240402.omc",
|
||||
"/sys_prod/etc/VideoProcessingEngine/Image_SR_Model_1104x1488_20240402.omc",
|
||||
"/sys_prod/etc/VideoProcessingEngine/Image_SR_Model_1488x1104_20240402.omc",
|
||||
"/sys_prod/etc/VideoProcessingEngine/Image_SR_Model_1872x1360_20240402.omc",
|
||||
"/sys_prod/etc/VideoProcessingEngine/calcHistCompShader0.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/calcHistCompRgbShader1.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/calcHistCompLimitShader1.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/calcHistCompFullShader1.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/sdr2sdr_video_convert_ebu_y2y.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/sdr2sdr_video_convert_ebu_y2r.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/sdr2sdr_video_convert_ebu_r2y.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/sdr2sdr_video_convert_ebu_r2r.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/sdr2sdr_video_convert_smpte_y2y.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/sdr2sdr_video_convert_smpte_y2r.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/sdr2sdr_video_convert_smpte_r2y.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/sdr2sdr_video_convert_smpte_r2r.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2hdr_video_pq2hlg_y2y.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2hdr_video_pq2hlg_y2r.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2hdr_video_pq2hlg_r2y.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2hdr_video_pq2hlg_r2r.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2hdr_video_hlg2pq_y2y.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2hdr_video_hlg2pq_y2r.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2hdr_video_hlg2pq_r2y.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2hdr_video_hlg2pq_r2r.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2sdr_video_hlg_y2y.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2sdr_video_hlg_y2r.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2sdr_video_hlg_r2y.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2sdr_video_hlg_r2r.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2sdr_video_hlg_y2y_default.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2sdr_video_hlg_y2r_default.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2sdr_video_hlg_r2y_default.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2sdr_video_hlg_r2r_default.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2sdr_video_pq_y2y.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2sdr_video_pq_y2r.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2sdr_video_pq_r2y.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/hdr2sdr_video_pq_r2r.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/video_aisr_ohos_config.xml",
|
||||
"/sys_prod/etc/VideoProcessingEngine/Video_SR_Model_576x576_2x.omc",
|
||||
"/sys_prod/etc/VideoProcessingEngine/Video_SR_Model_576x1024_2x.omc",
|
||||
"/sys_prod/etc/VideoProcessingEngine/Video_SR_Model_1024x576_2x.omc",
|
||||
"/sys_prod/etc/VideoProcessingEngine/Video_SR_Model_768x1280_2x.omc",
|
||||
"/sys_prod/etc/VideoProcessingEngine/Video_SR_Model_1280x768_2x.omc",
|
||||
"/sys_prod/etc/VideoProcessingEngine/Video_SR_Model_1088x1920_1x.omc",
|
||||
"/sys_prod/etc/VideoProcessingEngine/Video_SR_Model_1920x1088_1x.omc",
|
||||
"/sys_prod/etc/VideoProcessingEngine/Video_SR_Model_1920x1920_1x.omc",
|
||||
"/sys_prod/etc/VideoProcessingEngine/bilinear.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/bicubic.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/sr.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/10bitProcess.bin",
|
||||
"/sys_prod/etc/VideoProcessingEngine/video_aihdr_algo_config.xml",
|
||||
"/sys_prod/etc/VideoProcessingEngine/GTM_AIHDR.omc",
|
||||
"/sys_prod/etc/VideoProcessingEngine/10bitAisr.bin",
|
||||
};
|
||||
} // namespace VideoProcessingEngine
|
||||
} // namespace Media
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // VPE_MODEL_PATH_H
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef VPE_FRAMEWORK_ALGORITHM_COMMON_PARSE_METADATA_H
|
||||
#define VPE_FRAMEWORK_ALGORITHM_COMMON_PARSE_METADATA_H
|
||||
|
||||
#include <vector>
|
||||
#include "hdr_vivid_metadata_v1.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Media {
|
||||
namespace VideoProcessingEngine {
|
||||
constexpr int METADATA_MAX_LENGTH = 512;
|
||||
constexpr int AIHDR_METADATA_MAX_LENGTH = 128;
|
||||
// 以下变量根据CUVA标准7.4确定了每个元数据所占用的bit数
|
||||
using CuvaMetadataBitNum = enum {
|
||||
SYSTEM_START_CODE_BIT = 8,
|
||||
MINIMUM_MAXRGB_BIT = 12,
|
||||
AVERAGE_MAXRGB_BIT = 12,
|
||||
VARIANCE_MAXRGB_BIT = 12,
|
||||
MAXIMUM_MAXRGB_BIT = 12,
|
||||
TONE_MAPPING_MODE_BIT = 1,
|
||||
TONE_MAPPING_PARAM_NUM_BIT = 1,
|
||||
TARGETED_SYSTEM_DISPLAY_BIT = 12,
|
||||
BASE_FLAG_BIT = 1,
|
||||
BASE_PARAM_MP_BIT = 14,
|
||||
BASE_PARAM_MM_BIT = 6,
|
||||
BASE_PARAM_MA_BIT = 10,
|
||||
BASE_PARAM_MB_BIT = 10,
|
||||
BASE_PARAM_MN_BIT = 6,
|
||||
BASE_PARAM_K1_BIT = 2,
|
||||
BASE_PARAM_K2_BIT = 2,
|
||||
BASE_PARAM_K3_BIT = 4,
|
||||
BASE_PARAM_DELTA_MODE_BIT = 3,
|
||||
BASE_PARAM_DELTA_BIT = 7,
|
||||
P3SPLINE_FLAG_BIT = 1,
|
||||
P3SPLINE_NUM_BIT = 1,
|
||||
P3SPLINE_TH_MODE_BIT = 2,
|
||||
P3SPLINE_TH_MB_BIT = 8,
|
||||
P3SPLINE_TH_OFFSET_BIT = 2,
|
||||
P3SPLINE_TH1_BIT = 12,
|
||||
P3SPLINE_TH2_BIT = 10,
|
||||
P3SPLINE_TH3_BIT = 10,
|
||||
P3SPLINE_STRENGTH_BIT = 8,
|
||||
COLOR_SATURATION_BIT = 1,
|
||||
COLOR_SATURATION_NUM_BIT = 3,
|
||||
COLOR_SATURATION_GAIN_BIT = 8,
|
||||
CUVA_TWELVE_BIT_NUM = 4095,
|
||||
CUVA_LOW_AREA_CURVE = 0,
|
||||
CUVA_SPLINE_AREA_CURVE = 1,
|
||||
CUVA_HIGH_AREA_CURVE = 2,
|
||||
CUVA_TYPE_BIT = 4,
|
||||
MARKERBIT_BIT = 1,
|
||||
DISPLAY_3BIT = 3,
|
||||
DISPLAY_8BIT = 8,
|
||||
DISPLAY_MARKERBIT = 1,
|
||||
DISPLAY_16BIT = 16
|
||||
};
|
||||
|
||||
int PraseMetadataFromArray(const std::vector<uint8_t> &cuvaInfo, HdrVividMetadataV1 &tmoCuvaMetadata,
|
||||
HwDisplayMeta &displayMeta);
|
||||
} // namespace VideoProcessingEngine
|
||||
} // namespace Media
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // VPE_FRAMEWORK_ALGORITHM_COMMON_PARSE_METADATA_H
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2025 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
|
||||
@@ -13,10 +13,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef IMAGE_PROCESSING_UTILS_IMPL_H
|
||||
#define IMAGE_PROCESSING_UTILS_IMPL_H
|
||||
#ifndef VIDEO_PROCESSING_ENGINE_UTILS_H
|
||||
#define VIDEO_PROCESSING_ENGINE_UTILS_H
|
||||
|
||||
#include "pixelmap_native_impl.h"
|
||||
#include "algorithm_errors.h"
|
||||
#include "pixel_map.h"
|
||||
#include "surface_buffer.h"
|
||||
|
||||
namespace OHOS {
|
||||
@@ -39,9 +40,10 @@ public:
|
||||
std::shared_ptr<OHOS::Media::PixelMap>& pixelmap);
|
||||
static bool CopyNV12PixelmapToSurfaceBuffer(const std::shared_ptr<OHOS::Media::PixelMap>& pixelmap,
|
||||
sptr<SurfaceBuffer>& buffer);
|
||||
static VPEAlgoErrCode LoadModel(int modelKey, sptr<SurfaceBuffer>& modelBuffer);
|
||||
};
|
||||
} // namespace VideoProcessingEngine
|
||||
} // namespace Media
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // IMAGE_PROCESSING_UTILS_IMPL_H
|
||||
|
||||
#endif // VIDEO_PROCESSING_ENGINE_UTILS_H
|
||||
Reference in New Issue
Block a user