Formatted files with prepare_commit.sh. Code fixed to compile with Visual Studio 10

This commit is contained in:
Aous Naman 2021-09-04 12:09:59 +10:00
parent f00dad44c8
commit b684247201
6 changed files with 2055 additions and 2085 deletions

File diff suppressed because it is too large Load Diff

View File

@ -10617,12 +10617,18 @@ static OPJ_BOOL opj_j2k_read_SPCod_SPCoc(opj_j2k_t *p_j2k,
/* SPcod (G) / SPcoc (D) */ /* SPcod (G) / SPcoc (D) */
opj_read_bytes(l_current_ptr, &l_tccp->cblksty, 1); opj_read_bytes(l_current_ptr, &l_tccp->cblksty, 1);
++l_current_ptr; ++l_current_ptr;
if ((l_tccp->cblksty & 0x80U) != 0 || (l_tccp->cblksty & 0x48U) == 0x48U) { if ((l_tccp->cblksty & J2K_CCP_CBLKSTY_HTMIXED) != 0) {
/* For HT, we only support one mode, bit 6 set, meaning that "all code-blocks /* We do not support HT mixed mode yet*/
within the corresponding tile-component shall be HT code-blocks, and
bit 3 is reset, meaning that "No vertically causal context". */
opj_event_msg(p_manager, EVT_ERROR, opj_event_msg(p_manager, EVT_ERROR,
"Error reading SPCod SPCoc element, Invalid code-block style found\n"); "Error reading SPCod SPCoc element. Unsupported Mixed HT code-block style found\n");
return OPJ_FALSE;
}
if ((l_tccp->cblksty & (J2K_CCP_CBLKSTY_HT | J2K_CCP_CBLKSTY_VSC)) ==
(J2K_CCP_CBLKSTY_HT | J2K_CCP_CBLKSTY_VSC)) {
/* For HT, we do not support vertically causal mode yet. */
opj_event_msg(p_manager, EVT_ERROR,
"Error reading SPCod SPCoc element. Unsupported HT mode with vertically causal mode. \n");
return OPJ_FALSE; return OPJ_FALSE;
} }

View File

@ -61,7 +61,8 @@ The functions in J2K.C have for goal to read/write the several parts of the code
#define J2K_CCP_CBLKSTY_VSC 0x08 /**< Vertically stripe causal context */ #define J2K_CCP_CBLKSTY_VSC 0x08 /**< Vertically stripe causal context */
#define J2K_CCP_CBLKSTY_PTERM 0x10 /**< Predictable termination */ #define J2K_CCP_CBLKSTY_PTERM 0x10 /**< Predictable termination */
#define J2K_CCP_CBLKSTY_SEGSYM 0x20 /**< Segmentation symbols are used */ #define J2K_CCP_CBLKSTY_SEGSYM 0x20 /**< Segmentation symbols are used */
#define J2K_CCP_CBLKSTY_HT 0x40 /**< (high throughput) HT codeblock */ #define J2K_CCP_CBLKSTY_HT 0x40 /**< (high throughput) HT codeblocks */
#define J2K_CCP_CBLKSTY_HTMIXED 0x80 /**< MIXED mode HT codeblocks */
#define J2K_CCP_QNTSTY_NOQNT 0 #define J2K_CCP_QNTSTY_NOQNT 0
#define J2K_CCP_QNTSTY_SIQNT 1 #define J2K_CCP_QNTSTY_SIQNT 1
#define J2K_CCP_QNTSTY_SEQNT 2 #define J2K_CCP_QNTSTY_SEQNT 2

View File

@ -1700,8 +1700,7 @@ static void opj_t1_clbl_decode_processor(void* user_data, opj_tls_t* tls)
opj_free(job); opj_free(job);
return; return;
} }
} } else {
else {
if (OPJ_FALSE == opj_t1_decode_cblk( if (OPJ_FALSE == opj_t1_decode_cblk(
t1, t1,
cblk, cblk,

View File

@ -1261,61 +1261,61 @@ static OPJ_BOOL opj_t2_read_packet_header(opj_t2_t* p_t2,
if ((p_tcp->tccps[p_pi->compno].cblksty & J2K_CCP_CBLKSTY_HT) != 0) if ((p_tcp->tccps[p_pi->compno].cblksty & J2K_CCP_CBLKSTY_HT) != 0)
do { do {
OPJ_UINT32 bit_number; OPJ_UINT32 bit_number;
l_cblk->segs[l_segno].numnewpasses = l_segno == 0 ? 1u : (OPJ_UINT32)n; l_cblk->segs[l_segno].numnewpasses = l_segno == 0 ? 1 : (OPJ_UINT32)n;
bit_number = l_cblk->numlenbits + opj_uint_floorlog2( bit_number = l_cblk->numlenbits + opj_uint_floorlog2(
l_cblk->segs[l_segno].numnewpasses); l_cblk->segs[l_segno].numnewpasses);
if (bit_number > 32) { if (bit_number > 32) {
opj_event_msg(p_manager, EVT_ERROR, opj_event_msg(p_manager, EVT_ERROR,
"Invalid bit number %d in opj_t2_read_packet_header()\n", "Invalid bit number %d in opj_t2_read_packet_header()\n",
bit_number); bit_number);
opj_bio_destroy(l_bio); opj_bio_destroy(l_bio);
return OPJ_FALSE; return OPJ_FALSE;
} }
l_cblk->segs[l_segno].newlen = opj_bio_read(l_bio, bit_number); l_cblk->segs[l_segno].newlen = opj_bio_read(l_bio, bit_number);
JAS_FPRINTF(stderr, "included=%d numnewpasses=%d increment=%d len=%d \n", JAS_FPRINTF(stderr, "included=%d numnewpasses=%d increment=%d len=%d \n",
l_included, l_cblk->segs[l_segno].numnewpasses, l_increment, l_included, l_cblk->segs[l_segno].numnewpasses, l_increment,
l_cblk->segs[l_segno].newlen); l_cblk->segs[l_segno].newlen);
n -= (OPJ_INT32)l_cblk->segs[l_segno].numnewpasses; n -= (OPJ_INT32)l_cblk->segs[l_segno].numnewpasses;
if (n > 0) { if (n > 0) {
++l_segno; ++l_segno;
if (! opj_t2_init_seg(l_cblk, l_segno, p_tcp->tccps[p_pi->compno].cblksty, 0)) { if (! opj_t2_init_seg(l_cblk, l_segno, p_tcp->tccps[p_pi->compno].cblksty, 0)) {
opj_bio_destroy(l_bio); opj_bio_destroy(l_bio);
return OPJ_FALSE; return OPJ_FALSE;
} }
} }
} while (n > 0); } while (n > 0);
else else
do { do {
OPJ_UINT32 bit_number; OPJ_UINT32 bit_number;
l_cblk->segs[l_segno].numnewpasses = (OPJ_UINT32)opj_int_min((OPJ_INT32)( l_cblk->segs[l_segno].numnewpasses = (OPJ_UINT32)opj_int_min((OPJ_INT32)(
l_cblk->segs[l_segno].maxpasses - l_cblk->segs[l_segno].numpasses), n); l_cblk->segs[l_segno].maxpasses - l_cblk->segs[l_segno].numpasses), n);
bit_number = l_cblk->numlenbits + opj_uint_floorlog2( bit_number = l_cblk->numlenbits + opj_uint_floorlog2(
l_cblk->segs[l_segno].numnewpasses); l_cblk->segs[l_segno].numnewpasses);
if (bit_number > 32) { if (bit_number > 32) {
opj_event_msg(p_manager, EVT_ERROR, opj_event_msg(p_manager, EVT_ERROR,
"Invalid bit number %d in opj_t2_read_packet_header()\n", "Invalid bit number %d in opj_t2_read_packet_header()\n",
bit_number); bit_number);
opj_bio_destroy(l_bio); opj_bio_destroy(l_bio);
return OPJ_FALSE; return OPJ_FALSE;
} }
l_cblk->segs[l_segno].newlen = opj_bio_read(l_bio, bit_number); l_cblk->segs[l_segno].newlen = opj_bio_read(l_bio, bit_number);
JAS_FPRINTF(stderr, "included=%d numnewpasses=%d increment=%d len=%d \n", JAS_FPRINTF(stderr, "included=%d numnewpasses=%d increment=%d len=%d \n",
l_included, l_cblk->segs[l_segno].numnewpasses, l_increment, l_included, l_cblk->segs[l_segno].numnewpasses, l_increment,
l_cblk->segs[l_segno].newlen); l_cblk->segs[l_segno].newlen);
n -= (OPJ_INT32)l_cblk->segs[l_segno].numnewpasses; n -= (OPJ_INT32)l_cblk->segs[l_segno].numnewpasses;
if (n > 0) { if (n > 0) {
++l_segno; ++l_segno;
if (! opj_t2_init_seg(l_cblk, l_segno, p_tcp->tccps[p_pi->compno].cblksty, 0)) { if (! opj_t2_init_seg(l_cblk, l_segno, p_tcp->tccps[p_pi->compno].cblksty, 0)) {
opj_bio_destroy(l_bio); opj_bio_destroy(l_bio);
return OPJ_FALSE; return OPJ_FALSE;
} }
} }
} while (n > 0); } while (n > 0);
++l_cblk; ++l_cblk;
} }

View File

@ -122,12 +122,12 @@ typedef struct opj_tcd_cblk_dec {
opj_tcd_seg_data_chunk_t* chunks; /* Array of chunks */ opj_tcd_seg_data_chunk_t* chunks; /* Array of chunks */
/* position of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */ /* position of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_INT32 x0, y0, x1, y1; OPJ_INT32 x0, y0, x1, y1;
/* Mb is The maximum number of bit-planes available for the representation of /* Mb is The maximum number of bit-planes available for the representation of
coefficients in any sub-band, b, as defined in Equation (E-2). See coefficients in any sub-band, b, as defined in Equation (E-2). See
Section B.10.5 of the standard */ Section B.10.5 of the standard */
OPJ_UINT32 Mb; /* currently used only to check if HT decoding is correct */ OPJ_UINT32 Mb; /* currently used only to check if HT decoding is correct */
/* numbps is Mb - P as defined in Section B.10.5 of the standard */ /* numbps is Mb - P as defined in Section B.10.5 of the standard */
OPJ_UINT32 numbps; OPJ_UINT32 numbps;
/* number of bits for len, for the current packet. Transitory value */ /* number of bits for len, for the current packet. Transitory value */
OPJ_UINT32 numlenbits; OPJ_UINT32 numlenbits;
/* number of pass added to the code-blocks, for the current packet. Transitory value */ /* number of pass added to the code-blocks, for the current packet. Transitory value */