Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • bob.ap bob.ap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • bobbob
  • bob.apbob.ap
  • Issues
  • #1
Closed
Open
Issue created Jan 12, 2016 by André Anjos@andre.anjos💬Owner

Questionable implementation of DCT kernel in Ceps.cpp

Created by: pkorshunov

@laurentes and @khoury: Could you please check this issue?

DCT kernel is implemented in Ceps.cpp (see line 103):

m_dct_kernel = dct_coeff * blitz::cos(M_PI*(i+1)*(j+0.5)/(double)(m_n_filters));

I'm not sure if using '(i+1)' index instead of 'i' in the DCT formula is correct. I suspect it is a bug. According to Wikipedia (https://en.wikipedia.org/wiki/Discrete_cosine_transform) and Matlab (http://ch.mathworks.com/help/signal/ref/dct.html), DCT-II, which seems to be the targeted implementation here, should have 'i' instead of 'i+1' as an index.

Also, for the normalization (see Ceps.cpp, line 103): double dct_coeff = m_dct_norm ? (double)sqrt(2./(double)(m_n_filters)) : 1.;

It seems the normalization is not correct either, since if we choose to use it, we should multiply zeros coefficient by 1/sqrt(2). Here is a clear formula and implementation: https://unix4lyfe.org/dct-1d/

Assignee
Assign to
Time tracking