Skip to content

added support for partial bitstream decoding - #1251

Open
chafey wants to merge 12 commits into
uclouvain:masterfrom
chafey:master
Open

added support for partial bitstream decoding#1251
chafey wants to merge 12 commits into
uclouvain:masterfrom
chafey:master

Conversation

@chafey

@chafey chafey commented May 19, 2020

Copy link
Copy Markdown
Contributor

This PR adds support for partial bitstream decoding. Given a partial bitstream, it will still reconstruct an image with the data it has available.

@rouault

rouault commented Oct 9, 2021

Copy link
Copy Markdown
Collaborator

I've no idea what the last commit "added devcontainer and build.sh" does, and it should be removed from this PR

Comment thread src/lib/openjp2/t2.c Outdated
opj_tcd_cblk_dec_t* l_cblk = 00;
opj_tcd_resolution_t* l_res =
&p_tile->comps[p_pi->compno].resolutions[p_pi->resno];
OPJ_UINT32 partial_buffer = 0;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
OPJ_UINT32 partial_buffer = 0;
OPJ_BOOL partial_buffer = OPJ_FALSE;

Comment thread src/lib/openjp2/t2.c Outdated
p_pi->compno);
return OPJ_FALSE;
// skip this codeblock since it is a partial read
partial_buffer = 1;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
partial_buffer = 1;
partial_buffer = OPJ_TRUE;

Comment thread src/lib/openjp2/t2.c Outdated
l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
p_pi->compno);
return OPJ_FALSE;
//return OPJ_FALSE;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this commented line should be removed, and the message above turned as a EVT_WARNING ... when we allow decoding of partial bitstream.

I would like to see a public function
OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decoder_set_strict_mode(opj_codec_t *p_codec, OPJ_BOOL strict)
to control if we allow or not partial bitstreams.
We could potentially change the default to be the relaxed mode implemented in that PR, but if the user want the previous behaviour, they would call opj_decoder_set_strict_mode(codec, OPJ_TRUE). In that case the warnings should be errors, and the return OPJ_FALSE that have been removed would be used.

Comment thread src/lib/openjp2/jp2.h
bitstream must be decoded or an error is returned. When it is disabled,
the decoder will decode partial bitstreams.
@param jp2 JP2 decompressor handle
@param strict JPH_TRUE for strict mode

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@param strict JPH_TRUE for strict mode
@param strict OPJ_TRUE for strict mode

* bitstreams as much as possible without erroring
*
* @param p_codec decompressor handler
* @param strict OBJ_TRUE to enable strict decoding, OBJ_FALSE to disable

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param strict OBJ_TRUE to enable strict decoding, OBJ_FALSE to disable
* @param strict OPJ_TRUE to enable strict decoding, OPJ_FALSE to disable

@rouault

rouault commented Oct 13, 2021

Copy link
Copy Markdown
Collaborator

Indentation should also be fixed. see https://github.com/uclouvain/openjpeg/pull/1251/checks?check_run_id=3847146255

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants