UNPKG

image-in-browser

Version:

Package for encoding / decoding images, transforming images, applying filters, drawing primitives on images on the client side (no need for server Node.js)

65 lines (64 loc) 1.82 kB
/** @format */ /** * Class representing a VP8 random number generator. */ export declare class VP8Random { /** * A table of random values. * @private */ private readonly _table; /** * Index 1 for the random table. * @private */ private _index1; /** * Index 2 for the random table. * @private */ private _index2; /** * Amplitude for dithering. * @private */ private _amplitude; /** * Initializes random generator with an amplitude 'dithering' in range [0..1]. * @param {number} dithering - The dithering amplitude. */ constructor(dithering: number); /** * Returns a centered pseudo-random number with **numBits** amplitude. * (uses D.Knuth's Difference-based random generator). * **amp** is in randomDitherFix fixed-point precision. * @param {number} numBits - The number of bits for the random number. * @param {number} amp - The amplitude in fixed-point precision. * @returns {number} The generated random number. */ randomBits2(numBits: number, amp: number): number; /** * Returns a centered pseudo-random number with **numBits** amplitude. * @param {number} numBits - The number of bits for the random number. * @returns {number} The generated random number. */ randomBits(numBits: number): number; /** * Fixed-point precision for dithering. * @private * @constant {number} */ private static readonly randomDitherFix; /** * Size of the random table. * @private * @constant {number} */ private static readonly randomTableSize; /** * A table of 31-bit range values. * @private * @constant {Uint32Array} */ private static readonly randomTable; }