| synopsis || arguments || prev || next |
void set_max_bytes( kdu_long max_bytes, bool simulate_parsing=false)
Java: void Set_max_bytes( long max_bytes, boolean simulate_parsing)
[Declared in "../coresys/common/kdu_compressed.h"]
If used with an input codestream, this function sets the maximum number of bytes which will be read from the input code-stream. Additional bytes will be discarded. In this case, the simulate_parsing argument may modify the behaviour as described in connection with that argument below.
If used with an interchange codestream, the function does nothing at all.
If used with an output codestream, this function enables internal machinery for incrementally estimating the parameters which will be used by the PCRD-opt rate allocation algorithm, so that the block coder can be given feedback to assist it in minimizing the number of coding passes which must be processed — in many cases, most of the coding passes will be discarded. Note that the actual rate allocation performed during a call to the flush member function is independent of the value supplied here, although it is expected that max_bytes will be equal to (certainly no smaller than) the maximum layer byte count supplied in the flush call.
The following cautionary notes should be observed concerning the incremental rate control machinery enabled when this function is invoked on an output codestream:
For both input and output codestreams, the function may only be called prior to the point at which the first tile is opened and it may only be called once, if at all.
If restart is used to restart the code-stream managment machinery, the effect of the current function is lost. It may be restored by calling the function again after each call to restart.
If the supplied limit exceeds KDU_LONG_MAX/2, the limit will be reduced to that value, to avoid the possibility of overflow in the internal implementation.
The default value of this argument is false. If set to true, the behaviour with non-persistent input code-streams is modified as follows. Rather than simply counting the number of bytes consumed from the compressed data source, the function explicitly excludes all bytes consumed while parsing packet data which does not belong to precincts which contribute to the current spatial region, at the current resolution, within the current image components, as configured in any call to apply_input_restrictions. It also excludes bytes consumed while parsing packets which do not belong to the current layers of interest, as configured in any call to apply_input_restrictions. The byte limit applies only to those bytes which are of interest. Moreover, in this case, the number of bytes returned by the get_total_bytes function will also exclude the bytes corresponding to packets which are not of interest. If SOP markers have been used, the cost of these may still be counted, even for packets which would have been parsed away.