added support for partial bitstream decoding - #1251
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 |
| 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.
| OPJ_UINT32 partial_buffer = 0; | |
| OPJ_BOOL partial_buffer = OPJ_FALSE; |
| 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.
| partial_buffer = 1; | |
| partial_buffer = OPJ_TRUE; |
| 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.
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.
| @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.
| * @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.