NAME

Peta::MP3::Encode::Quantize - a granule's lines into Layer III's integers and codes

VERSION

version 0.2610180

SYNOPSIS

my $q  = Peta::MP3::Encode::Quantize->new(44100);
my $gi = $q->granule($xr, $allowed, $budget, $least, $block_type);
$q->write($gi, $writer, $xr);    # its main data

DESCRIPTION

The quantization and Huffman coding of one granule of one channel, in long or short blocks: within the noise the psychoacoustic model allows, where the bits allow it, and within the bits always.

METHODS

new

new($rate): a quantizer for a sample rate.

granule

granule($xr, $allowed, $budget, $least, $type, $before): a granule's lines quantized and coded, within the noise each band may take, at most $budget bits and at least $least where it would take fewer; $before the first granule's result for the channel, whose scalefactors the second may reuse. Returns its side information and quantized values.

write

write($granule, $out, $xr): the granule's main data to a bit writer (the lines give the signs): the scalefactors (but those reused), then the Huffman codes.

AUTHOR

PetaMem s.r.o. <info@petamem.com>

COPYRIGHT

Copyright (c) 2026 PetaMem s.r.o.

LICENSE

This package is free software, dual-licensed under the Artistic License 2.0 and the BSD 2-Clause License. See the LICENSE file of the distribution.