| synopsis || arguments || prev || next |

kdu_stripe_compressor::start

Java: Kdu_stripe_compressor.Start

C#: Ckdu_stripe_compressor.start

VB: Ckdu_stripe_compressor.start

void start( kdu_codestream codestream, int num_layer_specs=0, const kdu_long * layer_sizes=NULL, const kdu_uint16 * layer_slopes=NULL, kdu_uint16 min_slope_threshold=0, bool no_prediction=false, bool force_precise=false, bool record_layer_info_in_comment=true, double size_tolerance=0.0, int num_components=0, bool want_fastest=false, kdu_thread_env * env=NULL, kdu_thread_queue * env_queue=NULL, int env_dbuf_height=0)

Java: public native void Start( Kdu_codestream codestream, int num_layer_specs, long[] layer_sizes, int[] layer_slopes, int min_slope_threshold, boolean no_prediction, boolean force_precise, boolean record_layer_info_in_comment, double size_tolerance, int num_components, boolean want_fastest, Kdu_thread_env env, long env_queue, int env_dbuf_height)

C#: public void start( Kdu_codestream codestream, int num_layer_specs, long[] layer_sizes, int[] layer_slopes, int min_slope_threshold, bool no_prediction, bool force_precise, bool record_layer_info_in_comment, double size_tolerance, int num_components, bool want_fastest, Kdu_thread_env env, IntPtr, int env_dbuf_height)

VB: Public Sub start( ByVal codestream As Kdu_codestream, ByVal num_layer_specs As Integer, ByVal layer_sizes() As Long, ByVal layer_slopes() As Integer, ByVal min_slope_threshold As Integer, ByVal no_prediction As Boolean, ByVal force_precise As Boolean, ByVal record_layer_info_in_comment As Boolean, ByVal size_tolerance As Double, ByVal num_components As Integer, ByVal want_fastest As Boolean, ByVal env As Kdu_thread_env, ByVal As IntPtr, ByVal env_dbuf_height As Integer)

[Declared in "../apps/support/kdu_stripe_compressor.h"]

Go to class description.


Synopsis

Call this function to initialize the object for compression. Each call to start must be matched by a call to finish, but you may re-use the object to compress subsequent images, if you like.


Arguments

codestream [kdu_codestream]

Interface to a kdu_codestream object whose create function has already been called. The kdu_params::finalize_all function should not be called by the application; it will be invoked from within the present function, possibly after making some final adjustments to coding parameter attributes which have not been configured by the application.

num_layer_specs [int]

If this argument is equal to 0, the number of quality layers to build into the code-stream is recovered from the Clayers coding parameter attribute, which the application may have been configured prior to calling this function. If the Clayers attribute was not set, it will default to 1 when the kdu_params::finalize_all function is called from within this function. If the present argument is greater than 0, and the Clayers attribute has not already been set, it will be set equal to the value of num_layer_specs. Regardless of the final number of code-stream quality layers which is used, the num_layer_specs argument provides the number of entries in the layer_sizes and layer_slopes arrays, if non-NULL. These arrays, if provided, allow the application to specify the properties of the quality layers. If no layer sizes or slopes are specified, a logarithmically spaced set of quality layers will be constructed, following the conventions described with the kdu_codestream::flush function.

layer_sizes [const kdu_long *]

If non-NULL, this argument points to an array with num_layer_specs entries, containing the cumulative number of bytes from the start of the code-stream to the end of each quality layer, if the code-stream were to be arranged in layer progressive order. The code-stream may be arranged in a very different order, of course, but that has no impact on the sizes of the layers, as controlled by this argument. If the actual number of quality layers, as specified by the Clayers attribute, is smaller than num_layer_specs, not all of the entries in this array will be used. If the actual number of quality layers is larger than num_layer_specs, the additional quality layers will be empty. This argument is ignored if num_layer_specs is 0.

layer_slopes [const kdu_uint16 *]

If non-NULL, this argument points to an array with num_layer_specs entries, containing the distortion-length slope thresholds associated with each quality layer. This argument is ignored if layer_sizes is non-NULL, or num_layer_specs is 0. For an explanation of the logarithmic representation used for distortion length slope thresholds in Kakadu, see the comments associated with the kdu_codestream::flush function.

min_slope_threshold [kdu_uint16]

