本文整理汇总了C++中LLImageJ2C::updateRawDiscardLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ LLImageJ2C::updateRawDiscardLevel方法的具体用法?C++ LLImageJ2C::updateRawDiscardLevel怎么用?C++ LLImageJ2C::updateRawDiscardLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLImageJ2C
的用法示例。
在下文中一共展示了LLImageJ2C::updateRawDiscardLevel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: llmin
BOOL LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, ECodeStreamMode mode, S32 first_channel, S32 max_channel_count, int discard_level, int* region)
{
base.resetLastError();
// *FIX: kdu calls our callback function if there's an error, and then bombs.
// To regain control, we throw an exception, and catch it here.
try
{
// Merov : Test!! DO NOT COMMIT!!
//findDiscardLevelsBoundaries(base);
base.updateRawDiscardLevel();
setupCodeStream(base, TRUE, mode);
mRawImagep = &raw_image;
mCodeStreamp->change_appearance(false, true, false);
// Apply loading discard level and cropping if required
kdu_dims* region_kdu = NULL;
if (region != NULL)
{
region_kdu = new kdu_dims;
region_kdu->pos.x = region[0];
region_kdu->pos.y = region[1];
region_kdu->size.x = region[2] - region[0];
region_kdu->size.y = region[3] - region[1];
}
int discard = (discard_level != -1 ? discard_level : base.getRawDiscardLevel());
//llinfos << "Merov debug : initDecode, discard used = " << discard << ", asked = " << discard_level << llendl;
// Apply loading restrictions
mCodeStreamp->apply_input_restrictions( first_channel, max_channel_count, discard, 0, region_kdu);
// Clean-up
if (region_kdu)
{
delete region_kdu;
region_kdu = NULL;
}
// Resize raw_image according to the image to be decoded
kdu_dims dims; mCodeStreamp->get_dims(0,dims);
S32 channels = base.getComponents() - first_channel;
channels = llmin(channels,max_channel_count);
raw_image.resize(dims.size.x, dims.size.y, channels);
if (!mTileIndicesp)
{
mTileIndicesp = new kdu_dims;
}
mCodeStreamp->get_valid_tiles(*mTileIndicesp);
if (!mTPosp)
{
mTPosp = new kdu_coords;
mTPosp->y = 0;
mTPosp->x = 0;
}
}
catch (const char* msg)
{
base.setLastError(ll_safe_string(msg));
return FALSE;
}
catch (...)
{
base.setLastError("Unknown J2C error");
return FALSE;
}
return TRUE;
}
示例2: sizeof
BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base)
{
//
// FIXME: We get metadata by decoding the ENTIRE image.
//
// Update the raw discard level
base.updateRawDiscardLevel();
opj_dparameters_t parameters; /* decompression parameters */
opj_event_mgr_t event_mgr; /* event manager */
opj_image_t *image = NULL;
opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */
opj_cio_t *cio = NULL;
/* configure the event callbacks (not required) */
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
event_mgr.error_handler = error_callback;
event_mgr.warning_handler = warning_callback;
event_mgr.info_handler = info_callback;
/* set decoding parameters to default values */
opj_set_default_decoder_parameters(¶meters);
// Only decode what's required to get the size data.
parameters.cp_limit_decoding=LIMIT_TO_MAIN_HEADER;
//parameters.cp_reduce = mRawDiscardLevel;
/* decode the code-stream */
/* ---------------------- */
/* JPEG-2000 codestream */
/* get a decoder handle */
dinfo = opj_create_decompress(CODEC_J2K);
/* catch events using our callbacks and give a local context */
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
/* setup the decoder decoding parameters using user parameters */
opj_setup_decoder(dinfo, ¶meters);
/* open a byte stream */
cio = opj_cio_open((opj_common_ptr)dinfo, base.getData(), base.getDataSize());
/* decode the stream and fill the image structure */
image = opj_decode(dinfo, cio);
/* close the byte stream */
opj_cio_close(cio);
/* free remaining structures */
if(dinfo)
{
opj_destroy_decompress(dinfo);
}
if(!image)
{
llwarns << "ERROR -> getMetadata: failed to decode image!" << llendl;
return FALSE;
}
// Copy image data into our raw image format (instead of the separate channel format
S32 width = 0;
S32 height = 0;
S32 img_components = image->numcomps;
width = image->x1 - image->x0;
height = image->y1 - image->y0;
base.setSize(width, height, img_components);
/* free image data structure */
opj_image_destroy(image);
return TRUE;
}