{"_id":"@4bitlabs/dct","_rev":"4-730e2a4641397db7556eb74461d27a25","name":"@4bitlabs/dct","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"@4bitlabs/dct","version":"1.0.0","keywords":["dct","idct"],"author":{"name":"J. Holmes","email":"j@holmes.codes"},"license":"ISC","_id":"@4bitlabs/dct@1.0.0","maintainers":[{"name":"32bitkid","email":"32bitkid@gmail.com"}],"homepage":"https://github.com/32bitkid/sci.js/tree/main/libs/dct#readme","bugs":{"url":"https://github.com/32bitkid/sci.js/issues"},"dist":{"shasum":"95cc926b60ff5f12aeabfbb469b815389fd87faa","tarball":"https://registry.npmjs.org/@4bitlabs/dct/-/dct-1.0.0.tgz","fileCount":28,"integrity":"sha512-Ry4iKwkLEKv/Zh63Zuel7rdx8R5JaKhMHISmvYAfF/7c1knxH3PReem5yI2NV5/+Ml/OinDMTbfOMaIE2EOJog==","signatures":[{"sig":"MEUCIQDFSEDjWVTwahZwvwPiPIyOdGjYLjWXc8j/cZfh5BEhJAIgTAgqQT+Jo0nuJ2MGL0WfvkT57p6LnW7qYCTXTWh6Jrk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":60522},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":"./dist/index.js","./dct-n":"./dist/dct-n.js","./fast-dct-8":"./dist/fast-dct-8.js"},"gitHead":"439d2e247bc2448e43604cf3b38b3f2fe00a7b11","scripts":{"lint":"eslint .","test":"jest src/","build":"tsc --build","clean":"tsc --build --clean","version":"conventional-changelog -p eslint -i CHANGELOG.md -s && git add CHANGELOG.md","clean:wipe":"rimraf ./dist","format:fix":"prettier -w ."},"_npmUser":{"name":"32bitkid","email":"32bitkid@gmail.com"},"repository":{"url":"git+https://github.com/32bitkid/sci.js.git","type":"git"},"_npmVersion":"10.5.0","description":"Discrete cosine transform algorithms in js and ts","directories":{},"_nodeVersion":"18.18.2","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","eslint":"^8.57.0","ts-jest":"^29.1.2","prettier":"^3.2.5","typescript":"^5.4.3","@types/jest":"^29.5.12","eslint-plugin-import":"^2.29.1","eslint-config-prettier":"^9.1.0","@typescript-eslint/parser":"^7.5.0","eslint-plugin-deprecation":"^2.0.0","conventional-changelog-cli":"^4.1.0","conventional-changelog-eslint":"^5.0.0","@typescript-eslint/eslint-plugin":"^7.5.0"},"_npmOperationalInternal":{"tmp":"tmp/dct_1.0.0_1712097147983_0.8172594635975847","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@4bitlabs/dct","version":"1.0.1","keywords":["dct","idct"],"author":{"name":"J. Holmes","email":"j@holmes.codes"},"license":"ISC","_id":"@4bitlabs/dct@1.0.1","maintainers":[{"name":"32bitkid","email":"32bitkid@gmail.com"}],"homepage":"https://github.com/32bitkid/4bitlabs.dct#readme","bugs":{"url":"https://github.com/32bitkid/4bitlabs.dct/issues"},"dist":{"shasum":"757e05d8181eed269e3f8a511919d86fe4ed8c41","tarball":"https://registry.npmjs.org/@4bitlabs/dct/-/dct-1.0.1.tgz","fileCount":27,"integrity":"sha512-qxDWDsEgGaSkavh5QPGDmIm1sDhS5spW4Xtw2n88I03j2nbO815Dnf0pjhLv7dhB7jw4p+bP+fn1/TUORSJ2sQ==","signatures":[{"sig":"MEUCIQD6W/SgFKg3l9vNTuHR+uNn/+7FpHZlavd4LZRZ/fpd7wIgYUbto4clojkRF0KFVg+mPwNLxc8pIDxaPHyQKJfTDOI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":23105},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":"./dist/index.js","./dct-n":"./dist/dct-n.js","./fast-dct-8":"./dist/fast-dct-8.js"},"gitHead":"a72a7a1ec8d042ed71c7da777446f8e24a182655","scripts":{"lint":"eslint .","test":"jest src/","build":"tsc --build","clean":"tsc --build --clean","version":"conventional-changelog -p eslint -i CHANGELOG.md -s && git add CHANGELOG.md","clean:wipe":"rimraf ./dist","format:fix":"prettier -w ."},"_npmUser":{"name":"32bitkid","email":"32bitkid@gmail.com"},"repository":{"url":"git+https://github.com/32bitkid/4bitlabs.dct.git","type":"git"},"_npmVersion":"10.5.0","description":"Discrete cosine transform algorithms in js and ts","directories":{},"_nodeVersion":"18.18.2","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","eslint":"^8.57.0","ts-jest":"^29.1.2","prettier":"^3.2.5","typescript":"^5.4.3","@types/jest":"^29.5.12","eslint-plugin-import":"^2.29.1","eslint-config-prettier":"^9.1.0","@typescript-eslint/parser":"^7.5.0","eslint-plugin-deprecation":"^2.0.0","conventional-changelog-cli":"^4.1.0","conventional-changelog-eslint":"^5.0.0","@typescript-eslint/eslint-plugin":"^7.5.0"},"_npmOperationalInternal":{"tmp":"tmp/dct_1.0.1_1712097653199_0.40266006721550496","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@4bitlabs/dct","version":"1.0.2","keywords":["dct","idct"],"author":{"name":"J. Holmes","email":"j@holmes.codes"},"license":"ISC","_id":"@4bitlabs/dct@1.0.2","maintainers":[{"name":"32bitkid","email":"32bitkid@gmail.com"}],"homepage":"https://github.com/32bitkid/4bitlabs.dct#readme","bugs":{"url":"https://github.com/32bitkid/4bitlabs.dct/issues"},"dist":{"shasum":"e382e82cccf7b285604adb7d167f1e989e57ac07","tarball":"https://registry.npmjs.org/@4bitlabs/dct/-/dct-1.0.2.tgz","fileCount":27,"integrity":"sha512-ZZ2MgTdOe9xq2OiNU83lHqgIMerDFHjLKcgFKrqQQh+irfmIJxT8CraiuS+16evDd1GblqrlP8WRCNg5TJnkbA==","signatures":[{"sig":"MEYCIQC9VkTLp/noWyRRnjrYXGlql3fhXmgFuHEFznUGUbpqUQIhAKlxi1R2t3W+xYvuV1aL39W64jO28CxLyfdCJX35baBZ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":23031},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":"./dist/index.js","./dct-n":"./dist/dct-n.js","./fast-dct-8":"./dist/fast-dct-8.js"},"gitHead":"02b10a975b4a384f9ad5dd7f908afaf06721c57f","scripts":{"lint":"eslint .","test":"jest src/","build":"tsc --build","clean":"tsc --build --clean","prepack":"npm run build","version":"conventional-changelog -p eslint -i CHANGELOG.md -s && git add CHANGELOG.md","clean:wipe":"rimraf ./dist","format:fix":"prettier -w ."},"_npmUser":{"name":"32bitkid","email":"32bitkid@gmail.com"},"repository":{"url":"git+https://github.com/32bitkid/4bitlabs.dct.git","type":"git"},"_npmVersion":"10.8.2","description":"Discrete cosine transform algorithms in js and ts","directories":{},"_nodeVersion":"20.15.1","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","eslint":"^8.57.0","ts-jest":"^29.2.3","prettier":"^3.3.3","typescript":"^5.5.3","@types/jest":"^29.5.12","eslint-plugin-import":"^2.29.1","eslint-config-prettier":"^9.1.0","@typescript-eslint/parser":"^7.16.1","eslint-plugin-deprecation":"^3.0.0","conventional-changelog-cli":"^5.0.0","conventional-changelog-eslint":"^6.0.0","@typescript-eslint/eslint-plugin":"^7.16.1"},"_npmOperationalInternal":{"tmp":"tmp/dct_1.0.2_1721576737024_0.4492485092229228","host":"s3://npm-registry-packages"}},"2.0.0":{"name":"@4bitlabs/dct","version":"2.0.0","description":"Discrete cosine transform algorithms in js and ts","keywords":["dct","idct"],"homepage":"https://github.com/32bitkid/4bitlabs.dct#readme","bugs":{"url":"https://github.com/32bitkid/4bitlabs.dct/issues"},"repository":{"type":"git","url":"git+https://github.com/32bitkid/4bitlabs.dct.git"},"license":"ISC","author":{"name":"J. Holmes","email":"j@holmes.codes"},"type":"module","exports":{".":"./dist/index.js","./fast-dct-8":"./dist/fast-dct-8.js","./dct-n":"./dist/dct-n.js"},"types":"./dist/index.d.ts","scripts":{"build":"tsdown","clean:wipe":"rimraf ./dist","format:fix":"biome check --write","lint":"biome check","prepack":"npm run build","test":"vitest run","test:dev":"vitest dev","version":"conventional-changelog -p conventionalcommits -i CHANGELOG.md -s && git add CHANGELOG.md"},"overrides":{"tsdown":{"yuku-codegen":"0.6.5","yuku-parser":"0.6.5"}},"devDependencies":{"@biomejs/biome":"^2.5.4","@vitest/coverage-v8":"^4.1.10","conventional-changelog-cli":"^5.0.0","conventional-changelog-conventionalcommits":"^9.3.1","tsdown":"^0.22.9","typescript":"^6.0.3","vitest":"^4.1.10"},"allowScripts":{"fsevents@2.3.3":true},"gitHead":"a57c5b7256fb908f926e0f207b93eea17a552de9","_id":"@4bitlabs/dct@2.0.0","_nodeVersion":"22.18.0","_npmVersion":"11.18.0","dist":{"integrity":"sha512-ULxeptFnnLVUse24eJqHeJgq/1TQbtdoUMo/n7l9wxuKuseU4PiXZyzOQFOdvwfNg00P4FVakrKb0nO6pCRzdg==","shasum":"f367109d9bf8ad5b08acc978db760d96cbbc7e19","tarball":"https://registry.npmjs.org/@4bitlabs/dct/-/dct-2.0.0.tgz","fileCount":21,"unpackedSize":19769,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC7Bywk5GTQmhmhHuApan7C7Izo9w6yAXcQbDfjMDYMBgIhAJgr+mBcRDgYRr579Ils9hN1NC3iCofenPGRohS3dlvk"}]},"_npmUser":{"name":"32bitkid","email":"32bitkid@gmail.com"},"directories":{},"maintainers":[{"name":"32bitkid","email":"32bitkid@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dct_2.0.0_1784398974573_0.7358397073421028"},"_hasShrinkwrap":false}},"time":{"created":"2024-04-02T22:32:27.883Z","modified":"2026-07-18T18:22:54.858Z","1.0.0":"2024-04-02T22:32:28.149Z","1.0.1":"2024-04-02T22:40:53.420Z","1.0.2":"2024-07-21T15:45:37.180Z","2.0.0":"2026-07-18T18:22:54.709Z"},"bugs":{"url":"https://github.com/32bitkid/4bitlabs.dct/issues"},"author":{"name":"J. Holmes","email":"j@holmes.codes"},"license":"ISC","homepage":"https://github.com/32bitkid/4bitlabs.dct#readme","keywords":["dct","idct"],"repository":{"type":"git","url":"git+https://github.com/32bitkid/4bitlabs.dct.git"},"description":"Discrete cosine transform algorithms in js and ts","maintainers":[{"name":"32bitkid","email":"32bitkid@gmail.com"}],"readme":"# `@4bitlabs/dct`\n\nJavaScript/TypeScript ESM implementations of the [<abbr title=\"discrete cosine transform\">DCT</abbr>][wikipedia], with support for [`TypedArrays`][TypedArray].\n\n## Installation\n\nFor node, install with npm:\n\n```\nnpm i @4bitlabs/dct\n```\n\nIn browsers, import it from an ESM CDN:\n\n```html\n<script type=\"module\">\n  import { watercolorize } from 'https://unpkg.com/@4bitlabs/dct/dist/index.js'\n</script>\n```\n\n## DCT-II and DCT-III\n\n```ts\nimport { dct, idct } from '@4bitlabs/dct';\n\nconst signal = Uint8ClampedArray.of(/* data */);\n\n// Calculate DCT-II from signal\nconst coefficients = new Float64Array(signal.length);\ndct(signal, coefficients);\n\n// Reconstruct signal from coefficients with DCT-III\nconst reconstruction = new Uint8ClampedArray(coefficients.length);\nidct(coefficients, reconstruction);\n```\n\n## Fixed-length DCTs\n\nThe `dct()` and `idct()` will produce an output of the same `length` as the signal `length`. This can be convenient, however\nthe implementations make no optimizations for the number of elements in the vector provided. If the\nnumber of elements is known in advance, then you can use `createDctOfN(n)`. For example, to create a 16-element DCT:\n\n```ts\nimport { createDctOfN } from '@4bitlabs';\n\nconst dct16 = createDctOfN(16);\n\n// DCT-II\nconst coefficients = new Float64Array(16);\ndct16.transform(data, coefficients);\n\n// DCT-III\nconst reconstruction = new Uint8ClampedArray(16);\ndct16.inverse(coefficients, reconstruction);\n```\n\n## Fast 8-element DCT\n\nAn faster, optimized version of an 8-element DCT is available and implements the same interface:\n\n```ts\nimport { dct, idct } from '@4bitlabs/dct/fast-dtc-8';\n\nconst signal = Uint8ClampedArray.of(0, 0, 0, 0, 0, 0, 0, 0);\n\n// DCT-II\nconst coefficients = new Float64Array(8);\ndct(signal, coefficients);\n\n// DCT-III\nconst reconstruction = new Uint8ClampedArray(8);\nidct(coefficients, reconstruction);\n```\n\n[wikipedia]: https://en.wikipedia.org/wiki/Discrete_cosine_transform\n[TypedArray]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray\n","readmeFilename":"README.md"}