-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added support for partial bitstream decoding #1251
base: master
Are you sure you want to change the base?
Conversation
712d165
to
4aeec72
Compare
I've no idea what the last commit "added devcontainer and build.sh" does, and it should be removed from this PR |
src/lib/openjp2/t2.c
Outdated
@@ -1348,6 +1347,7 @@ static OPJ_BOOL opj_t2_read_packet_data(opj_t2_t* p_t2, | |||
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OPJ_UINT32 partial_buffer = 0; | |
OPJ_BOOL partial_buffer = OPJ_FALSE; |
src/lib/openjp2/t2.c
Outdated
"read: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n", | ||
l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno, | ||
p_pi->compno); | ||
return OPJ_FALSE; | ||
// skip this codeblock since it is a partial read | ||
partial_buffer = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
partial_buffer = 1; | |
partial_buffer = OPJ_TRUE; |
src/lib/openjp2/t2.c
Outdated
@@ -1523,7 +1547,7 @@ static OPJ_BOOL opj_t2_skip_packet_data(opj_t2_t* p_t2, | |||
"skip: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n", | |||
l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno, | |||
p_pi->compno); | |||
return OPJ_FALSE; | |||
//return OPJ_FALSE; |
There was a problem hiding this comment.
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.
… decoding is enabled
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param strict OBJ_TRUE to enable strict decoding, OBJ_FALSE to disable | |
* @param strict OPJ_TRUE to enable strict decoding, OPJ_FALSE to disable |
Indentation should also be fixed. see https://github.com/uclouvain/openjpeg/pull/1251/checks?check_run_id=3847146255 |
This PR adds support for partial bitstream decoding. Given a partial bitstream, it will still reconstruct an image with the data it has available.