Documentation
¶
Index ¶
- Constants
- func ExtractTile53(image []int32, imgWidth int, tile *Tile) []int32
- func ExtractTile97(image []float64, imgWidth int, tile *Tile) []float64
- func InsertTile53(image []int32, imgWidth int, tile *Tile, tileData []int32)
- func InsertTile97(image []float64, imgWidth int, tile *Tile, tileData []float64)
- func ReconstructFromTiles53(tiles []*TileData53, imgWidth, imgHeight int) []int32
- func ReconstructFromTiles97(tiles []*TileData97, imgWidth, imgHeight int) []float64
- type Coefficients
- type DecompLevel
- type DecompLevelF
- type Decomposition
- type DecompositionF
- type Subband
- type SubbandF
- type Tile
- type TileData53
- type TileData97
- type TilePartitioner
- type Transform53Impl
- func (t *Transform53Impl) Forward1D(input []int32) (lo, hi []int32)
- func (t *Transform53Impl) Forward2D(data []int32, width, height int) []int32
- func (t *Transform53Impl) ForwardMultiLevel(data []int32, width, height, levels int) *Decomposition
- func (t *Transform53Impl) Inverse1D(lo, hi []int32) []int32
- func (t *Transform53Impl) Inverse2D(data []int32, width, height int) []int32
- func (t *Transform53Impl) InverseMultiLevel(decomp *Decomposition) []int32
- type Transform97Impl
- func (t *Transform97Impl) Forward1D(input []float64) (lo, hi []float64)
- func (t *Transform97Impl) Forward2D(data []float64, width, height int) []float64
- func (t *Transform97Impl) ForwardMultiLevel(data []float64, width, height, levels int) *DecompositionF
- func (t *Transform97Impl) Inverse1D(lo, hi []float64) []float64
- func (t *Transform97Impl) Inverse2D(data []float64, width, height int) []float64
- func (t *Transform97Impl) InverseMultiLevel(decomp *DecompositionF) []float64
Constants ¶
const ( Transform53 = 1 // 5/3 reversible (lossless) Transform97 = 0 // 9/7 irreversible (lossy) )
Transform type constants
const ( SubbandLL = iota // Low-Low SubbandHL // High-Low SubbandLH // Low-High SubbandHH // High-High )
Subband types
const ( // Lift53PredictDivisor is the divisor for the 5/3 predict step: d[n] = d[n] - floor((s[n] + s[n+1]) / 2) Lift53PredictDivisor = 2 Lift53UpdateDivisor = 4 Lift53UpdateOffset = 2 )
5/3 Lifting coefficients (integers for reversible transform) These are fixed-point representations
const ( // Alpha97 is the first predict coefficient for 9/7 analysis lifting steps (forward transform) Alpha97 = -1.586134342 Beta97 = -0.052980118 // Update 1 Gamma97 = 0.882911075 // Predict 2 Delta97 = 0.443506852 // Update 2 // K97 is the scale factor for low-pass in 9/7 transform K97 = 1.230174105 InvK97 = 0.812893066 // 1/K for high-pass (approximately 1/K97) )
9/7 Lifting coefficients (floating-point for irreversible transform)
const MaxDecompLevels = 32
MaxDecompLevels is the maximum number of decomposition levels allowed.
Variables ¶
This section is empty.
Functions ¶
func ExtractTile53 ¶
ExtractTile53 extracts integer tile data from an image
func ExtractTile97 ¶
ExtractTile97 extracts float tile data from an image
func InsertTile53 ¶
InsertTile53 inserts integer tile data back into an image
func InsertTile97 ¶
InsertTile97 inserts float tile data back into an image
func ReconstructFromTiles53 ¶
func ReconstructFromTiles53(tiles []*TileData53, imgWidth, imgHeight int) []int32
ReconstructFromTiles53 reconstructs an image from 5/3 transformed tiles
func ReconstructFromTiles97 ¶
func ReconstructFromTiles97(tiles []*TileData97, imgWidth, imgHeight int) []float64
ReconstructFromTiles97 reconstructs an image from 9/7 transformed tiles
Types ¶
type Coefficients ¶
type Coefficients struct {
Data []int32 // For 5/3 reversible transform
DataF []float64 // For 9/7 irreversible transform
Width int
Height int
}
Coefficients represents wavelet coefficients for a signal
type DecompLevel ¶
type DecompLevel struct {
LL *Subband // Low-low subband (next level input)
HL *Subband // High-low subband
LH *Subband // Low-high subband
HH *Subband // High-high subband
}
DecompLevel represents one level of wavelet decomposition
type DecompLevelF ¶
DecompLevelF represents one level with float coefficients
type Decomposition ¶
type Decomposition struct {
Levels []*DecompLevel
NumLevels int
Width int // Original image width
Height int // Original image height
Transform int // Transform53 or Transform97
}
Decomposition represents a complete wavelet decomposition
type DecompositionF ¶
type DecompositionF struct {
Levels []*DecompLevelF
NumLevels int
Width int
Height int
Transform int
}
DecompositionF represents floating-point decomposition for 9/7
type Subband ¶
type Subband struct {
Type int // SubbandLL, HL, LH, or HH
Level int // Decomposition level
Data []int32 // Integer coefficients
DataF []float64 // Float coefficients
Width int
Height int
OffX int // X offset in full image
OffY int // Y offset in full image
}
Subband represents a wavelet subband
type Tile ¶
type Tile struct {
X int // Tile X index
Y int // Tile Y index
Width int // Tile width in pixels
Height int // Tile height in pixels
OffX int // X offset in original image
OffY int // Y offset in original image
}
Tile represents a single tile from an image
type TileData53 ¶
type TileData53 struct {
Tile *Tile
Data []int32
Decomp *Decomposition
}
TileData53 holds tile data and its wavelet decomposition for 5/3 transform
func TransformTiles53 ¶
func TransformTiles53(image []int32, imgWidth, imgHeight, tileWidth, tileHeight, levels int) []*TileData53
TransformTiles53 partitions an image into tiles and applies 5/3 wavelet transform to each
type TileData97 ¶
type TileData97 struct {
Tile *Tile
Data []float64
Decomp *DecompositionF
}
TileData97 holds tile data and its wavelet decomposition for 9/7 transform
func TransformTiles97 ¶
func TransformTiles97(image []float64, imgWidth, imgHeight, tileWidth, tileHeight, levels int) []*TileData97
TransformTiles97 partitions an image into tiles and applies 9/7 wavelet transform to each
type TilePartitioner ¶
type TilePartitioner struct {
ImageWidth int // Full image width
ImageHeight int // Full image height
TileWidth int // Nominal tile width
TileHeight int // Nominal tile height
TileOffsetX int // First tile X offset (typically 0)
TileOffsetY int // First tile Y offset (typically 0)
}
TilePartitioner partitions images into tiles for JPEG 2000 processing
func NewTilePartitioner ¶
func NewTilePartitioner(imgWidth, imgHeight, tileWidth, tileHeight int) *TilePartitioner
NewTilePartitioner creates a new tile partitioner
func (*TilePartitioner) GetAllTiles ¶
func (tp *TilePartitioner) GetAllTiles() []*Tile
GetAllTiles returns all tiles in raster order
func (*TilePartitioner) GetTile ¶
func (tp *TilePartitioner) GetTile(tileX, tileY int) *Tile
GetTile returns the tile at the given tile coordinates
func (*TilePartitioner) NumTiles ¶
func (tp *TilePartitioner) NumTiles() int
NumTiles returns the total number of tiles
func (*TilePartitioner) NumTilesX ¶
func (tp *TilePartitioner) NumTilesX() int
NumTilesX returns the number of tiles in the X direction
func (*TilePartitioner) NumTilesY ¶
func (tp *TilePartitioner) NumTilesY() int
NumTilesY returns the number of tiles in the Y direction
type Transform53Impl ¶
type Transform53Impl struct{}
Transform53Impl implements the 5/3 reversible wavelet transform
func NewTransform53 ¶
func NewTransform53() *Transform53Impl
NewTransform53 creates a new 5/3 transform instance
func (*Transform53Impl) Forward1D ¶
func (t *Transform53Impl) Forward1D(input []int32) (lo, hi []int32)
Forward1D performs 1D forward 5/3 wavelet transform using lifting Input: signal of length N Output: (N+1)/2 low-pass coefficients, N/2 high-pass coefficients
func (*Transform53Impl) Forward2D ¶
func (t *Transform53Impl) Forward2D(data []int32, width, height int) []int32
Forward2D performs 2D forward 5/3 wavelet transform Applies row transform then column transform
func (*Transform53Impl) ForwardMultiLevel ¶
func (t *Transform53Impl) ForwardMultiLevel(data []int32, width, height, levels int) *Decomposition
ForwardMultiLevel performs multi-level 2D decomposition
func (*Transform53Impl) Inverse1D ¶
func (t *Transform53Impl) Inverse1D(lo, hi []int32) []int32
Inverse1D performs 1D inverse 5/3 wavelet transform using lifting
func (*Transform53Impl) Inverse2D ¶
func (t *Transform53Impl) Inverse2D(data []int32, width, height int) []int32
Inverse2D performs 2D inverse 5/3 wavelet transform
func (*Transform53Impl) InverseMultiLevel ¶
func (t *Transform53Impl) InverseMultiLevel(decomp *Decomposition) []int32
InverseMultiLevel performs multi-level 2D reconstruction
type Transform97Impl ¶
type Transform97Impl struct{}
Transform97Impl implements the 9/7 irreversible wavelet transform
func NewTransform97 ¶
func NewTransform97() *Transform97Impl
NewTransform97 creates a new 9/7 transform instance
func (*Transform97Impl) Forward1D ¶
func (t *Transform97Impl) Forward1D(input []float64) (lo, hi []float64)
Forward1D performs 1D forward 9/7 wavelet transform using lifting Input: signal of length N Output: (N+1)/2 low-pass coefficients, N/2 high-pass coefficients
func (*Transform97Impl) Forward2D ¶
func (t *Transform97Impl) Forward2D(data []float64, width, height int) []float64
Forward2D performs 2D forward 9/7 wavelet transform
func (*Transform97Impl) ForwardMultiLevel ¶
func (t *Transform97Impl) ForwardMultiLevel(data []float64, width, height, levels int) *DecompositionF
ForwardMultiLevel performs multi-level 2D decomposition for 9/7
func (*Transform97Impl) Inverse1D ¶
func (t *Transform97Impl) Inverse1D(lo, hi []float64) []float64
Inverse1D performs 1D inverse 9/7 wavelet transform using lifting
func (*Transform97Impl) Inverse2D ¶
func (t *Transform97Impl) Inverse2D(data []float64, width, height int) []float64
Inverse2D performs 2D inverse 9/7 wavelet transform
func (*Transform97Impl) InverseMultiLevel ¶
func (t *Transform97Impl) InverseMultiLevel(decomp *DecompositionF) []float64
InverseMultiLevel performs multi-level 2D reconstruction for 9/7