openjp2/j2k: Make comments adhere to specification.

The function is used to read both SPcod and SPcoc, so all
comments should refer to both marker segments' parameter names.
This commit is contained in:
Sebastian Rasmussen 2019-09-04 01:18:37 +02:00
parent e66125fe26
commit d801bd4e62
1 changed files with 13 additions and 9 deletions

View File

@ -9739,8 +9739,8 @@ static OPJ_BOOL opj_j2k_read_SPCod_SPCoc(opj_j2k_t *p_j2k,
return OPJ_FALSE; return OPJ_FALSE;
} }
opj_read_bytes(l_current_ptr, &l_tccp->numresolutions, /* SPcod (D) / SPcoc (A) */
1); /* SPcox (D) */ opj_read_bytes(l_current_ptr, &l_tccp->numresolutions, 1);
++l_tccp->numresolutions; /* tccp->numresolutions = read() + 1 */ ++l_tccp->numresolutions; /* tccp->numresolutions = read() + 1 */
if (l_tccp->numresolutions > OPJ_J2K_MAXRLVLS) { if (l_tccp->numresolutions > OPJ_J2K_MAXRLVLS) {
opj_event_msg(p_manager, EVT_ERROR, opj_event_msg(p_manager, EVT_ERROR,
@ -9762,11 +9762,13 @@ static OPJ_BOOL opj_j2k_read_SPCod_SPCoc(opj_j2k_t *p_j2k,
return OPJ_FALSE; return OPJ_FALSE;
} }
opj_read_bytes(l_current_ptr, &l_tccp->cblkw, 1); /* SPcoc (E) */ /* SPcod (E) / SPcoc (B) */
opj_read_bytes(l_current_ptr, &l_tccp->cblkw, 1);
++l_current_ptr; ++l_current_ptr;
l_tccp->cblkw += 2; l_tccp->cblkw += 2;
opj_read_bytes(l_current_ptr, &l_tccp->cblkh, 1); /* SPcoc (F) */ /* SPcod (F) / SPcoc (C) */
opj_read_bytes(l_current_ptr, &l_tccp->cblkh, 1);
++l_current_ptr; ++l_current_ptr;
l_tccp->cblkh += 2; l_tccp->cblkh += 2;
@ -9777,8 +9779,8 @@ static OPJ_BOOL opj_j2k_read_SPCod_SPCoc(opj_j2k_t *p_j2k,
return OPJ_FALSE; return OPJ_FALSE;
} }
/* SPcod (G) / SPcoc (D) */
opj_read_bytes(l_current_ptr, &l_tccp->cblksty, 1); /* SPcoc (G) */ opj_read_bytes(l_current_ptr, &l_tccp->cblksty, 1);
++l_current_ptr; ++l_current_ptr;
if (l_tccp->cblksty & 0xC0U) { /* 2 msb are reserved, assume we can't read */ if (l_tccp->cblksty & 0xC0U) { /* 2 msb are reserved, assume we can't read */
opj_event_msg(p_manager, EVT_ERROR, opj_event_msg(p_manager, EVT_ERROR,
@ -9786,7 +9788,8 @@ static OPJ_BOOL opj_j2k_read_SPCod_SPCoc(opj_j2k_t *p_j2k,
return OPJ_FALSE; return OPJ_FALSE;
} }
opj_read_bytes(l_current_ptr, &l_tccp->qmfbid, 1); /* SPcoc (H) */ /* SPcod (H) / SPcoc (E) */
opj_read_bytes(l_current_ptr, &l_tccp->qmfbid, 1);
++l_current_ptr; ++l_current_ptr;
*p_header_size = *p_header_size - 5; *p_header_size = *p_header_size - 5;
@ -9798,8 +9801,9 @@ static OPJ_BOOL opj_j2k_read_SPCod_SPCoc(opj_j2k_t *p_j2k,
return OPJ_FALSE; return OPJ_FALSE;
} }
/* SPcod (I_i) / SPcoc (F_i) */
for (i = 0; i < l_tccp->numresolutions; ++i) { for (i = 0; i < l_tccp->numresolutions; ++i) {
opj_read_bytes(l_current_ptr, &l_tmp, 1); /* SPcoc (I_i) */ opj_read_bytes(l_current_ptr, &l_tmp, 1);
++l_current_ptr; ++l_current_ptr;
/* Precinct exponent 0 is only allowed for lowest resolution level (Table A.21) */ /* Precinct exponent 0 is only allowed for lowest resolution level (Table A.21) */
if ((i != 0) && (((l_tmp & 0xf) == 0) || ((l_tmp >> 4) == 0))) { if ((i != 0) && (((l_tmp & 0xf) == 0) || ((l_tmp >> 4) == 0))) {