Skip to content

Changelog

  • Fix warnings raised by Oxc lint (#58) (90d7f34)

    This includes adding missing awaits that were highlighted by Oxc lint, which could indicate actual bugs.

  • Use both BIK version and revision to determine whether to swap UV planes (ff6db2f)
  • Unpack constants when the decoder is first used, not at import time (ff6db2f)
  • Improve performance via extensive use of generators and other optimizations (ff6db2f)
  • Many internal changes to reduce minified/bundled size (#53) (ff6db2f)
  • Rename the audio track flag useDCT to usesDCT in the API (#51) (6b2a4de)
  • Optimize processing of image blocks in the critical path (6b2a4de)
  • Reduce state in the bit-stream reader and Huffman table implementations to improve performance and reduce memory usage (6b2a4de)
  • Refactor various code sections to reduce minified bundle size (6b2a4de)
  • Remove the API that required a “stream provider” function (8a4a44e)
  • Rename fileSize in the API interface BikHeader to totalSize (8a4a44e)
  • Add the function createBikDecoder() to the API which creates a decoder using a Blob/File/Request/URL as a video source (#47) (8a4a44e)

    This change makes the API much more straightforward to setup and use. The decoder uses the Fetch/Blob API to generate streams as required, rather than requiring a function to be provided that implements this functionality.

  • Remove CommonJS build and rely on the “require(esm)” feature of modern runtimes/bundlers (#45) (b71ee11)

    BREAKING CHANGE: CommonJS users instead need a modern bundler or runtime (like all Node.js versions supported by unbikit) that supports the use of require() with the ESM build.

  • Small fix for badges in the README that won’t display (#42) (92d522a)
  • Optimize IDCT and IRDFT implementations of the video and audio decoders (#39) (82cccdc)

    The video decoder uses a 2D DCT-III (inverse of DCT-II, sometimes just called IDCT) implementation, and the audio decoder uses either a 1D Inverse Real Discrete Fourier Transform (IRDFT) or a 1D Inverse Discrete Cosine Transform (IDCT). More sine and cosine lookup tables have been added to the audio decoder, and various code optimizations have been made to the 2D IDCT of the video decoder.

    FPS improvements of up to 20% have been observed with complex videos that make heavy use of the IDCT/IRDFT algorithms.

  • Optimize block copy operations in videos (#35) (5b531b7)

    This change gives a major increase to decoding speed for most videos. FPS (frames per second) improvements of between 20% and 1,200% can be seen in the benchmarks (“hz” represents the median FPS):

    Terminal window
    > unbikit@0.6.0 bench
    > vitest bench --run
    RUN v4.0.10
    tests/main.bench.ts > benchmark 72906ms
    name hz min max mean p75 p99 p995 p999 rme samples
    · decode of a frame of testfile01 755.62 0.0723 10.1624 1.5887 1.7413 3.4561 3.7919 4.8968 ±0.64% 10000
    · decode of a frame of testfile02 25,939.23 0.0252 4.4826 0.3243 0.0380 2.2814 2.8931 3.8021 ±4.02% 10000
    · decode of a frame of testfile03 48,525.00 0.0104 3.5536 0.1862 0.3992 0.7494 1.6234 2.3394 ±2.69% 10000
    · decode of a frame of testfile04 2,185.17 0.0303 6.8059 1.5158 2.1640 4.4432 5.2130 6.0582 ±1.31% 10000
    · decode of a frame of testfile05 3,699.67 0.0450 7.6835 0.8676 1.4391 2.4982 3.2387 5.8404 ±1.70% 10000
    · decode of a frame of testfile06 4,129.25 0.0291 4.2722 0.9196 1.3440 3.0265 3.1956 3.4895 ±1.48% 10000
    · decode of a frame of testfile07 2,488.67 0.0118 7.5235 1.7021 2.1133 4.0822 4.3607 6.4656 ±0.94% 10000
    > unbikit@0.5.0 bench
    > vitest bench --run
    RUN v4.0.10
    tests/main.bench.ts > benchmark 85055ms
    name hz min max mean p75 p99 p995 p999 rme samples
    · decode of a frame of testfile01 624.68 0.3201 161.58 1.7983 1.9422 3.5596 4.0219 4.9948 ±1.83% 10000
    · decode of a frame of testfile02 4,741.15 0.1519 9.0390 0.4753 0.2243 2.4211 3.9970 7.0758 ±3.05% 10000
    · decode of a frame of testfile03 3,818.20 0.1803 6.9488 0.3642 0.5529 0.8825 2.4169 3.7548 ±1.69% 10000
    · decode of a frame of testfile04 711.86 0.4686 45.0704 1.8906 2.4002 4.5546 5.2643 6.7018 ±1.53% 10000
    · decode of a frame of testfile05 709.65 0.7739 14.8372 1.6529 2.1308 3.1394 4.3492 12.5871 ±1.07% 10000
    · decode of a frame of testfile06 916.90 0.5484 11.1577 1.3421 1.6770 3.1628 3.4305 10.7946 ±1.14% 10000
    · decode of a frame of testfile07 1,504.80 0.1389 26.1466 0.7944 0.8737 1.4899 2.6282 3.3601 ±1.62% 10000
  • Remove redundant operations from decoder reset() method (5b531b7)

    BREAKING CHANGE: API change for reset() method.

  • Change method names and some other small changes (5b531b7)
  • Add support for decoding interlaced videos (#33) (5aa71a1)
  • Add video flags for scaling and grayscale to the decoder’s header data (5aa71a1)
  • Reduce lengths of error messages (5aa71a1)
  • Replace internal runtime checks with type checks where possible (5aa71a1)
  • Limit number of audio channels to a reasonable value (8) to guard against corrupted files (5aa71a1)
  • Add demo with an example video player and documentation (e747e37), closes #26
  • Add support for CSS view transitions (e747e37)
  • Optimize build settings to reduce the minified size of the decoder (e747e37)
  • Handle unsupported BIK versions and indicate status via the isSupported property (818ae04)
  • Add skipFrames() method for skipping multiple decoded frames (6d564dd)

Regression testing has also been improved significantly.

  • Add initial implementation of the .bik video decoder (124c3b9)

    Consists of a stream reader, header parser, demuxer, and audio/video decoders. Version 1 of the .bik video format is supported, except for revision b. DCT and DFT compressed audio are both supported. Each outputted frame combines a single video frame with a chunk of decoded audio.