+ All Categories
Home > Documents > Independently updating the DCT and DST for shifting windowed data

Independently updating the DCT and DST for shifting windowed data

Date post: 05-Dec-2016
Category:
Upload: yp
View: 221 times
Download: 2 times
Share this document with a friend
16
Author's Accepted Manuscript Independently updating the DCT and DST for shifting windowed data V. Karwal, B.G. Sherlock, Y.P. Kakad PII: S0016-0032(13)00100-2 DOI: http://dx.doi.org/10.1016/j.jfranklin.2013.02.028 Reference: FI1714 To appear in: Journal of the Franklin Institute Received date: 26 January 2011 Revised date: 10 January 2013 Accepted date: 25 February 2013 Cite this article as: V. Karwal, B.G. Sherlock, Y.P. Kakad, Independently updating the DCT and DST for shifting windowed data, Journal of the Franklin Institute, http://dx. doi.org/10.1016/j.jfranklin.2013.02.028 This is a PDF file of an unedited manuscript that has been accepted for publication. As a service to our customers we are providing this early version of the manuscript. The manuscript will undergo copyediting, typesetting, and review of the resulting galley proof before it is published in its final citable form. Please note that during the production process errors may be discovered which could affect the content, and all legal disclaimers that apply to the journal pertain. www.elsevier.com/locate/jfranklin
Transcript

Author's Accepted Manuscript

Independently updating the DCT and DST forshifting windowed data

V. Karwal, B.G. Sherlock, Y.P. Kakad

PII: S0016-0032(13)00100-2DOI: http://dx.doi.org/10.1016/j.jfranklin.2013.02.028Reference: FI1714

To appear in: Journal of the Franklin Institute

Received date: 26 January 2011Revised date: 10 January 2013Accepted date: 25 February 2013

Cite this article as: V. Karwal, B.G. Sherlock, Y.P. Kakad, Independently updating theDCT and DST for shifting windowed data, Journal of the Franklin Institute, http://dx.doi.org/10.1016/j.jfranklin.2013.02.028

This is a PDF file of an unedited manuscript that has been accepted for publication. As aservice to our customers we are providing this early version of the manuscript. Themanuscript will undergo copyediting, typesetting, and review of the resulting galley proofbefore it is published in its final citable form. Please note that during the production processerrors may be discovered which could affect the content, and all legal disclaimers that applyto the journal pertain.

www.elsevier.com/locate/jfranklin

Independently updating the DCT and DST for shifting windowed data

V. Karwal, B.G. Sherlock, Y.P. Kakad*

Department of Electrical and Computer Engineering, University of North Carolina at

Charlotte, 9201 University City Boulevard, Charlotte, NC 28223, USA

________________________________________________________________________

Abstract When processing a signal or an image using the Discrete Cosine Transform (DCT) or Discrete Sine Transform (DST), a typical approach is to extract a portion of the signal by windowing and then form the DCT or DST of the window contents. By shifting the window point by point over the signal, the entire signal may be processed. In this paper we develop algorithms to “update” the DCT and DST to reflect the modified window contents using less computation than by directly evaluating the modified transform via standard Fast Transform algorithms. Our algorithms constitute an improvement over previous DCT/ DST update algorithms because our approach establishes independence between the DCT and the DST: the algorithm for DCT makes use only of DCT terms, and similarly for DST. Algorithms are derived for use without windowing and with split-triangular, Hanning, Hamming and Blackman windows. Key words: Discrete cosine transform, Fast transform, Window ________________________________________________________________________

1. Introduction Since its introduction in 1974 [3] the Discrete Cosine Transform (DCT) has found widespread application in image processing for the purposes of pattern recognition, data compression, communication and several other areas. The reason for this success is the ability of the DCT to decorrelate signal data; specifically, the DCT has been shown to provide a close approximation to the ideal Karhunen-Loéve Transform (KLT) for data

* Email addresses: [email protected] (V.Karwal), [email protected] (B.G. Sherlock), [email protected] (Y.P. Kakad)

that exhibits Markov-1 statistics with a correlation coefficient ρ > 0.9. KLT optimally decorrelates data [4, 5]; however it is a signal-dependent transform and there is no general algorithm that enables its fast computation. This paper investigates the shift properties of the Discrete Cosine Transform (DCT) as applied to windowed signal data. In numerous applications, particularly for real-time data, it is impossible or inconvenient to form the DCT of the entire signal. Rather, a suitable transform length N is chosen, and the first N data points transformed. As new data points become available these are shifted into the data segment and the DCT recalculated [8]. In practice it is usually advisable to multiply the data by a window function before DCT is taken. Windowing serves to reduce edge effects which occur because the DCT treats its input data as having symmetries and periodicities that do not actually occur in the data. In [6] algorithms were developed to update the DCT and DST simultaneously to reflect the modified window contents using less computation than directly recalculating the modified transform via standard Fast Transform algorithms. However, these algorithms were limited to a single point step between successive windows (that is, one new data point per transform). Also, they apply only to the box car window. In subsequent research work [1, 2] the algorithms were extended to handle larger step sizes, i.e. the algorithms reflect the inclusion of a number r, where 1 ≤ r ≤ N-1, of additional data points and the removal of r old points from the signal. However all of these previous results use both DCT and DST for updating either the DCT or DST. In the present paper, we adopt a new approach whereby we develop new algorithms for r-point updating of the DCT using only DCT terms. Correspondingly, the DST update algorithms use only DST terms. The new DCT-only algorithm provides greater conceptual simplicity and easier implementation over previous combined DCT/DST algorithms because of the need to maintain updates of only the DCT rather than both DCT and DST. These algorithms are particularly useful in applications where only DCT coefficients need to be calculated. The analytically derived algorithms were tested for correctness using C language programs. 2. DCT/ DST definitions As developed by Rao and Yip [3] the type-II DCT and DST are defined as follows:

∑−

=

+=

1

0 2)12(cos)(2)(

N

xk N

kxxfPN

kC π (1)

for 1,...,1,0 −= Nk

and, ∑−

=

+=

1

0 2)12(sin)(2)(

N

xk N

kxxfPN

kS π (2)

for ,,...,1 Nk =

where, 2

1=jP for 0=j or N and 1 otherwise. Equation (2) differs from the

conventional definition of DST which has x ranging from 1 to N and (2x-1) in the sine argument. We use our definition in order to have the DST and DCT refer to the same set of signal data points. We emphasize that both definitions are fully equivalent in that they result in numerically identical transform coefficients. Xi and Chicharo [7] modified the notation to include a sequence pointer n for convenience in the presence of shifting data,

∑−

=

++−=

1

0 2)12(cos)(2),(

N

xk N

kxxNnfPN

knC π (3)

for 1,...,1,0 −= Nk

and, ∑−

=

++−=

1

0 2)12(sin)(2),(

N

xk N

kxxNnfPN

knS π (4)

for .,...,1 Nk =

3. Computation of r-point independent update equations for DCT and DST

Let ),( krnC + where k=0,…..,N-1, represent the updated DCT coefficients including the effect of r-points of new input data. From equation (3):

∑−−

=

+++−=+

rN

xk N

kxrxNnfPkrnCN 1

0 2)12(cos)(),(

∑−

−=

+++−+

1

.2

)12(cos)(N

rNxk N

kxrxNnfP π

Substituting y=x+r in the first term and i=x+r-N in the second term results in:

∑−

=

+−+−=+

1

2)1)(2(cos)(),(

2

N

ryk N

kryyNnfPkrnCN π

∑−

=

++−++

1

0.

2)1)(2(cos)(

r

ik N

kirNinfP π

∑−

=⎥⎦⎤

⎢⎣⎡ −

++−=

1

0 2)12(cos)(

N

yk N

rkN

kyyNnfP ππ

∑−

=

+−+−−

1

0 2)1)(2(cos)(

r

yk N

kryyNnfP π

∑−

=⎥⎦⎤

⎢⎣⎡ +

+−++

1

0 2)1)(2(cos)(

r

ik k

NkriinfP ππ

N

rkN

kyyNnfPN

yk

ππ cos2

)12(cos)(1

0∑−

=

++−=

Nrk

NkyyNnfP

N

yk

ππ sin2

)12(sin)(1

0∑−

=

++−+

∑−

=

+−+−−

1

0 2)1)(2(cos)(

r

yk N

kryyNnfP π

.2

)1)(2(cos)()1(1

0∑−

=

+−+−+

r

yk

k

NkryynfP π

Using the definition of the DCT and the DST as defined in equations (3) and (4) yields:

),(sin),(cos),( knSN

rkknCN

rkkrnC ππ+=+

∑−

=

+−+−−+−+

1

0 2)1)(2(cos)]()()1[(2 r

y

kk N

kryyNnfynfPN

π ,

Substituting x=r-1-y results in:

),(sin),(cos),( knSN

rkknCN

rkkrnC ππ+=+

∑−

=

+−−+−−−−+−+

1

0 2)12(cos)]1()1()1[(2 r

x

kk N

kxxrNnfxrnfPN

π . (5)

Calculating ),( krnC − from equation (3):

∑−

=

+−+−=−

1

0 2)12(cos)(),(

2

r

xk N

kxrxNnfPkrnCN π

∑−

=

+−+−+

1

.2

)12(cos)(N

rxk N

kxrxNnfP π

Substituting i=x-r-N in the first term and y=x-r in the second term results in:

∑−−

−−=

++++=−

1

2)1)(2(cos)(),(

2

N

Nri NkNriinfkPkrnCN π

∑−−

=

+++−+

1

0

.2

)1)(2(cos)(rN

y NkryyNnfkP π

∑−−

−−=⎥⎦⎤

⎢⎣⎡ +

++

+=1 )(

2)12(cos)(

N

Nrik N

kNrN

kiinfP ππ

∑−−

=⎥⎦⎤

⎢⎣⎡ +

++−+

1

0 2)12(cos)(

rN

yk N

rkN

kyyNnfP ππ

N

kNrN

kiinfPN

Nrik

ππ )(cos2

)12(cos)(1 ++

+= ∑−−

−−=

NkNr

NkiinfP

N

Nrik

ππ )(sin2

)12(sin)(1 ++

+− ∑−−

−−=

N

rkN

kyyNnfPrN

yk

ππ cos2

)12(cos)(1

0∑

−−

=

++−+

Nrk

NkyyNnfP

rN

yk

ππ sin2

)12(sin)(1

0∑

−−

=

++−−

∑−−

−−=

++−=

1

2)12(cos)(cos)1(

N

Nrik

k

NkiinfP

Nrk ππ

∑−−

−−=

++−−

1

2)12(sin)(sin)1(

N

Nrik

k

NkiinfP

Nrk ππ

∑−

=

++−+

1

0 2)12(cos)(cos

N

yk N

kyyNnfN

rkP ππ

∑−

−=

++−−

1

2)12(cos)(cos

N

rNyk N

kyyNnfN

rkP ππ

∑−

=

++−−

1

0 2)12(sin)(sin

N

yk N

kyyNnfN

rkP ππ

∑−

−=

++−+

1

2)12(sin)(sin

N

rNyk N

kyyNnfN

rkP ππ

Using the definition of the DCT and the DST as defined in equations (3) and (4) yields:

),(sin),(cos),( knSN

rkknCN

rkkrnC ππ−=−

∑−−

−−=

++−+

1

2)12(cos)(2cos)1(

N

Nrik

k

Nkiinf

NP

Nrk ππ

∑−−

−−=

++−−

1

2)12(sin)(2sin)1(

N

Nrik

k

Nkiinf

NP

Nrk ππ

∑−

−=

++−−

1

2)12(cos)(2cos

N

rNyk N

kyyNnfNN

rkP ππ

∑−

−=

++−+

1

2)12(sin)(2sin

N

rNyk N

kyyNnfNN

rkP ππ

Substituting i=-x-N-1 and y=-x+N-1 results in:

),(sin),(cos),( knSN

rkknCN

rkkrnC ππ−=−

∑−

=

+−−−+

1

0 2)12(cos)1(2cos

r

xk N

kxxNnfN

PN

rk ππ

∑−

=

+−−−+

1

0 2)12(sin)1(2sin

r

xk N

kxxNnfN

PN

rk ππ

∑−

=

+−−−−

1

0 2)12(cos)1(2cos)1(

r

xk

k

Nkxxnf

NNrkP ππ

∑−

=

+−−−−

1

0 2)12(sin)1(2sin)1(

r

xk

k

Nkxxnf

NNrkP ππ (6)

Adding equations (5) and (6) results in cancellation of the DST coefficients and yields the DST independent update equation for DCT-II.

),(),(cos2),( krnCknCN

rkkrnC −−=+π

+ ∑−

=

+−−−−−−−

1

0 2)12(sin)]1()1()1([sin2 r

x

kk N

kxxnfxNnfN

rkPN

ππ

∑−

=

+−−+−−−−+−+

1

0 2)12(cos)]1()1()1[(2 r

x

kk N

kxxrNnfxrnfPN

π

∑−

=

+−−−−−−−−

1

0 2)12(cos)]1()1()1[(cos2 r

x

kk N

kxxNnfxnfN

rkPN

ππ . (7)

Equation (7) can be used to update the DCT using the DCT coefficients of the current and one previous time sequences, new input data points and the old data points shifted out, independent of the discrete sine coefficients. The update equation involves real time update of N point data taking r-points at a time. Similarly the r-point update equation for the DST may be derived resulting in:

),(),(cos2),( krnSknSN

rkkrnS −−=+π

+ ∑−

=

+−−−−−−−

1

0 2)12(cos)]1()1()1([sin2 r

x

kk N

kxxnfxNnfN

rkPN

ππ

∑−

=

+−−+−−−−+−+

1

0 2)12(sin)]1()1()1([2 r

x

kk N

kxxrnfxrNnfPN

π

∑−

=

+−−−−−−−−

1

0 2)12(sin)]1()1()1([cos2 r

x

kk N

kxxnfxNnfN

rkPN

ππ . (8)

4. Windowed Update

The N-point DCT treats a data sequence f(x), x=0,…,N-1, as if it had the following reflective symmetries and periodicities:

).2()12()()( NxfxNfxfxf +=−−=−= In practice, most real-world signals do not exhibit the above symmetries. If the rectangular window is applied to such a signal the use of the DCT will result in undesired edge effects such as ringing. Such effects can be reduced by applying a more appropriate window [9]. In addition to selecting a portion of the signal, the window modifies it to make or tend to make it continuous at the edges when regarded as periodically repeated, or smoother, under the implicit symmetries of the DCT. In the absence of explicit windowing, the rectangular window is implicit and the moving DCT algorithm of equation (7) should be used. The present section introduces DCT updating algorithms for signals windowed using other frequently-encountered windows, including the trapezoidal, Hanning, Hamming and Blackman windows. 4.1. Moving DCT and DST for Trapezoidal Window For the trapezoidal window we derive the update algorithm for the special case of one new data point at a time, i.e. r=1. We do so because the formulae for r > 1 become increasingly complicated as r increases. The derivation resulting in equations (13) and (15) below was given in [1] but is repeated here to ensure understanding of the material that follows in section 4.1.1. The trapezoidal or split-triangular window, figure 1(a), is defined as follows:

=)(xw

with n0 being the tail length.

x/n0 if x=0,...,n0

1 if x= n0+1,...,N-n0

w(N-x) if x= N-n0+1,...,N-1

Fig. 1 (a) Split-triangular window w(x), for N=16, 0n =5 (b) function

)1()()( +−= xwxwxm , (c) function ).1()()( +−= xmxmxmp

For the input signal f(x) where x=0,....,N-1, and window w(x), the windowed data is

).()()( xwxfxf w = For a new incoming point the new windowed data is given by: )()1()()( xwxfxf neww += [ ])1()1()()1( +−+++= xwxwxwxf [ ])1()()1()1()1( +−++++= xwxwxfxwxf )()1()1()1( xmxfxwxf ++++= , where ).1()()( +−= xwxwxm i.e. )()1()( )()( xfxfxf newmwneww ++= (9) where, )()1()()( xmxfxf newm += and )1()1()1( ++=+ xwxfxf w . The function m(x) is illustrated in figure 1(b). fm(new)(x) can be re-written as: [ ])()1()1()1()()( xmxmxmxfxf newm ++−++= [ ])1()()1()1()1( +−++++= xmxmxfxmxf . (10)

But, =+− )1()( xmxm

.2111,

01,

01,

000 −−−− +−−= NxnNxnx nnn

δδδ (11)

Substituting equation (11) in (10) yields:

⎥⎦

⎤⎢⎣

⎡+−−++++= −−−− 1,

01,

01,

0)(

211)1()1()1()(00 NxnNxnxnewm nnn

xfxmxfxf δδδ

Therefore,

[ ]1,1,01,00

)( )(2)()(1)1()(00 −−−− +−−−++= NxnNxnxmnewm NfnNfnf

nxfxf δδδ . (12)

Equations (9) and (12) represents the windowed update version of fw(x) and fm(x) respectively. In equation (9), fw(x+1) represents un-windowed update of fw(x) and the second term fm(new)(x) converts this un-windowed update of fw(x) into an update in the presence of the window. Similarly, in equation (12), fm(x+1) represents un-windowed update of fm(x)=f(x)m(x) and the second term converts this into the update in the presence of the window. Taking DCT of equation (9) and (12) yields:

.)()]1()1([)( newmxwxfneww CCC += ++ (13)

)]1()1([)( ++= xmxfnewm CC

[ ]N

kxNfnNfnfn

PN

N

xNxnNxnxk 2

)12(cos)(2)()(12 1

01,1,01,0

000

πδδδ ++−−−+ ∑

=−−−−

for k=0,1,…,N-1, (14) where we use the notation )]([ xfC to denote the DCT of the function f(x), x=0,…,N-1. Simplifying equation (14) yields:

⎩⎨⎧ +−−+= ++ N

knnf

nP

NCC k

xmxfnewm 2]1)1(2[

cos)(2 00

0)]1()1([)(

π

-1/n0 if x = n0-1, -1/n0 if x = N-n0-1, 2/n0 if x = N-1, 0 all other x in 0,…, N-1,

.2

]1)1(2[cos)(22

]1)1(2[cos)( 0

0⎭⎬⎫+−

++−−

−−N

kNNfN

knNnNf ππ

Therefore,

⎩⎨⎧ −−+= ++ N

knnf

nP

NCC k

xmxfnewm 2)12(

cos)(2 00

0)]1()1([)(

π

,2

cos)1)((22

)12(cos)()1( 0

0⎭⎬⎫−+

+−−−

NkNf

Nkn

nNf kk ππ (15)

for k=0,1,…,N-1. In equation (13), C[f(x+1)w(x+1)] is the un-windowed update of fw(x) and in equation (15), C[f(x+1)m(x+1)] is the un-windowed DCT update of fm(x) calculated using the algorithm embodied in equation (7). Equations (13) and (15) can be used to calculate the independent windowed DCT update in the presence of the trapezoidal window. Analogously the independent DST update equations in the presence of the trapezoidal window can be derived and are given as follows:

;)()]1()1([)( newmxwxfneww SSS += ++ (16)

⎩⎨⎧ −−+= ++ N

knnf

nP

NSS k

xmxfnewm 2)12(

sin)(2 00

0)]1()1([)(

π

,2

sin)1)((22

)12(sin)()1( 00

⎭⎬⎫−+

+−−−

NkNf

NknnNf kk ππ (17)

for k=1,2,…,N. S[f(x+1)w(x+1)] is the un-windowed updated DST of fw(x) and S[f(x+1)m(x+1)] is the un-windowed updated DST of fm(x) that can be calculated using equation (8). Equations (16) and (17) can be used to calculate the independent windowed DST update in the presence of the trapezoidal window. 4.1.1. Derivation of correction values for oldest windowed DCT value When using equation (13) and (15) to get Cw(new) and Cm(new), it is clear that C[f(x+1)w(x+1)] and C[f(x+1)m(x+1)] must be obtained. This is done using the un-windowed update equation (7). However, examination of equation (7) shows that in order to calculate an updated DCT

),,1( knC + we need not only the current value ),( knC but also an older value ).,1( knC − In the case of wC and mC these older values are not directly available and must be calculated. For wC , the current value is C[f(x)w(x)] and the older value is C[f(x-1)w(x-1)]. Unfortunately C[f(x-1)w(x-1)] is not available; we have instead from the previous time-step C[f(x-1)w(x)]. Therefore, we must find a way to calculate C[f(x-1)w(x-1)] from C[f(x-1)w(x)]. Similarly for mC , we must calculate the needed C[f(x-1)m(x-1)] from the known C[f(x-1)m(x)]. Now, [ ])1()1()()1()()1( −−−+−=− xwxwxwxfxwxf

[ ])()1()1()1()1( xwxwxfxwxf −−−−−−= ),1()1()1()1( −−−−−= xmxfxwxf i.e. ).1()1()()1()1()1( −−+−=−− xmxfxwxfxwxf (18) Similarly, calculating the correction factor to convert f(x-1)m(x) into the correct value f(x-1)m(x-1), [ ])1()1()()1()()1( −−−+−=− xmxmxmxfxmxf [ ])()1()1()1()1( xmxmxfxmxf −−−−−−= ),1()1()1()1( −−−−−= xmxfxmxf p Therefore, ).1()1()()1()1()1( −−+−=−− xmxfxmxfxmxf p (19) where,

=+−= )1()()( xmxmxmp The function mp(x) is illustrated in figure 1(c). Substituting the value of mp(x-1) in equation (19) yields:

⎥⎦

⎤⎢⎣

⎡+−−−+−=−− − 0,

0,

0,

0

211)1()()1()1()1(00 xnNxnx nnn

xfxmxfxmxf δδδ ,

i.e.

[ ]0,,0,00

)1(2)1()1(1)()1()1(00 xnNxnxm fnNfnf

nxmxfxf δδδ −+−−−−−+−=− − . (20)

Taking the DCT of equation (20) and simplifying:

)]()1([)]1()1([)( xmxfxmxfmold CCkC −−− =≡

[ ]N

kxfnNfnfn

PN

N

xxnNxnxk 2

)12(cos)1(2)1()1(12 1

00,,0,0

000

πδδδ +−+−−−−−+ ∑

=−

for k=0,1,…,N-1.

-1/n0 if x = n0-1, -1/n0 if x = N-n0-1, 2/n0 if x = N-1, 0 all other x in 0,…, N-1

⎩⎨⎧ +

−−+= − Nkn

nfnP

NC k

xmxf 2)1(2

cos)1(2 00

0)]()1([

π

⎭⎬⎫−+

+−−−−

Nkf

NknN

nNf2

cos)1(22

]1)(2[cos)1( 0

0ππ

Therefore,

⎩⎨⎧ +

−−+=≡ −−− Nknnf

nP

NCCkC k

xmxfxmxfmold 2)12(cos)1(2)( 0

00

)]()1([)]1()1([π

.2

cos)1(22

)12(cos)1()1( 00

⎭⎬⎫−+

−−−−−

Nkf

NknnNfk ππ (21)

Taking the DCT of equation (18) yields: .)]1()1([)]()1([)]1()1([ −−−−− += xmxfxwxfxwxf CCC (22) Equations (21) and (22) together can be used to calculate the older time sequence windowed DCT values. C[f(x-1)w(x-1)] and C[f(x-1)m(x-1)] play the role of Cwold and Cmold respectively. Analogous equations for the older time sequence DST values can be derived similarly, and are as follows:

⎩⎨⎧ +

−−+=≡ −−− Nknnf

nP

NSSS k

xmxfxmxfmold 2)12(sin)1(2 0

00

)]()1([)]1()1([π

⎭⎬⎫−+

−−−−−

Nkf

Nkn

nNfk

2sin)1(2

2)12(

sin)1()1( 00

ππ (23)

for k=1,…,N. .)]1()1([)]()1([)]1()1([ −−−−− +== xmxfxwxfxwxfwold SSSS (24) 4.2. Moving DCT and DST update for Hamming, Hanning and Blackman windows

The general form of these windows for x=0,…,N-1 is defined as:

⎟⎠⎞

⎜⎝⎛+⎟

⎠⎞

⎜⎝⎛+=

Nxa

Nxaaxw ππ 4cos2cos)( 210 , (25)

where, a0=0.5, a1=-0.5 for Hanning Window, a0=0.54, a1=-0.46 for Hamming Window, and, a0=0.42, a1=-0.5, a2=0.08 for Blackman Window. (26) For a signal f(x), the windowed signal is:

).(4cos2cos)()()( 210 xfN

xaN

xaaxfxwxf w⎭⎬⎫

⎩⎨⎧

⎟⎠⎞

⎜⎝⎛+⎟

⎠⎞

⎜⎝⎛+==

ππ (27)

Taking the DCT of equation (27) yields;

Nkx

NxxfP

NaknCaknC

N

xkw 2

)12(cos2cos)(2),(),(1

010

ππ +⎟⎠⎞

⎜⎝⎛+= ∑

=

N

kxN

xxfPN

aN

xk 2

)12(cos4cos)(2 1

02

ππ +⎟⎠⎞

⎜⎝⎛+ ∑

=

(28)

Earlier work (equation (15) of [1]) showed that the update can be achieved using the following equation:

⎥⎦

⎤⎢⎣

⎡ −+

+⎩⎨⎧+=

−+ 22

10

)2,()2,(cos2

),(),(kk

kw PknC

PknC

NPaknCaknC π

⎥⎦

⎤⎢⎣

⎡ −+

+

⎩⎨⎧+

⎭⎬⎫⎥⎦

⎤⎢⎣

⎡ −−

++

−+−+ 44

2

22

)4,()4,(2cos2

)2,()2,(sinkk

kkk P

knCP

knCN

PaP

knSP

knSN

ππ

.)4,()4,(2sin44 ⎭

⎬⎫⎥⎦

⎤⎢⎣

⎡ −−

++

−+ kk PknS

PknS

Nπ (29)

for k=0,1,…,N-1. Clearly equation (29) depends on the DST as well as the DCT. To remedy this, we examine equation (5), i.e. the un-windowed DCT update for the special case of r=1:

[ ]).()()1(2

cos2),(sin),(cos),1( NnfnfN

kPN

knSNkknC

NkknC k

k −−−++=+πππ (30)

Solving equation (30) for S(n,k) yields:

{ }⎥⎦

⎤⎢⎣

⎡−−−+−+= )()1()(

2cos2),(cos),1(

sin

1),( nfNnfN

kPN

knCNkknC

NkknS k

kππ

π

for k=1,…,N-1. (31) Equation (31) is undefined at k=N, and is therefore valid only for k=1,…,N-1. At k=N, the definition of the DST yields:

∑−

=

+−−=1

0)()1(1),(

N

x

x xNnfN

NnS (32)

The dependence of equation (29) upon DST coefficients can be removed by calculating the S(n,k) terms using equations (31) and (32). However, the presence of indices (k+2), (k-2), (k+4) and (k-4) in equation (29) results in indices out of the range given in the definitions of DCT and DST. We can use the following symmetry properties of DCT and DST to extend the range of indices to all integers k:

);4,()4,()2,()2,(),(),( kNnCkNnCkNnCkNnCknCknC +=−=−−=+−=−= ;0),();,(),( =+=− NnCkNnCkNnC

);4,()4,()2,()2,(),(),( kNnSkNnSkNnSkNnSknSknS +=−−=+−=−=−−=

.0)0,();,(),( =−=+ nSkNnSkNnS The above symmetry properties are used to calculate the DCT and DST at any integer value of the frequency variable k. In this way, equations (29), (31) and (32) can be used to implement the independent windowed update of DCT coefficients in the presence of Hamming, Hanning and Blackman windows without needing to store DST coefficients depending on the values of a0, a1, and a2 as defined in equation (26). Similarly, from [1] the simultaneous DST update equation is given by:

⎥⎦

⎤⎢⎣

⎡ −+

+⎩⎨⎧+=

−+ 22

10

)2,()2,(cos2

),(),(kk

kw PknS

PknS

NPaknSaknS π

⎥⎦

⎤⎢⎣

⎡ −+

+⎩⎨⎧+

⎭⎬⎫⎥⎦

⎤⎢⎣

⎡ −−

++

−+−+ 44

2

22

)4,()4,(2cos2

)2,()2,(sinkk

kkk P

knSP

knSN

PaP

knCP

knCN

ππ

,)4,()4,(2sin44 ⎭

⎬⎫⎥⎦

⎤⎢⎣

⎡ −−

++

−+ kk PknC

PknC

Nπ (33)

for k=1,2,…,N. However updating windowed DST using equation (33) requires calculation of DCT coefficients as well. Analogous equations to (31) and (32) provides a way of calculating the DCT coefficients indirectly from the DST coefficients:

{ }⎥⎦

⎤⎢⎣

⎡−−−++−= )()1()(

2sin2),1(),(cos

sin

1),( nfNnfN

kPN

knSknSNk

NkknC k

kππ

π

for k=1,…,N-1. (34) and,

.)(1)0,(1

0∑−

=

+−=N

xxNnf

NnC (35)

Equations (33), (34) and (35) can be used to calculate the DST update in the presence of Hamming, Hanning and Blackman windows without using the DCT coefficients. 5. Conclusion

We have developed new efficient algorithms for independently updating the DCT and DST upon the inclusion of r new data points. Algorithms were presented for the case where no explicit windowing is done, and for windowing using the split-triangular, Hanning, Hamming and Blackman windows. Software implementations that demonstrate the correctness of the algorithms are also provided. All algorithms are of computational order N, whereas the alternative (i.e. calculating the entire transform via fast DCT/DST algorithms, rather than using an update formula) is of order .log2 NN References [1] B.G. Sherlock and Y.P. Kakad, "Windowed discrete cosine and sine transforms for shifting data," Signal Processing, vol. 81, Issue 7, pp. 1465-1478, July 2001. [2] B.G. Sherlock and Y.P. Kakad, "Transform domain technique for windowing the DCT and DST," Journal of the Franklin Institute, vol. 339, Issue 1, pp. 111-120, April 2002. [3] N. Ahmed, T. Natarajan, and K.R. Rao, "Discrete cosine transform," IEEE Trans. Comput., vol. C-23, pp. 90-94, Jan. 1974. [4] V. Britanak, P. C. Yip, and K. R. Rao, "Discrete Cosine and Sine Transforms: General Properties, Fast Algorithms and Integer Approximations", ISBN 9780123736246. [5] H.C. Andrews, "Multidimensional rotations in feature selection," IEEE Trans. Comput. C-20, pp. 1045-1051, 1971. [6] P.Yip and K.R. Rao, "On the shift properties of DCT's and DST's," IEEE Trans. Signal Processing, vol. 35, pp. 404-406, Mar 1987. [7] Jiangtao Xi and J. F. Chicharo, "Computing Running DCT's and DST's Based on Their Second-Order Shift Properties," IEEE Trans. on Circuits and Systems-I, vol. 47, No. 5, 779-783, May 2000. [8] N.R. Murthy and M.N.S. Swamy, "On the computation of running discrete Cosine and Sine transforms," IEEE Trans. Signal Processing, vol. 40, pp. 1430-1437, June 1992. [9] N.C. Geckinli and D. Yavuz, "Some novel windows and a concise tutorial comparison of window families," IEEE Trans. Acoust., Speech Signal Process. ASSP vol. 26, Issue 6, pp. 501-507, June 1978.


Recommended