Skip to content

Commit

Permalink
simpler
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Apr 19, 2024
1 parent c045dc9 commit 44d9397
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 27 deletions.
12 changes: 0 additions & 12 deletions winbuild/build/src/openjpeg-2.5.2/src/lib/openjp2/j2k.c
Original file line number Diff line number Diff line change
Expand Up @@ -9859,7 +9859,6 @@ OPJ_BOOL opj_j2k_decode_tile(opj_j2k_t * p_j2k,
opj_stream_private_t *p_stream,
opj_event_mgr_t * p_manager)
{
printf("opj_j2k_decode_tile %d\n", (int)time(NULL));
OPJ_UINT32 l_current_marker;
OPJ_BYTE l_data [2];
opj_tcp_t * l_tcp;
Expand All @@ -9872,14 +9871,12 @@ OPJ_BOOL opj_j2k_decode_tile(opj_j2k_t * p_j2k,

if (!(p_j2k->m_specific_param.m_decoder.m_state & J2K_STATE_DATA)
|| (p_tile_index != p_j2k->m_current_tile_number)) {
printf("false1 %d\n", (int)time(NULL));
return OPJ_FALSE;
}

l_tcp = &(p_j2k->m_cp.tcps[p_tile_index]);
if (! l_tcp->m_data) {
opj_j2k_tcp_destroy(l_tcp);
printf("false2 %d\n", (int)time(NULL));
return OPJ_FALSE;
}

Expand All @@ -9890,7 +9887,6 @@ OPJ_BOOL opj_j2k_decode_tile(opj_j2k_t * p_j2k,
/* but full tile decoding is done */
l_image_for_bounds = p_j2k->m_output_image ? p_j2k->m_output_image :
p_j2k->m_private_image;
printf("2.5 %d\n", (int)time(NULL));
if (! opj_tcd_decode_tile(p_j2k->m_tcd,
l_image_for_bounds->x0,
l_image_for_bounds->y0,
Expand All @@ -9905,17 +9901,14 @@ OPJ_BOOL opj_j2k_decode_tile(opj_j2k_t * p_j2k,
opj_j2k_tcp_destroy(l_tcp);
p_j2k->m_specific_param.m_decoder.m_state |= J2K_STATE_ERR;
opj_event_msg(p_manager, EVT_ERROR, "Failed to decode.\n");
printf("false3 %d\n", (int)time(NULL));
return OPJ_FALSE;
}
printf("2.7 %d\n", (int)time(NULL));

/* p_data can be set to NULL when the call will take care of using */
/* itself the TCD data. This is typically the case for whole single */
/* tile decoding optimization. */
if (p_data != NULL) {
if (! opj_tcd_update_tile_data(p_j2k->m_tcd, p_data, p_data_size)) {
printf("false4 %d\n", (int)time(NULL));
return OPJ_FALSE;
}

Expand All @@ -9931,15 +9924,13 @@ OPJ_BOOL opj_j2k_decode_tile(opj_j2k_t * p_j2k,

if (opj_stream_get_number_byte_left(p_stream) == 0
&& p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_NEOC) {
printf("true5 %d\n", (int)time(NULL));
return OPJ_TRUE;
}

if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_EOC) {
if (opj_stream_read_data(p_stream, l_data, 2, p_manager) != 2) {
opj_event_msg(p_manager, p_j2k->m_cp.strict ? EVT_ERROR : EVT_WARNING,
"Stream too short\n");
printf("both6 %d\n", (int)time(NULL));
return p_j2k->m_cp.strict ? OPJ_FALSE : OPJ_TRUE;
}
opj_read_bytes(l_data, &l_current_marker, 2);
Expand All @@ -9951,15 +9942,12 @@ OPJ_BOOL opj_j2k_decode_tile(opj_j2k_t * p_j2k,
if (opj_stream_get_number_byte_left(p_stream) == 0) {
p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_NEOC;
opj_event_msg(p_manager, EVT_WARNING, "Stream does not end with EOC\n");
printf("true7 %d\n", (int)time(NULL));
return OPJ_TRUE;
}
opj_event_msg(p_manager, EVT_ERROR, "Stream too short, expected SOT\n");
printf("false8 %d\n", (int)time(NULL));
return OPJ_FALSE;
}
}
printf("true9 %d\n", (int)time(NULL));

return OPJ_TRUE;
}
Expand Down
2 changes: 0 additions & 2 deletions winbuild/build/src/openjpeg-2.5.2/src/lib/openjp2/openjpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,6 @@ OPJ_BOOL OPJ_CALLCONV opj_decode_tile_data(opj_codec_t *p_codec,
opj_stream_t *p_stream
)
{
printf("torchwood %d\n", (int)time(NULL));
if (p_codec && p_data && p_stream) {
opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
opj_stream_private_t * l_stream = (opj_stream_private_t *) p_stream;
Expand All @@ -602,7 +601,6 @@ OPJ_BOOL OPJ_CALLCONV opj_decode_tile_data(opj_codec_t *p_codec,
return OPJ_FALSE;
}

printf("a\n");
return l_codec->m_codec_data.m_decompression.opj_decode_tile_data(
l_codec->m_codec,
p_tile_index,
Expand Down
3 changes: 3 additions & 0 deletions winbuild/build/src/openjpeg-2.5.2/src/lib/openjp2/t2.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ OPJ_BOOL opj_t2_decode_packets(opj_tcd_t* tcd,
(OPJ_UINT32)prec->x1,
(OPJ_UINT32)prec->y1)) {
skip_packet = OPJ_FALSE;
printf("break\n");
break;
}
}
Expand All @@ -515,6 +516,7 @@ OPJ_BOOL opj_t2_decode_packets(opj_tcd_t* tcd,
&l_nb_bytes_read, p_max_len, l_pack_info, p_manager)) {
opj_pi_destroy(l_pi, l_nb_pocs);
opj_free(first_pass_failed);
printf("return\n");
return OPJ_FALSE;
}

Expand All @@ -527,6 +529,7 @@ OPJ_BOOL opj_t2_decode_packets(opj_tcd_t* tcd,
&l_nb_bytes_read, p_max_len, l_pack_info, p_manager)) {
opj_pi_destroy(l_pi, l_nb_pocs);
opj_free(first_pass_failed);
printf("return2\n");
return OPJ_FALSE;
}
}
Expand Down
13 changes: 0 additions & 13 deletions winbuild/build/src/openjpeg-2.5.2/src/lib/openjp2/tcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1706,12 +1706,10 @@ OPJ_BOOL opj_tcd_decode_tile(opj_tcd_t *p_tcd,
}
/* << INDEX */
#endif
printf("tcd1 %d\n", (int)time(NULL));

/*--------------TIER2------------------*/
/* FIXME _ProfStart(PGROUP_T2); */
l_data_read = 0;
printf("tcd1a %d\n", (int)time(NULL));
if (! opj_tcd_t2_decode(p_tcd, p_src, &l_data_read, p_max_length, p_cstr_index,
p_manager)) {
return OPJ_FALSE;
Expand All @@ -1721,7 +1719,6 @@ OPJ_BOOL opj_tcd_decode_tile(opj_tcd_t *p_tcd,
/*------------------TIER1-----------------*/

/* FIXME _ProfStart(PGROUP_T1); */
printf("tcd1b %d\n", (int)time(NULL));
if (! opj_tcd_t1_decode(p_tcd, p_manager)) {
return OPJ_FALSE;
}
Expand All @@ -1730,10 +1727,8 @@ OPJ_BOOL opj_tcd_decode_tile(opj_tcd_t *p_tcd,

/* For subtile decoding, now we know the resno_decoded, we can allocate */
/* the tile data buffer */
printf("tcd2 %d\n", (int)time(NULL));
if (!p_tcd->whole_tile_decoding) {
for (compno = 0; compno < p_tcd->image->numcomps; compno++) {
printf("tcd3 %d %d\n", compno, (int)time(NULL));
opj_tcd_tilecomp_t* tilec = &(p_tcd->tcd_image->tiles->comps[compno]);
opj_image_comp_t* image_comp = &(p_tcd->image->comps[compno]);
opj_tcd_resolution_t *res = tilec->resolutions + image_comp->resno_decoded;
Expand Down Expand Up @@ -1771,7 +1766,6 @@ OPJ_BOOL opj_tcd_decode_tile(opj_tcd_t *p_tcd,
}
}
}
printf("tcd8 %d\n", (int)time(NULL));

/*----------------DWT---------------------*/

Expand All @@ -1796,7 +1790,6 @@ OPJ_BOOL opj_tcd_decode_tile(opj_tcd_t *p_tcd,
return OPJ_FALSE;
}
/* FIXME _ProfStop(PGROUP_DC_SHIFT); */
printf("tcd9 %d\n", (int)time(NULL));


/*---------------TILE-------------------*/
Expand Down Expand Up @@ -2023,13 +2016,11 @@ static OPJ_BOOL opj_tcd_t2_decode(opj_tcd_t *p_tcd,
{
opj_t2_t * l_t2;

printf("tcd2-a %d\n", (int)time(NULL));
l_t2 = opj_t2_create(p_tcd->image, p_tcd->cp);
if (l_t2 == 00) {
return OPJ_FALSE;
}

printf("tcd2-b %d\n", (int)time(NULL));
if (! opj_t2_decode_packets(
p_tcd,
l_t2,
Expand All @@ -2044,7 +2035,6 @@ static OPJ_BOOL opj_tcd_t2_decode(opj_tcd_t *p_tcd,
return OPJ_FALSE;
}

printf("tcd2-c %d\n", (int)time(NULL));
opj_t2_destroy(l_t2);

/*---------------CLEAN-------------------*/
Expand All @@ -2061,15 +2051,13 @@ static OPJ_BOOL opj_tcd_t1_decode(opj_tcd_t *p_tcd, opj_event_mgr_t *p_manager)
OPJ_BOOL check_pterm = OPJ_FALSE;
opj_mutex_t* p_manager_mutex = NULL;

printf("tcd1-a %d\n", (int)time(NULL));
p_manager_mutex = opj_mutex_create();

/* Only enable PTERM check if we decode all layers */
if (p_tcd->tcp->num_layers_to_decode == p_tcd->tcp->numlayers &&
(l_tccp->cblksty & J2K_CCP_CBLKSTY_PTERM) != 0) {
check_pterm = OPJ_TRUE;
}
printf("tcd1-b %d\n", (int)time(NULL));

for (compno = 0; compno < l_tile->numcomps;
++compno, ++l_tile_comp, ++l_tccp) {
Expand All @@ -2084,7 +2072,6 @@ static OPJ_BOOL opj_tcd_t1_decode(opj_tcd_t *p_tcd, opj_event_mgr_t *p_manager)
}
}

printf("tcd1-c %d\n", (int)time(NULL));
opj_thread_pool_wait_completion(p_tcd->thread_pool, 0);
if (p_manager_mutex) {
opj_mutex_destroy(p_manager_mutex);
Expand Down

0 comments on commit 44d9397

Please sign in to comment.