build/test/poznan $*
fi
+#j2k_dump -i poznan.j2k > poznan.dump
+#diff -u good.dump poznan.dump
#include <poznan/tier2/markers.h>
#include <dcp/openjpeg_image.h>
#include <dlfcn.h>
+#include <thrust/system/cuda/error.h>
#include "i18n.h"
img->use_part2_mct = _param.param_use_part2_mct;
img->mct_compression_method = _param.param_mct_compression_method;
- img->coding_style = CODING_STYLE;
+ img->coding_style = CODING_STYLE_PRECINCTS_DEFINED;
img->prog_order = COMP_POS_RES_LY_PROG;
img->num_layers = NUM_LAYERS;
_set_coding_parameters (img, &_param);
_init_tiles (&img, &_param);
- _color_coder_lossy (img);
-
type_tile* tile = &(img->tile[0]);
/* XXX: it's a shame about this int -> float conversion */
for (int i = 0; i < 3; ++i) {
type_tile_comp* c = &tile->tile_comp[i];
+ c->tile_comp_no = i;
std::cout << "Tile comp " << i << ": " << c->width << "x" << c->height << "\n";
int const pixels = c->width * c->height;
_cuda_h_allocate_mem ((void **) &c->img_data, pixels * sizeof (type_data));
for (int j = 0; j < pixels; ++j) {
- c->img_data[j] = float (input->data(i)[j]) / 4095;
+ c->img_data[j] = float (input->data(i)[j]);
//c->img_data[j] = input->data(i)[j];
}
_cuda_memcpy_htd (c->img_data, c->img_data_d, pixels * sizeof (type_data));
_cuda_h_free (c->img_data);
}
+ _color_coder_lossy (img);
+
std::cout << "Tile " << tile->width << "x" << tile->height << "\n";
_fwt (tile);
_quantize_tile (tile);
type_buffer buffer;
_init_buffer (&buffer);
_encode_codestream (&buffer, img);
+ if (cudaGetLastError () != cudaSuccess) {
+ throw EncodeError ("CUDA error");
+ }
std::cout << img->num_tiles << " tiles.\n";
std::cout << "got " << buffer.bytes_count << " bytes.\n";
Data encoded (buffer.data, buffer.bytes_count);
- /* XXX! */
- static int shit = 0;
- {
- string name = raw_convert<string> (shit);
- FILE* f = fopen (name.c_str(), "wb");
- fwrite (buffer.data, 1, buffer.bytes_count, f);
- fclose (f);
- ++shit;
- }
-
free (buffer.data);
delete img;
void (*_cuda_h_allocate_mem) (void **, uint64_t);
void (*_cuda_memcpy_htd) (void *, void *, uint64_t);
void (*_cuda_h_free) (void *);
+ void (*_check_cuda_error) (char const *);
};
AVCODEC AVUTIL AVFORMAT AVFILTER SWSCALE
BOOST_FILESYSTEM BOOST_THREAD BOOST_DATETIME BOOST_SIGNALS2 BOOST_REGEX
SNDFILE SAMPLERATE POSTPROC TIFF MAGICK SSH DCP CXML GLIB LZMA XML++
- CURL ZIP FONTCONFIG PANGOMM CAIROMM XMLSEC SUB ICU PATCHED_FFMPEG
+ CURL ZIP FONTCONFIG PANGOMM CAIROMM XMLSEC SUB ICU PATCHED_FFMPEG CUDA
"""
if bld.env.TARGET_OSX:
for (int x = 666; x < 1332; ++x) {
for (int y = 0; y < 1080; ++y) {
- rgb->data()[0][y * line_size + x * 3] = 255;
- rgb->data()[0][y * line_size + x * 3 + 1] = 0;
+ rgb->data()[0][y * line_size + x * 3] = 0;
+ rgb->data()[0][y * line_size + x * 3 + 1] = 255;
rgb->data()[0][y * line_size + x * 3 + 2] = 0;
}
}
for (int x = 1332; x < 1998; ++x) {
for (int y = 0; y < 1080; ++y) {
- rgb->data()[0][y * line_size + x * 3] = 255;
+ rgb->data()[0][y * line_size + x * 3] = 0;
rgb->data()[0][y * line_size + x * 3 + 1] = 0;
- rgb->data()[0][y * line_size + x * 3 + 2] = 0;
+ rgb->data()[0][y * line_size + x * 3 + 2] = 255;
}
}
shared_ptr<const dcp::OpenJPEGImage> xyz = dcp::rgb_to_xyz (rgb->data()[0], rgb->size(), rgb->stride()[0], ColourConversion::rec709_to_xyz ());
Data j2k = encoder->encode (xyz, 100000000, 24, RESOLUTION_2K, false);
+ j2k.write ("poznan.j2k");
}
obj = bld(features='cxx cxxprogram')
obj.name = 'unit-tests'
obj.uselib = 'BOOST_TEST BOOST_THREAD BOOST_FILESYSTEM BOOST_DATETIME SNDFILE SAMPLERATE DCP FONTCONFIG CAIROMM PANGOMM XMLPP '
- obj.uselib += 'AVFORMAT AVFILTER AVCODEC AVUTIL SWSCALE POSTPROC CXML MAGICK SUB GLIB CURL SSH XMLSEC BOOST_REGEX ICU '
+ obj.uselib += 'AVFORMAT AVFILTER AVCODEC AVUTIL SWSCALE POSTPROC CXML MAGICK SUB GLIB CURL SSH XMLSEC BOOST_REGEX ICU CUDA '
if bld.env.TARGET_WINDOWS:
obj.uselib += 'WINSOCK2'
obj.use = 'libdcpomatic2'
obj = bld(features='cxx cxxprogram')
obj.name = 'poznan'
- obj.uselib = 'DCP'
+ obj.uselib = 'DCP CUDA'
obj.use = 'libdcpomatic2'
obj.source = "poznan.cc"
obj.target = 'poznan'
else:
conf.env.LIB_XMLSEC = ['xmlsec1-openssl', 'xmlsec1']
+ # XXX
+ conf.env.LIB_CUDA = ['cudart']
+
# FFmpeg
if conf.options.static_ffmpeg:
names = ['avformat', 'avfilter', 'avcodec', 'avutil', 'swscale', 'postproc']