@woosh/meep-engine 3.9.0 → 3.11.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/README.md +168 -152
- package/build/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/package.json +3 -2
- package/src/REVIEW_2026_08_06.md +610 -610
- package/src/avif/encode_image_source.d.ts +70 -0
- package/src/avif/encode_image_source.d.ts.map +1 -0
- package/src/avif/encode_image_source.js +117 -0
- package/src/avif/encoder_worker.js +15 -126
- package/src/avif/index.d.ts +4 -2
- package/src/avif/index.js +21 -2
- package/src/avif/native/DECISIONS.md +537 -0
- package/src/avif/native/NOTICE.md +61 -0
- package/src/avif/native/api/AvifDecoder.d.ts +67 -0
- package/src/avif/native/api/AvifDecoder.d.ts.map +1 -0
- package/src/avif/native/api/AvifDecoder.js +121 -0
- package/src/avif/native/api/apply_transformations.d.ts +30 -0
- package/src/avif/native/api/apply_transformations.d.ts.map +1 -0
- package/src/avif/native/api/apply_transformations.js +120 -0
- package/src/avif/native/api/avif_to_sampler2d.d.ts +25 -0
- package/src/avif/native/api/avif_to_sampler2d.d.ts.map +1 -0
- package/src/avif/native/api/avif_to_sampler2d.js +42 -0
- package/src/avif/native/api/convert_to_rgba.d.ts +54 -0
- package/src/avif/native/api/convert_to_rgba.d.ts.map +1 -0
- package/src/avif/native/api/convert_to_rgba.js +204 -0
- package/src/avif/native/api/decode_avif.d.ts +24 -0
- package/src/avif/native/api/decode_avif.d.ts.map +1 -0
- package/src/avif/native/api/decode_avif.js +111 -0
- package/src/avif/native/api/decode_image_item.d.ts +18 -0
- package/src/avif/native/api/decode_image_item.d.ts.map +1 -0
- package/src/avif/native/api/decode_image_item.js +234 -0
- package/src/avif/native/api/encode_avif.d.ts +73 -0
- package/src/avif/native/api/encode_avif.d.ts.map +1 -0
- package/src/avif/native/api/encode_avif.js +488 -0
- package/src/avif/native/api/sampler2d_to_avif.d.ts +22 -0
- package/src/avif/native/api/sampler2d_to_avif.d.ts.map +1 -0
- package/src/avif/native/api/sampler2d_to_avif.js +108 -0
- package/src/avif/native/av1/decode/Av1FrameContext.d.ts +286 -0
- package/src/avif/native/av1/decode/Av1FrameContext.d.ts.map +1 -0
- package/src/avif/native/av1/decode/Av1FrameContext.js +622 -0
- package/src/avif/native/av1/decode/block_decoded.d.ts +27 -0
- package/src/avif/native/av1/decode/block_decoded.d.ts.map +1 -0
- package/src/avif/native/av1/decode/block_decoded.js +59 -0
- package/src/avif/native/av1/decode/decode_av1_still.d.ts +22 -0
- package/src/avif/native/av1/decode/decode_av1_still.d.ts.map +1 -0
- package/src/avif/native/av1/decode/decode_av1_still.js +309 -0
- package/src/avif/native/av1/decode/decode_coefficients.d.ts +20 -0
- package/src/avif/native/av1/decode/decode_coefficients.d.ts.map +1 -0
- package/src/avif/native/av1/decode/decode_coefficients.js +259 -0
- package/src/avif/native/av1/decode/decode_palette.d.ts +28 -0
- package/src/avif/native/av1/decode/decode_palette.d.ts.map +1 -0
- package/src/avif/native/av1/decode/decode_palette.js +442 -0
- package/src/avif/native/av1/decode/decode_tile.d.ts +14 -0
- package/src/avif/native/av1/decode/decode_tile.d.ts.map +1 -0
- package/src/avif/native/av1/decode/decode_tile.js +1213 -0
- package/src/avif/native/av1/decode/get_scan.d.ts +16 -0
- package/src/avif/native/av1/decode/get_scan.d.ts.map +1 -0
- package/src/avif/native/av1/decode/get_scan.js +138 -0
- package/src/avif/native/av1/decode/read_lr.d.ts +35 -0
- package/src/avif/native/av1/decode/read_lr.d.ts.map +1 -0
- package/src/avif/native/av1/decode/read_lr.js +277 -0
- package/src/avif/native/av1/decode/read_transform_type.d.ts +19 -0
- package/src/avif/native/av1/decode/read_transform_type.d.ts.map +1 -0
- package/src/avif/native/av1/decode/read_transform_type.js +92 -0
- package/src/avif/native/av1/decode/reconstruct.d.ts +36 -0
- package/src/avif/native/av1/decode/reconstruct.d.ts.map +1 -0
- package/src/avif/native/av1/decode/reconstruct.js +241 -0
- package/src/avif/native/av1/decode/transform_type.d.ts +49 -0
- package/src/avif/native/av1/decode/transform_type.d.ts.map +1 -0
- package/src/avif/native/av1/decode/transform_type.js +137 -0
- package/src/avif/native/av1/encode/Av1BlockSnapshot.d.ts +81 -0
- package/src/avif/native/av1/encode/Av1BlockSnapshot.d.ts.map +1 -0
- package/src/avif/native/av1/encode/Av1BlockSnapshot.js +299 -0
- package/src/avif/native/av1/encode/Av1EncodeContext.d.ts +384 -0
- package/src/avif/native/av1/encode/Av1EncodeContext.d.ts.map +1 -0
- package/src/avif/native/av1/encode/Av1EncodeContext.js +590 -0
- package/src/avif/native/av1/encode/build_headers.d.ts +50 -0
- package/src/avif/native/av1/encode/build_headers.d.ts.map +1 -0
- package/src/avif/native/av1/encode/build_headers.js +359 -0
- package/src/avif/native/av1/encode/choose_chroma_alpha.d.ts +26 -0
- package/src/avif/native/av1/encode/choose_chroma_alpha.d.ts.map +1 -0
- package/src/avif/native/av1/encode/choose_chroma_alpha.js +90 -0
- package/src/avif/native/av1/encode/choose_filters.d.ts +21 -0
- package/src/avif/native/av1/encode/choose_filters.d.ts.map +1 -0
- package/src/avif/native/av1/encode/choose_filters.js +318 -0
- package/src/avif/native/av1/encode/choose_restoration.d.ts +35 -0
- package/src/avif/native/av1/encode/choose_restoration.d.ts.map +1 -0
- package/src/avif/native/av1/encode/choose_restoration.js +616 -0
- package/src/avif/native/av1/encode/decode_effort.d.ts +57 -0
- package/src/avif/native/av1/encode/decode_effort.d.ts.map +1 -0
- package/src/avif/native/av1/encode/decode_effort.js +59 -0
- package/src/avif/native/av1/encode/encode_av1_still.d.ts +17 -0
- package/src/avif/native/av1/encode/encode_av1_still.d.ts.map +1 -0
- package/src/avif/native/av1/encode/encode_av1_still.js +194 -0
- package/src/avif/native/av1/encode/encode_effort.d.ts +56 -0
- package/src/avif/native/av1/encode/encode_effort.d.ts.map +1 -0
- package/src/avif/native/av1/encode/encode_effort.js +97 -0
- package/src/avif/native/av1/encode/encode_tile.d.ts +26 -0
- package/src/avif/native/av1/encode/encode_tile.d.ts.map +1 -0
- package/src/avif/native/av1/encode/encode_tile.js +2331 -0
- package/src/avif/native/av1/encode/quantise.d.ts +51 -0
- package/src/avif/native/av1/encode/quantise.d.ts.map +1 -0
- package/src/avif/native/av1/encode/quantise.js +212 -0
- package/src/avif/native/av1/encode/write_coefficients.d.ts +42 -0
- package/src/avif/native/av1/encode/write_coefficients.d.ts.map +1 -0
- package/src/avif/native/av1/encode/write_coefficients.js +367 -0
- package/src/avif/native/av1/encode/write_lr.d.ts +33 -0
- package/src/avif/native/av1/encode/write_lr.d.ts.map +1 -0
- package/src/avif/native/av1/encode/write_lr.js +174 -0
- package/src/avif/native/av1/encode/write_transform_type.d.ts +21 -0
- package/src/avif/native/av1/encode/write_transform_type.d.ts.map +1 -0
- package/src/avif/native/av1/encode/write_transform_type.js +70 -0
- package/src/avif/native/av1/entropy/CdfContext.d.ts +167 -0
- package/src/avif/native/av1/entropy/CdfContext.d.ts.map +1 -0
- package/src/avif/native/av1/entropy/CdfContext.js +433 -0
- package/src/avif/native/av1/entropy/SymbolReader.d.ts +103 -0
- package/src/avif/native/av1/entropy/SymbolReader.d.ts.map +1 -0
- package/src/avif/native/av1/entropy/SymbolReader.js +317 -0
- package/src/avif/native/av1/entropy/SymbolWriter.d.ts +107 -0
- package/src/avif/native/av1/entropy/SymbolWriter.d.ts.map +1 -0
- package/src/avif/native/av1/entropy/SymbolWriter.js +352 -0
- package/src/avif/native/av1/entropy/coefficient_context.d.ts +71 -0
- package/src/avif/native/av1/entropy/coefficient_context.d.ts.map +1 -0
- package/src/avif/native/av1/entropy/coefficient_context.js +325 -0
- package/src/avif/native/av1/entropy/partition_cdf.d.ts +54 -0
- package/src/avif/native/av1/entropy/partition_cdf.d.ts.map +1 -0
- package/src/avif/native/av1/entropy/partition_cdf.js +98 -0
- package/src/avif/native/av1/entropy/symbol_cost.d.ts +37 -0
- package/src/avif/native/av1/entropy/symbol_cost.d.ts.map +1 -0
- package/src/avif/native/av1/entropy/symbol_cost.js +76 -0
- package/src/avif/native/av1/filter/cdef.d.ts +15 -0
- package/src/avif/native/av1/filter/cdef.d.ts.map +1 -0
- package/src/avif/native/av1/filter/cdef.js +313 -0
- package/src/avif/native/av1/filter/loop_filter.d.ts +14 -0
- package/src/avif/native/av1/filter/loop_filter.d.ts.map +1 -0
- package/src/avif/native/av1/filter/loop_filter.js +377 -0
- package/src/avif/native/av1/filter/loop_restoration.d.ts +42 -0
- package/src/avif/native/av1/filter/loop_restoration.d.ts.map +1 -0
- package/src/avif/native/av1/filter/loop_restoration.js +451 -0
- package/src/avif/native/av1/filter/superres.d.ts +18 -0
- package/src/avif/native/av1/filter/superres.d.ts.map +1 -0
- package/src/avif/native/av1/filter/superres.js +86 -0
- package/src/avif/native/av1/grain/FilmGrainState.d.ts +62 -0
- package/src/avif/native/av1/grain/FilmGrainState.d.ts.map +1 -0
- package/src/avif/native/av1/grain/FilmGrainState.js +87 -0
- package/src/avif/native/av1/grain/film_grain.d.ts +16 -0
- package/src/avif/native/av1/grain/film_grain.d.ts.map +1 -0
- package/src/avif/native/av1/grain/film_grain.js +623 -0
- package/src/avif/native/av1/obu/FrameHeader.d.ts +248 -0
- package/src/avif/native/av1/obu/FrameHeader.d.ts.map +1 -0
- package/src/avif/native/av1/obu/FrameHeader.js +381 -0
- package/src/avif/native/av1/obu/ObuHeader.d.ts +53 -0
- package/src/avif/native/av1/obu/ObuHeader.d.ts.map +1 -0
- package/src/avif/native/av1/obu/ObuHeader.js +62 -0
- package/src/avif/native/av1/obu/SequenceHeader.d.ts +157 -0
- package/src/avif/native/av1/obu/SequenceHeader.d.ts.map +1 -0
- package/src/avif/native/av1/obu/SequenceHeader.js +225 -0
- package/src/avif/native/av1/obu/for_each_obu.d.ts +24 -0
- package/src/avif/native/av1/obu/for_each_obu.d.ts.map +1 -0
- package/src/avif/native/av1/obu/for_each_obu.js +50 -0
- package/src/avif/native/av1/obu/parse_frame_header.d.ts +18 -0
- package/src/avif/native/av1/obu/parse_frame_header.d.ts.map +1 -0
- package/src/avif/native/av1/obu/parse_frame_header.js +841 -0
- package/src/avif/native/av1/obu/parse_obu_header.d.ts +23 -0
- package/src/avif/native/av1/obu/parse_obu_header.d.ts.map +1 -0
- package/src/avif/native/av1/obu/parse_obu_header.js +69 -0
- package/src/avif/native/av1/obu/parse_sequence_header.d.ts +17 -0
- package/src/avif/native/av1/obu/parse_sequence_header.d.ts.map +1 -0
- package/src/avif/native/av1/obu/parse_sequence_header.js +263 -0
- package/src/avif/native/av1/obu/write_frame_header.d.ts +16 -0
- package/src/avif/native/av1/obu/write_frame_header.d.ts.map +1 -0
- package/src/avif/native/av1/obu/write_frame_header.js +579 -0
- package/src/avif/native/av1/obu/write_sequence_header.d.ts +17 -0
- package/src/avif/native/av1/obu/write_sequence_header.d.ts.map +1 -0
- package/src/avif/native/av1/obu/write_sequence_header.js +189 -0
- package/src/avif/native/av1/predict/IntraPredictionState.d.ts +49 -0
- package/src/avif/native/av1/predict/IntraPredictionState.d.ts.map +1 -0
- package/src/avif/native/av1/predict/IntraPredictionState.js +58 -0
- package/src/avif/native/av1/predict/intra_filter_type.d.ts +17 -0
- package/src/avif/native/av1/predict/intra_filter_type.d.ts.map +1 -0
- package/src/avif/native/av1/predict/intra_filter_type.js +79 -0
- package/src/avif/native/av1/predict/predict_chroma_from_luma.d.ts +50 -0
- package/src/avif/native/av1/predict/predict_chroma_from_luma.d.ts.map +1 -0
- package/src/avif/native/av1/predict/predict_chroma_from_luma.js +153 -0
- package/src/avif/native/av1/predict/predict_intra.d.ts +42 -0
- package/src/avif/native/av1/predict/predict_intra.d.ts.map +1 -0
- package/src/avif/native/av1/predict/predict_intra.js +803 -0
- package/src/avif/native/av1/predict/predict_palette.d.ts +23 -0
- package/src/avif/native/av1/predict/predict_palette.d.ts.map +1 -0
- package/src/avif/native/av1/predict/predict_palette.js +36 -0
- package/src/avif/native/av1/tables/av1_symbols.d.ts +411 -0
- package/src/avif/native/av1/tables/av1_symbols.d.ts.map +1 -0
- package/src/avif/native/av1/tables/av1_symbols.js +419 -0
- package/src/avif/native/av1/tables/block_tables.d.ts +181 -0
- package/src/avif/native/av1/tables/block_tables.d.ts.map +1 -0
- package/src/avif/native/av1/tables/block_tables.js +270 -0
- package/src/avif/native/av1/tables/cdf_tables.d.ts +961 -0
- package/src/avif/native/av1/tables/cdf_tables.d.ts.map +1 -0
- package/src/avif/native/av1/tables/cdf_tables.js +1893 -0
- package/src/avif/native/av1/tables/coefficient_tables.d.ts +41 -0
- package/src/avif/native/av1/tables/coefficient_tables.d.ts.map +1 -0
- package/src/avif/native/av1/tables/coefficient_tables.js +82 -0
- package/src/avif/native/av1/tables/derived_block_tables.d.ts +15 -0
- package/src/avif/native/av1/tables/derived_block_tables.d.ts.map +1 -0
- package/src/avif/native/av1/tables/derived_block_tables.js +23 -0
- package/src/avif/native/av1/tables/filter_tables.d.ts +171 -0
- package/src/avif/native/av1/tables/filter_tables.d.ts.map +1 -0
- package/src/avif/native/av1/tables/filter_tables.js +313 -0
- package/src/avif/native/av1/tables/grain_tables.d.ts +11 -0
- package/src/avif/native/av1/tables/grain_tables.d.ts.map +1 -0
- package/src/avif/native/av1/tables/grain_tables.js +190 -0
- package/src/avif/native/av1/tables/prediction_tables.d.ts +141 -0
- package/src/avif/native/av1/tables/prediction_tables.d.ts.map +1 -0
- package/src/avif/native/av1/tables/prediction_tables.js +223 -0
- package/src/avif/native/av1/tables/quantizer_matrix_tables.d.ts +21 -0
- package/src/avif/native/av1/tables/quantizer_matrix_tables.d.ts.map +1 -0
- package/src/avif/native/av1/tables/quantizer_matrix_tables.js +38 -0
- package/src/avif/native/av1/tables/quantizer_tables.d.ts +21 -0
- package/src/avif/native/av1/tables/quantizer_tables.d.ts.map +1 -0
- package/src/avif/native/av1/tables/quantizer_tables.js +160 -0
- package/src/avif/native/av1/tables/scan_tables.d.ts +321 -0
- package/src/avif/native/av1/tables/scan_tables.d.ts.map +1 -0
- package/src/avif/native/av1/tables/scan_tables.js +727 -0
- package/src/avif/native/av1/tables/segmentation_tables.d.ts +31 -0
- package/src/avif/native/av1/tables/segmentation_tables.d.ts.map +1 -0
- package/src/avif/native/av1/tables/segmentation_tables.js +48 -0
- package/src/avif/native/av1/tables/transform_tables.d.ts +91 -0
- package/src/avif/native/av1/tables/transform_tables.d.ts.map +1 -0
- package/src/avif/native/av1/tables/transform_tables.js +140 -0
- package/src/avif/native/av1/tables/unpack_table.d.ts +33 -0
- package/src/avif/native/av1/tables/unpack_table.d.ts.map +1 -0
- package/src/avif/native/av1/tables/unpack_table.js +73 -0
- package/src/avif/native/av1/transform/forward_transform_2d.d.ts +61 -0
- package/src/avif/native/av1/transform/forward_transform_2d.d.ts.map +1 -0
- package/src/avif/native/av1/transform/forward_transform_2d.js +574 -0
- package/src/avif/native/av1/transform/inverse_transform_1d.d.ts +76 -0
- package/src/avif/native/av1/transform/inverse_transform_1d.d.ts.map +1 -0
- package/src/avif/native/av1/transform/inverse_transform_1d.js +590 -0
- package/src/avif/native/av1/transform/inverse_transform_2d.d.ts +46 -0
- package/src/avif/native/av1/transform/inverse_transform_2d.d.ts.map +1 -0
- package/src/avif/native/av1/transform/inverse_transform_2d.js +180 -0
- package/src/avif/native/av1/util/ceil_log2.d.ts +13 -0
- package/src/avif/native/av1/util/ceil_log2.d.ts.map +1 -0
- package/src/avif/native/av1/util/ceil_log2.js +18 -0
- package/src/avif/native/av1/util/floor_log2.d.ts +20 -0
- package/src/avif/native/av1/util/floor_log2.d.ts.map +1 -0
- package/src/avif/native/av1/util/floor_log2.js +20 -0
- package/src/avif/native/av1/util/round2.d.ts +22 -0
- package/src/avif/native/av1/util/round2.d.ts.map +1 -0
- package/src/avif/native/av1/util/round2.js +27 -0
- package/src/avif/native/av1/util/round2_signed.d.ts +14 -0
- package/src/avif/native/av1/util/round2_signed.d.ts.map +1 -0
- package/src/avif/native/av1/util/round2_signed.js +17 -0
- package/src/avif/native/av1/util/tile_log2.d.ts +16 -0
- package/src/avif/native/av1/util/tile_log2.d.ts.map +1 -0
- package/src/avif/native/av1/util/tile_log2.js +23 -0
- package/src/avif/native/bitstream/BitReader.d.ts +174 -0
- package/src/avif/native/bitstream/BitReader.d.ts.map +1 -0
- package/src/avif/native/bitstream/BitReader.js +391 -0
- package/src/avif/native/bitstream/BitWriter.d.ts +122 -0
- package/src/avif/native/bitstream/BitWriter.d.ts.map +1 -0
- package/src/avif/native/bitstream/BitWriter.js +351 -0
- package/src/avif/native/color/ColourTransform.d.ts +62 -0
- package/src/avif/native/color/ColourTransform.d.ts.map +1 -0
- package/src/avif/native/color/ColourTransform.js +189 -0
- package/src/avif/native/color/YuvImage.d.ts +51 -0
- package/src/avif/native/color/YuvImage.d.ts.map +1 -0
- package/src/avif/native/color/YuvImage.js +66 -0
- package/src/avif/native/color/clamp_sample.d.ts +18 -0
- package/src/avif/native/color/clamp_sample.d.ts.map +1 -0
- package/src/avif/native/color/clamp_sample.js +25 -0
- package/src/avif/native/color/linear_to_transfer.d.ts +24 -0
- package/src/avif/native/color/linear_to_transfer.d.ts.map +1 -0
- package/src/avif/native/color/linear_to_transfer.js +126 -0
- package/src/avif/native/color/primaries.d.ts +20 -0
- package/src/avif/native/color/primaries.d.ts.map +1 -0
- package/src/avif/native/color/primaries.js +94 -0
- package/src/avif/native/color/rgb_row_to_ycbcr.d.ts +20 -0
- package/src/avif/native/color/rgb_row_to_ycbcr.d.ts.map +1 -0
- package/src/avif/native/color/rgb_row_to_ycbcr.js +78 -0
- package/src/avif/native/color/transfer_to_linear.d.ts +49 -0
- package/src/avif/native/color/transfer_to_linear.d.ts.map +1 -0
- package/src/avif/native/color/transfer_to_linear.js +171 -0
- package/src/avif/native/color/upsample_chroma_row.d.ts +35 -0
- package/src/avif/native/color/upsample_chroma_row.d.ts.map +1 -0
- package/src/avif/native/color/upsample_chroma_row.js +89 -0
- package/src/avif/native/color/ycbcr_row_to_rgb.d.ts +23 -0
- package/src/avif/native/color/ycbcr_row_to_rgb.d.ts.map +1 -0
- package/src/avif/native/color/ycbcr_row_to_rgb.js +78 -0
- package/src/avif/native/heif/AvifFile.d.ts +112 -0
- package/src/avif/native/heif/AvifFile.d.ts.map +1 -0
- package/src/avif/native/heif/AvifFile.js +142 -0
- package/src/avif/native/heif/ItemProperty.d.ts +244 -0
- package/src/avif/native/heif/ItemProperty.d.ts.map +1 -0
- package/src/avif/native/heif/ItemProperty.js +321 -0
- package/src/avif/native/heif/find_item_property.d.ts +17 -0
- package/src/avif/native/heif/find_item_property.d.ts.map +1 -0
- package/src/avif/native/heif/find_item_property.js +28 -0
- package/src/avif/native/heif/find_item_references.d.ts +16 -0
- package/src/avif/native/heif/find_item_references.d.ts.map +1 -0
- package/src/avif/native/heif/find_item_references.js +29 -0
- package/src/avif/native/heif/find_items_referencing.d.ts +17 -0
- package/src/avif/native/heif/find_items_referencing.d.ts.map +1 -0
- package/src/avif/native/heif/find_items_referencing.js +36 -0
- package/src/avif/native/heif/parse_avif_file.d.ts +15 -0
- package/src/avif/native/heif/parse_avif_file.d.ts.map +1 -0
- package/src/avif/native/heif/parse_avif_file.js +383 -0
- package/src/avif/native/heif/parse_image_grid.d.ts +18 -0
- package/src/avif/native/heif/parse_image_grid.d.ts.map +1 -0
- package/src/avif/native/heif/parse_image_grid.js +48 -0
- package/src/avif/native/heif/parse_item_property.d.ts +18 -0
- package/src/avif/native/heif/parse_item_property.d.ts.map +1 -0
- package/src/avif/native/heif/parse_item_property.js +243 -0
- package/src/avif/native/heif/read_item_data.d.ts +22 -0
- package/src/avif/native/heif/read_item_data.d.ts.map +1 -0
- package/src/avif/native/heif/read_item_data.js +97 -0
- package/src/avif/native/heif/write_avif_file.d.ts +50 -0
- package/src/avif/native/heif/write_avif_file.d.ts.map +1 -0
- package/src/avif/native/heif/write_avif_file.js +348 -0
- package/src/avif/native/heif/write_item_property.d.ts +16 -0
- package/src/avif/native/heif/write_item_property.d.ts.map +1 -0
- package/src/avif/native/heif/write_item_property.js +182 -0
- package/src/avif/native/index.d.ts +14 -0
- package/src/avif/native/index.d.ts.map +1 -0
- package/src/avif/native/index.js +56 -0
- package/src/avif/native/isobmff/BoxHeader.d.ts +50 -0
- package/src/avif/native/isobmff/BoxHeader.d.ts.map +1 -0
- package/src/avif/native/isobmff/BoxHeader.js +57 -0
- package/src/avif/native/isobmff/BoxWriter.d.ts +118 -0
- package/src/avif/native/isobmff/BoxWriter.d.ts.map +1 -0
- package/src/avif/native/isobmff/BoxWriter.js +264 -0
- package/src/avif/native/isobmff/ByteCursor.d.ts +125 -0
- package/src/avif/native/isobmff/ByteCursor.d.ts.map +1 -0
- package/src/avif/native/isobmff/ByteCursor.js +298 -0
- package/src/avif/native/isobmff/for_each_box.d.ts +23 -0
- package/src/avif/native/isobmff/for_each_box.d.ts.map +1 -0
- package/src/avif/native/isobmff/for_each_box.js +39 -0
- package/src/avif/native/isobmff/read_box_header.d.ts +22 -0
- package/src/avif/native/isobmff/read_box_header.d.ts.map +1 -0
- package/src/avif/native/isobmff/read_box_header.js +59 -0
- package/src/avif/native/isobmff/read_full_box_header.d.ts +26 -0
- package/src/avif/native/isobmff/read_full_box_header.d.ts.map +1 -0
- package/src/avif/native/isobmff/read_full_box_header.js +33 -0
- package/src/avif/threaded_image_encoder.d.ts +7 -2
- package/src/avif/threaded_image_encoder.d.ts.map +1 -1
- package/src/avif/threaded_image_encoder.js +107 -21
- package/src/core/binary/BinaryBuffer.d.ts +40 -0
- package/src/core/binary/BinaryBuffer.d.ts.map +1 -1
- package/src/core/binary/BinaryBuffer.js +100 -0
- package/src/core/binary/hash/crc32.d.ts +16 -0
- package/src/core/binary/hash/crc32.d.ts.map +1 -0
- package/src/core/binary/hash/crc32.js +96 -0
- package/src/core/binary/utf8/utf8_decode.d.ts +21 -0
- package/src/core/binary/utf8/utf8_decode.d.ts.map +1 -0
- package/src/core/binary/utf8/utf8_decode.js +43 -0
- package/src/core/binary/utf8/utf8_encode_into.d.ts +20 -0
- package/src/core/binary/utf8/utf8_encode_into.d.ts.map +1 -0
- package/src/core/binary/utf8/utf8_encode_into.js +48 -0
- package/src/core/binary/utf8/utf8_encoded_length.d.ts +14 -0
- package/src/core/binary/utf8/utf8_encoded_length.d.ts.map +1 -0
- package/src/core/binary/utf8/utf8_encoded_length.js +36 -0
- package/src/core/color/COLOR_FIX_PLAN_2026_08_28.md +417 -0
- package/src/core/color/COLOR_REVIEW_2026_08_28.md +779 -0
- package/src/core/color/Color.d.ts +128 -20
- package/src/core/color/Color.d.ts.map +1 -1
- package/src/core/color/Color.js +959 -866
- package/src/core/color/PQ/PQ_constants.d.ts +10 -0
- package/src/core/color/PQ/PQ_constants.d.ts.map +1 -1
- package/src/core/color/PQ/PQ_constants.js +10 -0
- package/src/core/color/PQ/linear_to_PQ.d.ts.map +1 -1
- package/src/core/color/PQ/linear_to_PQ.js +6 -0
- package/src/core/color/REC709_PRIMARIES.d.ts +50 -0
- package/src/core/color/REC709_PRIMARIES.d.ts.map +1 -0
- package/src/core/color/REC709_PRIMARIES.js +53 -0
- package/src/core/color/construct/color_from_hex.d.ts +21 -0
- package/src/core/color/construct/color_from_hex.d.ts.map +1 -0
- package/src/core/color/construct/color_from_hex.js +33 -0
- package/src/core/color/construct/color_from_temperature.d.ts +22 -0
- package/src/core/color/construct/color_from_temperature.d.ts.map +1 -0
- package/src/core/color/construct/color_from_temperature.js +33 -0
- package/src/core/color/construct/color_from_uint24.d.ts +19 -0
- package/src/core/color/construct/color_from_uint24.d.ts.map +1 -0
- package/src/core/color/construct/color_from_uint24.js +26 -0
- package/src/core/color/construct/color_from_uint32.d.ts +20 -0
- package/src/core/color/construct/color_from_uint32.d.ts.map +1 -0
- package/src/core/color/construct/color_from_uint32.js +39 -0
- package/src/core/color/construct/color_gray.d.ts +17 -0
- package/src/core/color/construct/color_gray.d.ts.map +1 -0
- package/src/core/color/construct/color_gray.js +22 -0
- package/src/core/color/hex/hex2rgb.d.ts +1 -11
- package/src/core/color/hex/hex2rgb.d.ts.map +1 -1
- package/src/core/color/hex/hex2rgb.js +7 -24
- package/src/core/color/hex/hex_to_rgb.d.ts +18 -0
- package/src/core/color/hex/hex_to_rgb.d.ts.map +1 -0
- package/src/core/color/hex/hex_to_rgb.js +62 -0
- package/src/core/color/hex/rgb2hex.d.ts +1 -8
- package/src/core/color/hex/rgb2hex.d.ts.map +1 -1
- package/src/core/color/hex/rgb2hex.js +7 -13
- package/src/core/color/hex/rgb_to_hex.d.ts +9 -0
- package/src/core/color/hex/rgb_to_hex.d.ts.map +1 -0
- package/src/core/color/hex/rgb_to_hex.js +13 -0
- package/src/core/color/hex/rgba_to_hex.d.ts +19 -0
- package/src/core/color/hex/rgba_to_hex.d.ts.map +1 -0
- package/src/core/color/hex/rgba_to_hex.js +23 -0
- package/src/core/color/hsv/hsv2rgb.d.ts +1 -12
- package/src/core/color/hsv/hsv2rgb.d.ts.map +1 -1
- package/src/core/color/hsv/hsv2rgb.js +8 -21
- package/src/core/color/hsv/hsv2rgb_float.d.ts +1 -12
- package/src/core/color/hsv/hsv2rgb_float.d.ts.map +1 -1
- package/src/core/color/hsv/hsv2rgb_float.js +8 -56
- package/src/core/color/hsv/hsv_to_rgb.d.ts +13 -0
- package/src/core/color/hsv/hsv_to_rgb.d.ts.map +1 -0
- package/src/core/color/hsv/hsv_to_rgb.js +39 -0
- package/src/core/color/hsv/hsv_to_rgb_uint8.d.ts +13 -0
- package/src/core/color/hsv/hsv_to_rgb_uint8.d.ts.map +1 -0
- package/src/core/color/hsv/hsv_to_rgb_uint8.js +21 -0
- package/src/core/color/hsv/hue_to_rgb_sextant.d.ts +24 -0
- package/src/core/color/hsv/hue_to_rgb_sextant.d.ts.map +1 -0
- package/src/core/color/hsv/hue_to_rgb_sextant.js +67 -0
- package/src/core/color/hsv/rgb2hsv.d.ts +1 -12
- package/src/core/color/hsv/rgb2hsv.d.ts.map +1 -1
- package/src/core/color/hsv/rgb2hsv.js +7 -42
- package/src/core/color/hsv/rgb_to_hsv.d.ts +13 -0
- package/src/core/color/hsv/rgb_to_hsv.d.ts.map +1 -0
- package/src/core/color/hsv/rgb_to_hsv.js +42 -0
- package/src/core/color/hunt/hpe_to_xyz.d.ts +2 -0
- package/src/core/color/hunt/hpe_to_xyz.d.ts.map +1 -0
- package/src/core/color/hunt/hpe_to_xyz.js +4 -0
- package/src/core/color/hunt/xyz_to_hpe.d.ts +1 -6
- package/src/core/color/hunt/xyz_to_hpe.d.ts.map +1 -1
- package/src/core/color/hunt/xyz_to_hpe.js +12 -15
- package/src/core/color/illuminant/D65_spd_tabulated.d.ts.map +1 -1
- package/src/core/color/illuminant/D65_spd_tabulated.js +107 -104
- package/src/core/color/int2rgb.d.ts +1 -10
- package/src/core/color/int2rgb.d.ts.map +1 -1
- package/src/core/color/int2rgb.js +7 -12
- package/src/core/color/int_to_rgb.d.ts +21 -0
- package/src/core/color/int_to_rgb.d.ts.map +1 -0
- package/src/core/color/int_to_rgb.js +33 -0
- package/src/core/color/kelvin/kelvin_to_rgb.d.ts.map +1 -1
- package/src/core/color/kelvin/kelvin_to_rgb.js +22 -2
- package/src/core/color/kelvin/rgb_to_kelvin.d.ts +22 -2
- package/src/core/color/kelvin/rgb_to_kelvin.d.ts.map +1 -1
- package/src/core/color/kelvin/rgb_to_kelvin.js +22 -2
- package/src/core/color/lab/lab_to_xyz.d.ts +20 -0
- package/src/core/color/lab/lab_to_xyz.d.ts.map +1 -0
- package/src/core/color/lab/lab_to_xyz.js +69 -0
- package/src/core/color/oklab/gamut_clip_adaptive_l0.d.ts +34 -0
- package/src/core/color/oklab/gamut_clip_adaptive_l0.d.ts.map +1 -0
- package/src/core/color/oklab/gamut_clip_adaptive_l0.js +46 -0
- package/src/core/color/oklab/gamut_clip_at_l0.d.ts +33 -0
- package/src/core/color/oklab/gamut_clip_at_l0.d.ts.map +1 -0
- package/src/core/color/oklab/gamut_clip_at_l0.js +84 -0
- package/src/core/color/oklab/gamut_clip_preserve_chroma.d.ts +24 -0
- package/src/core/color/oklab/gamut_clip_preserve_chroma.d.ts.map +1 -0
- package/src/core/color/oklab/gamut_clip_preserve_chroma.js +37 -0
- package/src/core/color/oklab/gamut_clip_project_to_lcusp.d.ts +23 -0
- package/src/core/color/oklab/gamut_clip_project_to_lcusp.d.ts.map +1 -0
- package/src/core/color/oklab/gamut_clip_project_to_lcusp.js +46 -0
- package/src/core/color/oklab/linear_srgb_to_okhsl.d.ts +19 -0
- package/src/core/color/oklab/linear_srgb_to_okhsl.d.ts.map +1 -0
- package/src/core/color/oklab/linear_srgb_to_okhsl.js +93 -0
- package/src/core/color/oklab/linear_srgb_to_okhsv.d.ts +12 -4
- package/src/core/color/oklab/linear_srgb_to_okhsv.d.ts.map +1 -1
- package/src/core/color/oklab/linear_srgb_to_okhsv.js +108 -84
- package/src/core/color/oklab/linear_srgb_to_oklab.d.ts +13 -4
- package/src/core/color/oklab/linear_srgb_to_oklab.d.ts.map +1 -1
- package/src/core/color/oklab/linear_srgb_to_oklab.js +28 -19
- package/src/core/color/oklab/okhsl_chroma_bounds.d.ts +51 -0
- package/src/core/color/oklab/okhsl_chroma_bounds.d.ts.map +1 -0
- package/src/core/color/oklab/okhsl_chroma_bounds.js +128 -0
- package/src/core/color/oklab/okhsl_to_linear_srgb.d.ts +19 -0
- package/src/core/color/oklab/okhsl_to_linear_srgb.d.ts.map +1 -0
- package/src/core/color/oklab/okhsl_to_linear_srgb.js +85 -0
- package/src/core/color/oklab/oklab_to_oklch.d.ts +24 -0
- package/src/core/color/oklab/oklab_to_oklch.d.ts.map +1 -0
- package/src/core/color/oklab/oklab_to_oklch.js +35 -0
- package/src/core/color/oklab/oklch_to_oklab.d.ts +18 -0
- package/src/core/color/oklab/oklch_to_oklab.d.ts.map +1 -0
- package/src/core/color/oklab/oklch_to_oklab.js +26 -0
- package/src/core/color/oklab/toe.d.ts +12 -0
- package/src/core/color/oklab/toe.d.ts.map +1 -1
- package/src/core/color/oklab/toe.js +34 -22
- package/src/core/color/operations/color_add.d.ts +21 -0
- package/src/core/color/operations/color_add.d.ts.map +1 -0
- package/src/core/color/operations/color_add.js +23 -0
- package/src/core/color/operations/color_add_scaled.d.ts +20 -0
- package/src/core/color/operations/color_add_scaled.d.ts.map +1 -0
- package/src/core/color/operations/color_add_scaled.js +30 -0
- package/src/core/color/operations/color_clamp.d.ts +22 -0
- package/src/core/color/operations/color_clamp.d.ts.map +1 -0
- package/src/core/color/operations/color_clamp.js +25 -0
- package/src/core/color/operations/color_darken.d.ts +2 -1
- package/src/core/color/operations/color_darken.d.ts.map +1 -1
- package/src/core/color/operations/color_darken.js +25 -24
- package/src/core/color/operations/color_desaturate.d.ts +2 -1
- package/src/core/color/operations/color_desaturate.d.ts.map +1 -1
- package/src/core/color/operations/color_desaturate.js +25 -24
- package/src/core/color/operations/color_get_hsl.d.ts +18 -0
- package/src/core/color/operations/color_get_hsl.d.ts.map +1 -0
- package/src/core/color/operations/color_get_hsl.js +60 -0
- package/src/core/color/operations/color_is_in_gamut.d.ts +20 -0
- package/src/core/color/operations/color_is_in_gamut.d.ts.map +1 -0
- package/src/core/color/operations/color_is_in_gamut.js +30 -0
- package/src/core/color/operations/color_lerp.d.ts +12 -3
- package/src/core/color/operations/color_lerp.d.ts.map +1 -1
- package/src/core/color/operations/color_lerp.js +55 -46
- package/src/core/color/operations/color_lighten.d.ts +9 -5
- package/src/core/color/operations/color_lighten.d.ts.map +1 -1
- package/src/core/color/operations/color_lighten.js +29 -24
- package/src/core/color/operations/color_mix_okhsv_channel.d.ts +24 -0
- package/src/core/color/operations/color_mix_okhsv_channel.d.ts.map +1 -0
- package/src/core/color/operations/color_mix_okhsv_channel.js +48 -0
- package/src/core/color/operations/color_multiply_rgb.d.ts +21 -0
- package/src/core/color/operations/color_multiply_rgb.d.ts.map +1 -0
- package/src/core/color/operations/color_multiply_rgb.js +26 -0
- package/src/core/color/operations/color_saturate.d.ts +9 -5
- package/src/core/color/operations/color_saturate.d.ts.map +1 -1
- package/src/core/color/operations/color_saturate.js +29 -24
- package/src/core/color/operations/color_scale_okhsv_channel.d.ts +1 -1
- package/src/core/color/operations/color_scale_okhsv_channel.d.ts.map +1 -1
- package/src/core/color/operations/color_scale_okhsv_channel.js +58 -45
- package/src/core/color/operations/color_srgb_apply.d.ts +28 -0
- package/src/core/color/operations/color_srgb_apply.d.ts.map +1 -0
- package/src/core/color/operations/color_srgb_apply.js +40 -0
- package/src/core/color/operations/color_sub.d.ts +16 -0
- package/src/core/color/operations/color_sub.d.ts.map +1 -0
- package/src/core/color/operations/color_sub.js +18 -0
- package/src/core/color/parse_color.d.ts +10 -1
- package/src/core/color/parse_color.d.ts.map +1 -1
- package/src/core/color/parse_color.js +100 -84
- package/src/core/color/parse_color_normalized.d.ts +24 -0
- package/src/core/color/parse_color_normalized.d.ts.map +1 -0
- package/src/core/color/parse_color_normalized.js +38 -0
- package/src/core/color/rgb2uint24.d.ts +1 -8
- package/src/core/color/rgb2uint24.d.ts.map +1 -1
- package/src/core/color/rgb2uint24.js +7 -20
- package/src/core/color/rgb2uint32.d.ts +1 -9
- package/src/core/color/rgb2uint32.d.ts.map +1 -1
- package/src/core/color/rgb2uint32.js +7 -18
- package/src/core/color/rgb_to_luminance.d.ts +14 -5
- package/src/core/color/rgb_to_luminance.d.ts.map +1 -1
- package/src/core/color/rgb_to_luminance.js +24 -13
- package/src/core/color/rgb_to_uint24.d.ts +9 -0
- package/src/core/color/rgb_to_uint24.d.ts.map +1 -0
- package/src/core/color/rgb_to_uint24.js +20 -0
- package/src/core/color/rgb_to_uint32.d.ts +10 -0
- package/src/core/color/rgb_to_uint32.d.ts.map +1 -0
- package/src/core/color/rgb_to_uint32.js +21 -0
- package/src/core/color/sRGB/linear_to_sRGB.d.ts +7 -0
- package/src/core/color/sRGB/linear_to_sRGB.d.ts.map +1 -1
- package/src/core/color/sRGB/linear_to_sRGB.js +39 -32
- package/src/core/color/xyz/hpe_to_xyz.d.ts +24 -0
- package/src/core/color/xyz/hpe_to_xyz.d.ts.map +1 -0
- package/src/core/color/xyz/hpe_to_xyz.js +39 -0
- package/src/core/color/xyz/rgb_to_xyz.d.ts +17 -2
- package/src/core/color/xyz/rgb_to_xyz.d.ts.map +1 -1
- package/src/core/color/xyz/rgb_to_xyz.js +44 -18
- package/src/core/color/xyz/xyz_cmf_tabulated.d.ts.map +1 -1
- package/src/core/color/xyz/xyz_cmf_tabulated.js +217 -211
- package/src/core/color/xyz/xyz_cmf_wyman.d.ts +4 -0
- package/src/core/color/xyz/xyz_cmf_wyman.d.ts.map +1 -1
- package/src/core/color/xyz/xyz_cmf_wyman.js +74 -65
- package/src/core/color/xyz/xyz_to_hpe.d.ts +18 -0
- package/src/core/color/xyz/xyz_to_hpe.d.ts.map +1 -0
- package/src/core/color/xyz/xyz_to_hpe.js +33 -0
- package/src/core/color/xyz/xyz_to_rgb.d.ts +17 -2
- package/src/core/color/xyz/xyz_to_rgb.d.ts.map +1 -1
- package/src/core/color/xyz/xyz_to_rgb.js +39 -16
- package/src/core/color/ycxcz/xyz_to_ycxcz.d.ts +7 -2
- package/src/core/color/ycxcz/xyz_to_ycxcz.d.ts.map +1 -1
- package/src/core/color/ycxcz/xyz_to_ycxcz.js +33 -28
- package/src/core/events/signal/Signal.js +820 -820
- package/src/core/geom/3d/shape/ConvexHullShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/ConvexHullShape3D.js +28 -4
- package/src/core/math/clamp_index.d.ts +18 -0
- package/src/core/math/clamp_index.d.ts.map +1 -0
- package/src/core/math/clamp_index.js +23 -0
- package/src/engine/asset/loaders/image/IMAGE_CODEC_REVIEW_2026_08_28.md +803 -0
- package/src/engine/asset/loaders/image/jpeg/JpegFrame.d.ts +5 -3
- package/src/engine/asset/loaders/image/jpeg/JpegFrame.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/jpeg/JpegFrame.js +5 -3
- package/src/engine/asset/loaders/image/jpeg/JpegFrameComponent.d.ts +2 -1
- package/src/engine/asset/loaders/image/jpeg/JpegFrameComponent.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/jpeg/JpegFrameComponent.js +2 -1
- package/src/engine/asset/loaders/image/jpeg/JpegImage.d.ts +17 -0
- package/src/engine/asset/loaders/image/jpeg/JpegImage.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/jpeg/JpegImage.js +197 -157
- package/src/engine/asset/loaders/image/jpeg/idct8x8_float.d.ts +0 -1
- package/src/engine/asset/loaders/image/jpeg/idct8x8_float.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/jpeg/idct8x8_float.js +0 -1
- package/src/engine/asset/loaders/image/jpeg/jpeg_component_row.d.ts +28 -0
- package/src/engine/asset/loaders/image/jpeg/jpeg_component_row.d.ts.map +1 -0
- package/src/engine/asset/loaders/image/jpeg/jpeg_component_row.js +31 -0
- package/src/engine/asset/loaders/image/png/PNG.d.ts +3 -18
- package/src/engine/asset/loaders/image/png/PNG.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/png/PNG.js +3 -139
- package/src/engine/asset/loaders/image/png/PNGReader.d.ts +16 -16
- package/src/engine/asset/loaders/image/png/PNGReader.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/png/PNGReader.js +143 -160
- package/src/engine/asset/loaders/image/png/chunk/png_chunk_decode_iTXt.js +3 -3
- package/src/engine/asset/loaders/image/png/chunk/png_chunk_decode_zTXt.js +3 -3
- package/src/engine/asset/loaders/image/png/crc32.d.ts +1 -15
- package/src/engine/asset/loaders/image/png/crc32.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/png/crc32.js +5 -89
- package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterNone.d.ts +12 -10
- package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterNone.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterNone.js +20 -45
- package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterSub.d.ts +2 -1
- package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterSub.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterSub.js +2 -0
- package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterUp.d.ts +2 -1
- package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterUp.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterUp.js +2 -0
- package/src/engine/asset/loaders/image/png/filter/png_unfilter.d.ts +22 -0
- package/src/engine/asset/loaders/image/png/filter/png_unfilter.d.ts.map +1 -0
- package/src/engine/asset/loaders/image/png/filter/png_unfilter.js +68 -0
- package/src/engine/asset/loaders/image/png/png_inflate.d.ts +20 -0
- package/src/engine/asset/loaders/image/png/png_inflate.d.ts.map +1 -0
- package/src/engine/asset/loaders/image/png/png_inflate.js +85 -0
- package/src/engine/asset/loaders/image/png/png_unpack_samples.d.ts +22 -0
- package/src/engine/asset/loaders/image/png/png_unpack_samples.d.ts.map +1 -0
- package/src/engine/asset/loaders/image/png/png_unpack_samples.js +38 -0
- package/src/engine/graphics/ecs/sprite/SpriteSystemPE.d.ts.map +1 -1
- package/src/engine/graphics/ecs/sprite/SpriteSystemPE.js +135 -132
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.d.ts +16 -3
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +1157 -1149
- package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts +26 -0
- package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/FrameGraph.js +947 -900
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +69 -81
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +83 -77
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/shade/device/IMMEDIATE_DATA_PLAN_2026_08_28.md +451 -0
- package/src/shade/device/ShadeGPUCommandContext.d.ts +21 -0
- package/src/shade/device/ShadeGPUCommandContext.d.ts.map +1 -1
- package/src/shade/device/ShadeGPUCommandContext.js +940 -749
- package/src/shade/device/timing/GPUTimerArray.d.ts +22 -4
- package/src/shade/device/timing/GPUTimerArray.d.ts.map +1 -1
- package/src/shade/device/timing/GPUTimerArray.js +88 -14
- package/src/shade/device/timing/GPU_PROFILER_PROPOSAL_2026_08_28.md +876 -0
- package/src/shade/device/timing/profile/GPUFrameRecorder.d.ts +93 -0
- package/src/shade/device/timing/profile/GPUFrameRecorder.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUFrameRecorder.js +297 -0
- package/src/shade/device/timing/profile/GPUProfileCapture.d.ts +62 -0
- package/src/shade/device/timing/profile/GPUProfileCapture.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUProfileCapture.js +77 -0
- package/src/shade/device/timing/profile/GPUProfileFrame.d.ts +73 -0
- package/src/shade/device/timing/profile/GPUProfileFrame.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUProfileFrame.js +88 -0
- package/src/shade/device/timing/profile/GPUProfileLevel.d.ts +20 -0
- package/src/shade/device/timing/profile/GPUProfileLevel.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUProfileLevel.js +50 -0
- package/src/shade/device/timing/profile/GPUProfileMeta.d.ts +63 -0
- package/src/shade/device/timing/profile/GPUProfileMeta.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUProfileMeta.js +73 -0
- package/src/shade/device/timing/profile/GPUProfileSession.d.ts +173 -0
- package/src/shade/device/timing/profile/GPUProfileSession.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUProfileSession.js +470 -0
- package/src/shade/device/timing/profile/GPUProfileSpan.d.ts +60 -0
- package/src/shade/device/timing/profile/GPUProfileSpan.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUProfileSpan.js +65 -0
- package/src/shade/device/timing/profile/GPUProfileSpanKind.d.ts +19 -0
- package/src/shade/device/timing/profile/GPUProfileSpanKind.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUProfileSpanKind.js +25 -0
- package/src/shade/device/timing/profile/GPUProfileTopology.d.ts +159 -0
- package/src/shade/device/timing/profile/GPUProfileTopology.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUProfileTopology.js +202 -0
- package/src/shade/device/timing/profile/GPUProfileWork.d.ts +90 -0
- package/src/shade/device/timing/profile/GPUProfileWork.d.ts.map +1 -0
- package/src/shade/device/timing/profile/GPUProfileWork.js +115 -0
- package/src/shade/device/timing/profile/SGPTDefect.d.ts +43 -0
- package/src/shade/device/timing/profile/SGPTDefect.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPTDefect.js +65 -0
- package/src/shade/device/timing/profile/SGPTHeader.d.ts +38 -0
- package/src/shade/device/timing/profile/SGPTHeader.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPTHeader.js +46 -0
- package/src/shade/device/timing/profile/SGPTRecordRef.d.ts +37 -0
- package/src/shade/device/timing/profile/SGPTRecordRef.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPTRecordRef.js +45 -0
- package/src/shade/device/timing/profile/SGPTWriteStream.d.ts +103 -0
- package/src/shade/device/timing/profile/SGPTWriteStream.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPTWriteStream.js +287 -0
- package/src/shade/device/timing/profile/SGPT_DEFECT.d.ts +19 -0
- package/src/shade/device/timing/profile/SGPT_DEFECT.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_DEFECT.js +26 -0
- package/src/shade/device/timing/profile/SGPT_FLAG.d.ts +8 -0
- package/src/shade/device/timing/profile/SGPT_FLAG.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_FLAG.js +15 -0
- package/src/shade/device/timing/profile/SGPT_FORMAT.md +345 -0
- package/src/shade/device/timing/profile/SGPT_FORMAT_VERSION.d.ts +10 -0
- package/src/shade/device/timing/profile/SGPT_FORMAT_VERSION.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_FORMAT_VERSION.js +9 -0
- package/src/shade/device/timing/profile/SGPT_FRAME_SLACK.d.ts +17 -0
- package/src/shade/device/timing/profile/SGPT_FRAME_SLACK.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_FRAME_SLACK.js +16 -0
- package/src/shade/device/timing/profile/SGPT_HEADER_CHECKSUM_COVERAGE.d.ts +16 -0
- package/src/shade/device/timing/profile/SGPT_HEADER_CHECKSUM_COVERAGE.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_HEADER_CHECKSUM_COVERAGE.js +15 -0
- package/src/shade/device/timing/profile/SGPT_HEADER_OFFSET.d.ts +15 -0
- package/src/shade/device/timing/profile/SGPT_HEADER_OFFSET.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_HEADER_OFFSET.js +29 -0
- package/src/shade/device/timing/profile/SGPT_HEADER_SIZE.d.ts +7 -0
- package/src/shade/device/timing/profile/SGPT_HEADER_SIZE.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_HEADER_SIZE.js +6 -0
- package/src/shade/device/timing/profile/SGPT_MAGIC.d.ts +7 -0
- package/src/shade/device/timing/profile/SGPT_MAGIC.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_MAGIC.js +6 -0
- package/src/shade/device/timing/profile/SGPT_MIN_READER_VERSION.d.ts +16 -0
- package/src/shade/device/timing/profile/SGPT_MIN_READER_VERSION.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_MIN_READER_VERSION.js +15 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_HEADER_SIZE.d.ts +7 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_HEADER_SIZE.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_HEADER_SIZE.js +6 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_OFFSET.d.ts +13 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_OFFSET.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_OFFSET.js +23 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_SYNC.d.ts +12 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_SYNC.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_SYNC.js +11 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_TYPE.d.ts +18 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_TYPE.d.ts.map +1 -0
- package/src/shade/device/timing/profile/SGPT_RECORD_TYPE.js +46 -0
- package/src/shade/device/timing/profile/frame_graph_extract_topology.d.ts +20 -0
- package/src/shade/device/timing/profile/frame_graph_extract_topology.d.ts.map +1 -0
- package/src/shade/device/timing/profile/frame_graph_extract_topology.js +174 -0
- package/src/shade/device/timing/profile/make_profiling_pass_encoder.d.ts +21 -0
- package/src/shade/device/timing/profile/make_profiling_pass_encoder.d.ts.map +1 -0
- package/src/shade/device/timing/profile/make_profiling_pass_encoder.js +114 -0
- package/src/shade/device/timing/profile/parse_workgroup_size.d.ts +20 -0
- package/src/shade/device/timing/profile/parse_workgroup_size.d.ts.map +1 -0
- package/src/shade/device/timing/profile/parse_workgroup_size.js +43 -0
- package/src/shade/device/timing/profile/sgpt_fourcc.d.ts +18 -0
- package/src/shade/device/timing/profile/sgpt_fourcc.d.ts.map +1 -0
- package/src/shade/device/timing/profile/sgpt_fourcc.js +34 -0
- package/src/shade/device/timing/profile/sgpt_frame_codec.d.ts +42 -0
- package/src/shade/device/timing/profile/sgpt_frame_codec.d.ts.map +1 -0
- package/src/shade/device/timing/profile/sgpt_frame_codec.js +172 -0
- package/src/shade/device/timing/profile/sgpt_meta_codec.d.ts +20 -0
- package/src/shade/device/timing/profile/sgpt_meta_codec.d.ts.map +1 -0
- package/src/shade/device/timing/profile/sgpt_meta_codec.js +65 -0
- package/src/shade/device/timing/profile/sgpt_read_capture.d.ts +19 -0
- package/src/shade/device/timing/profile/sgpt_read_capture.d.ts.map +1 -0
- package/src/shade/device/timing/profile/sgpt_read_capture.js +134 -0
- package/src/shade/device/timing/profile/sgpt_read_header.d.ts +22 -0
- package/src/shade/device/timing/profile/sgpt_read_header.d.ts.map +1 -0
- package/src/shade/device/timing/profile/sgpt_read_header.js +94 -0
- package/src/shade/device/timing/profile/sgpt_read_records.d.ts +27 -0
- package/src/shade/device/timing/profile/sgpt_read_records.d.ts.map +1 -0
- package/src/shade/device/timing/profile/sgpt_read_records.js +153 -0
- package/src/shade/device/timing/profile/sgpt_topology_codec.d.ts +54 -0
- package/src/shade/device/timing/profile/sgpt_topology_codec.d.ts.map +1 -0
- package/src/shade/device/timing/profile/sgpt_topology_codec.js +329 -0
- package/src/shade/device/timing/profile/sgpt_write_header.d.ts +22 -0
- package/src/shade/device/timing/profile/sgpt_write_header.d.ts.map +1 -0
- package/src/shade/device/timing/profile/sgpt_write_header.js +47 -0
- package/src/shade/device/timing/profile/sgpt_write_record.d.ts +23 -0
- package/src/shade/device/timing/profile/sgpt_write_record.d.ts.map +1 -0
- package/src/shade/device/timing/profile/sgpt_write_record.js +62 -0
- package/src/shade/renderer/Renderer.d.ts +21 -0
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +2513 -2455
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/scene/serialization/decode_image_source_hdr.d.ts +14 -3
- package/src/shade/renderer/scene/serialization/decode_image_source_hdr.d.ts.map +1 -1
- package/src/shade/renderer/scene/serialization/decode_image_source_hdr.js +50 -51
- package/src/shade/renderer/scene/serialization/deserialize_scene.d.ts.map +1 -1
- package/src/shade/renderer/scene/serialization/deserialize_scene.js +531 -521
- package/src/shade/renderer/scene/serialization/write_image_source.d.ts.map +1 -1
- package/src/shade/renderer/scene/serialization/write_image_source.js +6 -4
- package/src/shade/renderer/shader/chunk/color/chunk_rgb_to_luminance.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/color/chunk_rgb_to_luminance.js +34 -32
- package/src/shade/renderer/shader/chunk/color/iCtCp/chunk_eotf_st2084.d.ts +31 -0
- package/src/shade/renderer/shader/chunk/color/iCtCp/chunk_eotf_st2084.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/color/iCtCp/chunk_eotf_st2084.js +62 -31
- package/src/shade/renderer/shader/chunk/color/iCtCp/chunk_inverse_eotf_st2084.d.ts +10 -0
- package/src/shade/renderer/shader/chunk/color/iCtCp/chunk_inverse_eotf_st2084.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/color/iCtCp/chunk_inverse_eotf_st2084.js +32 -22
- package/src/shade/renderer/shader/chunk/color/sRGB/chunk_sRGBTransferOETF.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/color/sRGB/chunk_sRGBTransferOETF.js +22 -21
- package/src/shade/renderer/shader/chunk/color/tonemap/gt7/chunk_tonemap_gt7.d.ts +6 -0
- package/src/shade/renderer/shader/chunk/color/tonemap/gt7/chunk_tonemap_gt7.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/color/tonemap/gt7/chunk_tonemap_gt7.js +110 -104
- package/src/shade/renderer/shader/chunk/color/xyz/chunk_rgb_to_xyz.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/color/xyz/chunk_rgb_to_xyz.js +23 -21
- package/src/view/elements/ColorPickerView.js +296 -296
- package/src/avif/codec/dec/Readme.md +0 -14
- package/src/avif/codec/dec/avif_dec.cpp +0 -234
- package/src/avif/codec/dec/avif_dec.d.ts +0 -3
- package/src/avif/codec/dec/avif_dec.d.ts.map +0 -1
- package/src/avif/codec/dec/avif_dec.js +0 -16
- package/src/avif/codec/dec/avif_dec.wasm +0 -0
- package/src/avif/codec/enc/README.md +0 -37
- package/src/avif/codec/enc/avif_enc.cpp +0 -216
- package/src/avif/codec/enc/avif_enc.d.ts +0 -3
- package/src/avif/codec/enc/avif_enc.d.ts.map +0 -1
- package/src/avif/codec/enc/avif_enc.js +0 -6144
- package/src/avif/codec/enc/avif_enc.wasm +0 -0
- package/src/avif/codec/enc/avif_enc_mt.d.ts +0 -3
- package/src/avif/codec/enc/avif_enc_mt.d.ts.map +0 -1
- package/src/avif/codec/enc/avif_enc_mt.js +0 -6811
- package/src/avif/codec/enc/avif_enc_mt.wasm +0 -0
- package/src/avif/codec/enc/avif_enc_mt.worker.d.mts +0 -2
- package/src/avif/codec/enc/avif_enc_mt.worker.d.mts.map +0 -1
- package/src/avif/codec/enc/avif_enc_mt.worker.d.ts +0 -11
- package/src/avif/codec/enc/avif_enc_mt.worker.d.ts.map +0 -1
- package/src/avif/codec/enc/avif_enc_mt.worker.js +0 -171
- package/src/avif/codec/enc/avif_enc_mt.worker.mjs +0 -1
- package/src/avif/decode.d.ts +0 -3
- package/src/avif/decode.d.ts.map +0 -1
- package/src/avif/decode.js +0 -42
- package/src/avif/encode.d.ts +0 -3
- package/src/avif/encode.d.ts.map +0 -1
- package/src/avif/encode.js +0 -75
- package/src/avif/meta.d.ts +0 -24
- package/src/avif/meta.d.ts.map +0 -1
- package/src/avif/meta.js +0 -23
- package/src/avif/tsconfig.tsbuildinfo +0 -1
- package/src/avif/utils.d.ts +0 -17
- package/src/avif/utils.d.ts.map +0 -1
- package/src/avif/utils.js +0 -31
- package/src/engine/asset/loaders/image/jpeg/idct8x8_fixed.d.ts +0 -23
- package/src/engine/asset/loaders/image/jpeg/idct8x8_fixed.d.ts.map +0 -1
- package/src/engine/asset/loaders/image/jpeg/idct8x8_fixed.js +0 -214
- package/src/engine/asset/loaders/image/png/inflate.d.ts +0 -7
- package/src/engine/asset/loaders/image/png/inflate.d.ts.map +0 -1
- package/src/engine/asset/loaders/image/png/inflate.js +0 -20
- package/src/engine/save/GameStateLoader.d.ts +0 -49
- package/src/engine/save/GameStateLoader.d.ts.map +0 -1
- package/src/engine/save/GameStateLoader.js +0 -168
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quantise one transform block's coefficients.
|
|
3
|
+
*
|
|
4
|
+
* The step is exactly the one `reconstruct` will divide back out, taken from the same tables, so
|
|
5
|
+
* that the only error is the rounding this chooses to make.
|
|
6
|
+
*
|
|
7
|
+
* At quantizer index zero the step is four rather than one — the lossless transform is scaled to
|
|
8
|
+
* match, and the division here is exact — so the lossless path needs no special case.
|
|
9
|
+
*
|
|
10
|
+
* That rounding is deliberately biased towards zero. A coefficient that quantises to zero costs
|
|
11
|
+
* almost nothing to code, and one that quantises to one costs a symbol and a sign; giving up the
|
|
12
|
+
* last fraction of a step buys a great many bits back on the kind of content still images are made
|
|
13
|
+
* of.
|
|
14
|
+
*
|
|
15
|
+
* The pass runs in scan order and carries two answers out with it that the caller would otherwise
|
|
16
|
+
* pay for separately: the end-of-block position, which the coefficient writer used to find by
|
|
17
|
+
* walking a thousand positions backwards, and the squared error the quantiser cost in the
|
|
18
|
+
* coefficient domain, which is what saves the rate-distortion search an inverse transform per
|
|
19
|
+
* candidate. Both are free here and neither is anywhere else.
|
|
20
|
+
*
|
|
21
|
+
* @param {Av1EncodeContext} ec
|
|
22
|
+
* @param {number} plane
|
|
23
|
+
* @param {number} tx_size
|
|
24
|
+
* @param {number} tx_type
|
|
25
|
+
* @param {Int32Array} coefficients
|
|
26
|
+
* @param {Int32Array} levels filled with the signed quantised levels
|
|
27
|
+
* @param {number} levels_offset where in `levels` this transform block's start, so that a block's
|
|
28
|
+
* transform blocks can share one buffer
|
|
29
|
+
* @param {Uint16Array} scan the order the coefficients will be coded in
|
|
30
|
+
* @returns {number} the end-of-block position: one past the last coefficient in scan order that
|
|
31
|
+
* survived, and zero for a block that did not
|
|
32
|
+
* @see AV1 spec 7.12.2 "Dequantization functions", which this is the inverse of
|
|
33
|
+
*
|
|
34
|
+
* @author Alex Goldring
|
|
35
|
+
* @copyright Company Named Limited (c) 2026
|
|
36
|
+
*/
|
|
37
|
+
export function quantise_transform_block(ec: Av1EncodeContext, plane: number, tx_size: number, tx_type: number, coefficients: Int32Array, levels: Int32Array, levels_offset: number, scan: Uint16Array): number;
|
|
38
|
+
/**
|
|
39
|
+
* The coefficient magnitude below which the quantiser produces nothing at all.
|
|
40
|
+
*
|
|
41
|
+
* A coefficient quantises to zero when `|c| * denominator / step + rounding` stays under one, and
|
|
42
|
+
* the DC step is the smaller of the two, so a magnitude under this survives at no position. A block
|
|
43
|
+
* whose largest possible coefficient is under it is a block the transform need not be run on.
|
|
44
|
+
*
|
|
45
|
+
* @param {Av1EncodeContext} ec
|
|
46
|
+
* @param {number} plane
|
|
47
|
+
* @param {number} tx_size
|
|
48
|
+
* @returns {number}
|
|
49
|
+
*/
|
|
50
|
+
export function quantiser_zero_threshold(ec: Av1EncodeContext, plane: number, tx_size: number): number;
|
|
51
|
+
//# sourceMappingURL=quantise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quantise.d.ts","sourceRoot":"","sources":["../../../../../../src/avif/native/av1/encode/quantise.js"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,sEAfW,MAAM,WACN,MAAM,WACN,MAAM,gBACN,UAAU,UACV,UAAU,iBACV,MAAM,QAEN,WAAW,GACT,MAAM,CA2FlB;AAED;;;;;;;;;;;GAWG;AACH,sEAJW,MAAM,WACN,MAAM,GACJ,MAAM,CAclB"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TX_16X32,
|
|
3
|
+
TX_16X64,
|
|
4
|
+
TX_32X16,
|
|
5
|
+
TX_32X32,
|
|
6
|
+
TX_32X64,
|
|
7
|
+
TX_64X16,
|
|
8
|
+
TX_64X32,
|
|
9
|
+
TX_64X64
|
|
10
|
+
} from "../tables/av1_symbols.js";
|
|
11
|
+
import { TX_HEIGHT, TX_WIDTH } from "../tables/block_tables.js";
|
|
12
|
+
import { ac_quant, dc_quant, get_qindex } from "../decode/reconstruct.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Largest level the format can carry. The decoder masks a coefficient to twenty bits before
|
|
16
|
+
* dequantising, so anything past this would come back as something else entirely.
|
|
17
|
+
* @type {number}
|
|
18
|
+
*/
|
|
19
|
+
const MAX_LEVEL = 0xfffff;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Quantise one transform block's coefficients.
|
|
23
|
+
*
|
|
24
|
+
* The step is exactly the one `reconstruct` will divide back out, taken from the same tables, so
|
|
25
|
+
* that the only error is the rounding this chooses to make.
|
|
26
|
+
*
|
|
27
|
+
* At quantizer index zero the step is four rather than one — the lossless transform is scaled to
|
|
28
|
+
* match, and the division here is exact — so the lossless path needs no special case.
|
|
29
|
+
*
|
|
30
|
+
* That rounding is deliberately biased towards zero. A coefficient that quantises to zero costs
|
|
31
|
+
* almost nothing to code, and one that quantises to one costs a symbol and a sign; giving up the
|
|
32
|
+
* last fraction of a step buys a great many bits back on the kind of content still images are made
|
|
33
|
+
* of.
|
|
34
|
+
*
|
|
35
|
+
* The pass runs in scan order and carries two answers out with it that the caller would otherwise
|
|
36
|
+
* pay for separately: the end-of-block position, which the coefficient writer used to find by
|
|
37
|
+
* walking a thousand positions backwards, and the squared error the quantiser cost in the
|
|
38
|
+
* coefficient domain, which is what saves the rate-distortion search an inverse transform per
|
|
39
|
+
* candidate. Both are free here and neither is anywhere else.
|
|
40
|
+
*
|
|
41
|
+
* @param {Av1EncodeContext} ec
|
|
42
|
+
* @param {number} plane
|
|
43
|
+
* @param {number} tx_size
|
|
44
|
+
* @param {number} tx_type
|
|
45
|
+
* @param {Int32Array} coefficients
|
|
46
|
+
* @param {Int32Array} levels filled with the signed quantised levels
|
|
47
|
+
* @param {number} levels_offset where in `levels` this transform block's start, so that a block's
|
|
48
|
+
* transform blocks can share one buffer
|
|
49
|
+
* @param {Uint16Array} scan the order the coefficients will be coded in
|
|
50
|
+
* @returns {number} the end-of-block position: one past the last coefficient in scan order that
|
|
51
|
+
* survived, and zero for a block that did not
|
|
52
|
+
* @see AV1 spec 7.12.2 "Dequantization functions", which this is the inverse of
|
|
53
|
+
*
|
|
54
|
+
* @author Alex Goldring
|
|
55
|
+
* @copyright Company Named Limited (c) 2026
|
|
56
|
+
*/
|
|
57
|
+
export function quantise_transform_block(ec, plane, tx_size, tx_type, coefficients, levels, levels_offset, scan) {
|
|
58
|
+
const ctx = ec.frame_context;
|
|
59
|
+
const frame = ec.frame;
|
|
60
|
+
|
|
61
|
+
const width = TX_WIDTH[tx_size];
|
|
62
|
+
const height = TX_HEIGHT[tx_size];
|
|
63
|
+
|
|
64
|
+
const tw = Math.min(32, width);
|
|
65
|
+
const th = Math.min(32, height);
|
|
66
|
+
|
|
67
|
+
// the scan's positions are raster indices into the coded corner, whose stride is `tw`; the
|
|
68
|
+
// coefficients the transform produced are strided by the transform's full width. This encoder
|
|
69
|
+
// emits nothing wider than the corner, so the two agree — and if that ever changes, the scan
|
|
70
|
+
// would be indexing the wrong samples silently
|
|
71
|
+
if (tw !== width) {
|
|
72
|
+
throw new Error(`a transform ${width} wide codes only its first ${tw} columns, which this does not handle`);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const denominator = dequant_denominator(tx_size);
|
|
76
|
+
|
|
77
|
+
const qindex = get_qindex(ctx);
|
|
78
|
+
|
|
79
|
+
const dc_step = dc_quant(ctx.bit_depth, qindex + dc_delta(frame, plane));
|
|
80
|
+
const ac_step = ac_quant(ctx.bit_depth, qindex + ac_delta(frame, plane));
|
|
81
|
+
|
|
82
|
+
const rounding = ec.rounding;
|
|
83
|
+
|
|
84
|
+
// what the decoder will multiply these levels back up by, left where whatever wants to reason
|
|
85
|
+
// about a level's worth can find it without deriving it a second time
|
|
86
|
+
ec.step_dc = dc_step;
|
|
87
|
+
ec.step_ac = ac_step;
|
|
88
|
+
ec.step_denominator = denominator;
|
|
89
|
+
|
|
90
|
+
// a reciprocal, because this is the innermost loop of the encoder and a division here is worth
|
|
91
|
+
// twenty multiplications. The step is an integer under two thousand and the magnitude an
|
|
92
|
+
// integer under a million, so the product is exact well past the point the rounding decides
|
|
93
|
+
const dc_scale = denominator / dc_step;
|
|
94
|
+
const ac_scale = denominator / ac_step;
|
|
95
|
+
|
|
96
|
+
// one, a half or a quarter, all of them exact in floating point, so this is the dequantiser's
|
|
97
|
+
// division without the division
|
|
98
|
+
const inverse_denominator = 1 / denominator;
|
|
99
|
+
|
|
100
|
+
const count = tw * th;
|
|
101
|
+
|
|
102
|
+
// in scan order rather than in raster order, so that the end-of-block position — which the
|
|
103
|
+
// coefficient writer would otherwise find by walking a thousand positions backwards looking for
|
|
104
|
+
// one that is not zero — falls out of the same pass
|
|
105
|
+
let eob = 0;
|
|
106
|
+
let error = 0;
|
|
107
|
+
|
|
108
|
+
for (let c = 0; c < count; c++) {
|
|
109
|
+
const pos = scan[c];
|
|
110
|
+
|
|
111
|
+
const coefficient = coefficients[pos];
|
|
112
|
+
|
|
113
|
+
const magnitude = coefficient < 0 ? -coefficient : coefficient;
|
|
114
|
+
|
|
115
|
+
const scale = pos === 0 ? dc_scale : ac_scale;
|
|
116
|
+
|
|
117
|
+
let level = (magnitude * scale + rounding) | 0;
|
|
118
|
+
|
|
119
|
+
if (level > MAX_LEVEL) {
|
|
120
|
+
level = MAX_LEVEL;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
levels[levels_offset + pos] = coefficient < 0 ? -level : level;
|
|
124
|
+
|
|
125
|
+
if (level !== 0) {
|
|
126
|
+
eob = c + 1;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// what the decoder will reconstruct, and therefore what this cost in accuracy. Squared
|
|
130
|
+
// error in the coefficient domain, which the caller scales into samples
|
|
131
|
+
const step = pos === 0 ? dc_step : ac_step;
|
|
132
|
+
|
|
133
|
+
const difference = magnitude - ((level * step * inverse_denominator) | 0);
|
|
134
|
+
|
|
135
|
+
error += difference * difference;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
ec.quantised_error = error;
|
|
139
|
+
|
|
140
|
+
return eob;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The coefficient magnitude below which the quantiser produces nothing at all.
|
|
145
|
+
*
|
|
146
|
+
* A coefficient quantises to zero when `|c| * denominator / step + rounding` stays under one, and
|
|
147
|
+
* the DC step is the smaller of the two, so a magnitude under this survives at no position. A block
|
|
148
|
+
* whose largest possible coefficient is under it is a block the transform need not be run on.
|
|
149
|
+
*
|
|
150
|
+
* @param {Av1EncodeContext} ec
|
|
151
|
+
* @param {number} plane
|
|
152
|
+
* @param {number} tx_size
|
|
153
|
+
* @returns {number}
|
|
154
|
+
*/
|
|
155
|
+
export function quantiser_zero_threshold(ec, plane, tx_size) {
|
|
156
|
+
const ctx = ec.frame_context;
|
|
157
|
+
const frame = ec.frame;
|
|
158
|
+
|
|
159
|
+
const qindex = get_qindex(ctx);
|
|
160
|
+
|
|
161
|
+
const dc_step = dc_quant(ctx.bit_depth, qindex + dc_delta(frame, plane));
|
|
162
|
+
const ac_step = ac_quant(ctx.bit_depth, qindex + ac_delta(frame, plane));
|
|
163
|
+
|
|
164
|
+
const step = dc_step < ac_step ? dc_step : ac_step;
|
|
165
|
+
|
|
166
|
+
return ((1 - ec.rounding) * step) / dequant_denominator(tx_size);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The divisor the dequantiser applies after multiplying by the step, which is how large transforms
|
|
171
|
+
* keep their coefficients in range.
|
|
172
|
+
*
|
|
173
|
+
* @param {number} tx_size
|
|
174
|
+
* @returns {number}
|
|
175
|
+
*/
|
|
176
|
+
function dequant_denominator(tx_size) {
|
|
177
|
+
if (tx_size === TX_32X32 || tx_size === TX_16X32 || tx_size === TX_32X16 || tx_size === TX_16X64 || tx_size === TX_64X16) {
|
|
178
|
+
return 2;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (tx_size === TX_64X64 || tx_size === TX_32X64 || tx_size === TX_64X32) {
|
|
182
|
+
return 4;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return 1;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* @param {FrameHeader} frame
|
|
190
|
+
* @param {number} plane
|
|
191
|
+
* @returns {number}
|
|
192
|
+
*/
|
|
193
|
+
function dc_delta(frame, plane) {
|
|
194
|
+
if (plane === 0) {
|
|
195
|
+
return frame.delta_q_y_dc;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return plane === 1 ? frame.delta_q_u_dc : frame.delta_q_v_dc;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @param {FrameHeader} frame
|
|
203
|
+
* @param {number} plane
|
|
204
|
+
* @returns {number}
|
|
205
|
+
*/
|
|
206
|
+
function ac_delta(frame, plane) {
|
|
207
|
+
if (plane === 0) {
|
|
208
|
+
return 0;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return plane === 1 ? frame.delta_q_u_ac : frame.delta_q_v_ac;
|
|
212
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write the coefficients of one transform block.
|
|
3
|
+
*
|
|
4
|
+
* The mirror of `decode_coefficients`, and deliberately written to look like it: every context here
|
|
5
|
+
* has to be derived from exactly the state the decoder will have when it reads the symbol back, so
|
|
6
|
+
* the two read as the same sequence of decisions with the arrows reversed.
|
|
7
|
+
*
|
|
8
|
+
* `levels` holds the signed quantised coefficients by raster position. On return `ctx.quant` holds
|
|
9
|
+
* what the decoder would have, so `reconstruct` can be called on it directly — which is what keeps
|
|
10
|
+
* the encoder's picture and the decoder's identical rather than merely close.
|
|
11
|
+
*
|
|
12
|
+
* ### Costing a block without coding it
|
|
13
|
+
*
|
|
14
|
+
* Passing a writer in its costing mode, and `record` of zero, runs the whole syntax against
|
|
15
|
+
* something that adds up what each symbol would cost and writes nothing, leaving the block's
|
|
16
|
+
* entropy contexts and recorded transform types untouched. That is how the encoder prices a decision: the rate it weighs
|
|
17
|
+
* is the rate of exactly these symbols through exactly these contexts, because it *is* this
|
|
18
|
+
* function. `ctx.quant` is filled either way, so a trial can still be reconstructed and measured.
|
|
19
|
+
*
|
|
20
|
+
* @param {Av1FrameContext} ctx
|
|
21
|
+
* @param {SymbolWriter} writer where the symbols go, or what prices them
|
|
22
|
+
* @param {number} record `1` to update the entropy contexts and transform types this block leaves
|
|
23
|
+
* behind, `0` for a trial that must leave no trace
|
|
24
|
+
* @param {number} plane
|
|
25
|
+
* @param {number} start_x left edge of the transform block in plane samples
|
|
26
|
+
* @param {number} start_y
|
|
27
|
+
* @param {number} tx_size
|
|
28
|
+
* @param {number} tx_type the type the coefficients were produced with
|
|
29
|
+
* @param {Int32Array} levels
|
|
30
|
+
* @param {number} levels_offset where in `levels` this transform block starts
|
|
31
|
+
* @param {number} eob one past the last coefficient in scan order that survived the quantiser, as
|
|
32
|
+
* `quantise_transform_block` returned it. Passing it rather than looking for it is worth having:
|
|
33
|
+
* finding it here means walking the scan backwards from its end, which for a 32x32 block is a
|
|
34
|
+
* thousand positions to reach an answer that is usually under a hundred
|
|
35
|
+
* @returns {number} the same end-of-block position
|
|
36
|
+
* @see AV1 spec 5.11.39 "Coefficients syntax"
|
|
37
|
+
*
|
|
38
|
+
* @author Alex Goldring
|
|
39
|
+
* @copyright Company Named Limited (c) 2026
|
|
40
|
+
*/
|
|
41
|
+
export function write_coefficients(ctx: Av1FrameContext, writer: SymbolWriter, record: number, plane: number, start_x: number, start_y: number, tx_size: number, tx_type: number, levels: Int32Array, levels_offset: number, eob: number): number;
|
|
42
|
+
//# sourceMappingURL=write_coefficients.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write_coefficients.d.ts","sourceRoot":"","sources":["../../../../../../src/avif/native/av1/encode/write_coefficients.js"],"names":[],"mappings":"AA+BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,uFAnBW,MAAM,SAEN,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,UACN,UAAU,iBACV,MAAM,OACN,MAAM,GAIJ,MAAM,CAoKlB"}
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BR_CDF_SIZE,
|
|
3
|
+
COEFF_BASE_RANGE,
|
|
4
|
+
DCT_DCT,
|
|
5
|
+
NUM_BASE_LEVELS,
|
|
6
|
+
SIG_COEF_CONTEXTS,
|
|
7
|
+
SIG_COEF_CONTEXTS_EOB,
|
|
8
|
+
TX_16X64,
|
|
9
|
+
TX_32X32,
|
|
10
|
+
TX_64X16,
|
|
11
|
+
TX_CLASS_2D
|
|
12
|
+
} from "../tables/av1_symbols.js";
|
|
13
|
+
import {
|
|
14
|
+
ADJUSTED_TX_SIZE,
|
|
15
|
+
TX_HEIGHT,
|
|
16
|
+
TX_HEIGHT_LOG2,
|
|
17
|
+
TX_SIZE_SQR,
|
|
18
|
+
TX_SIZE_SQR_UP,
|
|
19
|
+
TX_WIDTH,
|
|
20
|
+
TX_WIDTH_LOG2
|
|
21
|
+
} from "../tables/block_tables.js";
|
|
22
|
+
import {
|
|
23
|
+
get_all_zero_ctx,
|
|
24
|
+
get_coeff_base_ctx,
|
|
25
|
+
get_coeff_br_ctx,
|
|
26
|
+
get_dc_sign_ctx
|
|
27
|
+
} from "../entropy/coefficient_context.js";
|
|
28
|
+
import { get_scan } from "../decode/get_scan.js";
|
|
29
|
+
import { get_tx_class } from "../decode/transform_type.js";
|
|
30
|
+
import { write_transform_type } from "./write_transform_type.js";
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Write the coefficients of one transform block.
|
|
34
|
+
*
|
|
35
|
+
* The mirror of `decode_coefficients`, and deliberately written to look like it: every context here
|
|
36
|
+
* has to be derived from exactly the state the decoder will have when it reads the symbol back, so
|
|
37
|
+
* the two read as the same sequence of decisions with the arrows reversed.
|
|
38
|
+
*
|
|
39
|
+
* `levels` holds the signed quantised coefficients by raster position. On return `ctx.quant` holds
|
|
40
|
+
* what the decoder would have, so `reconstruct` can be called on it directly — which is what keeps
|
|
41
|
+
* the encoder's picture and the decoder's identical rather than merely close.
|
|
42
|
+
*
|
|
43
|
+
* ### Costing a block without coding it
|
|
44
|
+
*
|
|
45
|
+
* Passing a writer in its costing mode, and `record` of zero, runs the whole syntax against
|
|
46
|
+
* something that adds up what each symbol would cost and writes nothing, leaving the block's
|
|
47
|
+
* entropy contexts and recorded transform types untouched. That is how the encoder prices a decision: the rate it weighs
|
|
48
|
+
* is the rate of exactly these symbols through exactly these contexts, because it *is* this
|
|
49
|
+
* function. `ctx.quant` is filled either way, so a trial can still be reconstructed and measured.
|
|
50
|
+
*
|
|
51
|
+
* @param {Av1FrameContext} ctx
|
|
52
|
+
* @param {SymbolWriter} writer where the symbols go, or what prices them
|
|
53
|
+
* @param {number} record `1` to update the entropy contexts and transform types this block leaves
|
|
54
|
+
* behind, `0` for a trial that must leave no trace
|
|
55
|
+
* @param {number} plane
|
|
56
|
+
* @param {number} start_x left edge of the transform block in plane samples
|
|
57
|
+
* @param {number} start_y
|
|
58
|
+
* @param {number} tx_size
|
|
59
|
+
* @param {number} tx_type the type the coefficients were produced with
|
|
60
|
+
* @param {Int32Array} levels
|
|
61
|
+
* @param {number} levels_offset where in `levels` this transform block starts
|
|
62
|
+
* @param {number} eob one past the last coefficient in scan order that survived the quantiser, as
|
|
63
|
+
* `quantise_transform_block` returned it. Passing it rather than looking for it is worth having:
|
|
64
|
+
* finding it here means walking the scan backwards from its end, which for a 32x32 block is a
|
|
65
|
+
* thousand positions to reach an answer that is usually under a hundred
|
|
66
|
+
* @returns {number} the same end-of-block position
|
|
67
|
+
* @see AV1 spec 5.11.39 "Coefficients syntax"
|
|
68
|
+
*
|
|
69
|
+
* @author Alex Goldring
|
|
70
|
+
* @copyright Company Named Limited (c) 2026
|
|
71
|
+
*/
|
|
72
|
+
export function write_coefficients(ctx, writer, record, plane, start_x, start_y, tx_size, tx_type, levels, levels_offset, eob) {
|
|
73
|
+
const cdf = ctx.cdf;
|
|
74
|
+
|
|
75
|
+
const x4 = start_x >> 2;
|
|
76
|
+
const y4 = start_y >> 2;
|
|
77
|
+
const w4 = TX_WIDTH[tx_size] >> 2;
|
|
78
|
+
const h4 = TX_HEIGHT[tx_size] >> 2;
|
|
79
|
+
|
|
80
|
+
const tx_size_ctx = (TX_SIZE_SQR[tx_size] + TX_SIZE_SQR_UP[tx_size] + 1) >> 1;
|
|
81
|
+
const plane_type = plane > 0 ? 1 : 0;
|
|
82
|
+
|
|
83
|
+
const seg_eob = tx_size === TX_16X64 || tx_size === TX_64X16
|
|
84
|
+
? 512
|
|
85
|
+
: Math.min(1024, TX_WIDTH[tx_size] * TX_HEIGHT[tx_size]);
|
|
86
|
+
|
|
87
|
+
const scan = get_scan(tx_size, tx_type);
|
|
88
|
+
|
|
89
|
+
const quant = ctx.quant;
|
|
90
|
+
|
|
91
|
+
quant.fill(0, 0, seg_eob);
|
|
92
|
+
|
|
93
|
+
const all_zero_ctx = get_all_zero_ctx(ctx, plane, x4, y4, w4, h4, tx_size);
|
|
94
|
+
|
|
95
|
+
writer.write_symbol(eob === 0 ? 1 : 0, cdf.txb_skip, (tx_size_ctx * 13 + all_zero_ctx) * 3, 2);
|
|
96
|
+
|
|
97
|
+
let cul_level = 0;
|
|
98
|
+
let dc_category = 0;
|
|
99
|
+
|
|
100
|
+
if (eob === 0) {
|
|
101
|
+
if (record === 1) {
|
|
102
|
+
if (plane === 0) {
|
|
103
|
+
for (let i = 0; i < w4; i++) {
|
|
104
|
+
for (let j = 0; j < h4; j++) {
|
|
105
|
+
ctx.tx_types[(y4 + j) * ctx.mi_stride + x4 + i] = DCT_DCT;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
update_contexts(ctx, plane, x4, y4, w4, h4, 0, 0);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// the type is coded here, after the block is known not to be empty, because that is where the
|
|
117
|
+
// decoder reads it
|
|
118
|
+
if (plane === 0) {
|
|
119
|
+
write_transform_type(ctx, writer, record, x4, y4, tx_size, tx_type);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
ctx.plane_tx_type = tx_type;
|
|
123
|
+
|
|
124
|
+
const tx_class = get_tx_class(tx_type);
|
|
125
|
+
|
|
126
|
+
write_eob_position(ctx, writer, tx_size, tx_size_ctx, plane_type, tx_class, eob);
|
|
127
|
+
|
|
128
|
+
const adjusted = ADJUSTED_TX_SIZE[tx_size];
|
|
129
|
+
const bwl = TX_WIDTH_LOG2[adjusted];
|
|
130
|
+
const adjusted_width = 1 << bwl;
|
|
131
|
+
const adjusted_height = TX_HEIGHT[adjusted];
|
|
132
|
+
|
|
133
|
+
const br_cdf_size_ctx = Math.min(tx_size_ctx, TX_32X32);
|
|
134
|
+
|
|
135
|
+
// the magnitudes the decoder holds while it reads: capped, because anything larger is coded as
|
|
136
|
+
// a suffix in the second pass and the contexts below never see the true value
|
|
137
|
+
const cap = NUM_BASE_LEVELS + COEFF_BASE_RANGE + 1;
|
|
138
|
+
|
|
139
|
+
for (let c = eob - 1; c >= 0; c--) {
|
|
140
|
+
const pos = scan[c];
|
|
141
|
+
|
|
142
|
+
const magnitude = Math.abs(levels[levels_offset + pos]);
|
|
143
|
+
const capped = magnitude < cap ? magnitude : cap;
|
|
144
|
+
|
|
145
|
+
if (c === eob - 1) {
|
|
146
|
+
const eob_ctx = get_coeff_base_ctx(quant, tx_class, bwl, adjusted_width, adjusted_height, pos, c, 1, tx_size)
|
|
147
|
+
- SIG_COEF_CONTEXTS + SIG_COEF_CONTEXTS_EOB;
|
|
148
|
+
|
|
149
|
+
writer.write_symbol(
|
|
150
|
+
(capped < 3 ? capped : 3) - 1,
|
|
151
|
+
cdf.coeff_base_eob,
|
|
152
|
+
((tx_size_ctx * 2 + plane_type) * SIG_COEF_CONTEXTS_EOB + eob_ctx) * 4,
|
|
153
|
+
3
|
|
154
|
+
);
|
|
155
|
+
} else {
|
|
156
|
+
const base_ctx = get_coeff_base_ctx(quant, tx_class, bwl, adjusted_width, adjusted_height, pos, c, 0, tx_size);
|
|
157
|
+
|
|
158
|
+
writer.write_symbol(
|
|
159
|
+
capped < 3 ? capped : 3,
|
|
160
|
+
cdf.coeff_base,
|
|
161
|
+
((tx_size_ctx * 2 + plane_type) * SIG_COEF_CONTEXTS + base_ctx) * 5,
|
|
162
|
+
4
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (capped > NUM_BASE_LEVELS) {
|
|
167
|
+
const br_ctx = get_coeff_br_ctx(quant, tx_class, bwl, adjusted_width, adjusted_height, pos);
|
|
168
|
+
|
|
169
|
+
let remaining = capped - (NUM_BASE_LEVELS + 1);
|
|
170
|
+
|
|
171
|
+
for (let idx = 0; idx < COEFF_BASE_RANGE / (BR_CDF_SIZE - 1); idx++) {
|
|
172
|
+
const chunk = remaining < BR_CDF_SIZE - 1 ? remaining : BR_CDF_SIZE - 1;
|
|
173
|
+
|
|
174
|
+
writer.write_symbol(
|
|
175
|
+
chunk,
|
|
176
|
+
cdf.coeff_br,
|
|
177
|
+
((br_cdf_size_ctx * 2 + plane_type) * 21 + br_ctx) * 5,
|
|
178
|
+
4
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
remaining -= chunk;
|
|
182
|
+
|
|
183
|
+
if (chunk < BR_CDF_SIZE - 1) {
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
quant[pos] = capped;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const dc_sign_ctx = get_dc_sign_ctx(ctx, plane, x4, y4, w4, h4);
|
|
193
|
+
|
|
194
|
+
for (let c = 0; c < eob; c++) {
|
|
195
|
+
const pos = scan[c];
|
|
196
|
+
|
|
197
|
+
const level = levels[levels_offset + pos];
|
|
198
|
+
const magnitude = Math.abs(level);
|
|
199
|
+
|
|
200
|
+
const sign = level < 0 ? 1 : 0;
|
|
201
|
+
|
|
202
|
+
if (magnitude !== 0) {
|
|
203
|
+
if (c === 0) {
|
|
204
|
+
writer.write_symbol(sign, cdf.dc_sign, (plane_type * 3 + dc_sign_ctx) * 3, 2);
|
|
205
|
+
} else {
|
|
206
|
+
writer.write_bool(sign);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (quant[pos] > NUM_BASE_LEVELS + COEFF_BASE_RANGE) {
|
|
211
|
+
write_golomb(writer, magnitude - (NUM_BASE_LEVELS + COEFF_BASE_RANGE));
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (pos === 0 && magnitude > 0) {
|
|
215
|
+
dc_category = sign !== 0 ? 1 : 2;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
cul_level += magnitude;
|
|
219
|
+
|
|
220
|
+
quant[pos] = level;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
cul_level = Math.min(63, cul_level);
|
|
224
|
+
|
|
225
|
+
if (record === 1) {
|
|
226
|
+
update_contexts(ctx, plane, x4, y4, w4, h4, cul_level, dc_category);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return eob;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Write the end-of-block position, which is coded as a bucket and then the offset within it.
|
|
234
|
+
*
|
|
235
|
+
* @param {Av1FrameContext} ctx
|
|
236
|
+
* @param {SymbolWriter} writer
|
|
237
|
+
* @param {number} tx_size
|
|
238
|
+
* @param {number} tx_size_ctx
|
|
239
|
+
* @param {number} plane_type
|
|
240
|
+
* @param {number} tx_class
|
|
241
|
+
* @param {number} eob
|
|
242
|
+
*/
|
|
243
|
+
function write_eob_position(ctx, writer, tx_size, tx_size_ctx, plane_type, tx_class, eob) {
|
|
244
|
+
const cdf = ctx.cdf;
|
|
245
|
+
|
|
246
|
+
// the bucket is the position of the top set bit, offset so that one and two get buckets of
|
|
247
|
+
// their own
|
|
248
|
+
let eob_pt = 1;
|
|
249
|
+
|
|
250
|
+
while (eob_pt < 11 && eob > bucket_base(eob_pt)) {
|
|
251
|
+
eob_pt++;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const eob_multisize = Math.min(TX_WIDTH_LOG2[tx_size], 5) + Math.min(TX_HEIGHT_LOG2[tx_size], 5) - 4;
|
|
255
|
+
|
|
256
|
+
const eob_class_ctx = tx_class === TX_CLASS_2D ? 0 : 1;
|
|
257
|
+
|
|
258
|
+
if (eob_multisize === 0) {
|
|
259
|
+
writer.write_symbol(eob_pt - 1, cdf.eob_pt_16, ((plane_type * 2) + eob_class_ctx) * 6, 5);
|
|
260
|
+
} else if (eob_multisize === 1) {
|
|
261
|
+
writer.write_symbol(eob_pt - 1, cdf.eob_pt_32, ((plane_type * 2) + eob_class_ctx) * 7, 6);
|
|
262
|
+
} else if (eob_multisize === 2) {
|
|
263
|
+
writer.write_symbol(eob_pt - 1, cdf.eob_pt_64, ((plane_type * 2) + eob_class_ctx) * 8, 7);
|
|
264
|
+
} else if (eob_multisize === 3) {
|
|
265
|
+
writer.write_symbol(eob_pt - 1, cdf.eob_pt_128, ((plane_type * 2) + eob_class_ctx) * 9, 8);
|
|
266
|
+
} else if (eob_multisize === 4) {
|
|
267
|
+
writer.write_symbol(eob_pt - 1, cdf.eob_pt_256, ((plane_type * 2) + eob_class_ctx) * 10, 9);
|
|
268
|
+
} else if (eob_multisize === 5) {
|
|
269
|
+
writer.write_symbol(eob_pt - 1, cdf.eob_pt_512, plane_type * 11, 10);
|
|
270
|
+
} else {
|
|
271
|
+
writer.write_symbol(eob_pt - 1, cdf.eob_pt_1024, plane_type * 12, 11);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const base = bucket_base(eob_pt - 1) + 1;
|
|
275
|
+
|
|
276
|
+
let remainder = eob - base;
|
|
277
|
+
|
|
278
|
+
let eob_shift = Math.max(-1, eob_pt - 3);
|
|
279
|
+
|
|
280
|
+
if (eob_shift < 0) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const extra = (remainder >> eob_shift) & 1;
|
|
285
|
+
|
|
286
|
+
writer.write_symbol(
|
|
287
|
+
extra,
|
|
288
|
+
cdf.eob_extra,
|
|
289
|
+
((tx_size_ctx * 2 + plane_type) * 9 + (eob_pt - 3)) * 3,
|
|
290
|
+
2
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
for (let i = 1; i < Math.max(0, eob_pt - 2); i++) {
|
|
294
|
+
eob_shift = Math.max(0, eob_pt - 2) - 1 - i;
|
|
295
|
+
|
|
296
|
+
writer.write_bool((remainder >> eob_shift) & 1);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* The largest end-of-block position a bucket covers.
|
|
302
|
+
*
|
|
303
|
+
* @param {number} eob_pt
|
|
304
|
+
* @returns {number}
|
|
305
|
+
*/
|
|
306
|
+
function bucket_base(eob_pt) {
|
|
307
|
+
if (eob_pt < 1) {
|
|
308
|
+
return 0;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
if (eob_pt < 2) {
|
|
312
|
+
return eob_pt;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return (1 << (eob_pt - 1));
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Write the Exp-Golomb suffix for a coefficient beyond the range the base symbols reach.
|
|
320
|
+
*
|
|
321
|
+
* @param {SymbolWriter} writer
|
|
322
|
+
* @param {number} value at least one
|
|
323
|
+
*/
|
|
324
|
+
function write_golomb(writer, value) {
|
|
325
|
+
let length = 0;
|
|
326
|
+
|
|
327
|
+
for (let probe = value; probe > 0; probe >>= 1) {
|
|
328
|
+
length++;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
for (let i = 0; i < length - 1; i++) {
|
|
332
|
+
writer.write_bool(0);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
writer.write_bool(1);
|
|
336
|
+
|
|
337
|
+
for (let i = length - 2; i >= 0; i--) {
|
|
338
|
+
writer.write_bool((value >> i) & 1);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* @param {Av1FrameContext} ctx
|
|
344
|
+
* @param {number} plane
|
|
345
|
+
* @param {number} x4
|
|
346
|
+
* @param {number} y4
|
|
347
|
+
* @param {number} w4
|
|
348
|
+
* @param {number} h4
|
|
349
|
+
* @param {number} cul_level
|
|
350
|
+
* @param {number} dc_category
|
|
351
|
+
*/
|
|
352
|
+
function update_contexts(ctx, plane, x4, y4, w4, h4, cul_level, dc_category) {
|
|
353
|
+
const above_level = ctx.above_level_context[plane];
|
|
354
|
+
const above_dc = ctx.above_dc_context[plane];
|
|
355
|
+
const left_level = ctx.left_level_context[plane];
|
|
356
|
+
const left_dc = ctx.left_dc_context[plane];
|
|
357
|
+
|
|
358
|
+
for (let i = 0; i < w4; i++) {
|
|
359
|
+
above_level[x4 + i] = cul_level;
|
|
360
|
+
above_dc[x4 + i] = dc_category;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
for (let i = 0; i < h4; i++) {
|
|
364
|
+
left_level[y4 + i] = cul_level;
|
|
365
|
+
left_dc[y4 + i] = dc_category;
|
|
366
|
+
}
|
|
367
|
+
}
|