Pure MoonBit AV1 and AVIF decoder for native, JavaScript, and WebAssembly GC.
moon add 0717lee/moonav1@0.2.0import {
"0717lee/moonav1",
}git clone https://github.com/0717lee/moonav1.git
cd moonav1
moon run examples/decode --target jsfn decode_image(bytes : Array[Byte]) -> @moonav1.Image? {
@moonav1.avif_decode_rgba(bytes)
}| 用途 | 接口 |
|---|---|
| AVIF 主图与 alpha/grid | avif_decode_rgba |
| AVIF 主图,不合成辅助 alpha | avif_decode |
| AVIF 动画与时间选择 | avif_decode_animation、avif_animation_frame_at |
| 原始 AV1 首个呈现 | av1_decode |
| 跨 temporal unit 的解码状态 | av1_video_decoder、av1_video_decode_temporal_unit |
| 容器/序列信息 | avif_container_parse、av1_sequence_info |
| 原生像素与动画 | av1_decode_native、avif_decode_native、avif_decode_animation_native |
| RGBA16 输出 | av1_decode_rgba16、avif_decode_rgba16、Av1NativeFrame::to_rgba16 |
| 流式与惰性解码 | Av1StreamDecoder、AvifAnimationDecoder |
| 诊断与资源限额 | av1_decode_native_result、avif_decode_native_result、DecodeLimits |
| 容器解码与定位 | Av1ContainerDecoder、Av1ContainerStreamDecoder、Av1PresentationTimeline |
| 色彩管理与 HDR | IccProfile、IccTransformOptions、Av1NativeFrame::to_sdr_rgba16 |
| 分数裁剪与重采样 | AvifMetadata::resample_rgba8、resample_rgba16 |
moon version --all
moon check
moon build
moon test --target js
moon test --target wasm-gc
moon test --target nativepub(all) struct Av1CdefParams {
primary_strength : Int
secondary_strength : Int
damping : Int
direction : Int
}pub struct Av1ContainerDecoder {
// private fields
}fn Av1ContainerDecoder::new(data : Array[Byte], format? : Av1ContainerFormat?, track_id? : Int64?, limits? : DecodeLimits) -> Result[Av1ContainerDecoder, DecodeError]fn Av1ContainerDecoder::next_frame(self : Av1ContainerDecoder) -> Result[Av1ContainerFrame?, DecodeError]fn Av1ContainerDecoder::presentation_timeline(self : Av1ContainerDecoder) -> Result[Av1PresentationTimeline, DecodeError]fn Av1ContainerDecoder::seek_timestamp(self : Av1ContainerDecoder, requested_timestamp : Int64) -> Result[Av1ContainerSeekResult, DecodeError]pub struct Av1ContainerFrame {
packet_index : Int
timestamp : Int64?
duration : Int64?
timescale : Int64
frame : Av1NativeFrame
}pub struct Av1ContainerFrameBatch {
frames : Array[Av1ContainerFrame]
status : Av1ContainerStreamStatus
}pub struct Av1ContainerSeekResult {
requested_timestamp : Int64
outcome : Av1ContainerSeekOutcome
frame : Av1ContainerFrame?
}pub struct Av1ContainerStream {
// private fields
}fn Av1ContainerStream::feed(self : Av1ContainerStream, chunk : Array[Byte]) -> Result[Av1ContainerPacketBatch, DecodeError]fn Av1ContainerStream::finish(self : Av1ContainerStream) -> Result[Av1ContainerPacketBatch, DecodeError]fn Av1ContainerStream::new(format? : Av1ContainerFormat?, track_id? : Int64?, limits? : DecodeLimits) -> Result[Av1ContainerStream, DecodeError]pub struct Av1ContainerStreamDecoder {
// private fields
}fn Av1ContainerStreamDecoder::feed(self : Av1ContainerStreamDecoder, chunk : Array[Byte]) -> Result[Av1ContainerFrameBatch, DecodeError]fn Av1ContainerStreamDecoder::finish(self : Av1ContainerStreamDecoder) -> Result[Av1ContainerFrameBatch, DecodeError]fn Av1ContainerStreamDecoder::new(format? : Av1ContainerFormat?, track_id? : Int64?, limits? : DecodeLimits) -> Result[Av1ContainerStreamDecoder, DecodeError]fn Av1ContainerStreamDecoder::track_info(self : Av1ContainerStreamDecoder) -> Av1ContainerStreamInfo?pub struct Av1ContainerStreamInfo {
format : Av1ContainerFormat
track_id : Int64
width : Int
height : Int
timescale : Int64
movie_timescale : Int64?
edits : Array[Av1TrackEdit]
codec_initialization : Array[Byte]
}pub struct Av1DemuxedTrack {
format : Av1ContainerFormat
track_id : Int64
width : Int
height : Int
timescale : Int64
movie_timescale : Int64?
edits : Array[Av1TrackEdit]
codec_initialization : Array[Byte]
packets : Array[Av1Packet]
}pub(all) struct Av1FilmGrainParams {
apply_grain : Bool
grain_seed : Int
num_y_points : Int
point_y_value : Array[Int]
point_y_scaling : Array[Int]
chroma_scaling_from_luma : Bool
num_cb_points : Int
point_cb_value : Array[Int]
point_cb_scaling : Array[Int]
num_cr_points : Int
point_cr_value : Array[Int]
point_cr_scaling : Array[Int]
grain_scaling_minus8 : Int
ar_coeff_lag : Int
ar_coeffs_y : Array[Int]
ar_coeffs_cb : Array[Int]
ar_coeffs_cr : Array[Int]
ar_coeff_shift_minus6 : Int
grain_scale_shift : Int
cb_mult : Int
cb_luma_mult : Int
cb_offset : Int
cr_mult : Int
cr_luma_mult : Int
cr_offset : Int
overlap_flag : Bool
clip_to_restricted_range : Bool
}pub(all) struct Av1FrameHeaderInfo {
frame_width : Int
upscaled_width : Int
frame_height : Int
superres_denom : Int
header_bytes : Int
tile_payload : Array[Byte]
base_q_idx : Int
quant_matrix : Av1QuantMatrix?
delta_lf_res : Int
delta_lf_multi : Bool
tile_cols : Int
tile_rows : Int
tile_cols_log2 : Int
tile_rows_log2 : Int
tile_col_starts_sb : Array[Int]
tile_row_starts_sb : Array[Int]
tile_size_bytes : Int
context_update_tile_id : Int
tx_mode_select : Bool
reduced_tx_set : Bool
coded_lossless : Bool
cdef : Av1CdefConfig?
loop_filter : Av1LoopFilterConfig?
restoration : Av1RestorationConfig?
disable_cdf_update : Bool
allow_screen_content_tools : Bool
film_grain : Av1FilmGrainParams?
quant_deltas : Av1QuantDeltas
delta_q_present : Bool
delta_q_res : Int
delta_lf_present : Bool
segmentation : Av1SegmentationParams
frame_type : Int
frame_is_intra : Bool
show_frame : Bool
show_existing_frame : Bool
frame_to_show_map_idx : Int
error_resilient : Bool
showable_frame : Bool
disable_frame_end_update_cdf : Bool
force_integer_mv : Int
current_frame_id : Int
order_hint : Int
primary_ref_frame : Int
refresh_frame_flags : Int
ref_frame_idx : Array[Int]
order_hints : Array[Int]
ref_frame_sign_bias : Array[Int]
allow_high_precision_mv : Bool
interpolation_filter : Int
is_motion_mode_switchable : Bool
use_ref_frame_mvs : Bool
allow_warped_motion : Bool
reference_select : Bool
skip_mode_present : Bool
skip_mode_frame : Array[Int]
gm_type : Array[Int]
gm_params : Array[Array[Int]]
prev_gm_params : Array[Array[Int]]
loop_filter_ref_deltas : Array[Int]
loop_filter_mode_deltas : Array[Int]
allow_intrabc : Bool
render_width : Int
render_height : Int
}pub(all) struct Av1FrameInfo {
key_frame : Bool
show_frame : Bool
payload_size : Int
}pub(all) struct Av1FrameMap {
slots : Array[Av1RefFrame?]
valid : Array[Bool]
order_hints : Array[Int]
frame_types : Array[Int]
frame_ids : Array[Int]
upscaled_widths : Array[Int]
frame_widths : Array[Int]
frame_heights : Array[Int]
render_widths : Array[Int]
render_heights : Array[Int]
saved_gm_params : Array[Array[Array[Int]]]
saved_loop_filter_ref_deltas : Array[Array[Int]]
saved_loop_filter_mode_deltas : Array[Array[Int]]
saved_segmentation : Array[Av1SegmentationParams]
saved_segment_ids : Array[Array[Int]]
saved_film_grain : Array[Av1FilmGrainParams?]
saved_showable : Array[Bool]
current_frame_id : Int
has_frame_id : Bool
saved_cdfs : Av1FrameCdfs?
}pub(all) struct Av1InterBlock {
mi_row : Int
mi_col : Int
width4 : Int
height4 : Int
block_width : Int
block_height : Int
size_index : Int
avail_u : Bool
avail_l : Bool
skip : Int
skip_mode : Bool
segment_ref : Int
segment_skip : Bool
segment_global : Bool
is_inter : Bool
y_mode : Int
ref_frame : Int
ref_frame1 : Int
mv_row : Int
mv_col : Int
mv_row1 : Int
mv_col1 : Int
interintra : Int
interintra_mode : Int
wedge_interintra : Int
wedge_index_ii : Int
compound_type : Int
compound_idx : Int
comp_group_idx : Int
wedge_index : Int
wedge_sign : Int
mask_type : Int
interp_vertical : Int
interp_horizontal : Int
ref_mv_idx : Int
motion_mode : Int
warp : Array[Av1WarpModel]
}pub(all) struct Av1InterFrame {
field : Av1MotionField
frame : Av1MvFrame
refs : Array[Av1RefFrame?]
interpolation_filter : Int
enable_dual_filter : Bool
skip_mode_present : Bool
skip_mode_frame : Array[Int]
reference_select : Bool
enable_interintra_compound : Bool
ref_distances : Array[Int]
enable_masked_compound : Bool
enable_jnt_comp : Bool
mi_cols : Int
mi_rows : Int
}pub(all) struct Av1LoopFilterBlockMap {
cols : Int
rows : Int
segment_ids : Array[Int]
deltas : Array[Int]
segmentation : Av1SegmentationParams
}pub(all) struct Av1MotionField {
cols : Int
rows : Int
width4 : Array[Int]
height4 : Array[Int]
y_modes : Array[Int]
is_inter : Array[Bool]
written : Array[Bool]
skips : Array[Int]
skip_modes : Array[Int]
tx_width : Array[Int]
tx_height : Array[Int]
tx_types : Array[Int]
interp_v : Array[Int]
interp_h : Array[Int]
refs : Array[Int]
mv_rows : Array[Int]
mv_cols : Array[Int]
compound_idxs : Array[Int]
comp_group_idxs : Array[Int]
}pub(all) struct Av1MotionRequest {
reference : Av1RefFrame
frame_width : Int
frame_height : Int
plane : Int
x : Int
y : Int
width : Int
height : Int
mv_row : Int
mv_col : Int
filter_vertical : Int
filter_horizontal : Int
compound : Bool
}pub(all) struct Av1MvBlock {
mi_row : Int
mi_col : Int
width4 : Int
height4 : Int
block_width : Int
block_height : Int
refs : Array[Int]
tile_row_start : Int
tile_row_end : Int
tile_col_start : Int
tile_col_end : Int
}pub(all) struct Av1MvFrame {
allow_high_precision_mv : Bool
use_ref_frame_mvs : Bool
force_integer_mv : Int
is_motion_mode_switchable : Bool
allow_warped_motion : Bool
gm_type : Array[Int]
gm_params : Array[Array[Int]]
ref_frame_sign_bias : Array[Int]
frame_width : Int
frame_height : Int
temporal : Av1MotionFieldGrid?
}pub(all) struct Av1MvStack {
mv_rows : Array[Int]
mv_cols : Array[Int]
weights : Array[Int]
count : Int
newmv_count : Int
found_match : Int
close_matches : Int
total_matches : Int
zero_mv_context : Int
newmv_context : Int
refmv_context : Int
drl_contexts : Array[Int]
global_rows : Array[Int]
global_cols : Array[Int]
}pub struct Av1NativeFrame {
width : Int
height : Int
bit_depth : Int
subsampling_x : Bool
subsampling_y : Bool
full_range : Bool
matrix_coefficients : Int
color_primaries : Int
transfer_characteristics : Int
planes : FixedArray[Av1PixelPlane]
}fn Av1NativeFrame::copy_plane_into(self : Av1NativeFrame, plane : Int, destination : FixedArray[Byte], row_bytes : Int, packing : PixelPacking, offset? : Int) -> Result[Unit, DecodeError]fn Av1NativeFrame::to_rgba16_into(self : Av1NativeFrame, destination : FixedArray[UInt16], row_stride : Int, offset? : Int) -> Result[Unit, DecodeError]fn Av1NativeFrame::to_sdr_rgba16(self : Av1NativeFrame, options? : HdrToneMapOptions) -> Result[Image16, DecodeError]pub struct Av1Packet {
data : Array[Byte]
presentation_timestamp : Int64?
decode_timestamp : Int64?
duration : Int64?
sync_sample : Bool?
}pub struct Av1PixelPlane {
width : Int
height : Int
data : FixedArray[Int]
}pub struct Av1PresentationTimeline {
// private fields
}fn Av1PresentationTimeline::map_movie_time(self : Av1PresentationTimeline, movie_time : Int64) -> Result[Av1PresentationPoint, DecodeError]fn Av1PresentationTimeline::new(track : Av1DemuxedTrack) -> Result[Av1PresentationTimeline, DecodeError]pub(all) struct Av1QuantDeltas {
y_dc : Int
u_dc : Int
u_ac : Int
v_dc : Int
v_ac : Int
}pub(all) struct Av1RefFrame {
planes : Array[Array[Int]]
coded_width : Int
coded_height : Int
width : Int
height : Int
sub_x : Int
sub_y : Int
bit_depth : Int
frame_width : Int
upscaled_width : Int
frame_height : Int
render_width : Int
render_height : Int
order_hint : Int
frame_type : Int
frame_id : Int
order_hints : Array[Int]
gm_params : Array[Array[Int]]
loop_filter_ref_deltas : Array[Int]
loop_filter_mode_deltas : Array[Int]
cdfs : Av1FrameCdfs?
mf_refs : Array[Int]
mf_mvs : Array[Int]
mi_cols : Int
mi_rows : Int
saved_order_hints : Array[Int]
}pub(all) struct Av1RestorationLayout {
config : Av1RestorationConfig
frame_width : Int
upscaled_width : Int
frame_height : Int
superres_denom : Int
unit_cols : Array[Int]
unit_rows : Array[Int]
}pub(all) struct Av1RestorationSourceView {
store : Av1RestorationStripeStore
frame : Array[Array[Int]]
frame_strides : Array[Int]
}pub(all) struct Av1RestorationUnitRecord {
plane : Int
unit_row : Int
unit_col : Int
unit : Av1RestorationUnit
}pub(all) struct Av1SbBlock {
row : Int
col : Int
width : Int
height : Int
}pub(all) enum Av1SbPartition {
Av1SbPartitionNone
Av1SbPartitionHorz
Av1SbPartitionVert
Av1SbPartitionSplit
Av1SbPartitionHorzA
Av1SbPartitionHorzB
Av1SbPartitionVertA
Av1SbPartitionVertB
Av1SbPartitionHorz4
Av1SbPartitionVert4
}pub(all) struct Av1SbPartitionNode {
row : Int
col : Int
size : Int
frame_width : Int
frame_height : Int
}pub(all) struct Av1SequenceInfo {
profile : Int
width : Int
height : Int
bit_depth : Int
monochrome : Bool
subsampling_x : Bool
subsampling_y : Bool
reduced_still_picture_header : Bool
use_128x128_superblock : Bool
enable_filter_intra : Bool
enable_intra_edge_filter : Bool
enable_superres : Bool
enable_cdef : Bool
enable_restoration : Bool
full_range : Bool
separate_uv_delta_q : Bool
film_grain_params_present : Bool
color_primaries : Int
transfer_characteristics : Int
matrix_coefficients : Int
still_picture : Bool
enable_order_hint : Bool
order_hint_bits : Int
enable_ref_frame_mvs : Bool
enable_warped_motion : Bool
enable_dual_filter : Bool
enable_jnt_comp : Bool
enable_masked_compound : Bool
enable_interintra_compound : Bool
seq_force_screen_content_tools : Int
seq_force_integer_mv : Int
frame_id_numbers_present : Bool
delta_frame_id_length_minus_2 : Int
additional_frame_id_length_minus_1 : Int
decoder_model_info_present : Bool
equal_picture_interval : Bool
buffer_delay_length_minus_1 : Int
buffer_removal_time_length_minus_1 : Int
frame_presentation_time_length_minus_1 : Int
operating_points_cnt_minus_1 : Int
operating_point_idc : Array[Int]
decoder_model_present_for_this_op : Array[Bool]
frame_width_bits_minus_1 : Int
frame_height_bits_minus_1 : Int
}pub(all) struct Av1ShowExistingFrameConfig {
decoder_model_info_present : Bool
equal_picture_interval : Bool
frame_presentation_time_length_minus_1 : Int
frame_id_numbers_present : Bool
additional_frame_id_len_minus1 : Int
delta_frame_id_length_minus2 : Int
reference_frame_types : Array[Int]
}pub(all) struct Av1ShowExistingFrameEnvelope {
show_existing_frame : Bool
frame_to_show_map_idx : Int
reference_frame_type : Int
frame_presentation_time : Int64?
display_frame_id : Int?
header_bits : Int
header_bytes : Int
}pub(all) struct Av1Stage1Input {
width : Int
frame_width : Int
superres_denom : Int
height : Int
bit_depth : Int
monochrome : Bool
header_bytes : Int
base_q_idx : Int
disable_cdf_update : Bool
allow_screen_content_tools : Bool
tx_mode_select : Bool
reduced_tx_set : Bool
cdef : Av1CdefConfig?
loop_filter : Av1LoopFilterConfig?
restoration : Av1RestorationConfig?
tile_cols : Int
tile_rows : Int
tile_cols_log2 : Int
tile_rows_log2 : Int
tile_col_starts_sb : Array[Int]
tile_row_starts_sb : Array[Int]
tile_size_bytes : Int
enable_filter_intra : Bool
enable_intra_edge_filter : Bool
full_range : Bool
matrix_coefficients : Int
use_128x128_superblock : Bool
tile_payload : Array[Byte]
film_grain : Av1FilmGrainParams?
quant_deltas : Av1QuantDeltas
}pub struct Av1StreamDecoder {
// private fields
}fn Av1StreamDecoder::end_temporal_unit(self : Av1StreamDecoder) -> Result[Av1StreamBatch, DecodeError]fn Av1StreamDecoder::feed(self : Av1StreamDecoder, chunk : Array[Byte]) -> Result[Av1StreamBatch, DecodeError]fn Av1StreamDecoder::new(limits? : DecodeLimits, allow_monochrome? : Bool) -> Result[Av1StreamDecoder, DecodeError]pub(all) struct Av1TilePayload {
index : Int
row : Int
col : Int
offset : Int
length : Int
bytes : Array[Byte]
}pub struct Av1TrackEdit {
duration : Int64
media_time : Int64
media_rate : Int
}pub(all) struct Av1TxNode {
row : Int
col : Int
width : Int
height : Int
}pub(all) enum Av1TxPartition {
Av1TxNone
Av1TxSplit
Av1TxHorz
Av1TxVert
}pub(all) enum Av1TxType {
Av1TxDctDct
Av1TxAdstDct
Av1TxDctAdst
Av1TxAdstAdst
Av1TxFlipadstDct
Av1TxDctFlipadst
Av1TxFlipadstFlipadst
Av1TxAdstFlipadst
Av1TxFlipadstAdst
Av1TxIdentityIdentity
Av1TxIdentityDct
Av1TxDctIdentity
Av1TxVerticalDct
Av1TxHorizontalDct
Av1TxVerticalAdst
Av1TxHorizontalAdst
Av1TxVerticalFlipadst
Av1TxHorizontalFlipadst
}pub struct AvifAlphaExtent {
offset : Int
length : Int
construction_method : Int
}pub struct AvifAlphaItemDescriptor {
item_id : Int
width : Int
height : Int
bit_depth : Int
auxiliary_property : Bool
premultiplied : Bool
extents : Array[AvifAlphaExtent]
}pub struct AvifAnimationDecoder {
// private fields
}fn AvifAnimationDecoder::frame_timing(self : AvifAnimationDecoder, index : Int) -> Result[AvifAnimationFrame, DecodeError]fn AvifAnimationDecoder::is_keyframe(self : AvifAnimationDecoder, index : Int) -> Result[Bool, DecodeError]fn AvifAnimationDecoder::nearest_keyframe(self : AvifAnimationDecoder, index : Int) -> Result[Int?, DecodeError]fn AvifAnimationDecoder::new(data : Array[Byte], limits? : DecodeLimits) -> Result[AvifAnimationDecoder, DecodeError]fn AvifAnimationDecoder::next_frame(self : AvifAnimationDecoder) -> Result[AvifNativeAnimationFrame?, DecodeError]fn AvifAnimationDecoder::seek_frame(self : AvifAnimationDecoder, index : Int) -> Result[AvifNativeAnimationFrame, DecodeError]pub struct AvifAnimationFrame {
index : Int
offset : Int
length : Int
timestamp : Int
duration : Int
timescale : Int
}pub struct AvifAnimationPixelFrame {
index : Int
timestamp : Int
duration : Int
timescale : Int
image : Image
}pub struct AvifContainer {
width : Int
height : Int
bit_depth : Int
monochrome : Bool
subsampling_x : Bool
subsampling_y : Bool
yuv420 : Bool
has_alpha : Bool
av1c : Array[Byte]
payload : Array[Byte]
operating_point : Int
spatial_layer : Int?
nclx_primaries : Int?
nclx_transfer : Int?
nclx_matrix : Int?
nclx_full_range : Bool?
}pub(all) enum AvifDisplayTransform {
Crop(AvifCleanAperture)
Rotate(Int)
Mirror(Int)
} derive(Eq, Debug)pub struct AvifGridDescriptor {
item_id : Int
rows : Int
columns : Int
output_width : Int
output_height : Int
tiles : Array[AvifGridTile]
}pub struct AvifGridExtent {
offset : Int
length : Int
construction_method : Int
}pub struct AvifMetadata {
primary_item_id : Int?
track_id : Int?
icc : FixedArray[Byte]?
exif : FixedArray[Byte]?
exif_tiff_offset : Int?
xmp : FixedArray[Byte]?
pixel_aspect_ratio : (Int64, Int64)?
transforms : FixedArray[AvifDisplayTransform]
}fn AvifMetadata::display_size(self : AvifMetadata, width : Int, height : Int) -> Result[(Int, Int), DecodeError]fn AvifMetadata::resample_rgba16(self : AvifMetadata, image : Image16, width : Int, height : Int) -> Result[Image16, DecodeError]fn AvifMetadata::resample_rgba8(self : AvifMetadata, image : Image, width : Int, height : Int) -> Result[Image, DecodeError]fn AvifNativeAnimation::frame_at(self : AvifNativeAnimation, timestamp : Int) -> AvifNativeAnimationFrame?pub struct AvifNativeAnimationFrame {
index : Int
timestamp : Int
duration : Int
timescale : Int
image : AvifNativeImage
}fn AvifNativeImage::to_rgba16_into(self : AvifNativeImage, destination : FixedArray[UInt16], row_stride : Int, offset? : Int) -> Result[Unit, DecodeError]fn AvifNativeImage::to_sdr_rgba16(self : AvifNativeImage, options? : HdrToneMapOptions) -> Result[Image16, DecodeError]pub struct DecodeError {
kind : DecodeErrorKind
byte_offset : Int64?
context : String
message : String
} derive(Eq, Debug)pub(all) struct DecodeLimits {
max_input_bytes : Int
max_frame_pixels : Int
max_total_pixels : Int
max_frames : Int
}fn DecodeLimits::av1_video_decode_frame(self : DecodeLimits, decoder : Av1VideoDecoder, data : Array[Byte], allow_monochrome? : Bool) -> Image?fn DecodeLimits::av1_video_decode_temporal_unit(self : DecodeLimits, decoder : Av1VideoDecoder, data : Array[Byte], allow_monochrome? : Bool) -> Array[Image]?fn DecodeLimits::av1_video_decode_temporal_unit_native(self : DecodeLimits, decoder : Av1VideoDecoder, data : Array[Byte], allow_monochrome? : Bool) -> Array[Av1NativeFrame]?fn DecodeLimits::avif_alpha_item_descriptor(self : DecodeLimits, data : Array[Byte]) -> AvifAlphaItemDescriptor?fn DecodeLimits::avif_decode_animation(self : DecodeLimits, data : Array[Byte]) -> AvifAnimationPixels?fn DecodeLimits::avif_decode_animation_frame(self : DecodeLimits, data : Array[Byte], timestamp : Int) -> Image?fn DecodeLimits::avif_decode_animation_frames(self : DecodeLimits, descriptor : AvifAnimationDescriptor, samples : Array[Array[Byte]]) -> AvifAnimationPixels?fn DecodeLimits::avif_decode_animation_native(self : DecodeLimits, data : Array[Byte]) -> AvifNativeAnimation?fn DecodeLimits::avif_decode_animation_samples(self : DecodeLimits, timescale : Int, timestamps : Array[Int], durations : Array[Int], samples : Array[Array[Byte]]) -> AvifAnimationPixels?fn DecodeLimits::avif_decode_grid(self : DecodeLimits, data : Array[Byte], descriptor : AvifGridDescriptor) -> Image?fn DecodeLimits::avif_decode_grid_tiles(self : DecodeLimits, rows : Int, columns : Int, output_width : Int, output_height : Int, samples : Array[Array[Byte]]) -> Image?pub(all) struct HdrToneMapOptions {
peak_luminance_nits : Double
reference_white_nits : Double
exposure_stops : Double
}pub struct IccProfile {
// private fields
}fn IccProfile::apply_rgba16_with_options(self : IccProfile, image : Image16, options : IccTransformOptions) -> Result[Image16, DecodeError]fn IccProfile::apply_rgba8_with_options(self : IccProfile, image : Image, options : IccTransformOptions) -> Result[Image, DecodeError]pub(all) enum IccRenderingIntent {
Perceptual
RelativeColorimetric
Saturation
AbsoluteColorimetric
}fn IccTransformOptions::new(intent : IccRenderingIntent, black_point_compensation : Bool) -> IccTransformOptionspub(all) struct Image {
width : Int
height : Int
data : FixedArray[Byte]
}pub struct Image16 {
width : Int
height : Int
data : FixedArray[UInt16]
}fn Image16::copy_bytes_into(self : Image16, destination : FixedArray[Byte], row_bytes : Int, big_endian? : Bool, offset? : Int) -> Result[Unit, DecodeError]fn av1_apply_film_grain_planes(planes : Array[Array[Int]], width : Int, height : Int, bit_depth : Int, monochrome : Bool, subsampling_x : Bool, subsampling_y : Bool, matrix_coefficients : Int, fg : Av1FilmGrainParams) -> Unit?fn av1_cdef_filter_plane(width : Int, height : Int, plane : Array[Int], params : Array[Av1CdefParams], bit_depth? : Int) -> Array[Int]?fn av1_cdef_filter_yuv420(width : Int, height : Int, y : Array[Int], u : Array[Int], v : Array[Int], y_params : Array[Av1CdefParams], uv_params : Array[Av1CdefParams], bit_depth? : Int) -> (Array[Int], Array[Int], Array[Int])?fn av1_coeff_base_default(q_context : Int, tx_context : Int, plane : Int, coeff_context : Int) -> Array[Int]fn av1_coeff_base_eob_default(q_context : Int, tx_context : Int, plane : Int, eob_context : Int) -> Array[Int]fn av1_coeff_br_default(q_context : Int, tx_context : Int, plane : Int, br_context : Int) -> Array[Int]fn av1_coeff_eob_extra_default(q_context : Int, tx_context : Int, plane : Int, eob_context : Int) -> Array[Int]fn av1_coeff_eob_small_default(kind : Int, q_context : Int, plane : Int, tx_class : Int) -> Array[Int]fn av1_decode_alpha_tile(width : Int, height : Int, tile_payload : Array[Byte], base_q_idx : Int, use_128x128_superblock? : Bool, allow_screen_content_tools? : Bool, bit_depth? : Int, disable_cdf_update? : Bool, tx_mode_select? : Bool, reduced_tx_set? : Bool, enable_filter_intra? : Bool, enable_intra_edge_filter? : Bool, cdef? : Av1CdefConfig?, loop_filter? : Av1LoopFilterConfig?, restoration? : Av1RestorationConfig?, upscaled_width? : Int, quant_deltas? : Av1QuantDeltas) -> Array[Byte]?fn av1_decode_dc_tile(width : Int, height : Int, tile_payload : Array[Byte], base_q_idx : Int, disable_cdf_update? : Bool, full_range? : Bool, matrix_coefficients? : Int, use_128x128_superblock? : Bool, bit_depth? : Int, allow_screen_content_tools? : Bool, tx_mode_select? : Bool, reduced_tx_set? : Bool, enable_filter_intra? : Bool, enable_intra_edge_filter? : Bool, cdef? : Av1CdefConfig?, loop_filter? : Av1LoopFilterConfig?, restoration? : Av1RestorationConfig?, upscaled_width? : Int, superres_denom? : Int) -> Image?fn av1_decode_native_result(data : Array[Byte], limits? : DecodeLimits) -> Result[Av1NativeFrame, DecodeError]fn av1_decode_partition_leaves(tile_payload : Array[Byte], frame_width : Int, frame_height : Int, disable_cdf_update? : Bool, use_128x128_superblock? : Bool) -> Array[Av1SbBlock]?fn av1_decode_rgba16_result(data : Array[Byte], limits? : DecodeLimits) -> Result[Image16, DecodeError]fn av1_decode_show_existing_frame(frame_payload : Array[Byte], state : Av1ReferenceState, config : Av1ShowExistingFrameConfig) -> Image?fn av1_decode_tile_group(width : Int, height : Int, tile_cols : Int, tile_rows : Int, tile_payload : Array[Byte], tile_size_bytes : Int, base_q_idx : Int, disable_cdf_update? : Bool, full_range? : Bool, matrix_coefficients? : Int, use_128x128_superblock? : Bool, bit_depth? : Int, allow_screen_content_tools? : Bool, tx_mode_select? : Bool, reduced_tx_set? : Bool, enable_filter_intra? : Bool, enable_intra_edge_filter? : Bool, cdef? : Av1CdefConfig?, loop_filter? : Av1LoopFilterConfig?, restoration? : Av1RestorationConfig?, upscaled_width? : Int, superres_denom? : Int) -> Image?fn av1_decode_tile_group_with_boundaries(width : Int, height : Int, tile_col_starts_sb : Array[Int], tile_row_starts_sb : Array[Int], superblock_pixels : Int, tile_payload : Array[Byte], tile_size_bytes : Int, base_q_idx : Int, disable_cdf_update? : Bool, full_range? : Bool, matrix_coefficients? : Int, use_128x128_superblock? : Bool, bit_depth? : Int, allow_screen_content_tools? : Bool, tx_mode_select? : Bool, reduced_tx_set? : Bool, enable_filter_intra? : Bool, enable_intra_edge_filter? : Bool, cdef? : Av1CdefConfig?, loop_filter? : Av1LoopFilterConfig?, restoration? : Av1RestorationConfig?, upscaled_width? : Int, monochrome? : Bool, superres_denom? : Int) -> Image?fn av1_demux(data : Array[Byte], format? : Av1ContainerFormat?, track_id? : Int64?, limits? : DecodeLimits) -> Result[Av1DemuxedTrack, DecodeError]fn av1_demux_ivf(data : Array[Byte], limits? : DecodeLimits) -> Result[Av1DemuxedTrack, DecodeError]fn av1_demux_mp4(data : Array[Byte], track_id? : Int64?, limits? : DecodeLimits) -> Result[Av1DemuxedTrack, DecodeError]fn av1_demux_webm(data : Array[Byte], track_id? : Int64?, limits? : DecodeLimits) -> Result[Av1DemuxedTrack, DecodeError]fn av1_extract_tile_payloads(payload : Array[Byte], tile_cols : Int, tile_rows : Int, tile_size_bytes : Int) -> Array[Av1TilePayload]?fn av1_find_mv_stack(field : Av1MotionField, block : Av1MvBlock, frame : Av1MvFrame, is_compound : Bool) -> Av1MvStack?fn av1_inter_frame_of(header : Av1FrameHeaderInfo, sequence : Av1SequenceInfo, map : Av1FrameMap) -> Av1InterFrame?fn av1_motion_field_estimation(sequence : Av1SequenceInfo, order_hint : Int, order_hints : Array[Int], refs : Array[Av1RefFrame?], mi_cols : Int, mi_rows : Int) -> Av1MotionFieldGridfn av1_motion_field_store(field : Av1MotionField, row : Int, col : Int, width4 : Int, height4 : Int, y_mode : Int, refs : Array[Int], mv_rows : Array[Int], mv_cols : Array[Int], skip? : Int, skip_mode? : Int, interp? : Array[Int], compound_idx? : Int, comp_group_idx? : Int) -> Unitfn av1_mv_block_position(x8 : Int, y8 : Int, proj_mv_row : Int, proj_mv_col : Int, dst_sign : Int, mi_cols : Int, mi_rows : Int) -> (Int, Int, Bool)let av1_mv_div_mult_size : Intlet av1_mv_invalid : Intlet av1_mv_max_frame_distance : Intlet av1_mv_max_offset_width : Intfn av1_mv_projection(mv_row : Int, mv_col : Int, numerator : Int, denominator : Int) -> (Int, Int)fn av1_mv_projection_component(component : Int, numerator : Int, denominator : Int) -> Intlet av1_mv_refmvs_limit : Intlet av1_mv_stack_stamp : Intfn av1_parse_show_existing_frame(frame_payload : Array[Byte], config : Av1ShowExistingFrameConfig) -> Av1ShowExistingFrameEnvelope?fn av1_parse_show_existing_frame_envelope(frame_payload : Array[Byte], config : Av1ShowExistingFrameConfig) -> Av1ShowExistingFrameEnvelope?fn av1_parse_stage1_frame(frame_payload : Array[Byte], sequence : Av1SequenceInfo, allow_monochrome? : Bool, allow_highbd? : Bool, map? : Av1FrameMap, frame_header_obu? : Bool, tile_groups? : Array[Array[Byte]], temporal_id? : Int, spatial_id? : Int) -> Av1FrameHeaderInfo?fn av1_partition_children(node : Av1SbPartitionNode, partition : Av1SbPartition) -> Array[Av1SbBlock]fn av1_partition_context(current_size : Int, above_size : Int?, left_size : Int?) -> Intfn av1_partition_leaves(root : Av1SbPartitionNode, partitions : Array[Av1SbPartition]) -> Array[Av1SbBlock]?fn av1_partition_node(row : Int, col : Int, size : Int, frame_width : Int, frame_height : Int) -> Av1SbPartitionNodefn av1_reconstruct_split_yuv420_with_types(y_coeffs : Array[Array[Int]], u_coeffs : Array[Array[Int]], v_coeffs : Array[Array[Int]], y_modes : Array[Int], u_modes : Array[Int], v_modes : Array[Int], y_types : Array[Av1TxType], u_types : Array[Av1TxType], v_types : Array[Av1TxType]) -> (Array[Byte], Array[Byte], Array[Byte])?fn av1_reconstruct_tx_rgba(width : Int, height : Int, y_leaves : Array[Av1TxLeaf], y_coefficients : Array[Array[Int]], u_leaves : Array[Av1TxLeaf], u_coefficients : Array[Array[Int]], v_leaves : Array[Av1TxLeaf], v_coefficients : Array[Array[Int]], y_mode : Int, uv_mode : Int, y_types : Array[Av1TxType], u_types : Array[Av1TxType], v_types : Array[Av1TxType], bit_depth : Int, full_range? : Bool, matrix_coefficients? : Int) -> Image?fn av1_reference_show_existing(state : Av1ReferenceState, envelope : Av1ShowExistingFrameEnvelope) -> Image?fn av1_reference_store(state : Av1ReferenceState, slot : Int, image : Image, frame_type : Int) -> Boollet av1_seg_level_alt_q : Intlet av1_seg_level_ref_frame : Intfn av1_tx_depth_context_from_neighbors(above_depth : Int, left_depth : Int) -> Intfn av1_tx_depth_context_from_sizes(above_width : Int, left_height : Int, max_tx_width : Int, max_tx_height : Int) -> Intfn av1_tx_rect_supported(width : Int, height : Int) -> Boolfn av1_video_decode_frame(decoder : Av1VideoDecoder, data : Array[Byte], allow_monochrome? : Bool) -> Image?fn av1_video_decode_temporal_unit(decoder : Av1VideoDecoder, data : Array[Byte], allow_monochrome? : Bool) -> Array[Image]?fn av1_video_decode_temporal_unit_native(decoder : Av1VideoDecoder, data : Array[Byte], allow_monochrome? : Bool) -> Array[Av1NativeFrame]?fn av1_video_decode_temporal_unit_native_result(decoder : Av1VideoDecoder, data : Array[Byte], allow_monochrome? : Bool, limits? : DecodeLimits) -> Result[Array[Av1NativeFrame], DecodeError]let av1_warp_samples_scan_limit : Intfn av1_wedge_shape_ok(width : Int, height : Int) -> Boolfn avif_animation_sample_payloads(data : Array[Byte]) -> (AvifAnimationDescriptor, Array[Array[Byte]])?fn avif_container_parse_result(data : Array[Byte], limits? : DecodeLimits) -> Result[AvifContainer, DecodeError]fn avif_decode_animation_frames(descriptor : AvifAnimationDescriptor, samples : Array[Array[Byte]]) -> AvifAnimationPixels?fn avif_decode_animation_samples(timescale : Int, timestamps : Array[Int], durations : Array[Int], samples : Array[Array[Byte]]) -> AvifAnimationPixels?fn avif_decode_native_result(data : Array[Byte], limits? : DecodeLimits) -> Result[AvifNativeImage, DecodeError]fn avif_decode_rgba16_result(data : Array[Byte], limits? : DecodeLimits) -> Result[Image16, DecodeError]fn avif_decode_rgba_result(data : Array[Byte], limits? : DecodeLimits) -> Result[Image, DecodeError]fn clamp_byte(value : Int) -> ByteInstall
Download zipPure MoonBit AV1 and AVIF decoder for native, JavaScript, and WebAssembly GC.