2 Copyright (C) 2022 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
23 #include <dcp/array_data.h>
25 #include <libavutil/pixfmt.h>
27 #include <boost/thread/condition.hpp>
28 #include <boost/thread/mutex.hpp>
39 CUDA(CUDA &) = delete;
40 CUDA(CUDA &&) = delete;
42 std::shared_ptr<Image> decode(std::shared_ptr<const dcp::Data> j2k_data, int reduce, AVPixelFormat pixel_format, Image::Alignment alignment);
44 static CUDA* instance();
55 std::shared_ptr<const dcp::Data> data;
57 AVPixelFormat pixel_format;
58 Image::Alignment alignment;
61 std::queue<DecodeQueueItem> _decode_queue;
62 std::map<ID, std::shared_ptr<Image>> _decode_output;
63 boost::condition _decode_queue_empty_condition;
64 boost::condition _decode_complete_condition;
65 boost::mutex _decode_mutex;
66 std::thread _decode_thread;
67 ID _next_decode_id = 0;
69 static CUDA* _instance;