69 bool is_signed = (Data[2] >> 4) & 1;
70 bool reversible = (Data[2] >> 5) & 1;
71 bool color_transform = (Data[2] >> 6) & 1;
73 bool planar = (Data[3] >> 3) & 1;
75 if (num_decomps > 5) num_decomps = 5;
76 if (num_comps < 3) color_transform =
false;
77 if (color_transform) planar =
false;
79 const uint8_t *pixels = Data + 4;
80 size_t pixels_len = Size - 4;
121 dp[x] = is_signed ? val - 128 : val;
123 line = cs.
exchange(line, next_comp);
129 catch (
const std::exception &)
135#ifdef OJPH_FUZZ_TARGET_MAIN
136int main(
int argc,
char **argv) {
140 FILE *f = fopen(argv[1],
"rb");
141 if (!f) {
return -1; }
142 fseek(f, 0, SEEK_END);
148 std::vector<uint8_t> buf(len);
149 size_t n = fread(buf.data(), 1, len, f);
150 if(n !=
static_cast<size_t>(len)) {
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...
param_qcd access_qcd()
Returns the underlying QCD marker segment object.
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 flush()
This is the last call to a writing (encoding) codestream. This will write encoded bitstream data to t...
mem_outfile stores encoded j2k codestreams in memory
void open(size_t initial_size=65536, bool clear_mem=false)
Call this function to open a memory file.
void set_num_decomposition(ui32 num_decompositions)
void set_color_transform(bool color_transform)
void set_reversible(bool reversible)
void set_irrev_quant(float delta)
Set the irreversible quantization base delta.
void set_component(ui32 comp_num, const point &downsampling, ui32 bit_depth, bool is_signed)
void set_num_components(ui32 num_comps)
void set_image_extent(point extent)
int main(int argc, char *argv[])
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)