Skip to content

Commit

Permalink
Added DFS and ATK, but not fully tested. Need to add COC. Integrate w…
Browse files Browse the repository at this point in the history
…ith the rest of the code.
  • Loading branch information
aous72 committed Mar 28, 2024
1 parent 1761bfe commit 508eb92
Show file tree
Hide file tree
Showing 6 changed files with 554 additions and 83 deletions.
20 changes: 14 additions & 6 deletions src/core/codestream/ojph_codestream_local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ namespace ojph {

used_qcc_fields = 0;
qcc = qcc_store;
used_coc_fields = 0;
coc = coc_store;

allocator = new mem_fixed_allocator;
elastic_alloc = new mem_elastic_allocator(1048576); //1 megabyte
Expand Down Expand Up @@ -717,15 +719,15 @@ namespace ojph {
{
if (msg_level == OJPH_MSG_LEVEL::INFO)
{
OJPH_INFO(0x00030001, "%s\n", msg);
OJPH_INFO(0x00030001, "%s", msg);
}
else if (msg_level == OJPH_MSG_LEVEL::WARN)
{
OJPH_WARN(0x00030001, "%s\n", msg);
OJPH_WARN(0x00030001, "%s", msg);
}
else if (msg_level == OJPH_MSG_LEVEL::ERROR)
{
OJPH_ERROR(0x00030001, "%s\n", msg);
OJPH_ERROR(0x00030001, "%s", msg);
}
else
assert(0);
Expand All @@ -736,16 +738,16 @@ namespace ojph {
//////////////////////////////////////////////////////////////////////////
void codestream::read_headers(infile_base *file)
{
ui16 marker_list[17] = { SOC, SIZ, CAP, PRF, CPF, COD, COC, QCD, QCC,
RGN, POC, PPM, TLM, PLM, CRG, COM, SOT };
ui16 marker_list[19] = { SOC, SIZ, CAP, PRF, CPF, COD, COC, QCD, QCC,
RGN, POC, PPM, TLM, PLM, CRG, COM, DFS, ATK, SOT };
find_marker(file, marker_list, 1); //find SOC
find_marker(file, marker_list + 1, 1); //find SIZ
siz.read(file);
int marker_idx = 0;
int received_markers = 0; //check that COD, & QCD received
while (true)
{
marker_idx = find_marker(file, marker_list + 2, 15);
marker_idx = find_marker(file, marker_list + 2, 17);
if (marker_idx == 0)
cap.read(file);
else if (marker_idx == 1)
Expand Down Expand Up @@ -805,11 +807,17 @@ namespace ojph {
else if (marker_idx == 13)
skip_marker(file, "COM", NULL, OJPH_MSG_LEVEL::NO_MSG, false);
else if (marker_idx == 14)
dfs.read(file);
else if (marker_idx == 15)
atk.read(file);
else if (marker_idx == 16)
break;
else
OJPH_ERROR(0x00030051, "File ended before finding a tile segment");
}

//qcd.update(&dfs);

if (received_markers != 3)
OJPH_ERROR(0x00030052, "markers error, COD and QCD are required");

Expand Down
27 changes: 17 additions & 10 deletions src/core/codestream/ojph_codestream_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,20 +148,27 @@ namespace ojph {
bool employ_color_transform;
int planar;
int profile;
ui32 tilepart_div; // tilepart division value
bool need_tlm; // true if tlm markers are needed
ui32 tilepart_div; // tilepart division value
bool need_tlm; // true if tlm markers are needed

private:
param_siz siz;
param_cod cod;
param_cap cap;
param_qcd qcd;
param_tlm tlm;
param_siz siz; // image and tile size
param_cod cod; // coding style default
param_cap cap; // extended capabilities
param_qcd qcd; // quantization default
param_tlm tlm; // tile-part lengths

private: // this is to handle qcc
private: // this is to handle qcc and coc
int used_qcc_fields;
param_qcc qcc_store[4], *qcc; // we allocate 4,
// if not enough, we allocate more
param_qcc *qcc; // quantization component
param_qcc qcc_store[4]; // we allocate 4, we allocate more if needed
int used_coc_fields;
param_coc *coc; // coding style component
param_coc coc_store[4]; // we allocate 4, we allocate more if needed

private: // these are from Part 2 of the standard
param_dfs dfs; // downsmapling factor styles
param_atk atk; // arbitrary transformation kernels

private:
mem_fixed_allocator *allocator;
Expand Down
Loading

0 comments on commit 508eb92

Please sign in to comment.