OrangePi3588Media/include/hw/atlas_defaults.h
2026-01-16 20:29:32 +08:00

99 lines
2.8 KiB
C++

#pragma once
#include <memory>
#include <string>
#include <vector>
#include "hw/i_decoder.h"
#include "hw/i_encoder.h"
#include "hw/i_image_processor.h"
#include "hw/i_infer_backend.h"
#include "utils/result.h"
namespace rk3588 {
class AtlasInferBackend : public IInferBackend {
public:
ModelHandle LoadModel(const std::string& /*model_path*/, std::string& err) override {
err = "atlas infer backend not supported";
return kInvalidModelHandle;
}
void UnloadModel(ModelHandle /*handle*/) override {}
bool GetModelInfo(ModelHandle /*handle*/, ModelInfo& /*info*/) const override {
return false;
}
InferResult Infer(ModelHandle /*handle*/, const InferInput& /*input*/) override {
InferResult res;
res.success = false;
res.error = "atlas infer backend not supported";
return res;
}
AiScheduler::BorrowedInferResult InferBorrowed(ModelHandle /*handle*/, const InferInput& /*input*/) override {
AiScheduler::BorrowedInferResult res;
res.success = false;
res.error = "atlas infer backend not supported";
return res;
}
};
class AtlasImageProcessor : public IImageProcessor {
public:
Status Resize(const Frame& /*src*/, Frame& /*dst*/) override {
return FailStatus("atlas image processor not supported");
}
Status CvtColor(const Frame& /*src*/, Frame& /*dst*/, PixelFormat /*dst_format*/) override {
return FailStatus("atlas image processor not supported");
}
Status Normalize(const Frame& /*src*/, std::vector<float>& /*out*/,
const std::vector<float>& /*mean*/,
const std::vector<float>& /*std*/) override {
return FailStatus("atlas image processor not supported");
}
};
class AtlasDecoder : public IDecoder {
public:
Status Open(const SimpleJson& /*config*/) override {
return FailStatus("atlas decoder not supported");
}
Status Send(const DecodePacket& /*packet*/) override {
return FailStatus("atlas decoder not supported");
}
Result<std::shared_ptr<Frame>> Receive() override {
return MakeError<std::shared_ptr<Frame>>("atlas decoder not supported");
}
void Close() override {}
};
class AtlasEncoder : public IEncoder {
public:
Status Open(const SimpleJson& /*config*/) override {
return FailStatus("atlas encoder not supported");
}
Status Send(const std::shared_ptr<Frame>& /*frame*/) override {
return FailStatus("atlas encoder not supported");
}
Result<EncodePacket> Receive() override {
return MakeError<EncodePacket>("atlas encoder not supported");
}
std::vector<uint8_t> ExtraData() const override {
return {};
}
void Close() override {}
};
} // namespace rk3588