If this argument is non-zero, the kdu_codestream::set_min_slope_threshold function will be used to apply this slope threshold prior to compression. As explained in connection with that function, this can help to speed up the compression process significantly. Although the application could invoke kdu_codestream::set_min_slope_threshold itself, providing a non-zero argument here will prevent the present function from calling kdu_codestream::set_max_bytes if the layer_sizes array is non-NULL. More precisely, the function follows the following set of rules in determining what speedup features to apply:

no_prediction [bool]

If true, neither the kdu_codestream::set_max_bytes function, nor the kdu_codestream::set_min_slope_threshold function will be invoked. Applications should set this argument to true only if they want to adopt a very conservative stance in relation to maximizing image quality at the expense of compression speed. For typical images, Kakadu's code-block truncation prediction mechanisms have no impact on image quality at all, while saving processing time.

force_precise [bool]

If true, 32-bit internal representations are used by the compression engines created by this object, regardless of the precision of the image samples reported by kdu_codestream::get_bit_depth.

record_layer_info_in_comment [bool]

If true, the rate-distortion slope and the target number of bytes associated with each quality layer will be recorded in a COM (comment) marker segment in the main code-stream header. This can be very useful for applications which wish to process the code-stream later in a manner which depends upon the interpretation of the quality layers. For this reason, you should generally set this argument to true, unless you want to get the smallest possible file size when compressing small images. For more information on this option, consult the comments appearing with its namesake in kdu_codestream::flush.

size_tolerance [double]

This argument is ignored unless layering is controlled by cumulative layer sizes supplied via a layer_sizes array. In this case, it may be used to trade accuracy for speed when determining the distortion-length slopes which achieve the target layer sizes as closely as possible. In particular, the algorithm will finish once it has found a distortion-length slope which yields a size in the range target*(1-tolerance) <= size <= target, where target is the target size for the relevant layer. If no such slope can be found, the layer is assigned a slope such that the size is as close as possible to the target, without exceeding it.

num_components [int]

If zero, the number of image components to be supplied to the push_stripe function is identical to the value returned by kdu_codestream::get_num_components, with its optional want_output_comps argument set to true. However, you may supply a smaller number of image components during compression, if you think that these provide sufficient information to generate all codestream image components. This can happen where a Part 2 multi-component transformation defines more MCT output components than there are codestream image components. Then, during compression, it may be possible to invert the defined multi-component transform network by supplying only a subset of the MCT output components as source components (the components supplied to push_stripe). If a non-zero num_components argument is supplied, this is the number of components you will push to push_stripe — if there are not sufficient components, the machinery will generate an appropriate error message through kdu_error. For more on this, consult the description of the kdu_multi_analysis object on which this is built.

want_fastest [bool]

If this argument is true and force_precise is false, the function selects a 16-bit internal representation (usually leads to the fastest processing) even if this will result in reduced image quality, at least for irreversible processing. For image components which require reversible compression, the 32-bit representation must be selected if the image sample precision is too high, or else numerical overflow might occur.

env [kdu_thread_env *]

This argument is used to establish multi-threaded processing. For a discussion of the multi-threaded processing features offered by the present object, see the introductory comments to kdu_stripe_compressor. We remind you here, however, that all calls to start, process and finish must be executed from the same thread, which is identified only in this function. If you re-use the object to process a subsequent image, you may change threads between the two uses, passing the appropriate appropriate kdu_thread_env reference in each call to start. For the single-threaded processing model used prior to Kakadu version 5.1, set this argument to NULL.

env_queue [kdu_thread_queue *]

This argument is ignored unless env is non-NULL, in which case a non-NULL env_queue means that all multi-threaded processing queues created inside the present object, by calls to process, should be created as sub-queues of the identified env_queue.

env_dbuf_height [int]

This argument may be used to introduce and control parallelism in the DWT processing steps, allowing you to distribute the load associated with multiple tile-components across multiple threads. In the simplest case, this argument is 0, and parallel processing applies only to the block encoding processes. For a small number of processors, this is usually sufficient to keep all CPU's active. If this argument is non-zero, however, the kdu_multi_analysis objects on which all processing is based, are created with double_buffering equal to true and a processing_stripe_height equal to the value supplied for this argument. See kdu_multi_analysis::create for a more comprehensive discussion of double buffering principles and guidelines.


| top || synopsis || arguments || prev || next |