void test_fx_fixed_limits_double(ostream& out) { out << "****************** limits fx_fixed<8, 5>_double\n"; sc_fixed<8, 5> zero_min("-0"); SHOW(zero_min); sc_fixed<8, 5> zero_plus("+0"); SHOW(zero_plus); sc_fixed<8, 5> zero(0); SHOW(zero); sc_fixed<8, 5> long_max(LONG_MAX); SHOW(long_max); sc_fixed<8, 5> long_min(LONG_MIN); SHOW(long_min); sc_fixed<8, 5> int_max(INT_MAX); SHOW(int_max); sc_fixed<8, 5> int_min(INT_MIN); SHOW(int_min); sc_fixed<8, 5> uint_max(UINT_MAX); SHOW(uint_max); sc_fixed<8, 5> ulong_max(ULONG_MAX); SHOW(ulong_max); sc_fixed<8, 5> double_min(DBL_MIN); SHOW(double_min); sc_fixed<8, 5> double_max(DBL_MAX); SHOW(double_max); sc_fixed<8, 5> float_min(FLT_MIN); SHOW(float_min); sc_fixed<8, 5> float_max(FLT_MAX); SHOW(float_max); // sc_fixed<8, 5> res; // SHOW_EXPS(double_min); // SHOW_EXPS(double_max); // SHOW_EXPS(float_min); // SHOW_EXPS(float_max); }
void test_fx_fix_limits_long(ostream& out) { out << "****************** limits fx_fix_long\n"; sc_fix zero_min("-0"); SHOW(zero_min); sc_fix zero_plus("+0"); SHOW(zero_plus); sc_fix zero(0); SHOW(zero); sc_fix long_max(LONG_MAX); SHOW(long_max); sc_fix long_min(LONG_MIN); SHOW(long_min); sc_fix int_max(INT_MAX); SHOW(int_max); sc_fix int_min(INT_MIN); SHOW(int_min); sc_fix uint_max(UINT_MAX); SHOW(uint_max); sc_fix ulong_max(ULONG_MAX); SHOW(ulong_max); sc_fix double_min(DBL_MIN); SHOW(double_min); sc_fix double_max(DBL_MAX); SHOW(double_max); sc_fix float_min(FLT_MIN); SHOW(float_min); sc_fix float_max(FLT_MAX); SHOW(float_max); // sc_fix res; // SHOW_EXPS(long_max); // SHOW_EXPS(long_min); // SHOW_EXPS(int_max); // SHOW_EXPS(int_min); // SHOW_EXPS(uint_max); // SHOW_EXPS(ulong_max); }
void test_fx_float_limits_zero(ostream& out) { cerr << "****************** limits fx_float_zero\n"; sc_fxval zero_min("-0"); SHOW(zero_min); sc_fxval zero_plus("+0"); SHOW(zero_plus); sc_fxval zero(0); SHOW(zero); sc_fxval nan("NaN"); SHOW(nan); sc_fxval inf_plus("+Inf"); SHOW(inf_plus); sc_fxval inf_min("-Inf"); SHOW(inf_min); sc_fxval inf("Inf"); SHOW(inf); sc_fxval long_max(LONG_MAX); SHOW(long_max); sc_fxval long_min(LONG_MIN); SHOW(long_min); sc_fxval int_max(INT_MAX); SHOW(int_max); sc_fxval int_min(INT_MIN); SHOW(int_min); sc_fxval uint_max(UINT_MAX); SHOW(uint_max); sc_fxval ulong_max(ULONG_MAX); SHOW(ulong_max); sc_fxval double_min(DBL_MIN); SHOW(double_min); sc_fxval double_max(DBL_MAX); SHOW(double_max); sc_fxval float_min(FLT_MIN); SHOW(float_min); sc_fxval float_max(FLT_MAX); SHOW(float_max); sc_fxval res; SHOW_EXPS(zero_min); SHOW_EXPS(zero_plus); SHOW_EXPS(zero); }
bool t2_decode_packets( opj_t2_t *p_t2, OPJ_UINT32 p_tile_no, struct opj_tcd_tile *p_tile, OPJ_BYTE *p_src, OPJ_UINT32 * p_data_read, OPJ_UINT32 p_max_len, struct opj_codestream_info *p_cstr_info) { OPJ_BYTE *l_current_data = p_src; opj_pi_iterator_t *l_pi = 00; OPJ_UINT32 pino; opj_image_t *l_image = p_t2->image; opj_cp_t *l_cp = p_t2->cp; opj_cp_t *cp = p_t2->cp; opj_tcp_t *l_tcp = &(p_t2->cp->tcps[p_tile_no]); OPJ_UINT32 l_nb_bytes_read; OPJ_UINT32 l_nb_pocs = l_tcp->numpocs + 1; opj_pi_iterator_t *l_current_pi = 00; OPJ_UINT32 curtp = 0; OPJ_UINT32 tp_start_packno; opj_packet_info_t *l_pack_info = 00; opj_image_comp_t* l_img_comp = 00; if (p_cstr_info) { l_pack_info = p_cstr_info->tile[p_tile_no].packet; } /* create a packet iterator */ l_pi = pi_create_decode(l_image, l_cp, p_tile_no); if (!l_pi) { return false; } tp_start_packno = 0; l_current_pi = l_pi; for (pino = 0; pino <= l_tcp->numpocs; ++pino) { while (pi_next(l_current_pi)) { if (l_tcp->num_layers_to_decode > l_current_pi->layno && l_current_pi->resno < p_tile->comps[l_current_pi->compno].minimum_num_resolutions) { l_nb_bytes_read = 0; if (! t2_decode_packet(p_t2,p_tile,l_tcp,l_current_pi,l_current_data,&l_nb_bytes_read,p_max_len,l_pack_info)) { pi_destroy(l_pi,l_nb_pocs); return false; } l_img_comp = &(l_image->comps[l_current_pi->compno]); l_img_comp->resno_decoded = uint_max(l_current_pi->resno, l_img_comp->resno_decoded); } else { l_nb_bytes_read = 0; if (! t2_skip_packet(p_t2,p_tile,l_tcp,l_current_pi,l_current_data,&l_nb_bytes_read,p_max_len,l_pack_info)) { pi_destroy(l_pi,l_nb_pocs); return false; } } l_current_data += l_nb_bytes_read; p_max_len -= l_nb_bytes_read; /* INDEX >> */ if(p_cstr_info) { opj_tile_info_t *info_TL = &p_cstr_info->tile[p_tile_no]; opj_packet_info_t *info_PK = &info_TL->packet[p_cstr_info->packno]; if (!p_cstr_info->packno) { info_PK->start_pos = info_TL->end_header + 1; } else if (info_TL->packet[p_cstr_info->packno-1].end_pos >= (OPJ_INT32)p_cstr_info->tile[p_tile_no].tp[curtp].tp_end_pos){ // New tile part info_TL->tp[curtp].tp_numpacks = p_cstr_info->packno - tp_start_packno; // Number of packets in previous tile-part tp_start_packno = p_cstr_info->packno; curtp++; info_PK->start_pos = p_cstr_info->tile[p_tile_no].tp[curtp].tp_end_header+1; } else { info_PK->start_pos = (cp->m_specific_param.m_enc.m_tp_on && info_PK->start_pos) ? info_PK->start_pos : info_TL->packet[p_cstr_info->packno - 1].end_pos + 1; } info_PK->end_pos = info_PK->start_pos + l_nb_bytes_read - 1; info_PK->end_ph_pos += info_PK->start_pos - 1; // End of packet header which now only represents the distance ++p_cstr_info->packno; } /* << INDEX */ } ++l_current_pi; } /* INDEX >> */ if (p_cstr_info) { p_cstr_info->tile[p_tile_no].tp[curtp].tp_numpacks = p_cstr_info->packno - tp_start_packno; // Number of packets in last tile-part } /* << INDEX */ /* don't forget to release pi */ pi_destroy(l_pi,l_nb_pocs); *p_data_read = l_current_data - p_src; return true; }