📄 qccspihtencode.3
字号:
.TH QCCSPIHTENCODE 1 "QCCPACK" ""
.SH NAME
QccSPIHTEncode, QccSPIHTDecode \-
encode/decode an image using the SPIHT algorithm
.SH SYNOPSIS
.B #include <QccPack.h>
.sp
.BI "int QccSPIHTEncode(const QccIMGImageComponent *" image ", const QccIMGImageComponent *" mask ", QccBitBuffer *" buffer ", int " num_levels ", const QccWAVWavelet *" wavelet ", const QccWAVPerceptualWeights *" perceptual_weights ", int " target_bit_cnt ", int " arithmetic_coded );
.sp
.BI "int QccSPIHTDecodeHeader(QccBitBuffer *" buffer ", int *" num_levels ", int *" num_rows ", int *" num_cols ", double *" image_mean ", int *" max_coefficient_bits ", int *" arithmetic_coded );
.sp
.BI "int QccSPIHTDecode(QccBitBuffer *" buffer ", QccIMGImageComponent *" image ", const QccIMGImageComponent *" mask ", int " num_levels ", const QccWAVWavelet *" wavelet ", const QccWAVPerceptualWeights *" perceptual_weights ", double " image_mean ", int " max_coefficient_bits ", int " arithmetic_coded );
.SH DESCRIPTION
.SS Encoding
.LP
.B QccSPIHTEncode()
encodes an image component,
.IR image ,
using the Set Partitioning In Hierarchical Trees (SPIHT) algorithm by
Said and Pearlman.
The SPIHT algorithm involves a 2D DWT followed by
a progressive "bit-plane" coding of the wavelet coefficients using a
zerotree-like quantization structure.
.LP
.I image
is the image component to be coded and
.I buffer
is the output bitstream.
.I buffer
must be of
.B QCCBITBUFFER_OUTPUT
type and opened via a prior call to
.BR QccBitBufferStart (3).
.LP
.I num_levels
gives the number of levels of dyadic wavelet decomposition to perform,
and
.I wavelet
is the wavelet to use for decomposition.
.I perceptual_weights
is the optional perceptual weights to employ (see
.BR QccWAVPerceptualWeights (3))
or use
.B NULL
for no perceptual weighting.
Note: the SPIHT algorithm as described originally by Said and
Pearlman in their ITCSVT paper does not employ perceptual weighting.
.LP
The bitstream output from the SPIHT encoder is embedded, meaning that
any prefix of the bitstream can be decoded to give a valid
representation of the image. The SPIHT encoder essentially produces
output bits until the number of bits output reaches
.IR target_bit_cnt ,
the desired (target) total length of the output bitstream in bits,
and then it stops.
Note that this is the bitstream length in bits, not the rate of the bitstream
(which would be expressed in bits per pixel).
.LP
As originally described by Said and Pearlman,
the SPIHT algorithm uses arithmetic coding of symbols as a final output step
to improve coding efficiency. Alternatively, arithmetic coding can be
suppressed, producing what Said and Pearlman call "binary-uncoded"
output.
The QccPack SPIHT implementation supports both arithmetic-coded
and binary-uncoded output modes.
.I arithmetic_coded
is a flag passed to
.BR QccSPIHTEncode()
that indicates whether arithmetic coding should be performed
(1 = arithmetic coding, 0 = binary-uncoded).
.LP
.BR QccSPIHTEncode()
optionally supports the use of a shape-adaptive DWT (SA-DWT) rather than
the usual DWT. That is,
.BR QccSPIHTEncode()
can call
.BR QccWAVSubbandPyramidShapeAdaptiveDWT (3)
as the wavelet transform rather than the usual
.BR QccWAVSubbandPyramidDWT (3).
The use of a SA-DWT is indicated by a non-NULL
.IR mask ;
if
.I mask
is NULL, then the usual DWT is used.
In the case of a SA-DWT,
.I mask
gives the transparency mask which indicates which pixels of the image
are non-transparent and thus have data that is to be transformed.
Refer to
.BR QccWAVSubbandPyramidShapeAdaptiveDWT (3)
for more details on the calculation of this SA-DWT.
The wavelet transform is the only component of the SPIHT algorithm
that is affected by the shape-adaptive nature of the processing.
That is, transparent regions in the image are effectively set
to "insignificant" by the SA-DWT, so the SPIHT algorithm
processes these transparent regions in a manner identical to that of other
insignificant coefficients. This approach has been described for
a number of zerotree-based coding algorithms; see Li and Li for
an example of such. Finally, note that the concept of
shape-adaptive coding arose in the recent MPEG-4 standard and was
not considered in the original work by Said and Pearlman.
.SS Decoding
.LP
.B QccSPIHTDecodeHeader()
decodes the header information
in a bitstream previously produced by
.BR QccSPIHTEncode() .
The input bitstream is
.I buffer
which must be of
.B QCCBITBUFFER_INPUT
type and opened via a prior call to
.BR QccBitBufferStart (3).
.LP
The header information is returned in
.I num_levels
(number of levels of wavelet decomposition),
.I num_rows
(vertical size of image),
.I num_cols
(horizontal size of image),
.I image_mean
(the mean value of the original image),
.I max_coefficient_bits
(indicates the precision, in number of bits, of the wavelet coefficient
with the largest magnitude),
and
.I arithmetic_coded
(indicates whether the to data stream to follow is arithmetic-coded or not).
.LP
.B QccSPIHTDecode()
decodes the bitstream
.IR buffer ,
producing the reconstructed image component,
.IR image .
The bitstream must already have had its header read by a prior call
to
.B QccSPIHTDecodeHeader()
(i.e., you call
.B QccSPIHTDecodeHeader()
first and then
.BR QccSPIHTDecode() ).
.LP
If a SA-DWT was used in SPIHT encoding, then the original transparency
mask should be passed to
.BR QccSPIHTDecode()
as
.IR mask .
That is,
.I mask
should be the same transparency mask (in the spatial domain)
that was passed to
.BR QccSPIHTEncode() .
Note that
.BR QccSPIHTDecode()
will transform this
.I mask
via a Lazy wavelet transform, and then pass the transformed mask
to
.BR QccWAVSubbandPyramidInverseShapeAdaptiveDWT (3).
If the usual DWT was used in encoding, then
.I mask
should be a NULL pointer.
.SH PERFORMANCE
The QccPack implementation of the SPIHT algorithm was coded "from scratch,"
with no consultation of the original SPIHT source code produced at
RPI by Said and Pearlman.
The QccPack implementation follows as description of the SPIHT algorithm
as described by Said and Pearlman in their original ITCSVT paper
as closely as can be extrapolated from that description.
(Note that the description of the algorithm given in their patent
documents differs slightly from that of the ITCSVT description).
However,
since no algorithm of complexity can ever be described
.I completely
in a journal article,
it is inevitable that certain subtle details
were implemented in the QccPack SPIHT coder
differently from in the coder used by
Said and Pearlman for their results.
As a consequence, the performance of the
QccPack implementation differs slightly from that reported
by Said and Pearlman in their ITCSVT paper and from that obtained by the
binary executable SPIHT programs available from RPI
(see http://www.cipr.rpi.edu/research/SPIHT -- with
.I arithmetic_coded
= 1, the QccPack code is similar to RPI's
.BR codetree / decdtree
programs, and with
.I arithmetic_coded
= 0, the QccPack code is similar to RPI's
.BR fastcode / fastdecd
programs).
However, the difference has been observed to be rather small, with
the QccPack implementation achieving PSNR typically 0.15 dB below
that achieved with the RPI binary executables (although look at the
Barbara arithmetic-coded results below for an unusually strong QccPack
performance!)
.LP
A quantitative comparison follows using the three "standard" images
(Lenna, Barbara, and Goldhill)
provided with QccPack. In all of the results, the wavelet transform employed
is a 5-level dyadic decomposition using
the 9/7 Cohen-Daubechies-Feauveau biorthogonal wavelet with
symmetric extension at the image boundaries (this is the same transform
used in Said and Pearlman's paper and in their executable code).
The RPI results refer to the results obtained using the
SPIHT executable code available from RPI.
The "average difference" is the average of the RPI PSNR minus the
QccPack PSNR over the range 0.05 dB to 1 dB calculated at every 0.025 dB.
.RS
.nf
Lenna - Arithmetic Coding
------------------------------------
| Rate | PSNR (db) |
| (bpp) | RPI QccPack |
------------------------------------
| 0.2 | 33.15 | 32.94 |
| 0.5 | 37.21 | 37.11 |
| 1.0 | 40.41 | 40.28 |
------------------------------------
Average difference = 0.17 dB
Lenna - No Arithmetic Coding
------------------------------------
| Rate | PSNR (db) |
| (bpp) | RPI QccPack |
------------------------------------
| 0.2 | 32.73 | 32.59 |
| 0.5 | 36.84 | 36.72 |
| 1.0 | 39.98 | 39.88 |
------------------------------------
Average difference = 0.14 dB
Barbara - Arithmetic Coding
------------------------------------
| Rate | PSNR (db) |
| (bpp) | RPI QccPack |
------------------------------------
| 0.2 | 26.66 | 26.48 |
| 0.5 | 31.40 | 31.33 |
| 1.0 | 36.41 | 36.43 |
------------------------------------
Average difference = 0.05 dB
Barbara - No Arithmetic Coding
------------------------------------
| Rate | PSNR (db) |
| (bpp) | RPI QccPack |
------------------------------------
| 0.2 | 26.29 | 26.11 |
| 0.5 | 30.94 | 30.80 |
| 1.0 | 35.94 | 35.79 |
------------------------------------
Average difference = 0.16 dB
Goldhill - Arithmetic Coding
------------------------------------
| Rate | PSNR (db) |
| (bpp) | RPI QccPack |
------------------------------------
| 0.2 | 29.85 | 29.68 |
| 0.5 | 33.13 | 32.96 |
| 1.0 | 36.55 | 36.37 |
------------------------------------
Average difference = 0.15 dB
Goldhill - No Arithmetic Coding
------------------------------------
| Rate | PSNR (db) |
| (bpp) | RPI QccPack |
------------------------------------
| 0.2 | 29.53 | 29.33 |
| 0.5 | 32.71 | 32.54 |
| 1.0 | 36.00 | 35.84 |
------------------------------------
Average difference = 0.14 dB
.fi
.RE
.SH "SEE ALSO"
.BR spihtencode (1),
.BR spihtdecode (1),
.BR imgdwt (1),
.BR squniform (1),
.BR QccBitBuffer (3),
.BR QccWAVPerceptualWeights (3),
.BR QccWAVSubbandPyramid (3),
.BR QccWAVSubbandPyramidDWT (3),
.BR QccWAVSubbandPyramidShapeAdaptiveDWT (3),
.BR QccPackWAV (3),
.BR QccPackIMG (3),
.BR QccPack (3)
A. Said and W. A. Pearlman,
"A New, Fast, and Efficient Image Codec Based
on Set Partitioning in Hierarchical Trees,"
.IR "IEEE Transactions on Circuits and Systems for Video Technology" ,
vol. 6, no. 3, pp. 243-250, June 1996.
.LP
S. Li and W. Li, "Shape-Adaptive Discrete Wavelet Transforms for
Arbitrarily Shaped Visual Object Coding,"
.IR "IEEE Transactions on Circuits and Systems for Video Coding" ,
vol. 10, pp. 725-743, August 2000.
.SH AUTHOR
Copyright (C) 1997-2001 James E. Fowler
.SH LICENSE
The Set Partitioning In Hierarchical Trees (SPIHT) algorithm is protected
by US Patent #5,764,807 (issued June 9, 1998) and other international
patents and patents pending. An implementation of the SPIHT algorithm is
included herein (utility programs spihtencode and spihtdecode, and spiht.c
in the QccPackSPIHT module of the QccPack library) with the permission of
PrimaComp, Inc., exclusive holder of patent rights. PrimaComp has graciously
granted a license with certain restrictions governing the terms and
conditions for use, copying, distribution, and modification of the SPIHT
algorithm implementation contained herein. Specifically, only use in
academic and non-commercial research is permitted, while all commercial
use is prohibited. Refer to the file LICENSE-SPIHT for more details.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -