Multidimensional Modified Discrete Cosine Transforms
Project description
MDCTN :yarn:
Multidimensional Modified Discrete Cosine Transforms
pip install mdctn
- 1-D MDCT & IMDCT
- n-D MDCT & IMDCT
- Windowing support
- Helper functions for signals
1-D MDCT on signals
Signals are wrapped around so all the data is stored in the same number of bits.
import numpy as np
from mdctn import mdct, imdct
x = np.arange(24)
y = mdct(x, N=16)
z = imdct(y, N=16)
np.allclose(x, z) # True
1-D Pure MDCT
The core MDCT function
import numpy as np
from mdctn import core
x = np.arange(6) # [0, 1, 2, 3, 4, 5]
y_1 = core.mdct(x[0:4]) # [-2.50104055, -0.49476881]
y_2 = core.mdct(x[2:6]) # [-4.34879961, -1.26013568]
z_1 = core.imdct(y_1) # [-0.5, 0.5, 2.5, 2.5]
z_2 = core.imdct(y_2) # [-0.5, 0.5, 4.5, 4.5]
z = (z_1[2:4] + z_2[0:2]) # [2.0, 3.0]
Benchmarks
See benchmarks.ipynb
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mdctn-0.3.0.tar.gz
(3.3 kB
view details)
Built Distribution
mdctn-0.3.0-py3-none-any.whl
(6.3 kB
view details)
File details
Details for the file mdctn-0.3.0.tar.gz
.
File metadata
- Download URL: mdctn-0.3.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.6 Linux/6.0.6-76060006-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac19d46093b1769252b31f186396098b2ee80c86e0967e086cbeabcbf0d74c8b |
|
MD5 | 5fc7fd9ab7f1d7465427e76bee1d571a |
|
BLAKE2b-256 | a9abc454d02d129ad0baaf29a6ceb463698c2ce5b9b16eac00f34ffb339d34d0 |
Provenance
File details
Details for the file mdctn-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: mdctn-0.3.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.6 Linux/6.0.6-76060006-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 403887eb2a9d9f691902e53d0aeba6436f935203397b4173f8079c46381c83db |
|
MD5 | 7828f547afb54a95d24fa4b91f7024c1 |
|
BLAKE2b-256 | 11f3df6d7fcd99c2f4f27a11cf760539bfc3ea57c21b3b2bd25043184b119880 |