From 8746516cb4cb0da2c7b1a66b67c69e7335f2cafd Mon Sep 17 00:00:00 2001 From: Aous Naman Date: Tue, 9 Jan 2024 10:07:23 +1100 Subject: [PATCH] Started work on add windows of interest decoding --- src/core/codestream/ojph_codestream.cpp | 5 ++ src/core/codestream/ojph_codestream_local.cpp | 6 +++ src/core/codestream/ojph_codestream_local.h | 1 + src/core/common/ojph_codestream.h | 25 ++-------- src/core/common/ojph_message.h | 12 ++--- src/core/common/ojph_params.h | 49 ++----------------- 6 files changed, 24 insertions(+), 74 deletions(-) diff --git a/src/core/codestream/ojph_codestream.cpp b/src/core/codestream/ojph_codestream.cpp index 7036085..b74305c 100644 --- a/src/core/codestream/ojph_codestream.cpp +++ b/src/core/codestream/ojph_codestream.cpp @@ -147,6 +147,11 @@ namespace ojph { state->restrict_input_resolution(skipped_res_for_read, skipped_res_for_recon); } + //////////////////////////////////////////////////////////////////////////// + void codestream::restrict_recon_region(rect region) + { + state->restrict_recon_region(region); + } //////////////////////////////////////////////////////////////////////////// void codestream::create() diff --git a/src/core/codestream/ojph_codestream_local.cpp b/src/core/codestream/ojph_codestream_local.cpp index cb1a69b..113fc43 100644 --- a/src/core/codestream/ojph_codestream_local.cpp +++ b/src/core/codestream/ojph_codestream_local.cpp @@ -837,6 +837,12 @@ namespace ojph { siz.set_skipped_resolutions(skipped_res_for_recon); } + ////////////////////////////////////////////////////////////////////////// + void codestream::restrict_recon_region(rect region) + { + + } + ////////////////////////////////////////////////////////////////////////// void codestream::enable_resilience() { diff --git a/src/core/codestream/ojph_codestream_local.h b/src/core/codestream/ojph_codestream_local.h index 5e0bbfa..294528a 100644 --- a/src/core/codestream/ojph_codestream_local.h +++ b/src/core/codestream/ojph_codestream_local.h @@ -104,6 +104,7 @@ namespace ojph { void read_headers(infile_base *file); void restrict_input_resolution(ui32 skipped_res_for_data, ui32 skipped_res_for_recon); + void restrict_recon_region(rect region); void read(); void set_planar(int planar); void set_profile(const char *s); diff --git a/src/core/common/ojph_codestream.h b/src/core/common/ojph_codestream.h index 042fe03..47d629b 100644 --- a/src/core/common/ojph_codestream.h +++ b/src/core/common/ojph_codestream.h @@ -59,59 +59,42 @@ namespace ojph { class comment_exchange; class mem_fixed_allocator; struct point; + struct rect; struct line_buf; class outfile_base; class infile_base; //////////////////////////////////////////////////////////////////////////// - class codestream + class OJPH_EXPORT codestream { public: - OJPH_EXPORT codestream(); - OJPH_EXPORT ~codestream(); - OJPH_EXPORT void set_planar(bool planar); - OJPH_EXPORT void set_profile(const char* s); - OJPH_EXPORT void set_tilepart_divisions(bool at_resolutions, bool at_components); - OJPH_EXPORT void request_tlm_marker(bool needed); - OJPH_EXPORT void write_headers(outfile_base *file, const comment_exchange* comments = NULL, ui32 num_comments = 0); - OJPH_EXPORT line_buf* exchange(line_buf* line, ui32& next_component); - OJPH_EXPORT void flush(); - OJPH_EXPORT void enable_resilience(); // before read_headers - OJPH_EXPORT void read_headers(infile_base *file); // before resolution restrictions - OJPH_EXPORT void restrict_input_resolution(ui32 skipped_res_for_data, - ui32 skipped_res_for_recon); // before create - OJPH_EXPORT + ui32 skipped_res_for_recon); //before create + void restrict_recon_region(rect region); // before create void create(); - OJPH_EXPORT line_buf* pull(ui32 &comp_num); - OJPH_EXPORT void close(); - OJPH_EXPORT param_siz access_siz(); - OJPH_EXPORT param_cod access_cod(); - OJPH_EXPORT param_qcd access_qcd(); - OJPH_EXPORT bool is_planar() const; private: diff --git a/src/core/common/ojph_message.h b/src/core/common/ojph_message.h index 45e3d7d..41cb624 100644 --- a/src/core/common/ojph_message.h +++ b/src/core/common/ojph_message.h @@ -53,18 +53,16 @@ namespace ojph { }; //////////////////////////////////////////////////////////////////////////// - class message_base { + class OJPH_EXPORT message_base { public: - OJPH_EXPORT virtual void operator() (int warn_code, const char* file_name, int line_num, const char *fmt, ...) = 0; }; //////////////////////////////////////////////////////////////////////////// - class message_info : public message_base + class OJPH_EXPORT message_info : public message_base { public: - OJPH_EXPORT virtual void operator() (int info_code, const char* file_name, int line_num, const char* fmt, ...); }; @@ -78,10 +76,9 @@ namespace ojph { message_info& get_info(); //////////////////////////////////////////////////////////////////////////// - class message_warning : public message_base + class OJPH_EXPORT message_warning : public message_base { public: - OJPH_EXPORT virtual void operator() (int warn_code, const char* file_name, int line_num, const char* fmt, ...); }; @@ -95,10 +92,9 @@ namespace ojph { message_warning& get_warning(); //////////////////////////////////////////////////////////////////////////// - class message_error : public message_base + class OJPH_EXPORT message_error : public message_base { public: - OJPH_EXPORT virtual void operator() (int warn_code, const char* file_name, int line_num, const char *fmt, ...); }; diff --git a/src/core/common/ojph_params.h b/src/core/common/ojph_params.h index d17e8d2..bd5ebe8 100644 --- a/src/core/common/ojph_params.h +++ b/src/core/common/ojph_params.h @@ -55,49 +55,32 @@ namespace ojph { } //////////////////////////////////////////////////////////////////////////// - class param_siz + class OJPH_EXPORT param_siz { public: - OJPH_EXPORT param_siz(local::param_siz *p) : state(p) {} //setters - OJPH_EXPORT void set_image_extent(point extent); - OJPH_EXPORT void set_tile_size(size s); - OJPH_EXPORT void set_image_offset(point offset); - OJPH_EXPORT void set_tile_offset(point offset); - OJPH_EXPORT void set_num_components(ui32 num_comps); - OJPH_EXPORT void set_component(ui32 comp_num, const point& downsampling, ui32 bit_depth, bool is_signed); //getters - OJPH_EXPORT point get_image_extent() const; - OJPH_EXPORT point get_image_offset() const; - OJPH_EXPORT size get_tile_size() const; - OJPH_EXPORT point get_tile_offset() const; - OJPH_EXPORT ui32 get_num_components() const; - OJPH_EXPORT ui32 get_bit_depth(ui32 comp_num) const; - OJPH_EXPORT bool is_signed(ui32 comp_num) const; - OJPH_EXPORT point get_downsampling(ui32 comp_num) const; //deeper getters - OJPH_EXPORT ui32 get_recon_width(ui32 comp_num) const; - OJPH_EXPORT ui32 get_recon_height(ui32 comp_num) const; private: @@ -105,50 +88,30 @@ namespace ojph { }; //////////////////////////////////////////////////////////////////////////// - class param_cod + class OJPH_EXPORT param_cod { public: - OJPH_EXPORT param_cod(local::param_cod* p) : state(p) {} - OJPH_EXPORT void set_num_decomposition(ui32 num_decompositions); - OJPH_EXPORT void set_block_dims(ui32 width, ui32 height); - OJPH_EXPORT void set_precinct_size(int num_levels, size* precinct_size); - OJPH_EXPORT void set_progression_order(const char *name); - OJPH_EXPORT void set_color_transform(bool color_transform); - OJPH_EXPORT void set_reversible(bool reversible); - OJPH_EXPORT ui32 get_num_decompositions() const; - OJPH_EXPORT size get_block_dims() const; - OJPH_EXPORT size get_log_block_dims() const; - OJPH_EXPORT bool is_reversible() const; - OJPH_EXPORT size get_precinct_size(ui32 level_num) const; - OJPH_EXPORT size get_log_precinct_size(ui32 level_num) const; - OJPH_EXPORT int get_progression_order() const; - OJPH_EXPORT const char* get_progression_order_as_string() const; - OJPH_EXPORT int get_num_layers() const; - OJPH_EXPORT bool is_using_color_transform() const; - OJPH_EXPORT bool packets_may_use_sop() const; - OJPH_EXPORT bool packets_use_eph() const; - OJPH_EXPORT bool get_block_vertical_causality() const; private: @@ -156,13 +119,11 @@ namespace ojph { }; //////////////////////////////////////////////////////////////////////////// - class param_qcd + class OJPH_EXPORT param_qcd { public: - OJPH_EXPORT param_qcd(local::param_qcd* p) : state(p) {} - OJPH_EXPORT void set_irrev_quant(float delta); private: @@ -170,14 +131,12 @@ namespace ojph { }; //////////////////////////////////////////////////////////////////////////// - class comment_exchange + class OJPH_EXPORT comment_exchange { friend class local::codestream; public: comment_exchange() : data(NULL), len(0), Rcom(0) {} - OJPH_EXPORT void set_string(char* str); - OJPH_EXPORT void set_data(char* data, ui16 len); private: