Menu

DCT algorithm in sphinxtrain ?

Help
2010-08-25
2012-09-22
  • dang-khoa.nguyen

    Dir sir,
    we are developing an extension module of sphinxtrain and we need to calculate
    the invert DCT of feature vector. But as we find out the DCT algorithm in
    sphinxtrain source code may not really be DCT2 or DCT3 algorithm (that
    descripted in wiki) . So we can't implement the invert DCT associated.
    Could you explain this problem for us !
    thank in advance.

     
  • Nickolay V. Shmyrev

    Sorry, I don't understand the problem to explain. Could you please explain
    your question first? What's the problem with DCT being not DCT2 or DCT3. What
    wiki are you talking about.

     
  • dang-khoa.nguyen

    Sorry about my question is not clearly.
    I mean, in frontend processing include a module Discrete-Cosine-Transform and
    we need to know what exactly DCT algorithm in which used by sphinx. As we
    reference in this site:
    http://en.wikipedia.org/wiki/Discrete_cosine_transform
    there are 5 base DCT algorithm : DCT1, DCT2, DCT3, .... and there is one
    Invert DCT algorithm associate with each DCT algorithm.
    We try to search on sphinxtrain source code to find out what DCT algorithm was
    deployed in sphinxtrain. And the result is:
    subroutine to computer DCT
    for (i=0; i< FE->NUM_CEPSTRA; ++i){
    mfcep_ = 0;
    for (j=0;j<fe->MEL_FB->num_filters; j++){
    if (j==0)
    beta = 0.5;
    else
    beta = 1.0;
    mfcep_ += betamfspecFE->MEL_FB->mel_cosine_;
    }
    mfcep_ /= (float32)period;
    } </fe->

    subroutine to computer mel_cosine:
    for (i=0; i<mel_fb->num_cepstra; i++) {
    freq = 2(float32)M_PI(float32)i/period;
    for (j=0;j< MEL_FB->num_filters;j++)
    MEL_FB->mel_cosine_ = (float32)cos((float64)(freq*(j+0.5)));
    } </mel_fb->

    that is deployment of expression:
    X(k)=1/2x(0)+sigma(x(n)cos(PI/N(n+1/2)k)) , n=1,N-1
    It look like DCT3 algorithm that describe in wikipedia page above but not
    true, in DCT3 algorithm we have n(k+1/2) but not (n+1/2)k
    So we need to know whether you did a mistake or not. If not, could you explain
    the invert DCT algorithm associate with it ?
    Thank_____

     
  • Nickolay V. Shmyrev

    X(k)=1/2x(0)+sigma(x(n)cos(PI/N(n+1/2)k)) , n=1,N-1

    There is no sigma. This is a special form of DCT-II where first coefficient is
    multiplied on 0.5. It's not directly the same as any DCT on the Wikipedia.
    This transform was initially used long time ago and kept for legacy reason.

    Sphinxbase also supports real DCT-II, which you can extract with sphinx_fe
    -transform dct.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.