9#if defined HAVE_GPUJPEG
33static bool no_gpu =
false;
37static void gpujpeg_test_teardown()
40 if (decompress !=
nullptr) {
45static pthread_once_t set_up = PTHREAD_ONCE_INIT;
47static void gpujpeg_test_setup()
50 int ret =
compress_init(
nullptr,
"GPUJPEG:check", &compression);
56 clog <<
"Either GPUJPEG not compiled in or no CUDA-capable devices found - skipping GPUJPEG tests.\n";
62 assert(ret >= 0 &&
"Compression initialization failed");
65 atexit(gpujpeg_test_teardown);
70 using namespace std::string_literals;
71 pthread_once(&set_up, gpujpeg_test_setup);
78 memset(in->tiles[0].data, 127, in->tiles[0].data_len);
84 vector<unsigned char> decompressed(in->tiles[0].data_len);
85 auto comp_desc =
desc;
94 reinterpret_cast<unsigned char *
>(compressed->tiles[0].data),
95 compressed->tiles[0].data_len,
103 for_each(decompressed.begin(), decompressed.end(), [&](
unsigned char &x) {max_diff = max(abs(x - (unsigned char) in->tiles[0].data[i++]), max_diff);});
104 ASSERT_MESSAGE(
"Maximal allowed difference 1, found "s + to_string(max_diff), max_diff <= 1);
void vf_free(struct video_frame *buf)
Frees video_frame structure.
int vc_get_linesize(unsigned int width, codec_t codec)
struct video_frame * vf_alloc_desc_data(struct video_desc desc)
int gpujpeg_test_simple()
void module_done(struct module *module_data)
shared_ptr< video_frame > compress_pop(struct compress_state *proxy)
void compress_frame(struct compress_state *proxy, shared_ptr< video_frame > frame)
int compress_init(struct module *parent, const char *config_string, struct compress_state **state)
This function initializes video compression.
decompress_status decompress_frame(struct state_decompress *s, unsigned char *dst, unsigned char *compressed, unsigned int compressed_len, int frame_seq, struct video_frame_callbacks *callbacks, struct pixfmt_desc *internal_prop)
Decompresses video frame.
void decompress_done(struct state_decompress *s)
int decompress_reconfigure(struct state_decompress *s, struct video_desc desc, int rshift, int gshift, int bshift, int pitch, codec_t out_codec)
bool decompress_init_multi(codec_t compression, struct pixfmt_desc internal_prop, codec_t out_codec, struct state_decompress **out, int count)
Initializes (multiple) decompress states.
std::unordered_map< std::string, std::string > commandline_params
unsigned int width
width of every tile (!)
@ PROGRESSIVE
progressive frame
@ RGB
RGB 8-bit (packed into 24-bit word)
@ JPEG
JPEG image, restart intervals may be used. Compatible with GPUJPEG.
#define ASSERT_MESSAGE(msg, expr)
This is an umbrella header for video functions.
API for video compress drivers.
API for video decompress drivers.