2024-11-30 17:10:43 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <queue>
|
|
|
|
|
|
|
|
#include "Core/Core.h"
|
|
|
|
#include "Core/Singleton.h"
|
|
|
|
|
|
|
|
class ImageBuffer : public Singleton<ImageBuffer> {
|
|
|
|
public:
|
|
|
|
enum class IBType {
|
2024-12-02 15:01:10 +00:00
|
|
|
Human,
|
|
|
|
Face,
|
|
|
|
FaceMask,
|
2024-11-30 17:10:43 +00:00
|
|
|
};
|
|
|
|
public:
|
|
|
|
explicit ImageBuffer() noexcept = default;
|
|
|
|
~ImageBuffer() = default;
|
|
|
|
|
|
|
|
ImageBuffer(const ImageBuffer&) = delete;
|
|
|
|
ImageBuffer& operator=(const ImageBuffer&) = delete;
|
|
|
|
|
2024-12-01 17:31:51 +00:00
|
|
|
bool Initialize() override;
|
|
|
|
void Uninitialize() override;
|
|
|
|
|
2024-11-30 17:10:43 +00:00
|
|
|
void PushImage(IBType type, std::vector<uint8> data, uint32 width, uint32 height, uint32 comp);
|
2024-12-01 17:31:51 +00:00
|
|
|
void Update(IBType type, class Texture2D* texture);
|
2024-11-30 17:10:43 +00:00
|
|
|
|
|
|
|
private:
|
2024-12-02 15:01:10 +00:00
|
|
|
void PushHumanImage(std::vector<uint8> data, uint32 width, uint32 height, uint32 comp);
|
|
|
|
void UpdateHuman(class Texture2D* texture);
|
|
|
|
|
|
|
|
void PushFaceImage(std::vector<uint8> data, uint32 width, uint32 height, uint32 comp);
|
|
|
|
void UpdateFace(class Texture2D* texture);
|
|
|
|
void PushFaceMaskImage(std::vector<uint8> data, uint32 width, uint32 height, uint32 comp);
|
|
|
|
void UpdateFaceMask(class Texture2D* texture);
|
|
|
|
|
2024-11-30 17:10:43 +00:00
|
|
|
private:
|
|
|
|
struct Image {
|
|
|
|
std::vector<uint8> data;
|
|
|
|
uint32 width;
|
|
|
|
uint32 height;
|
|
|
|
uint32 comp;
|
|
|
|
};
|
2024-12-02 15:01:10 +00:00
|
|
|
CriticalSection human_cs_;
|
|
|
|
Image human_;
|
|
|
|
|
|
|
|
CriticalSection face_cs_;
|
|
|
|
Image face_;
|
|
|
|
|
|
|
|
CriticalSection face_mask_cs_;
|
|
|
|
Image faceMask_;
|
2024-11-30 17:10:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
};
|