📄 region_decompressor.h
字号:
/******************************************************************************/// File: region_decompressor.h [scope = APPS/SHOW]// Version: Kakadu, V2.2// Author: David Taubman// Last Revised: 20 June, 2001/******************************************************************************/// Copyright 2001, David Taubman, The University of New South Wales (UNSW)// The copyright owner is Unisearch Ltd, Australia (commercial arm of UNSW)// Neither this copyright statement, nor the licensing details below// may be removed from this file or dissociated from its contents./******************************************************************************/// Licensee: Book Owner// License number: 99999// The Licensee has been granted a NON-COMMERCIAL license to the contents of// this source file, said Licensee being the owner of a copy of the book,// "JPEG2000: Image Compression Fundamentals, Standards and Practice," by// Taubman and Marcellin (Kluwer Academic Publishers, 2001). A brief summary// of the license appears below. This summary is not to be relied upon in// preference to the full text of the license agreement, which was accepted// upon breaking the seal of the compact disc accompanying the above-mentioned// book.// 1. The Licensee has the right to Non-Commercial Use of the Kakadu software,// Version 2.2, including distribution of one or more Applications built// using the software, provided such distribution is not for financial// return.// 2. The Licensee has the right to personal use of the Kakadu software,// Version 2.2.// 3. The Licensee has the right to distribute Reusable Code (including// source code and dynamically or statically linked libraries) to a Third// Party, provided the Third Party possesses a license to use the Kakadu// software, Version 2.2, and provided such distribution is not for// financial return./*******************************************************************************Description: Defines incremental, robust, region-based decompression services throughthe "kd_region_decompressor" object. These services should prove usefulto many interactive applications which require JPEG2000 rendering capabilities.*******************************************************************************/#ifndef REGION_DECOMPRESSOR_H#define REGION_DECOMPRESSOR_H#include "kdu_compressed.h"#include "kdu_sample_processing.h"#include "jp2.h"// Declared herestruct kdr_channel_mapping;struct kdr_component;struct kdr_channel;class kdr_region_decompressor;/******************************************************************************//* kdr_channel_mapping *//******************************************************************************/struct kdr_channel_mapping { public: // Member functions kdr_channel_mapping() { palette[0] = palette[1] = palette[2] = NULL; clear(); } ~kdr_channel_mapping() { clear(); } void clear() { num_channels = 0; palette_bits = 0; for (int c=0; c < 3; c++) { source_components[c] = 0; if (palette[c] != NULL) delete[] palette[c]; palette[c] = NULL; } } public: // Data int num_channels; int source_components[3]; int palette_bits; kdu_sample16 *palette[3]; jp2_colour colour; }; /* Notes: This structure describes the procedures required to map source image components to colour channels. The number of channels is either 1 or 3. The `source_components' array holds the indices of the image components which are used to generate each of the three colour channels (the first one if there is only one channel). Similarly, the `palette' array holds the palette lookup table to be applied to each source component to obtain the colour channel values. The number of index bits for the palette lookup tables is given by `palette_bits' and each table is guaranteed to have 2^{palette_bits} entries. If `palette_bits' is 0, there is no palette. If any individual entry in the `palette' array is NULL, that colour channel is rendered directly from its source component. The entries in each palette lookup table are 16-bit fixed point values, having KDU_FIX_POINT fraction bits and representing normalized quantities having the nominal range of -0.5 to +0.5. The `colour' object, if it exists (use the `exists' member function to check), identifies the colour space of the data and provides colour conversion capabilities which may be required. *//******************************************************************************//* kdr_component *//******************************************************************************/struct kdr_component { int comp_idx; // This will be < 0 if component is not used. int bit_depth; bool is_signed; int palette_bits; // If != 0, samples will be converted to palette indices bool reversible; kdu_line_buf line; kdu_pull_ifc engine; // Decompression engine kdu_dims dims; // See notes below. kdu_coords sampling; // See notes below. kdu_coords interp; // See notes below. bool line_buf_valid; // False when `line' contains valid decompressed data }; /* Notes: The `sampling' and `dims' members together identify the size, location and interpolation properties of the current tile region within this image component. The `dims' member holds the location and dimensions of the component region on the high resolution code-stream canvas, after possible after geometric transformation. This is the information returned by the `kdu_tile_comp::get_dims' function. Note that `dims.size.y' is decremented and `dims.pos.y' is incremented whenever a new line is decompressed. The `sampling' member identifies the spacing between image component samples, measured in rendering grid points. This is essentially the expansion (or interpolation) factor required for this component. The `interp' member holds placement state information which is used for interpolating the component samples up to the rendering grid. Specifically, `interp.x' holds the number of rendering grid points which are considered to be closest to the left-most component sample. Our nearest neighbour interpolation rule sets all of these grid points equal to the first component sample and then moves on to the next component sample, copying it into the next `sampling.x' grid points and so forth. `interp.y' initially has the same interpretation for the vertical direction. Its value is decremented whenever a new channel line is produced; when it reaches 0, a new line must be decompressed and `interp.y' is incremented by `sampling.y'. *//******************************************************************************//* kdr_channel *//******************************************************************************/struct kdr_channel { kdr_component *source; // Source component for this channel.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -