NAME

Peta::Vorbis::Encode::Book - a Vorbis codebook

VERSION

version 0.2610180

SYNOPSIS

my $book = Peta::Vorbis::Encode::Book->new(dimensions => 2, values => 5,
    minimum => -2, delta => 1, weights => \@weights);
$book->header($writer);                        # in the setup header
$book->put($writer, $book->entry(-1, 2));      # a vector, coded

DESCRIPTION

Huffman code lengths from weights, codewords as Vorbis I assigns them, lattice values (lookup type 1), and the book's form in the setup header.

METHODS

new

new(dimensions => d, values => m, delta => ..., minimum => ..., weights => \@w): a lattice book; new(entries => n, weights => \@w): a scalar one (floors and classifications).

entries, dimensions, lengths

How many entries it has, how many values each, their code lengths.

vector, entry

vector($entry): a lattice book's values of an entry; entry(@values): the entry of those values (value i its digit i, in base m).

put, bits

put($out, $entry): an entry's codeword into a bit writer; bits($entry): its length.

count

Counting the entries written from now on (for training the weights): the counts so far.

header($out): the book in the setup header.

FUNCTIONS

float32

float32($x): Vorbis' float32 of a number (sign, 10-bit exponent, 21-bit mantissa).

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.