55#include "gtest/gtest.h"
68 const std::vector<std::vector<ojph::si32> >& samples)
98 ASSERT_EQ(next_comp, c);
100 cur_line->i32[x] = samples[c][y * width + x];
101 cur_line = codestream.
exchange(cur_line, next_comp);
120 ASSERT_EQ(comp_num, c);
122 ASSERT_EQ(line->i32[x], samples[c][y * width + x])
123 <<
"component " << c <<
" at (" << x <<
", " << y <<
")";
133 std::vector<std::vector<ojph::si32> >
136 std::vector<std::vector<ojph::si32> > s(3,
137 std::vector<ojph::si32>((
size_t)width * height));
138 for (
ojph::ui32 i = 0; i < width * height; ++i)
151TEST(TestSignedShift, RctNegative32) {
153 round_trip(width, height, 3, 16, 0,
true, 5,
154 negative_rgb(width, height, 1000));
159TEST(TestSignedShift, RctNegative64) {
161 round_trip(width, height, 3, 32, 0,
true, 5,
162 negative_rgb(width, height, 100000000));
168TEST(TestSignedShift, OddSingleColumnNegative) {
170 std::vector<std::vector<ojph::si32> > s(1,
171 std::vector<ojph::si32>(height));
174 round_trip(width, height, 1, 16, 1,
false, 1, s);
178int main(
int argc,
char** argv) {
179 ::testing::InitGoogleTest(&argc, argv);
180 return RUN_ALL_TESTS();
The object represent a codestream.
param_siz access_siz()
Returns the underlying SIZ marker segment object.
param_cod access_cod()
Returns the underlying COD marker segment object.
void close()
Call this function to close the underlying file; works for both encoding and decoding codestreams.
void set_planar(bool planar)
Sets the sequence of pushing or pull rows from the machinery.
line_buf * exchange(line_buf *line, ui32 &next_component)
This call is used to send image data rows to the library. We expect to send one row from a single com...
void read_headers(infile_base *file)
This call reads the headers of a codestream. It is for a reading (or decoding) codestream,...
void write_headers(outfile_base *file, const comment_exchange *comments=NULL, ui32 num_comments=0)
Writes codestream headers when the codestream is used for writing. This function should be called aft...
void create()
This call is for a decoding (or reading) codestream. Call this function after calling restrict_input_...
void flush()
This is the last call to a writing (encoding) codestream. This will write encoded bitstream data to t...
line_buf * pull(ui32 &comp_num)
This call is to pull one row from the codestream, being decoded. The returned line_buf object holds o...
void open(const ui8 *data, size_t size)
mem_outfile stores encoded j2k codestreams in memory
size_t get_used_size() const
Call this function to get the used size of the memory file.
void open(size_t initial_size=65536, bool clear_mem=false)
Call this function to open a memory file.
const ui8 * get_data()
Call this function to access memory file data.
void set_num_decomposition(ui32 num_decompositions)
void set_block_dims(ui32 width, ui32 height)
void set_color_transform(bool color_transform)
void set_reversible(bool reversible)
void set_tile_size(size s)
void set_component(ui32 comp_num, const point &downsampling, ui32 bit_depth, bool is_signed)
void set_num_components(ui32 num_comps)
void set_tile_offset(point offset)
void set_image_offset(point offset)
void set_image_extent(point extent)
int main(int argc, char *argv[])
TEST(TestExecutables, OpenJPHCompressNoArguments)