@woosh/meep-engine 3.79.0 → 3.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -3
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/format/image/webp/vp8/VP8BoolDecoder.d.ts +45 -0
- package/src/format/image/webp/vp8/VP8BoolDecoder.d.ts.map +1 -0
- package/src/format/image/webp/vp8/VP8BoolDecoder.js +137 -0
- package/src/format/image/webp/vp8/vp8_decode.d.ts +21 -0
- package/src/format/image/webp/vp8/vp8_decode.d.ts.map +1 -0
- package/src/format/image/webp/vp8/vp8_decode.js +756 -0
- package/src/format/image/webp/vp8/vp8_loop_filter.d.ts +31 -0
- package/src/format/image/webp/vp8/vp8_loop_filter.d.ts.map +1 -0
- package/src/format/image/webp/vp8/vp8_loop_filter.js +189 -0
- package/src/format/image/webp/vp8/vp8_predict.d.ts +48 -0
- package/src/format/image/webp/vp8/vp8_predict.d.ts.map +1 -0
- package/src/format/image/webp/vp8/vp8_predict.js +290 -0
- package/src/format/image/webp/vp8/vp8_tables.d.ts +34 -0
- package/src/format/image/webp/vp8/vp8_tables.d.ts.map +1 -0
- package/src/format/image/webp/vp8/vp8_tables.js +350 -0
- package/src/format/image/webp/vp8/vp8_transform.d.ts +22 -0
- package/src/format/image/webp/vp8/vp8_transform.d.ts.map +1 -0
- package/src/format/image/webp/vp8/vp8_transform.js +114 -0
- package/src/format/image/webp/vp8/vp8_yuv_to_rgba.d.ts +23 -0
- package/src/format/image/webp/vp8/vp8_yuv_to_rgba.d.ts.map +1 -0
- package/src/format/image/webp/vp8/vp8_yuv_to_rgba.js +133 -0
- package/src/format/image/webp/vp8l/VP8LBitReader.d.ts +47 -0
- package/src/format/image/webp/vp8l/VP8LBitReader.d.ts.map +1 -0
- package/src/format/image/webp/vp8l/VP8LBitReader.js +84 -0
- package/src/format/image/webp/vp8l/VP8LPrefixCode.d.ts +27 -0
- package/src/format/image/webp/vp8l/VP8LPrefixCode.d.ts.map +1 -0
- package/src/format/image/webp/vp8l/VP8LPrefixCode.js +184 -0
- package/src/format/image/webp/vp8l/vp8l_decode.d.ts +28 -0
- package/src/format/image/webp/vp8l/vp8l_decode.d.ts.map +1 -0
- package/src/format/image/webp/vp8l/vp8l_decode.js +261 -0
- package/src/format/image/webp/vp8l/vp8l_distance.d.ts +22 -0
- package/src/format/image/webp/vp8l/vp8l_distance.d.ts.map +1 -0
- package/src/format/image/webp/vp8l/vp8l_distance.js +62 -0
- package/src/format/image/webp/vp8l/vp8l_inverse_transforms.d.ts +50 -0
- package/src/format/image/webp/vp8l/vp8l_inverse_transforms.d.ts.map +1 -0
- package/src/format/image/webp/vp8l/vp8l_inverse_transforms.js +267 -0
- package/src/format/image/webp/vp8l/vp8l_read_prefix_code.d.ts +14 -0
- package/src/format/image/webp/vp8l/vp8l_read_prefix_code.d.ts.map +1 -0
- package/src/format/image/webp/vp8l/vp8l_read_prefix_code.js +99 -0
- package/src/format/image/webp/webp_decode.d.ts +23 -0
- package/src/format/image/webp/webp_decode.d.ts.map +1 -0
- package/src/format/image/webp/webp_decode.js +179 -0
- package/src/format/image/webp/webp_decode_alpha.d.ts +18 -0
- package/src/format/image/webp/webp_decode_alpha.d.ts.map +1 -0
- package/src/format/image/webp/webp_decode_alpha.js +84 -0
- package/src/format/texture/{basis → astc}/astc_block.d.ts +41 -0
- package/src/format/texture/astc/astc_block.d.ts.map +1 -0
- package/src/format/texture/{basis → astc}/astc_block.js +284 -164
- package/src/format/texture/astc/astc_decode_block.d.ts +68 -0
- package/src/format/texture/astc/astc_decode_block.d.ts.map +1 -0
- package/src/format/texture/astc/astc_decode_block.js +1119 -0
- package/src/format/texture/astc/astc_encode_block_4x4.d.ts +32 -0
- package/src/format/texture/astc/astc_encode_block_4x4.d.ts.map +1 -0
- package/src/format/texture/astc/astc_encode_block_4x4.js +181 -0
- package/src/format/texture/astc/astc_encode_block_4x4_rgba.d.ts +32 -0
- package/src/format/texture/astc/astc_encode_block_4x4_rgba.d.ts.map +1 -0
- package/src/format/texture/astc/astc_encode_block_4x4_rgba.js +337 -0
- package/src/format/texture/astc/astc_integer_sequence.d.ts.map +1 -0
- package/src/format/texture/{basis → astc}/astc_integer_sequence.js +251 -251
- package/src/format/texture/astc/astc_partition.d.ts.map +1 -0
- package/src/format/texture/{basis → astc}/astc_partition.js +199 -199
- package/src/format/texture/basis/transcode/etc1s_to_astc.js +329 -329
- package/src/format/texture/basis/transcode/etc1s_to_etc2.d.ts.map +1 -1
- package/src/format/texture/basis/transcode/etc1s_to_etc2.js +305 -332
- package/src/format/texture/basis/transcode/fit_endpoints.d.ts.map +1 -1
- package/src/format/texture/basis/transcode/fit_endpoints.js +14 -27
- package/src/format/texture/basis/uastc/uastc_bc7_tables.d.ts +66 -0
- package/src/format/texture/basis/uastc/uastc_bc7_tables.d.ts.map +1 -0
- package/src/format/texture/basis/uastc/uastc_bc7_tables.js +148 -0
- package/src/format/texture/basis/uastc/uastc_decode_block.js +463 -463
- package/src/format/texture/basis/uastc/uastc_to_astc.js +421 -421
- package/src/format/texture/basis/uastc/uastc_to_bc5.d.ts +1 -6
- package/src/format/texture/basis/uastc/uastc_to_bc5.d.ts.map +1 -1
- package/src/format/texture/basis/uastc/uastc_to_bc5.js +48 -115
- package/src/format/texture/basis/uastc/uastc_to_bc7.d.ts.map +1 -1
- package/src/format/texture/basis/uastc/uastc_to_bc7.js +604 -602
- package/src/format/texture/bc/bc1_decode_block.d.ts +19 -0
- package/src/format/texture/bc/bc1_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc1_decode_block.js +22 -0
- package/src/format/texture/bc/bc1_decode_colors.d.ts +27 -0
- package/src/format/texture/bc/bc1_decode_colors.d.ts.map +1 -0
- package/src/format/texture/bc/bc1_decode_colors.js +100 -0
- package/src/format/texture/bc/bc2_decode_block.d.ts +18 -0
- package/src/format/texture/bc/bc2_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc2_decode_block.js +28 -0
- package/src/format/texture/bc/bc3_decode_block.d.ts +18 -0
- package/src/format/texture/bc/bc3_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc3_decode_block.js +23 -0
- package/src/format/texture/bc/bc4_decode_channel.d.ts +56 -0
- package/src/format/texture/bc/bc4_decode_channel.d.ts.map +1 -0
- package/src/format/texture/bc/bc4_decode_channel.js +138 -0
- package/src/format/texture/bc/bc4_encode_block.d.ts +43 -0
- package/src/format/texture/bc/bc4_encode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc4_encode_block.js +324 -0
- package/src/format/texture/bc/bc4_snorm_decode_block.d.ts +18 -0
- package/src/format/texture/bc/bc4_snorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc4_snorm_decode_block.js +27 -0
- package/src/format/texture/bc/bc4_unorm_decode_block.d.ts +17 -0
- package/src/format/texture/bc/bc4_unorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc4_unorm_decode_block.js +26 -0
- package/src/format/texture/bc/bc5_encode_block.d.ts +25 -0
- package/src/format/texture/bc/bc5_encode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc5_encode_block.js +34 -0
- package/src/format/texture/bc/bc5_snorm_decode_block.d.ts +18 -0
- package/src/format/texture/bc/bc5_snorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc5_snorm_decode_block.js +27 -0
- package/src/format/texture/bc/bc5_unorm_decode_block.d.ts +17 -0
- package/src/format/texture/bc/bc5_unorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc5_unorm_decode_block.js +26 -0
- package/src/format/texture/bc/bc6h_decode_texels.d.ts +30 -0
- package/src/format/texture/bc/bc6h_decode_texels.d.ts.map +1 -0
- package/src/format/texture/bc/bc6h_decode_texels.js +430 -0
- package/src/format/texture/bc/bc6h_sfloat_decode_block.d.ts +20 -0
- package/src/format/texture/bc/bc6h_sfloat_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc6h_sfloat_decode_block.js +23 -0
- package/src/format/texture/bc/bc6h_ufloat_decode_block.d.ts +18 -0
- package/src/format/texture/bc/bc6h_ufloat_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc6h_ufloat_decode_block.js +21 -0
- package/src/format/texture/bc/bc7_decode_block.d.ts +30 -0
- package/src/format/texture/bc/bc7_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc7_decode_block.js +232 -0
- package/src/format/texture/bc/bc7_encode_block.d.ts +39 -0
- package/src/format/texture/bc/bc7_encode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc7_encode_block.js +423 -0
- package/src/format/texture/bc/bc7_tables.d.ts +126 -0
- package/src/format/texture/bc/bc7_tables.d.ts.map +1 -0
- package/src/format/texture/{basis/uastc → bc}/bc7_tables.js +225 -276
- package/src/format/texture/bc/bc7_write_block.d.ts +65 -0
- package/src/format/texture/bc/bc7_write_block.d.ts.map +1 -0
- package/src/format/texture/{basis/uastc → bc}/bc7_write_block.js +185 -227
- package/src/format/texture/etc/eac_decode_channel.d.ts +50 -0
- package/src/format/texture/etc/eac_decode_channel.d.ts.map +1 -0
- package/src/format/texture/etc/eac_decode_channel.js +142 -0
- package/src/format/texture/etc/eac_modifiers.d.ts +15 -0
- package/src/format/texture/etc/eac_modifiers.d.ts.map +1 -0
- package/src/format/texture/etc/eac_modifiers.js +31 -0
- package/src/format/texture/etc/eac_r11_snorm_decode_block.d.ts +21 -0
- package/src/format/texture/etc/eac_r11_snorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/eac_r11_snorm_decode_block.js +30 -0
- package/src/format/texture/etc/eac_r11_unorm_decode_block.d.ts +20 -0
- package/src/format/texture/etc/eac_r11_unorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/eac_r11_unorm_decode_block.js +29 -0
- package/src/format/texture/etc/eac_rg11_snorm_decode_block.d.ts +19 -0
- package/src/format/texture/etc/eac_rg11_snorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/eac_rg11_snorm_decode_block.js +28 -0
- package/src/format/texture/etc/eac_rg11_unorm_decode_block.d.ts +19 -0
- package/src/format/texture/etc/eac_rg11_unorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/eac_rg11_unorm_decode_block.js +28 -0
- package/src/format/texture/etc/etc2_decode_color.d.ts +25 -0
- package/src/format/texture/etc/etc2_decode_color.d.ts.map +1 -0
- package/src/format/texture/etc/etc2_decode_color.js +370 -0
- package/src/format/texture/etc/etc2_rgb8_decode_block.d.ts +18 -0
- package/src/format/texture/etc/etc2_rgb8_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/etc2_rgb8_decode_block.js +21 -0
- package/src/format/texture/etc/etc2_rgb8a1_decode_block.d.ts +21 -0
- package/src/format/texture/etc/etc2_rgb8a1_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/etc2_rgb8a1_decode_block.js +24 -0
- package/src/format/texture/etc/etc2_rgba8_decode_block.d.ts +18 -0
- package/src/format/texture/etc/etc2_rgba8_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/etc2_rgba8_decode_block.js +24 -0
- package/src/format/texture/fit/fit_line.d.ts +23 -0
- package/src/format/texture/fit/fit_line.d.ts.map +1 -0
- package/src/format/texture/fit/fit_line.js +123 -0
- package/src/format/texture/fit/fit_line_refine.d.ts +21 -0
- package/src/format/texture/fit/fit_line_refine.d.ts.map +1 -0
- package/src/format/texture/fit/fit_line_refine.js +69 -0
- package/src/format/texture/fit/fit_line_solve.d.ts +23 -0
- package/src/format/texture/fit/fit_line_solve.d.ts.map +1 -0
- package/src/format/texture/fit/fit_line_solve.js +71 -0
- package/src/format/texture/texel_decode_image.d.ts +44 -0
- package/src/format/texture/texel_decode_image.d.ts.map +1 -0
- package/src/format/texture/texel_decode_image.js +251 -0
- package/src/format/texture/texel_encode_image.d.ts +77 -0
- package/src/format/texture/texel_encode_image.d.ts.map +1 -0
- package/src/format/texture/texel_encode_image.js +187 -0
- package/src/shade/renderer/ShadeIndirectLightingMode.js +2 -0
- package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
- package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
- package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts +1 -0
- package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts.map +1 -1
- package/src/shade/renderer/loader/mtf/mtf_encode_texture.js +102 -28
- package/src/shade/renderer/loader/mtf/mtf_replace_textures.d.ts +19 -0
- package/src/shade/renderer/loader/mtf/mtf_replace_textures.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_replace_textures.js +60 -0
- package/src/shade/renderer/loader/mtf/mtf_write.d.ts.map +1 -1
- package/src/shade/renderer/loader/mtf/mtf_write.js +7 -31
- package/src/shade/renderer/loader/mtf/mtf_write_collection.d.ts +23 -0
- package/src/shade/renderer/loader/mtf/mtf_write_collection.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_write_collection.js +36 -0
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4.d.ts +13 -0
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4.d.ts.map +1 -0
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4.js +39 -0
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts +3 -2
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.js +6 -21
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgba.d.ts +42 -0
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgba.d.ts.map +1 -0
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgba.js +612 -0
- package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts +5 -4
- package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.js +8 -25
- package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.js +3 -19
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts +14 -4
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.js +65 -54
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts +2 -2
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.js +5 -22
- package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.js +1 -1
- package/src/shade/renderer/texture/encode/chunk_scatter_principal_axis.d.ts +27 -0
- package/src/shade/renderer/texture/encode/chunk_scatter_principal_axis.d.ts.map +1 -0
- package/src/shade/renderer/texture/encode/chunk_scatter_principal_axis.js +147 -0
- package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.d.ts +3 -4
- package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.js +6 -13
- package/src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.d.ts +13 -0
- package/src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.d.ts.map +1 -0
- package/src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.js +66 -0
- package/src/shade/renderer/texture/encode/texture_encode.d.ts +28 -1
- package/src/shade/renderer/texture/encode/texture_encode.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/texture_encode.js +202 -168
- package/src/shade/renderer/texture/encode/texture_encode_shader.d.ts +13 -1
- package/src/shade/renderer/texture/encode/texture_encode_shader.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/texture_encode_shader.js +146 -108
- package/src/shade/renderer/texture/format/texture_formats_to_build.d.ts +20 -0
- package/src/shade/renderer/texture/format/texture_formats_to_build.d.ts.map +1 -0
- package/src/shade/renderer/texture/format/texture_formats_to_build.js +98 -0
- package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.d.ts.map +1 -1
- package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.js +4 -23
- package/src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.d.ts +53 -0
- package/src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.js +76 -0
- package/src/shade/renderer/texture/mipmaps/cpu/MipmapKernelAxis.d.ts +40 -0
- package/src/shade/renderer/texture/mipmaps/cpu/MipmapKernelAxis.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/MipmapKernelAxis.js +43 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_centres.d.ts +17 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_centres.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_centres.js +29 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_sample.d.ts +21 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_sample.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_sample.js +91 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_chain_cpu.d.ts +32 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_chain_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_chain_cpu.js +216 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_cubic_filter_cpu.d.ts +30 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_cubic_filter_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_cubic_filter_cpu.js +134 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_catmull_rom_cpu.d.ts +16 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_catmull_rom_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_catmull_rom_cpu.js +33 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.d.ts +18 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.js +71 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.d.ts +20 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.js +57 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.d.ts +18 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.js +111 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.d.ts +16 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.js +33 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.d.ts +18 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.js +128 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.d.ts +21 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.js +169 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.d.ts +21 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.js +119 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.d.ts +16 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.js +19 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.d.ts +24 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.js +41 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.d.ts +24 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.js +140 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.d.ts +21 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.js +35 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.d.ts +19 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.js +27 -0
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_catmull_rom.js +4 -4
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.d.ts +13 -0
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.d.ts.map +1 -1
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.js +54 -4
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mitchell.js +4 -4
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mks.d.ts.map +1 -1
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mks.js +9 -13
- package/src/shade/renderer/texture/texture_block_encodings.d.ts +33 -0
- package/src/shade/renderer/texture/texture_block_encodings.d.ts.map +1 -0
- package/src/shade/renderer/texture/texture_block_encodings.js +89 -0
- package/src/format/texture/basis/astc_block.d.ts.map +0 -1
- package/src/format/texture/basis/astc_integer_sequence.d.ts.map +0 -1
- package/src/format/texture/basis/astc_partition.d.ts.map +0 -1
- package/src/format/texture/basis/uastc/bc7_tables.d.ts +0 -111
- package/src/format/texture/basis/uastc/bc7_tables.d.ts.map +0 -1
- package/src/format/texture/basis/uastc/bc7_write_block.d.ts +0 -124
- package/src/format/texture/basis/uastc/bc7_write_block.d.ts.map +0 -1
- /package/src/format/texture/{basis → astc}/astc_integer_sequence.d.ts +0 -0
- /package/src/format/texture/{basis → astc}/astc_partition.d.ts +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The 120 short distance codes of a lossless WebP bitstream (RFC 9649 §4.2.2): each is a neighbour at
|
|
3
|
+
* `(x, y)` pixels back and up, packed as `y << 4 | (8 - x)`.
|
|
4
|
+
*
|
|
5
|
+
* @type {Uint8Array}
|
|
6
|
+
*/
|
|
7
|
+
const DISTANCE_CODES = new Uint8Array([
|
|
8
|
+
0x18, 0x07, 0x17, 0x19, 0x28, 0x06, 0x27, 0x29, 0x16, 0x1a,
|
|
9
|
+
0x26, 0x2a, 0x38, 0x05, 0x37, 0x39, 0x15, 0x1b, 0x36, 0x3a,
|
|
10
|
+
0x25, 0x2b, 0x48, 0x04, 0x47, 0x49, 0x14, 0x1c, 0x35, 0x3b,
|
|
11
|
+
0x46, 0x4a, 0x24, 0x2c, 0x58, 0x45, 0x4b, 0x34, 0x3c, 0x03,
|
|
12
|
+
0x57, 0x59, 0x13, 0x1d, 0x56, 0x5a, 0x23, 0x2d, 0x44, 0x4c,
|
|
13
|
+
0x55, 0x5b, 0x33, 0x3d, 0x68, 0x02, 0x67, 0x69, 0x12, 0x1e,
|
|
14
|
+
0x66, 0x6a, 0x22, 0x2e, 0x54, 0x5c, 0x43, 0x4d, 0x65, 0x6b,
|
|
15
|
+
0x32, 0x3e, 0x78, 0x01, 0x77, 0x79, 0x53, 0x5d, 0x11, 0x1f,
|
|
16
|
+
0x64, 0x6c, 0x42, 0x4e, 0x76, 0x7a, 0x21, 0x2f, 0x75, 0x7b,
|
|
17
|
+
0x31, 0x3f, 0x63, 0x6d, 0x52, 0x5e, 0x00, 0x74, 0x7c, 0x41,
|
|
18
|
+
0x4f, 0x10, 0x20, 0x62, 0x6e, 0x30, 0x73, 0x7d, 0x51, 0x5f,
|
|
19
|
+
0x40, 0x72, 0x7e, 0x61, 0x6f, 0x50, 0x71, 0x7f, 0x60, 0x70
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A value of a length or distance prefix symbol and the extra bits after it (RFC 9649 §4.2.2): symbols 0 to 3 are
|
|
24
|
+
* 1 to 4, and each later pair of symbols covers twice the span of the pair before.
|
|
25
|
+
*
|
|
26
|
+
* @param {number} symbol
|
|
27
|
+
* @param {import("./VP8LBitReader.js").VP8LBitReader} reader
|
|
28
|
+
* @returns {number} at least 1
|
|
29
|
+
*
|
|
30
|
+
* @author Alex Goldring
|
|
31
|
+
* @copyright Company Named Limited (c) 2026
|
|
32
|
+
*/
|
|
33
|
+
export function vp8l_prefix_value(symbol, reader) {
|
|
34
|
+
if (symbol < 4) {
|
|
35
|
+
return symbol + 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const extra_bits = (symbol - 2) >> 1;
|
|
39
|
+
const offset = (2 + (symbol & 1)) << extra_bits;
|
|
40
|
+
|
|
41
|
+
return offset + reader.read(extra_bits) + 1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* How many pixels back a backward reference copies from: a distance code is one of the 120 neighbours of
|
|
46
|
+
* {@link DISTANCE_CODES} first, and a distance in pixels, less 120, after.
|
|
47
|
+
*
|
|
48
|
+
* @param {number} code from {@link vp8l_prefix_value}, at least 1
|
|
49
|
+
* @param {number} width of the image the reference is in, in pixels
|
|
50
|
+
* @returns {number} at least 1
|
|
51
|
+
*/
|
|
52
|
+
export function vp8l_distance(code, width) {
|
|
53
|
+
if (code > DISTANCE_CODES.length) {
|
|
54
|
+
return code - DISTANCE_CODES.length;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const packed = DISTANCE_CODES[code - 1];
|
|
58
|
+
const distance = (packed >> 4) * width + 8 - (packed & 0xF);
|
|
59
|
+
|
|
60
|
+
// a neighbour off a narrow image's row comes out at less than one pixel back
|
|
61
|
+
return distance >= 1 ? distance : 1;
|
|
62
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-channel sum, each channel modulo 256.
|
|
3
|
+
*
|
|
4
|
+
* @param {number} a ARGB
|
|
5
|
+
* @param {number} b ARGB
|
|
6
|
+
* @returns {number} ARGB, unsigned
|
|
7
|
+
*/
|
|
8
|
+
export function argb_add(a: number, b: number): number;
|
|
9
|
+
/**
|
|
10
|
+
* Undoes the predictor transform in place: each pixel is its residual plus what its block's mode predicts from the
|
|
11
|
+
* pixels already restored. The first pixel is predicted black, the rest of the top row from the left, the rest of the
|
|
12
|
+
* left column from above.
|
|
13
|
+
*
|
|
14
|
+
* @param {Uint32Array} pixels width × height
|
|
15
|
+
* @param {number} width
|
|
16
|
+
* @param {number} height
|
|
17
|
+
* @param {Uint32Array} modes one pixel a block, the mode in bits 8 to 11
|
|
18
|
+
* @param {number} bits log2 of the block size
|
|
19
|
+
*/
|
|
20
|
+
export function vp8l_inverse_predictor(pixels: Uint32Array, width: number, height: number, modes: Uint32Array, bits: number): void;
|
|
21
|
+
/**
|
|
22
|
+
* Undoes the colour transform in place: red gains a multiple of green, and blue a multiple of green and of the
|
|
23
|
+
* restored red, each multiplier a signed 3.5 fixed-point number of the pixel's block.
|
|
24
|
+
*
|
|
25
|
+
* @param {Uint32Array} pixels
|
|
26
|
+
* @param {number} width
|
|
27
|
+
* @param {number} height
|
|
28
|
+
* @param {Uint32Array} elements one pixel a block: green-to-red in bits 0 to 7, green-to-blue 8 to 15, red-to-blue 16 to 23
|
|
29
|
+
* @param {number} bits log2 of the block size
|
|
30
|
+
*/
|
|
31
|
+
export function vp8l_inverse_color(pixels: Uint32Array, width: number, height: number, elements: Uint32Array, bits: number): void;
|
|
32
|
+
/**
|
|
33
|
+
* Undoes the subtract-green transform in place: green is added back to red and to blue.
|
|
34
|
+
*
|
|
35
|
+
* @param {Uint32Array} pixels
|
|
36
|
+
*/
|
|
37
|
+
export function vp8l_inverse_subtract_green(pixels: Uint32Array): void;
|
|
38
|
+
/**
|
|
39
|
+
* Undoes the colour indexing transform: each pixel's index, in green, packed several to a pixel when the table is
|
|
40
|
+
* small, becomes its colour in the table. An index past the table is transparent black.
|
|
41
|
+
*
|
|
42
|
+
* @param {Uint32Array} packed packed_width × height
|
|
43
|
+
* @param {number} width of the picture unpacked
|
|
44
|
+
* @param {number} height
|
|
45
|
+
* @param {Uint32Array} table the colours, already undelta'd
|
|
46
|
+
* @param {number} width_bits log2 of how many indices a pixel packs
|
|
47
|
+
* @returns {Uint32Array} width × height
|
|
48
|
+
*/
|
|
49
|
+
export function vp8l_inverse_color_indexing(packed: Uint32Array, width: number, height: number, table: Uint32Array, width_bits: number): Uint32Array;
|
|
50
|
+
//# sourceMappingURL=vp8l_inverse_transforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vp8l_inverse_transforms.d.ts","sourceRoot":"","sources":["../../../../../../src/format/image/webp/vp8l/vp8l_inverse_transforms.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,4BAJW,MAAM,KACN,MAAM,GACJ,MAAM,CAOlB;AA8HD;;;;;;;;;;GAUG;AACH,+CANW,WAAW,SACX,MAAM,UACN,MAAM,SACN,WAAW,QACX,MAAM,QAyBhB;AAUD;;;;;;;;;GASG;AACH,2CANW,WAAW,SACX,MAAM,UACN,MAAM,YACN,WAAW,QACX,MAAM,QAyBhB;AAED;;;;GAIG;AACH,oDAFW,WAAW,QAWrB;AAED;;;;;;;;;;GAUG;AACH,oDAPW,WAAW,SACX,MAAM,UACN,MAAM,SACN,WAAW,cACX,MAAM,GACJ,WAAW,CAoBvB"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The inverses of the four transforms of a lossless WebP bitstream (RFC 9649 §4), over pixels as 32-bit ARGB words.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Per-channel sum, each channel modulo 256.
|
|
7
|
+
*
|
|
8
|
+
* @param {number} a ARGB
|
|
9
|
+
* @param {number} b ARGB
|
|
10
|
+
* @returns {number} ARGB, unsigned
|
|
11
|
+
*/
|
|
12
|
+
export function argb_add(a, b) {
|
|
13
|
+
const alpha_green = ((a & 0xFF00FF00) + (b & 0xFF00FF00)) & 0xFF00FF00;
|
|
14
|
+
const red_blue = ((a & 0x00FF00FF) + (b & 0x00FF00FF)) & 0x00FF00FF;
|
|
15
|
+
|
|
16
|
+
return (alpha_green | red_blue) >>> 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Per-channel mean, rounded down.
|
|
21
|
+
*
|
|
22
|
+
* @param {number} a
|
|
23
|
+
* @param {number} b
|
|
24
|
+
* @returns {number}
|
|
25
|
+
*/
|
|
26
|
+
function average2(a, b) {
|
|
27
|
+
return ((((a ^ b) & 0xFEFEFEFE) >>> 1) + (a & b)) >>> 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @param {number} v
|
|
32
|
+
* @returns {number} v clamped to a byte
|
|
33
|
+
*/
|
|
34
|
+
function clamp255(v) {
|
|
35
|
+
return v < 0 ? 0 : v > 255 ? 255 : v;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Left or top, whichever the gradient `left + top - top_left` is nearer to, summed over the channels; top on a tie.
|
|
40
|
+
*
|
|
41
|
+
* @param {number} left
|
|
42
|
+
* @param {number} top
|
|
43
|
+
* @param {number} top_left
|
|
44
|
+
* @returns {number}
|
|
45
|
+
*/
|
|
46
|
+
function select(left, top, top_left) {
|
|
47
|
+
let to_left = 0;
|
|
48
|
+
let to_top = 0;
|
|
49
|
+
|
|
50
|
+
for (let shift = 0; shift < 32; shift += 8) {
|
|
51
|
+
const l = (left >>> shift) & 0xFF;
|
|
52
|
+
const t = (top >>> shift) & 0xFF;
|
|
53
|
+
const tl = (top_left >>> shift) & 0xFF;
|
|
54
|
+
|
|
55
|
+
to_left += Math.abs(t - tl);
|
|
56
|
+
to_top += Math.abs(l - tl);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return to_left < to_top ? left : top;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Per channel, `a + b - c` clamped to a byte.
|
|
64
|
+
*
|
|
65
|
+
* @param {number} a
|
|
66
|
+
* @param {number} b
|
|
67
|
+
* @param {number} c
|
|
68
|
+
* @returns {number}
|
|
69
|
+
*/
|
|
70
|
+
function clamp_add_subtract_full(a, b, c) {
|
|
71
|
+
let out = 0;
|
|
72
|
+
|
|
73
|
+
for (let shift = 0; shift < 32; shift += 8) {
|
|
74
|
+
out |= clamp255(((a >>> shift) & 0xFF) + ((b >>> shift) & 0xFF) - ((c >>> shift) & 0xFF)) << shift;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return out >>> 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Per channel, `a + (a - b) / 2` with the division truncated toward zero, clamped to a byte.
|
|
82
|
+
*
|
|
83
|
+
* @param {number} a
|
|
84
|
+
* @param {number} b
|
|
85
|
+
* @returns {number}
|
|
86
|
+
*/
|
|
87
|
+
function clamp_add_subtract_half(a, b) {
|
|
88
|
+
let out = 0;
|
|
89
|
+
|
|
90
|
+
for (let shift = 0; shift < 32; shift += 8) {
|
|
91
|
+
const ca = (a >>> shift) & 0xFF;
|
|
92
|
+
const cb = (b >>> shift) & 0xFF;
|
|
93
|
+
|
|
94
|
+
out |= clamp255(ca + Math.trunc((ca - cb) / 2)) << shift;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return out >>> 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* What predictor mode `mode` predicts a pixel to be from its decoded neighbours.
|
|
102
|
+
*
|
|
103
|
+
* @param {number} mode 0 to 15: 0, and 14 and 15 which the format leaves unused, predict opaque black
|
|
104
|
+
* @param {number} left
|
|
105
|
+
* @param {number} top
|
|
106
|
+
* @param {number} top_right
|
|
107
|
+
* @param {number} top_left
|
|
108
|
+
* @returns {number}
|
|
109
|
+
*/
|
|
110
|
+
function predict(mode, left, top, top_right, top_left) {
|
|
111
|
+
switch (mode) {
|
|
112
|
+
case 1:
|
|
113
|
+
return left;
|
|
114
|
+
case 2:
|
|
115
|
+
return top;
|
|
116
|
+
case 3:
|
|
117
|
+
return top_right;
|
|
118
|
+
case 4:
|
|
119
|
+
return top_left;
|
|
120
|
+
case 5:
|
|
121
|
+
return average2(average2(left, top_right), top);
|
|
122
|
+
case 6:
|
|
123
|
+
return average2(left, top_left);
|
|
124
|
+
case 7:
|
|
125
|
+
return average2(left, top);
|
|
126
|
+
case 8:
|
|
127
|
+
return average2(top_left, top);
|
|
128
|
+
case 9:
|
|
129
|
+
return average2(top, top_right);
|
|
130
|
+
case 10:
|
|
131
|
+
return average2(average2(left, top_left), average2(top, top_right));
|
|
132
|
+
case 11:
|
|
133
|
+
return select(left, top, top_left);
|
|
134
|
+
case 12:
|
|
135
|
+
return clamp_add_subtract_full(left, top, top_left);
|
|
136
|
+
case 13:
|
|
137
|
+
return clamp_add_subtract_half(average2(left, top), top_left);
|
|
138
|
+
default:
|
|
139
|
+
return 0xFF000000;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Undoes the predictor transform in place: each pixel is its residual plus what its block's mode predicts from the
|
|
145
|
+
* pixels already restored. The first pixel is predicted black, the rest of the top row from the left, the rest of the
|
|
146
|
+
* left column from above.
|
|
147
|
+
*
|
|
148
|
+
* @param {Uint32Array} pixels width × height
|
|
149
|
+
* @param {number} width
|
|
150
|
+
* @param {number} height
|
|
151
|
+
* @param {Uint32Array} modes one pixel a block, the mode in bits 8 to 11
|
|
152
|
+
* @param {number} bits log2 of the block size
|
|
153
|
+
*/
|
|
154
|
+
export function vp8l_inverse_predictor(pixels, width, height, modes, bits) {
|
|
155
|
+
const blocks_wide = (width + (1 << bits) - 1) >> bits;
|
|
156
|
+
|
|
157
|
+
pixels[0] = argb_add(pixels[0], 0xFF000000);
|
|
158
|
+
|
|
159
|
+
for (let x = 1; x < width; x++) {
|
|
160
|
+
pixels[x] = argb_add(pixels[x], pixels[x - 1]);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
for (let y = 1; y < height; y++) {
|
|
164
|
+
const row = y * width;
|
|
165
|
+
const mode_row = (y >> bits) * blocks_wide;
|
|
166
|
+
|
|
167
|
+
pixels[row] = argb_add(pixels[row], pixels[row - width]);
|
|
168
|
+
|
|
169
|
+
for (let x = 1; x < width; x++) {
|
|
170
|
+
const i = row + x;
|
|
171
|
+
const mode = (modes[mode_row + (x >> bits)] >>> 8) & 0xF;
|
|
172
|
+
|
|
173
|
+
// the pixel above and to the right of the row's last is the row's first, which is already restored
|
|
174
|
+
pixels[i] = argb_add(pixels[i], predict(mode, pixels[i - 1], pixels[i - width], pixels[i - width + 1], pixels[i - width - 1]));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* @param {number} byte
|
|
181
|
+
* @returns {number} the byte as a signed 8-bit value
|
|
182
|
+
*/
|
|
183
|
+
function int8(byte) {
|
|
184
|
+
return (byte << 24) >> 24;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Undoes the colour transform in place: red gains a multiple of green, and blue a multiple of green and of the
|
|
189
|
+
* restored red, each multiplier a signed 3.5 fixed-point number of the pixel's block.
|
|
190
|
+
*
|
|
191
|
+
* @param {Uint32Array} pixels
|
|
192
|
+
* @param {number} width
|
|
193
|
+
* @param {number} height
|
|
194
|
+
* @param {Uint32Array} elements one pixel a block: green-to-red in bits 0 to 7, green-to-blue 8 to 15, red-to-blue 16 to 23
|
|
195
|
+
* @param {number} bits log2 of the block size
|
|
196
|
+
*/
|
|
197
|
+
export function vp8l_inverse_color(pixels, width, height, elements, bits) {
|
|
198
|
+
const blocks_wide = (width + (1 << bits) - 1) >> bits;
|
|
199
|
+
|
|
200
|
+
for (let y = 0; y < height; y++) {
|
|
201
|
+
const element_row = (y >> bits) * blocks_wide;
|
|
202
|
+
|
|
203
|
+
for (let x = 0; x < width; x++) {
|
|
204
|
+
const i = y * width + x;
|
|
205
|
+
const element = elements[element_row + (x >> bits)];
|
|
206
|
+
|
|
207
|
+
const green_to_red = int8(element & 0xFF);
|
|
208
|
+
const green_to_blue = int8((element >>> 8) & 0xFF);
|
|
209
|
+
const red_to_blue = int8((element >>> 16) & 0xFF);
|
|
210
|
+
|
|
211
|
+
const argb = pixels[i];
|
|
212
|
+
const green = int8((argb >>> 8) & 0xFF);
|
|
213
|
+
|
|
214
|
+
const red = (((argb >>> 16) & 0xFF) + ((green_to_red * green) >> 5)) & 0xFF;
|
|
215
|
+
const blue = ((argb & 0xFF) + ((green_to_blue * green) >> 5) + ((red_to_blue * int8(red)) >> 5)) & 0xFF;
|
|
216
|
+
|
|
217
|
+
pixels[i] = ((argb & 0xFF00FF00) | (red << 16) | blue) >>> 0;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Undoes the subtract-green transform in place: green is added back to red and to blue.
|
|
224
|
+
*
|
|
225
|
+
* @param {Uint32Array} pixels
|
|
226
|
+
*/
|
|
227
|
+
export function vp8l_inverse_subtract_green(pixels) {
|
|
228
|
+
for (let i = 0; i < pixels.length; i++) {
|
|
229
|
+
const argb = pixels[i];
|
|
230
|
+
const green = (argb >>> 8) & 0xFF;
|
|
231
|
+
|
|
232
|
+
const red_blue = ((argb & 0x00FF00FF) + ((green << 16) | green)) & 0x00FF00FF;
|
|
233
|
+
|
|
234
|
+
pixels[i] = ((argb & 0xFF00FF00) | red_blue) >>> 0;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Undoes the colour indexing transform: each pixel's index, in green, packed several to a pixel when the table is
|
|
240
|
+
* small, becomes its colour in the table. An index past the table is transparent black.
|
|
241
|
+
*
|
|
242
|
+
* @param {Uint32Array} packed packed_width × height
|
|
243
|
+
* @param {number} width of the picture unpacked
|
|
244
|
+
* @param {number} height
|
|
245
|
+
* @param {Uint32Array} table the colours, already undelta'd
|
|
246
|
+
* @param {number} width_bits log2 of how many indices a pixel packs
|
|
247
|
+
* @returns {Uint32Array} width × height
|
|
248
|
+
*/
|
|
249
|
+
export function vp8l_inverse_color_indexing(packed, width, height, table, width_bits) {
|
|
250
|
+
const out = new Uint32Array(width * height);
|
|
251
|
+
|
|
252
|
+
const packed_width = (width + (1 << width_bits) - 1) >> width_bits;
|
|
253
|
+
const bits_per_index = 8 >> width_bits;
|
|
254
|
+
const index_mask = (1 << bits_per_index) - 1;
|
|
255
|
+
const slot_mask = (1 << width_bits) - 1;
|
|
256
|
+
|
|
257
|
+
for (let y = 0; y < height; y++) {
|
|
258
|
+
for (let x = 0; x < width; x++) {
|
|
259
|
+
const green = (packed[y * packed_width + (x >> width_bits)] >>> 8) & 0xFF;
|
|
260
|
+
const index = (green >> (bits_per_index * (x & slot_mask))) & index_mask;
|
|
261
|
+
|
|
262
|
+
out[y * width + x] = index < table.length ? table[index] : 0;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return out;
|
|
267
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One prefix code as a lossless WebP bitstream writes it (RFC 9649 §3.7.2.1): a simple code of one or two symbols, or
|
|
3
|
+
* code lengths written with a code of their own.
|
|
4
|
+
*
|
|
5
|
+
* @param {import("./VP8LBitReader.js").VP8LBitReader} reader
|
|
6
|
+
* @param {number} alphabet_size how many symbols the code is over
|
|
7
|
+
* @returns {VP8LPrefixCode}
|
|
8
|
+
*
|
|
9
|
+
* @author Alex Goldring
|
|
10
|
+
* @copyright Company Named Limited (c) 2026
|
|
11
|
+
*/
|
|
12
|
+
export function vp8l_read_prefix_code(reader: import("./VP8LBitReader.js").VP8LBitReader, alphabet_size: number): VP8LPrefixCode;
|
|
13
|
+
import { VP8LPrefixCode } from "./VP8LPrefixCode.js";
|
|
14
|
+
//# sourceMappingURL=vp8l_read_prefix_code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vp8l_read_prefix_code.d.ts","sourceRoot":"","sources":["../../../../../../src/format/image/webp/vp8l/vp8l_read_prefix_code.js"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AACH,8CAPW,OAAO,oBAAoB,EAAE,aAAa,iBAC1C,MAAM,GACJ,cAAc,CAmF1B;+BAlG8B,qBAAqB"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { VP8LPrefixCode } from "./VP8LPrefixCode.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The order the code lengths of the code-length code are written in (RFC 9649 §3.7.2.1.2).
|
|
5
|
+
*
|
|
6
|
+
* @type {number[]}
|
|
7
|
+
*/
|
|
8
|
+
const CODE_LENGTH_ORDER = [17, 18, 0, 1, 2, 3, 4, 5, 16, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* One prefix code as a lossless WebP bitstream writes it (RFC 9649 §3.7.2.1): a simple code of one or two symbols, or
|
|
12
|
+
* code lengths written with a code of their own.
|
|
13
|
+
*
|
|
14
|
+
* @param {import("./VP8LBitReader.js").VP8LBitReader} reader
|
|
15
|
+
* @param {number} alphabet_size how many symbols the code is over
|
|
16
|
+
* @returns {VP8LPrefixCode}
|
|
17
|
+
*
|
|
18
|
+
* @author Alex Goldring
|
|
19
|
+
* @copyright Company Named Limited (c) 2026
|
|
20
|
+
*/
|
|
21
|
+
export function vp8l_read_prefix_code(reader, alphabet_size) {
|
|
22
|
+
const lengths = new Uint8Array(alphabet_size);
|
|
23
|
+
|
|
24
|
+
if (reader.read(1) === 1) {
|
|
25
|
+
// simple: one or two symbols, each of length 1
|
|
26
|
+
const count = reader.read(1) + 1;
|
|
27
|
+
const first_bits = reader.read(1) === 1 ? 8 : 1;
|
|
28
|
+
|
|
29
|
+
lengths[reader.read(first_bits)] = 1;
|
|
30
|
+
|
|
31
|
+
if (count === 2) {
|
|
32
|
+
lengths[reader.read(8)] = 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return new VP8LPrefixCode(lengths);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const length_lengths = new Uint8Array(CODE_LENGTH_ORDER.length);
|
|
39
|
+
const listed = reader.read(4) + 4;
|
|
40
|
+
|
|
41
|
+
for (let i = 0; i < listed; i++) {
|
|
42
|
+
length_lengths[CODE_LENGTH_ORDER[i]] = reader.read(3);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const length_code = new VP8LPrefixCode(length_lengths);
|
|
46
|
+
|
|
47
|
+
// how many code lengths are written, when fewer than the alphabet
|
|
48
|
+
let remaining = alphabet_size;
|
|
49
|
+
|
|
50
|
+
if (reader.read(1) === 1) {
|
|
51
|
+
const bits = 2 + 2 * reader.read(3);
|
|
52
|
+
|
|
53
|
+
remaining = 2 + reader.read(bits);
|
|
54
|
+
|
|
55
|
+
if (remaining > alphabet_size) {
|
|
56
|
+
throw new Error("WebP: a prefix code writes more lengths than its alphabet has symbols");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let previous = 8;
|
|
61
|
+
let symbol = 0;
|
|
62
|
+
|
|
63
|
+
while (symbol < alphabet_size && remaining-- > 0) {
|
|
64
|
+
const code = length_code.read(reader);
|
|
65
|
+
|
|
66
|
+
if (code < 16) {
|
|
67
|
+
lengths[symbol++] = code;
|
|
68
|
+
|
|
69
|
+
if (code !== 0) {
|
|
70
|
+
previous = code;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let repeat;
|
|
77
|
+
let value;
|
|
78
|
+
|
|
79
|
+
if (code === 16) {
|
|
80
|
+
repeat = 3 + reader.read(2);
|
|
81
|
+
value = previous;
|
|
82
|
+
} else if (code === 17) {
|
|
83
|
+
repeat = 3 + reader.read(3);
|
|
84
|
+
value = 0;
|
|
85
|
+
} else {
|
|
86
|
+
repeat = 11 + reader.read(7);
|
|
87
|
+
value = 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (symbol + repeat > alphabet_size) {
|
|
91
|
+
throw new Error("WebP: a run of code lengths runs past the alphabet");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
lengths.fill(value, symbol, symbol + repeat);
|
|
95
|
+
symbol += repeat;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return new VP8LPrefixCode(lengths);
|
|
99
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A still WebP image's pixels: lossy (`VP8 `), lossless (`VP8L`), and either inside the extended format (`VP8X`), a
|
|
3
|
+
* lossy one with its alpha (`ALPH`).
|
|
4
|
+
*
|
|
5
|
+
* What it decodes to is what libwebp decodes to, sample for sample: a lossy picture's colour is libwebp's conversion
|
|
6
|
+
* from YUV, chroma upsampled by interpolating between the samples around each pixel, as browsers show it. An ICC
|
|
7
|
+
* profile, Exif and XMP are left unread.
|
|
8
|
+
*
|
|
9
|
+
* @param {Uint8Array} bytes the file, whole
|
|
10
|
+
* @returns {{width: number, height: number, has_alpha: boolean, data: Uint8Array}} `data` is RGBA, eight bits a channel,
|
|
11
|
+
* not premultiplied; `has_alpha` is whether the file says the picture has alpha, which is opaque wherever it has none
|
|
12
|
+
* @throws {Error} for bytes that are not a WebP file, a file cut short or damaged, and an animation
|
|
13
|
+
*
|
|
14
|
+
* @author Alex Goldring
|
|
15
|
+
* @copyright Company Named Limited (c) 2026
|
|
16
|
+
*/
|
|
17
|
+
export function webp_decode(bytes: Uint8Array): {
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
has_alpha: boolean;
|
|
21
|
+
data: Uint8Array;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=webp_decode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webp_decode.d.ts","sourceRoot":"","sources":["../../../../../src/format/image/webp/webp_decode.js"],"names":[],"mappings":"AAqGA;;;;;;;;;;;;;;;GAeG;AACH,mCARW,UAAU,GACR;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAC,CAoEjF"}
|