本文整理汇总了C++中LLImageJ2C::getMaxBytes方法的典型用法代码示例。如果您正苦于以下问题:C++ LLImageJ2C::getMaxBytes方法的具体用法?C++ LLImageJ2C::getMaxBytes怎么用?C++ LLImageJ2C::getMaxBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLImageJ2C
的用法示例。
在下文中一共展示了LLImageJ2C::getMaxBytes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LLKDUMemSource
void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, BOOL keep_codestream, ECodeStreamMode mode)
{
S32 data_size = base.getDataSize();
S32 max_bytes = (base.getMaxBytes() ? base.getMaxBytes() : data_size);
//
// Initialization
//
if (!kdu_message_initialized)
{
kdu_message_initialized = true;
kdu_customize_errors(&LLKDUMessageError::sDefaultMessage);
kdu_customize_warnings(&LLKDUMessageWarning::sDefaultMessage);
}
if (mCodeStreamp)
{
mCodeStreamp->destroy();
delete mCodeStreamp;
mCodeStreamp = NULL;
}
if (!mInputp && base.getData())
{
// The compressed data has been loaded
// Setup the source for the codestream
mInputp = new LLKDUMemSource(base.getData(), data_size);
}
if (mInputp)
{
mInputp->reset();
}
mCodeStreamp = new kdu_codestream;
mCodeStreamp->create(mInputp);
// Set the maximum number of bytes to use from the codestream
// *TODO: This seems to be wrong. The base class should have no idea of how j2c compression works so no
// good way of computing what's the byte range to be used.
mCodeStreamp->set_max_bytes(max_bytes,true);
// If you want to flip or rotate the image for some reason, change
// the resolution, or identify a restricted region of interest, this is
// the place to do it. You may use "kdu_codestream::change_appearance"
// and "kdu_codestream::apply_input_restrictions" for this purpose.
// If you wish to truncate the code-stream prior to decompression, you
// may use "kdu_codestream::set_max_bytes".
// If you wish to retain all compressed data so that the material
// can be decompressed multiple times, possibly with different appearance
// parameters, you should call "kdu_codestream::set_persistent" here.
// There are a variety of other features which must be enabled at
// this point if you want to take advantage of them. See the
// descriptions appearing with the "kdu_codestream" interface functions
// in "kdu_compressed.h" for an itemized account of these capabilities.
switch (mode)
{
case MODE_FAST:
mCodeStreamp->set_fast();
break;
case MODE_RESILIENT:
mCodeStreamp->set_resilient();
break;
case MODE_FUSSY:
mCodeStreamp->set_fussy();
break;
default:
llassert(0);
mCodeStreamp->set_fast();
}
kdu_dims dims;
mCodeStreamp->get_dims(0,dims);
S32 components = mCodeStreamp->get_num_components();
if (components >= 3)
{ // Check that components have consistent dimensions (for PPM file)
kdu_dims dims1; mCodeStreamp->get_dims(1,dims1);
kdu_dims dims2; mCodeStreamp->get_dims(2,dims2);
if ((dims1 != dims) || (dims2 != dims))
{
llerrs << "Components don't have matching dimensions!" << llendl;
}
}
// Get the number of resolution levels in that image
mLevels = mCodeStreamp->get_min_dwt_levels();
// Set the base dimensions
base.setSize(dims.size.x, dims.size.y, components);
base.setLevels(mLevels);
if (!keep_codestream)
{
mCodeStreamp->destroy();
delete mCodeStreamp;
mCodeStreamp = NULL;
delete mInputp;
//.........这里部分代码省略.........