diff options
author | german77 <juangerman-13@hotmail.com> | 2022-06-19 22:54:21 +0200 |
---|---|---|
committer | german77 <juangerman-13@hotmail.com> | 2022-07-24 22:01:43 +0200 |
commit | 3ac4f3a2521e421a625fe1d7dcba05b8441fe056 (patch) | |
tree | ce7e1f5be8624a8b6d3084b9c4ef522f87ba6ac7 /src/core/hle/service/hid/irsensor/clustering_processor.h | |
parent | Merge pull request #8484 from german77/irs_release (diff) | |
download | yuzu-3ac4f3a2521e421a625fe1d7dcba05b8441fe056.tar yuzu-3ac4f3a2521e421a625fe1d7dcba05b8441fe056.tar.gz yuzu-3ac4f3a2521e421a625fe1d7dcba05b8441fe056.tar.bz2 yuzu-3ac4f3a2521e421a625fe1d7dcba05b8441fe056.tar.lz yuzu-3ac4f3a2521e421a625fe1d7dcba05b8441fe056.tar.xz yuzu-3ac4f3a2521e421a625fe1d7dcba05b8441fe056.tar.zst yuzu-3ac4f3a2521e421a625fe1d7dcba05b8441fe056.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/hid/irsensor/clustering_processor.h | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/core/hle/service/hid/irsensor/clustering_processor.h b/src/core/hle/service/hid/irsensor/clustering_processor.h index 6e2ba8846..dc01a8ea7 100644 --- a/src/core/hle/service/hid/irsensor/clustering_processor.h +++ b/src/core/hle/service/hid/irsensor/clustering_processor.h @@ -5,12 +5,19 @@ #include "common/common_types.h" #include "core/hid/irs_types.h" +#include "core/hle/service/hid/irs_ring_lifo.h" #include "core/hle/service/hid/irsensor/processor_base.h" +namespace Core::HID { +class EmulatedController; +} // namespace Core::HID + namespace Service::IRS { class ClusteringProcessor final : public ProcessorBase { public: - explicit ClusteringProcessor(Core::IrSensor::DeviceFormat& device_format); + explicit ClusteringProcessor(Core::HID::HIDCore& hid_core_, + Core::IrSensor::DeviceFormat& device_format, + std::size_t npad_index); ~ClusteringProcessor() override; // Called when the processor is initialized @@ -26,6 +33,10 @@ public: void SetConfig(Core::IrSensor::PackedClusteringProcessorConfig config); private: + static constexpr auto format = Core::IrSensor::ImageTransferProcessorFormat::Size320x240; + static constexpr std::size_t width = 320; + static constexpr std::size_t height = 240; + // This is nn::irsensor::ClusteringProcessorConfig struct ClusteringProcessorConfig { Core::IrSensor::CameraConfig camera_config; @@ -68,7 +79,32 @@ private: static_assert(sizeof(ClusteringProcessorState) == 0x198, "ClusteringProcessorState is an invalid size"); + struct ClusteringSharedMemory { + Service::IRS::Lifo<ClusteringProcessorState, 6> clustering_lifo; + static_assert(sizeof(clustering_lifo) == 0x9A0, "clustering_lifo is an invalid size"); + INSERT_PADDING_WORDS(0x11F); + }; + static_assert(sizeof(ClusteringSharedMemory) == 0xE20, + "ClusteringSharedMemory is an invalid size"); + + void OnControllerUpdate(Core::HID::ControllerTriggerType type); + void RemoveLowIntensityData(std::vector<u8>& data); + ClusteringData GetClusterProperties(std::vector<u8>& data, std::size_t x, std::size_t y); + ClusteringData GetPixelProperties(const std::vector<u8>& data, std::size_t x, + std::size_t y) const; + ClusteringData MergeCluster(const ClusteringData a, const ClusteringData b) const; + u8 GetPixel(const std::vector<u8>& data, std::size_t x, std::size_t y) const; + void SetPixel(std::vector<u8>& data, std::size_t x, std::size_t y, u8 value); + + // Sets config parameters of the camera + void SetDefaultConfig(); + + ClusteringSharedMemory* shared_memory = nullptr; + ClusteringProcessorState next_state{}; + ClusteringProcessorConfig current_config{}; Core::IrSensor::DeviceFormat& device; + Core::HID::EmulatedController* npad_device; + int callback_key{}; }; } // namespace Service::IRS |