blob: 28e8a3c764bfbc225778818c0a8a5a1bdf264b5f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/*
Copyright (C) 2022 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
DCP-o-matic is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
DCP-o-matic is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DCPOMATIC_CUDA_J2K_FRAME_ENCODER
#define DCPOMATIC_CUDA_J2K_FRAME_ENCODER
#include "j2k_frame_encoder.h"
#include "types.h"
#include <dcp/types.h>
#include <nvjpeg2k.h>
#include <vector>
class CUDAJ2KFrameEncoder : public J2KFrameEncoder
{
public:
CUDAJ2KFrameEncoder();
std::vector<dcp::ArrayData> encode(DCPVideo const &) override;
std::vector<dcp::ArrayData> flush() override;
void log_thread_start() override;
private:
nvjpeg2kEncoder_t _encoder_handle;
nvjpeg2kEncodeState_t _encoder_state;
nvjpeg2kEncodeParams_t _encoder_params;
class Frame
{
public:
Frame(DCPVideo const& vf);
Frame(Frame const& other) = delete;
Frame(Frame&& other);
~Frame();
Frame& operator=(Frame const& other) = delete;
nvjpeg2kImage_t const* const device_image() const {
return &_device_image;
}
private:
uint8_t* _pixel_data_d[3];
size_t _pitch_in_bytes[3];
nvjpeg2kImage_t _device_image;
};
std::vector<Frame> _batch;
boost::optional<dcp::Size> _size;
boost::optional<Resolution> _resolution;
};
#endif
|