diff --git a/selfdrive/ui/replay/framereader.cc b/selfdrive/ui/replay/framereader.cc index ca3c1a38dbd532..26c17670bab8a9 100644 --- a/selfdrive/ui/replay/framereader.cc +++ b/selfdrive/ui/replay/framereader.cc @@ -49,7 +49,7 @@ FrameReader::~FrameReader() { } } -bool FrameReader::load(const std::string &url, AVHWDeviceType hw_device_type, std::atomic *abort) { +bool FrameReader::load(const std::string &url, bool no_cuda, std::atomic *abort) { std::string content = read(url, abort); if (content.empty()) return false; @@ -85,8 +85,8 @@ bool FrameReader::load(const std::string &url, AVHWDeviceType hw_device_type, st width = (decoder_ctx->width + 3) & ~3; height = decoder_ctx->height; - if (hw_device_type != AV_HWDEVICE_TYPE_NONE) { - if (!initHardwareDecoder(hw_device_type)) { + if (!no_cuda) { + if (!initHardwareDecoder(AV_HWDEVICE_TYPE_CUDA)) { return false; } } diff --git a/selfdrive/ui/replay/framereader.h b/selfdrive/ui/replay/framereader.h index 6820d1af93c790..fe9372e850094f 100644 --- a/selfdrive/ui/replay/framereader.h +++ b/selfdrive/ui/replay/framereader.h @@ -21,7 +21,7 @@ class FrameReader : protected FileReader { public: FrameReader(bool local_cache = false, int chunk_size = -1, int retries = 0); ~FrameReader(); - bool load(const std::string &url, AVHWDeviceType hw_device_type = AV_HWDEVICE_TYPE_NONE, std::atomic *abort = nullptr); + bool load(const std::string &url, bool no_cuda = false, std::atomic *abort = nullptr); bool get(int idx, uint8_t *rgb, uint8_t *yuv); int getRGBSize() const { return width * height * 3; } int getYUVSize() const { return width * height * 3 / 2; } diff --git a/selfdrive/ui/replay/main.cc b/selfdrive/ui/replay/main.cc index 22a55e5fb8f579..062837885b1c67 100644 --- a/selfdrive/ui/replay/main.cc +++ b/selfdrive/ui/replay/main.cc @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) { {"no-cache", REPLAY_FLAG_NO_FILE_CACHE, "turn off local cache"}, {"qcam", REPLAY_FLAG_QCAMERA, "load qcamera"}, {"yuv", REPLAY_FLAG_SEND_YUV, "send yuv frame"}, - {"cuda", REPLAY_FLAG_CUDA, "enable CUDA accelerated decoding"}, + {"no-cuda", REPLAY_FLAG_NO_CUDA, "disable CUDA"}, }; QCommandLineParser parser; diff --git a/selfdrive/ui/replay/replay.cc b/selfdrive/ui/replay/replay.cc index 54666a967a32b8..e3753ccf200602 100644 --- a/selfdrive/ui/replay/replay.cc +++ b/selfdrive/ui/replay/replay.cc @@ -23,9 +23,6 @@ Replay::Replay(QString route, QStringList allow, QStringList block, SubMaster *s } } qDebug() << "services " << s; - if (flags & REPLAY_FLAG_CUDA) { - qInfo() << "decode frames with CUDA"; - } if (sm == nullptr) { pm = new PubMaster(s); diff --git a/selfdrive/ui/replay/replay.h b/selfdrive/ui/replay/replay.h index 0dd0f70a74d509..2d30d90e4bce7d 100644 --- a/selfdrive/ui/replay/replay.h +++ b/selfdrive/ui/replay/replay.h @@ -16,7 +16,7 @@ enum REPLAY_FLAGS { REPLAY_FLAG_NO_FILE_CACHE = 0x0020, REPLAY_FLAG_QCAMERA = 0x0040, REPLAY_FLAG_SEND_YUV = 0x0080, - REPLAY_FLAG_CUDA = 0x0100, + REPLAY_FLAG_NO_CUDA = 0x0100, }; class Replay : public QObject { diff --git a/selfdrive/ui/replay/route.cc b/selfdrive/ui/replay/route.cc index dc5fbd5ec7d49c..9ee1d387c4736c 100644 --- a/selfdrive/ui/replay/route.cc +++ b/selfdrive/ui/replay/route.cc @@ -119,9 +119,7 @@ void Segment::loadFile(int id, const std::string file) { bool success = false; if (id < MAX_CAMERAS) { frames[id] = std::make_unique(local_cache, 20 * 1024 * 1024, 3); - - AVHWDeviceType hw_device_type = flags & REPLAY_FLAG_CUDA ? AV_HWDEVICE_TYPE_CUDA : AV_HWDEVICE_TYPE_NONE; - success = frames[id]->load(file, hw_device_type, &abort_); + success = frames[id]->load(file, flags & REPLAY_FLAG_NO_CUDA, &abort_); } else { log = std::make_unique(local_cache, -1, 3); success = log->load(file, &abort_);