//! SBR (HE-AAC v1) Huffman codebooks (ISO/IEC 14496-3 ยง4.6.18.3.6). //! //! Derived black box from a reference decoder's own bit accounting by //! `scripts/aac-tables/sbrtables.py`: no source was consulted. The //! decoder's "Expected to read N SBR bytes actually read M" complaint //! reads codeword lengths off a controlled FIL payload, and its //! `env_facs_q`/`noise_facs_q` range check reads the delta value each //! codeword carries off the same payload. Every table here closed with //! a Kraft sum of exactly 1 (asserted below). //! //! GENERATED: books by `sbrtables.py --stage values`, then the four 3.0 dB //! books (`ENV30_F`, `ENV30_T`, `ENVB30_F`, `ENVB30_T`) re-valued in place by //! `scripts/aac-tables/sbrvalues.py`, which walks each codeword's delta out //! of range by delta-time ACCUMULATION (a single +d on the 6-bit 3 dB raw //! field never reaches the 7-bit ceiling, so the one-shot stage read every //! positive 3 dB delta as 0). Do not hand-edit the books. #![allow(dead_code)] /// SBR Huffman book `ENV15_F`: (length, code, delta) by codeword. pub(crate) static ENV15_F: [(u8, u32, i32); 121] = [ (2, 0, 0), (2, 1, -1), (3, 4, 1), (3, 5, -2), (4, 12, -3), (4, 13, 2), (5, 28, -4), (5, 29, 3), (6, 60, -5), (6, 61, 4), (7, 124, -6), (8, 250, 5), (8, 251, -7), (8, 252, 6), (9, 506, -8), (9, 507, 7), (9, 508, -9), (10, 1018, 8), (10, 1019, -10), (11, 2040, 9), (11, 2041, -11), (11, 2042, 10), (11, 2043, 11), (12, 4088, -12), (12, 4089, 12), (12, 4090, -13), (12, 4091, 13), (13, 8184, 14), (13, 8185, -14), (13, 8186, -15), (13, 8187, 15), (14, 16376, 16), (14, 16377, 17), (14, 16378, -16), (15, 32758, -17), (15, 32759, -18), (16, 65520, -19), (16, 65521, 18), (16, 65522, 19), (16, 65523, -20), (16, 65524, -21), (17, 131050, 20), (17, 131051, 21), (17, 131052, -24), (17, 131053, -23), (17, 131054, -22), (17, 131055, -26), (18, 262112, -28), (18, 262113, 22), (18, 262114, 23), (18, 262115, 25), (18, 262116, -41), (18, 262117, -25), (18, 262118, 26), (18, 262119, 27), (18, 262120, -30), (18, 262121, -27), (18, 262122, 24), (18, 262123, 28), (18, 262124, 44), (19, 524250, -51), (19, 524251, -46), (19, 524252, -44), (19, 524253, -43), (19, 524254, -37), (19, 524255, -33), (19, 524256, -31), (19, 524257, -29), (19, 524258, 30), (19, 524259, 37), (19, 524260, 42), (19, 524261, 47), (19, 524262, 48), (19, 524263, -60), (19, 524264, -59), (20, 1048530, -58), (20, 1048531, -57), (20, 1048532, -56), (20, 1048533, -55), (20, 1048534, -54), (20, 1048535, -53), (20, 1048536, -52), (20, 1048537, -50), (20, 1048538, -49), (20, 1048539, -48), (20, 1048540, -47), (20, 1048541, -45), (20, 1048542, -42), (20, 1048543, -40), (20, 1048544, -39), (20, 1048545, -38), (20, 1048546, -36), (20, 1048547, -35), (20, 1048548, -34), (20, 1048549, -32), (20, 1048550, 29), (20, 1048551, 31), (20, 1048552, 32), (20, 1048553, 33), (20, 1048554, 34), (20, 1048555, 35), (20, 1048556, 36), (20, 1048557, 38), (20, 1048558, 39), (20, 1048559, 40), (20, 1048560, 41), (20, 1048561, 43), (20, 1048562, 45), (20, 1048563, 46), (20, 1048564, 49), (20, 1048565, 50), (20, 1048566, 51), (20, 1048567, 52), (20, 1048568, 53), (20, 1048569, 54), (20, 1048570, 55), (20, 1048571, 56), (20, 1048572, 57), (20, 1048573, 58), (20, 1048574, 59), (20, 1048575, 60), ]; /// SBR Huffman book `ENV15_T`: (length, code, delta) by codeword. pub(crate) static ENV15_T: [(u8, u32, i32); 121] = [ (2, 0, 0), (2, 1, -1), (3, 4, 1), (3, 5, -2), (4, 12, 2), (4, 13, -3), (5, 28, 3), (5, 29, -4), (6, 60, 4), (6, 61, -5), (7, 124, 5), (7, 125, -6), (8, 252, 6), (8, 253, -7), (9, 508, 7), (9, 509, -8), (10, 1020, -9), (10, 1021, 8), (11, 2044, -10), (12, 4090, 9), (12, 4091, -11), (13, 8184, 10), (13, 8185, -12), (13, 8186, -13), (14, 16374, 11), (14, 16375, -14), (14, 16376, 12), (14, 16377, -15), (15, 32756, -16), (15, 32757, 13), (16, 65516, -19), (16, 65517, -18), (16, 65518, -17), (16, 65519, 14), (16, 65520, -24), (16, 65521, -20), (16, 65522, 16), (17, 131046, -26), (17, 131047, -21), (17, 131048, 15), (17, 131049, -23), (18, 262100, -25), (18, 262101, -22), (18, 262102, -60), (18, 262103, -59), (18, 262104, -58), (18, 262105, -57), (18, 262106, -56), (18, 262107, -55), (19, 524216, -54), (19, 524217, -53), (19, 524218, -52), (19, 524219, -51), (19, 524220, -50), (19, 524221, -49), (19, 524222, -48), (19, 524223, -47), (19, 524224, -46), (19, 524225, -45), (19, 524226, -44), (19, 524227, -43), (19, 524228, -42), (19, 524229, -41), (19, 524230, -40), (19, 524231, -39), (19, 524232, -38), (19, 524233, -37), (19, 524234, -36), (19, 524235, -35), (19, 524236, -34), (19, 524237, -33), (19, 524238, -32), (19, 524239, -31), (19, 524240, -30), (19, 524241, -29), (19, 524242, -28), (19, 524243, -27), (19, 524244, 17), (19, 524245, 18), (19, 524246, 19), (19, 524247, 20), (19, 524248, 21), (19, 524249, 22), (19, 524250, 23), (19, 524251, 24), (19, 524252, 25), (19, 524253, 26), (19, 524254, 27), (19, 524255, 28), (19, 524256, 29), (19, 524257, 30), (19, 524258, 31), (19, 524259, 32), (19, 524260, 33), (19, 524261, 34), (19, 524262, 35), (19, 524263, 36), (19, 524264, 37), (19, 524265, 38), (19, 524266, 39), (19, 524267, 40), (19, 524268, 41), (19, 524269, 42), (19, 524270, 43), (19, 524271, 44), (19, 524272, 45), (19, 524273, 46), (19, 524274, 47), (19, 524275, 48), (19, 524276, 49), (19, 524277, 50), (19, 524278, 51), (19, 524279, 52), (19, 524280, 53), (19, 524281, 54), (19, 524282, 55), (19, 524283, 56), (19, 524284, 57), (19, 524285, 58), (19, 524286, 59), (19, 524287, 60), ]; /// SBR Huffman book `ENV30_T`: (length, code, delta) by codeword. pub(crate) static ENV30_T: [(u8, u32, i32); 63] = [ (1, 0, 0), (2, 2, -1), (3, 6, 1), (4, 14, -2), (5, 30, 2), (6, 62, -3), (7, 126, 3), (8, 254, -4), (9, 510, 4), (11, 2044, -5), (11, 2045, 5), (12, 4092, -6), (13, 8186, -7), (13, 8187, 6), (14, 16376, -8), (14, 16377, 7), (14, 16378, -9), (14, 16379, -10), (14, 16380, 8), (15, 32762, 9), (16, 65526, 10), (16, 65527, -13), (16, 65528, -11), (16, 65529, -12), (17, 131060, -14), (17, 131061, 11), (18, 262124, 12), (18, 262125, -31), (18, 262126, -30), (19, 524254, -29), (19, 524255, -28), (19, 524256, -27), (19, 524257, -26), (19, 524258, -25), (19, 524259, -24), (19, 524260, -23), (19, 524261, -22), (19, 524262, -21), (19, 524263, -20), (19, 524264, -19), (19, 524265, -18), (19, 524266, -17), (19, 524267, -16), (19, 524268, -15), (19, 524269, 13), (19, 524270, 14), (19, 524271, 15), (19, 524272, 16), (19, 524273, 17), (19, 524274, 18), (19, 524275, 19), (19, 524276, 20), (19, 524277, 21), (19, 524278, 22), (19, 524279, 23), (19, 524280, 24), (19, 524281, 25), (19, 524282, 26), (19, 524283, 27), (19, 524284, 28), (19, 524285, 29), (19, 524286, 30), (19, 524287, 31), ]; /// SBR Huffman book `ENV30_F`: (length, code, delta) by codeword. pub(crate) static ENV30_F: [(u8, u32, i32); 63] = [ (1, 0, 0), (2, 2, -1), (3, 6, 1), (4, 14, -2), (5, 30, 2), (6, 62, -3), (8, 252, 3), (8, 253, -4), (9, 508, 4), (9, 509, -5), (10, 1020, 5), (10, 1021, -6), (11, 2044, 6), (11, 2045, -7), (12, 4092, 7), (12, 4093, -8), (13, 8188, 8), (14, 16378, 9), (14, 16379, -9), (15, 32760, -10), (15, 32761, 10), (15, 32762, 11), (16, 65526, -11), (16, 65527, -12), (16, 65528, 12), (16, 65529, 13), (17, 131060, -13), (17, 131061, -15), (17, 131062, 14), (17, 131063, 15), (18, 262128, -14), (18, 262129, 18), (18, 262130, -18), (18, 262131, -24), (18, 262132, -19), (18, 262133, 16), (18, 262134, 17), (19, 524270, -22), (19, 524271, -21), (19, 524272, -16), (19, 524273, 20), (19, 524274, 21), (19, 524275, 22), (19, 524276, 25), (19, 524277, -23), (19, 524278, -20), (19, 524279, 24), (20, 1048560, -31), (20, 1048561, -30), (20, 1048562, -29), (20, 1048563, -28), (20, 1048564, -27), (20, 1048565, -26), (20, 1048566, -25), (20, 1048567, -17), (20, 1048568, 19), (20, 1048569, 23), (20, 1048570, 26), (20, 1048571, 27), (20, 1048572, 28), (20, 1048573, 29), (20, 1048574, 30), (20, 1048575, 31), ]; /// SBR Huffman book `NOISE_T`: (length, code, delta) by codeword. pub(crate) static NOISE_T: [(u8, u32, i32); 63] = [ (1, 0, 0), (2, 2, 1), (3, 6, -1), (4, 14, -2), (5, 30, 2), (6, 62, -3), (8, 252, 3), (8, 253, -4), (10, 1016, 4), (11, 2034, -5), (13, 8140, 5), (13, 8141, 11), (13, 8142, -31), (13, 8143, -30), (13, 8144, -29), (13, 8145, -28), (13, 8146, -27), (13, 8147, -26), (13, 8148, -25), (13, 8149, -24), (13, 8150, -23), (13, 8151, -22), (13, 8152, -21), (13, 8153, -20), (13, 8154, -19), (13, 8155, -18), (13, 8156, -17), (13, 8157, -16), (13, 8158, -15), (13, 8159, -14), (13, 8160, -13), (13, 8161, -12), (13, 8162, -11), (13, 8163, -10), (13, 8164, -9), (13, 8165, -8), (13, 8166, -7), (13, 8167, -6), (13, 8168, 6), (13, 8169, 7), (13, 8170, 8), (13, 8171, 9), (13, 8172, 10), (13, 8173, 12), (13, 8174, 13), (13, 8175, 14), (13, 8176, 15), (13, 8177, 16), (13, 8178, 17), (13, 8179, 18), (13, 8180, 19), (13, 8181, 20), (13, 8182, 21), (13, 8183, 22), (13, 8184, 23), (13, 8185, 24), (13, 8186, 25), (13, 8187, 26), (13, 8188, 27), (13, 8189, 28), (13, 8190, 29), (14, 16382, 30), (14, 16383, 31), ]; /// SBR Huffman book `NOISE_F`: (length, code, delta) by codeword. pub(crate) static NOISE_F: [(u8, u32, i32); 63] = [ (1, 0, 0), (2, 2, -1), (3, 6, 1), (4, 14, -2), (5, 30, 2), (6, 62, -3), (8, 252, 3), (8, 253, -4), (9, 508, 4), (9, 509, -5), (10, 1020, 5), (10, 1021, -6), (11, 2044, 6), (11, 2045, -7), (12, 4092, 7), (12, 4093, -8), (13, 8188, 8), (14, 16378, 9), (14, 16379, -9), (15, 32760, -10), (15, 32761, 10), (15, 32762, 11), (16, 65526, -11), (16, 65527, -12), (16, 65528, 12), (16, 65529, 13), (17, 131060, -13), (17, 131061, -15), (17, 131062, 14), (17, 131063, 15), (18, 262128, -14), (18, 262129, 18), (18, 262130, -18), (18, 262131, -24), (18, 262132, -19), (18, 262133, 16), (18, 262134, 17), (19, 524270, -22), (19, 524271, -21), (19, 524272, -16), (19, 524273, 20), (19, 524274, 21), (19, 524275, 22), (19, 524276, 25), (19, 524277, -23), (19, 524278, -20), (19, 524279, 24), (20, 1048560, -31), (20, 1048561, -30), (20, 1048562, -29), (20, 1048563, -28), (20, 1048564, -27), (20, 1048565, -26), (20, 1048566, -25), (20, 1048567, -17), (20, 1048568, 19), (20, 1048569, 23), (20, 1048570, 26), (20, 1048571, 27), (20, 1048572, 28), (20, 1048573, 29), (20, 1048574, 30), (20, 1048575, 31), ]; /// SBR Huffman book `ENVB15_F`: (length, code, delta) by codeword. pub(crate) static ENVB15_F: [(u8, u32, i32); 49] = [ (1, 0, 0), (2, 2, -1), (3, 6, 1), (4, 14, -2), (5, 30, 2), (6, 62, 3), (7, 126, -3), (8, 254, -4), (9, 510, 4), (11, 2044, -5), (11, 2045, 5), (11, 2046, -6), (12, 4094, 6), (14, 16380, -7), (15, 32762, 7), (16, 65526, 8), (16, 65527, -9), (17, 131056, -8), (18, 262114, -24), (18, 262115, -23), (18, 262116, -22), (18, 262117, -21), (18, 262118, -20), (18, 262119, -19), (18, 262120, -18), (18, 262121, -17), (18, 262122, -16), (18, 262123, -15), (18, 262124, -14), (18, 262125, -13), (18, 262126, -12), (18, 262127, -11), (18, 262128, -10), (18, 262129, 9), (18, 262130, 10), (18, 262131, 11), (18, 262132, 12), (18, 262133, 13), (18, 262134, 14), (18, 262135, 15), (18, 262136, 16), (18, 262137, 17), (18, 262138, 18), (18, 262139, 19), (18, 262140, 20), (18, 262141, 21), (18, 262142, 22), (19, 524286, 23), (19, 524287, 24), ]; /// SBR Huffman book `ENVB15_T`: (length, code, delta) by codeword. pub(crate) static ENVB15_T: [(u8, u32, i32); 49] = [ (1, 0, 0), (2, 2, 1), (3, 6, -1), (4, 14, 2), (5, 30, -2), (6, 62, 3), (7, 126, -3), (8, 254, 4), (9, 510, -4), (11, 2044, -5), (11, 2045, 5), (12, 4092, -6), (12, 4093, 6), (15, 32752, 7), (16, 65506, -7), (16, 65507, 8), (16, 65508, -24), (16, 65509, -23), (16, 65510, -22), (16, 65511, -21), (16, 65512, -20), (16, 65513, -19), (16, 65514, -18), (16, 65515, -17), (16, 65516, -16), (16, 65517, -15), (16, 65518, -14), (16, 65519, -13), (16, 65520, -12), (16, 65521, -11), (16, 65522, -10), (16, 65523, -9), (16, 65524, -8), (16, 65525, 9), (16, 65526, 10), (16, 65527, 11), (16, 65528, 12), (16, 65529, 13), (16, 65530, 14), (17, 131062, 15), (17, 131063, 16), (17, 131064, 17), (17, 131065, 18), (17, 131066, 19), (17, 131067, 20), (17, 131068, 21), (17, 131069, 22), (17, 131070, 23), (17, 131071, 24), ]; /// SBR Huffman book `ENVB30_T`: (length, code, delta) by codeword. pub(crate) static ENVB30_T: [(u8, u32, i32); 25] = [ (1, 0, 0), (2, 2, 1), (3, 6, -1), (4, 14, -2), (5, 30, 2), (6, 62, 3), (7, 126, -3), (8, 254, -4), (9, 510, 4), (12, 4088, -5), (13, 8178, -12), (13, 8179, -11), (13, 8180, -10), (13, 8181, -9), (13, 8182, -8), (13, 8183, -7), (13, 8184, -6), (13, 8185, 5), (13, 8186, 6), (13, 8187, 7), (13, 8188, 8), (13, 8189, 9), (13, 8190, 10), (14, 16382, 11), (14, 16383, 12), ]; /// SBR Huffman book `ENVB30_F`: (length, code, delta) by codeword. pub(crate) static ENVB30_F: [(u8, u32, i32); 25] = [ (1, 0, 0), (2, 2, -1), (3, 6, 1), (4, 14, -2), (5, 30, 2), (6, 62, 3), (7, 126, -3), (8, 254, -4), (9, 510, 4), (11, 2044, -5), (12, 4090, 5), (13, 8182, 6), (13, 8183, -12), (13, 8184, -11), (13, 8185, -10), (13, 8186, -9), (13, 8187, -8), (14, 16376, -7), (14, 16377, -6), (14, 16378, 7), (14, 16379, 8), (14, 16380, 9), (14, 16381, 10), (14, 16382, 11), (14, 16383, 12), ]; /// SBR Huffman book `NOISEB_T`: (length, code, delta) by codeword. pub(crate) static NOISEB_T: [(u8, u32, i32); 25] = [ (1, 0, 0), (2, 2, -1), (3, 6, 1), (5, 28, -2), (6, 58, 2), (8, 236, -12), (8, 237, -11), (8, 238, -10), (8, 239, -9), (8, 240, -8), (8, 241, -7), (8, 242, -6), (8, 243, -5), (8, 244, -4), (8, 245, -3), (8, 246, 3), (8, 247, 4), (8, 248, 5), (8, 249, 6), (8, 250, 7), (8, 251, 8), (8, 252, 9), (8, 253, 10), (8, 254, 11), (8, 255, 12), ]; /// SBR Huffman book `NOISEB_F`: (length, code, delta) by codeword. pub(crate) static NOISEB_F: [(u8, u32, i32); 25] = [ (1, 0, 0), (2, 2, -1), (3, 6, 1), (4, 14, -2), (5, 30, 2), (6, 62, 3), (7, 126, -3), (8, 254, -4), (9, 510, 4), (11, 2044, -5), (12, 4090, 5), (13, 8182, 6), (13, 8183, -12), (13, 8184, -11), (13, 8185, -10), (13, 8186, -9), (13, 8187, -8), (14, 16376, -7), (14, 16377, -6), (14, 16378, 7), (14, 16379, 8), (14, 16380, 9), (14, 16381, 10), (14, 16382, 11), (14, 16383, 12), ]; /// ISO/IEC 14496-3 Table 4.A.88: the 512-entry complex noise sequence /// `V` the envelope adjuster draws from (`f_IndexNoise` wraps at 512), as /// `(re, im)` pairs. pub(crate) static SBR_NOISE: [(f64, f64); 512] = [ (-0.99948153278296, -0.59483417516607), (0.97113454393991, -0.67528515225647), (0.14130051758487, -0.95090983575689), (-0.47005496701697, -0.37340549728647), (0.80705063769351, 0.29653668284408), (-0.38981478896926, 0.89572605717087), (-0.01053049862020, -0.66959058036166), (-0.91266367957293, -0.11522938140034), (0.54840422910309, 0.75221367176302), (0.40009252867955, -0.98929400334421), (-0.99867974711855, -0.88147068645358), (-0.95531076805040, 0.90908757154593), (-0.45725933317144, -0.56716323646760), (-0.72929675029275, -0.98008272727324), (0.75622801399036, 0.20950329995549), (0.07069442601050, -0.78247898470706), (0.74496252926055, -0.91169004445807), (-0.96440182703856, -0.94739918296622), (0.30424629369539, -0.49438267012479), (0.66565033746925, 0.64652935542491), (0.91697008020594, 0.17514097332009), (-0.70774918760427, 0.52548653416543), (-0.70051415345560, -0.45340028808763), (-0.99496513054797, -0.90071908066973), (0.98164490790123, -0.77463155528697), (-0.54671580548181, -0.02570928536004), (-0.01689629065389, 0.00287506445732), (-0.86110349531986, 0.42548583726477), (-0.98892980586032, -0.87881132267556), (0.51756627678691, 0.66926784710139), (-0.99635026409640, -0.58107730574765), (-0.99969370862163, 0.98369989360250), (0.55266258627194, 0.59449057465591), (0.34581177741673, 0.94879421061866), (0.62664209577999, -0.74402970906471), (-0.77149701404973, -0.33883658042801), (-0.91592244254432, 0.03687901376713), (-0.76285492357887, -0.91371867919124), (0.79788337195331, -0.93180971199849), (0.54473080610200, -0.11919206037186), (-0.85639281671058, 0.42429854760451), (-0.92882402971423, 0.27871809078609), (-0.11708371046774, -0.99800843444966), (0.21356749817493, -0.90716295627033), (-0.76191692573909, 0.99768118356265), (0.98111043100884, -0.95854459734407), (-0.85913269895572, 0.95766566168880), (-0.93307242253692, 0.49431757696466), (0.30485754879632, -0.70540034357529), (0.85289650925190, 0.46766131791044), (0.91328082618125, -0.99839597361769), (-0.05890199924154, 0.70741827819497), (0.28398686150148, 0.34633555702188), (0.95258164539612, -0.54893416026939), (-0.78566324168507, -0.75568541079691), (-0.95789495447877, -0.20423194696966), (0.82411158711197, 0.96654618432562), (-0.65185446735885, -0.88734990773289), (-0.93643603134666, 0.99870790442385), (0.91427159529618, -0.98290505544444), (-0.70395684036886, 0.58796798221039), (0.00563771969365, 0.61768196727244), (0.89065051931895, 0.52783352697585), (-0.68683707712762, 0.80806944710339), (0.72165342518718, -0.69259857349564), (-0.62928247730667, 0.13627037407335), (0.29938434065514, -0.46051329682246), (-0.91781958879280, -0.74012716684186), (0.99298717043688, 0.40816610075661), (0.82368298622748, -0.74036047190173), (-0.98512833386833, -0.99972330709594), (-0.95915368242257, -0.99237800466040), (-0.21411126572790, -0.93424819052545), (-0.68821476106884, -0.26892306315457), (0.91851997982317, 0.09358228901785), (-0.96062769559127, 0.36099095133739), (0.51646184922287, -0.71373332873917), (0.61130721139669, 0.46950141175917), (0.47336129371299, -0.27333178296162), (0.90998308703519, 0.96715662938132), (0.44844799194357, 0.99211574628306), (0.66614891079092, 0.96590176169121), (0.74922239129237, -0.89879858826087), (-0.99571588506485, 0.52785521494349), (0.97401082477563, -0.16855870075190), (0.72683747733879, -0.48060774432251), (0.95432193457128, 0.68849603408441), (-0.72962208425191, -0.76608443420917), (-0.85359479233537, 0.88738125901579), (-0.81412430338535, -0.97480768049637), (-0.87930772356786, 0.74748307690436), (-0.71573331064977, -0.98570608178923), (0.83524300028228, 0.83702537075163), (-0.48086065601423, -0.98848504923531), (0.97139128574778, 0.80093621198236), (0.51992825347895, 0.80247631400510), (-0.00848591195325, -0.76670128000486), (-0.70294374303036, 0.55359910445577), (-0.95894428168140, -0.43265504344783), (0.97079252950321, 0.09325857238682), (-0.92404293670797, 0.85507704027855), (-0.69506469500450, 0.98633412625459), (0.26559203620024, 0.73314307966524), (0.28038443336943, 0.14537913654427), (-0.74138124825523, 0.99310339807762), (-0.01752795995444, -0.82616635284178), (-0.55126773094930, -0.98898543862153), (0.97960898850996, -0.94021446752851), (-0.99196309146936, 0.67019017358456), (-0.67684928085260, 0.12631491649378), (0.09140039465500, -0.20537731453108), (-0.71658965751996, -0.97788200391224), (0.81014640078925, 0.53722648362443), (0.40616991671205, -0.26469008598449), (-0.67680188682972, 0.94502052337695), (0.86849774348749, -0.18333598647899), (-0.99500381284851, -0.02634122068550), (0.84329189340667, 0.10406957462213), (-0.09215968531446, 0.69540012101253), (0.99956173327206, -0.12358542001404), (-0.79732779473535, -0.91582524736159), (0.96349973642406, 0.96640458041000), (-0.79942778496547, 0.64323902822857), (-0.11566039853896, 0.28587846253726), (-0.39922954514662, 0.94129601616966), (0.99089197565987, -0.92062625581587), (0.28631285179909, -0.91035047143603), (-0.83302725605608, -0.67330410892084), (0.95404443402072, 0.49162765398743), (-0.06449863579434, 0.03250560813135), (-0.99575054486311, 0.42389784469507), (-0.65501142790847, 0.82546114655624), (-0.81254441908887, -0.51627234660629), (-0.99646369485481, 0.84490533520752), (0.00287840603348, 0.64768261158166), (0.70176989408455, -0.20453028573322), (0.96361882270190, 0.40706967140989), (-0.68883758192426, 0.91338958840772), (-0.34875585502238, 0.71472290693300), (0.91980081243087, 0.66507455644919), (-0.99009048343881, 0.85868021604848), (0.68865791458395, 0.55660316809678), (-0.99484402129368, -0.20052559254934), (0.94214511408023, -0.99696425367461), (-0.67414626793544, 0.49548221180078), (-0.47339353684664, -0.85904328834047), (0.14323651387360, -0.94145598222488), (-0.29268293575672, 0.05759224927952), (0.43793861458754, -0.78904969892724), (-0.36345126374441, 0.64874435357162), (-0.08750604656825, 0.97686944362527), (-0.96495267812511, -0.53960305946511), (0.55526940659947, 0.78891523734774), (0.73538215752630, 0.96452072373404), (-0.30889773919437, -0.80664389776860), (0.03574995626194, -0.97325616900959), (0.98720684660488, 0.48409133691962), (-0.81689296271203, -0.90827703628298), (0.67866860118215, 0.81284503870856), (-0.15808569732583, 0.85279555024382), (0.80723395114371, -0.24717418514605), (0.47788757329038, -0.46333147839295), (0.96367554763201, 0.38486749303242), (-0.99143875716818, -0.24945277239809), (0.83081876925833, -0.94780851414763), (-0.58753191905341, 0.01290772389163), (0.95538108220960, -0.85557052096538), (-0.96490920476211, -0.64020970923102), (-0.97327101028521, 0.12378128133110), (0.91400366022124, 0.57972471346930), (-0.99925837363824, 0.71084847864067), (-0.86875903507313, -0.20291699203564), (-0.26240034795124, -0.68264554369108), (-0.24664412953388, -0.87642273115183), (0.02416275806869, 0.27192914288905), (0.82068619590515, -0.85087787994476), (0.88547373760759, -0.89636802901469), (-0.18173078152226, -0.26152145156800), (0.09355476558534, 0.54845123045604), (-0.54668414224090, 0.95980774020221), (0.37050990604091, -0.59910140383171), (-0.70373594262891, 0.91227665827081), (-0.34600785879594, -0.99441426144200), (-0.68774481731008, -0.30238837956299), (-0.26843291251234, 0.83115668004362), (0.49072334613242, -0.45359708737775), (0.38975993093975, 0.95515358099121), (-0.97757125224150, 0.05305894580606), (-0.17325552859616, -0.92770672250494), (0.99948035025744, 0.58285545563426), (-0.64946246527458, 0.68645507104960), (-0.12016920576437, -0.57147322153312), (-0.58947456517751, -0.34847132454388), (-0.41815140454465, 0.16276422358861), (0.99885650204884, 0.11136095490444), (-0.56649614128386, -0.90494866361587), (0.94138021032330, 0.35281916733018), (-0.75725076534641, 0.53650549640587), (0.20541973692630, -0.94435144369918), (0.99980371023351, 0.79835913565599), (0.29078277605775, 0.35393777921520), (-0.62858772103030, 0.38765693387102), (0.43440904467688, -0.98546330463232), (-0.98298583762390, 0.21021524625209), (0.19513029146934, -0.94239832251867), (-0.95476662400101, 0.98364554179143), (0.93379635304810, -0.70881994583682), (-0.85235410573336, -0.08342347966410), (-0.86425093011245, -0.45795025029466), (0.38879779059045, 0.97274429344593), (0.92045124735495, -0.62433652524220), (0.89162532251878, 0.54950955570563), (-0.36834336949252, 0.96458298020975), (0.93891760988045, -0.89968353740388), (0.99267657565094, -0.03757034316958), (-0.94063471614176, 0.41332338538963), (0.99740224117019, -0.16830494996370), (-0.35899413170555, -0.46633226649613), (0.05237237274947, -0.25640361602661), (0.36703583957424, -0.38653265641875), (0.91653180367913, -0.30587628726597), (0.69000803499316, 0.90952171386132), (-0.38658751133527, 0.99501571208985), (-0.29250814029851, 0.37444994344615), (-0.60182204677608, 0.86779651036123), (-0.97418588163217, 0.96468523666475), (0.88461574003963, 0.57508405276414), (0.05198933055162, 0.21269661669964), (-0.53499621979720, 0.97241553731237), (-0.49429560226497, 0.98183865291903), (-0.98935142339139, -0.40249159006933), (-0.98081380091130, -0.72856895534041), (-0.27338148835532, 0.99950922447209), (0.06310802338302, -0.54539587529618), (-0.20461677199539, -0.14209977628489), (0.66223843141647, 0.72528579940326), (-0.84764345483665, 0.02372316801261), (-0.89039863483811, 0.88866581484602), (0.95903308477986, 0.76744927173873), (0.73504123909879, -0.03747203173192), (-0.31744434966056, -0.36834111883652), (-0.34110827591623, 0.40211222807691), (0.47803883714199, -0.39423219786288), (0.98299195879514, 0.01989791390047), (-0.30963073129751, -0.18076720599336), (0.99992588229018, -0.26281872094289), (-0.93149731080767, -0.98313162570490), (0.99923472302773, -0.80142993767554), (-0.26024169633417, -0.75999759855752), (-0.35712514743563, 0.19298963768574), (-0.99899084509530, 0.74645156992493), (0.86557171579452, 0.55593866696299), (0.33408042438752, 0.86185953874709), (0.99010736374716, 0.04602397576623), (-0.66694269691195, -0.91643611810148), (0.64016792079480, 0.15649530836856), (0.99570534804836, 0.45844586038111), (-0.63431466947340, 0.21079116459234), (-0.07706847005931, -0.89581437101329), (0.98590090577724, 0.88241721133981), (0.80099335254678, -0.36851896710853), (0.78368131392666, 0.45506999802597), (0.08707806671691, 0.80938994918745), (-0.86811883080712, 0.39347308654705), (-0.39466529740375, -0.66809432114456), (0.97875325649683, -0.72467840967746), (-0.95038560288864, 0.89563219587625), (0.17005239424212, 0.54683053962658), (-0.76910792026848, -0.96226617549298), (0.99743281016846, 0.42697157037567), (0.95437383549973, 0.97002324109952), (0.99578905365569, -0.54106826257356), (0.28058259829990, -0.85361420634036), (0.85256524470573, -0.64567607735589), (-0.50608540105128, -0.65846015480300), (-0.97210735183243, -0.23095213067791), (0.95424048234441, -0.99240147091219), (-0.96926570524023, 0.73775654896574), (0.30872163214726, 0.41514960556126), (-0.24523839572639, 0.63206633394807), (-0.33813265086024, -0.38661779441897), (-0.05826828420146, -0.06940774188029), (-0.22898461455054, 0.97054853316316), (-0.18509915019881, 0.47565762892084), (-0.10488238045009, -0.87769947402394), (-0.71886586182037, 0.78030982480538), (0.99793873738654, 0.90041310491497), (0.57563307626120, -0.91034337352097), (0.28909646383717, 0.96307783970534), (0.42188998312520, 0.48148651230437), (0.93335049681047, -0.43537023883588), (-0.97087374418267, 0.86636445711364), (0.36722871286923, 0.65291654172961), (-0.81093025665696, 0.08778370229363), (-0.26240603062237, -0.92774095379098), (0.83996497984604, 0.55839849139647), (-0.99909615720225, -0.96024605713970), (0.74649464155061, 0.12144893606462), (-0.74774595569805, -0.26898062008959), (0.95781667469567, -0.79047927052628), (0.95472308713099, -0.08588776019550), (0.48708332746299, 0.99999041579432), (0.46332038247497, 0.10964126185063), (-0.76497004940162, 0.89210929242238), (0.57397389364339, 0.35289703373760), (0.75374316974495, 0.96705214651335), (-0.59174397685714, -0.89405370422752), (0.75087906691890, -0.29612672982396), (-0.98607857336230, 0.25034911730023), (-0.40761056640505, -0.90045573444695), (0.66929266740477, 0.98629493401748), (-0.97463695257310, -0.00190223301301), (0.90145509409859, 0.99781390365446), (-0.87259289048043, 0.99233587353666), (-0.91529461447692, -0.15698707534206), (-0.03305738840705, -0.37205262859764), (0.07223051368337, -0.88805001733626), (0.99498012188353, 0.97094358113387), (-0.74904939500519, 0.99985483641521), (0.04585228574211, 0.99812337444082), (-0.89054954257993, -0.31791913188064), (-0.83782144651251, 0.97637632547466), (0.33454804933804, -0.86231516800408), (-0.99707579362824, 0.93237990079441), (-0.22827527843994, 0.18874759397997), (0.67248046289143, -0.03646211390569), (-0.05146538187944, -0.92599700120679), (0.99947295749905, 0.93625229707912), (0.66951124390363, 0.98905825623893), (-0.99602956559179, -0.44654715757688), (0.82104905483590, 0.99540741724928), (0.99186510988782, 0.72023001312947), (-0.65284592392918, 0.52186723253637), (0.93885443798188, -0.74895312615259), (0.96735248738388, 0.90891816978629), (-0.22225968841114, 0.57124029781228), (-0.44132783753414, -0.92688840659280), (-0.85694974219574, 0.88844532719844), (0.91783042091762, -0.46356892383970), (0.72556974415690, -0.99899555770747), (-0.99711581834508, 0.58211560180426), (0.77638976371966, 0.94321834873819), (0.07717324253925, 0.58638399856595), (-0.56049829194163, 0.82522301569036), (0.98398893639988, 0.39467440420569), (0.47546946844938, 0.68613044836811), (0.65675089314631, 0.18331637134880), (0.03273375457980, -0.74933109564108), (-0.38684144784738, 0.51337349030406), (-0.97346267944545, -0.96549364384098), (-0.53282156061942, -0.91423265091354), (0.99817310731176, 0.61133572482148), (-0.50254500772635, -0.88829338134294), (0.01995873238855, 0.85223515096765), (0.99930381973804, 0.94578896296649), (0.82907767600783, -0.06323442598128), (-0.58660709669728, 0.96840773806582), (-0.17573736667267, -0.48166920859485), (0.83434292401346, -0.13023450646997), (0.05946491307025, 0.20511047074866), (0.81505484574602, -0.94685947861369), (-0.44976380954860, 0.40894572671545), (-0.89746474625671, 0.99846578838537), (0.39677256130792, -0.74854668609359), (-0.07588948563079, 0.74096214084170), (0.76343198951445, 0.41746629422634), (-0.74490104699626, 0.94725911744610), (0.64880119792759, 0.41336660830571), (0.62319537462542, -0.93098313552599), (0.42215817594807, -0.07712787385208), (0.02704554141885, -0.05417518053666), (0.80001773566818, 0.91542195141039), (-0.79351832348816, -0.36208897989136), (0.63872359151636, 0.08128252493444), (0.52890520960295, 0.60048872455592), (0.74238552914587, 0.04491915291044), (0.99096131449250, -0.19451182854402), (-0.80412329643109, -0.88513818199457), (-0.64612616129736, 0.72198674804544), (0.11657770663191, -0.83662833815041), (-0.95053182488101, -0.96939905138082), (-0.62228872928622, 0.82767262846661), (0.03004475787316, -0.99738896333384), (-0.97987214341034, 0.36526129686425), (-0.99986980746200, -0.36021610299715), (0.89110648599879, -0.97894250343044), (0.10407960510582, 0.77357793811619), (0.95964737821728, -0.35435818285502), (0.50843233159162, 0.96107691266205), (0.17006334670615, -0.76854025314829), (0.25872675063360, 0.99893303933816), (-0.01115998681937, 0.98496019742444), (-0.79598702973261, 0.97138411318894), (-0.99264708948101, -0.99542822402536), (-0.99829663752818, 0.01877138824311), (-0.70801016548184, 0.33680685948117), (-0.70467057786826, 0.93272777501857), (0.99846021905254, -0.98725746254433), (-0.63364968534650, -0.16473594423746), (-0.16258217500792, -0.95939125400802), (-0.43645594360633, -0.94805030113284), (-0.99848471702976, 0.96245166923809), (-0.16796458968998, -0.98987511890470), (-0.87979225745213, -0.71725725041680), (0.44183099021786, -0.93568974498761), (0.93310180125532, -0.99913308068246), (-0.93941931782002, -0.56409379640356), (-0.88590003188677, 0.47624600491382), (0.99971463703691, -0.83889954253462), (-0.75376385639978, 0.00814643438625), (0.93887685615875, -0.11284528204636), (0.85126435782309, 0.52349251543547), (0.39701421446381, 0.81779634174316), (-0.37024464187437, -0.87071656222959), (-0.36024828242896, 0.34655735648287), (-0.93388812549209, -0.84476541096429), (-0.65298804552119, -0.18439575450921), (0.11960319006843, 0.99899346780168), (0.94292565553160, 0.83163906518293), (0.75081145286948, -0.35533223142265), (0.56721979748394, -0.24076836414499), (0.46857766746029, -0.30140233457198), (0.97312313923635, -0.99548191630031), (-0.38299976567017, 0.98516909715427), (0.41025800019463, 0.02116736935734), (0.09638062008048, 0.04411984381457), (-0.85283249275397, 0.91475563922421), (0.88866808958124, -0.99735267083226), (-0.48202429536989, -0.96805608884164), (0.27572582416567, 0.58634753335832), (-0.65889129659168, 0.58835634138583), (0.98838086953732, 0.99994349600236), (-0.20651349620689, 0.54593044066355), (-0.62126416356920, -0.59893681700392), (0.20320105410437, -0.86879180355289), (-0.97790548600584, 0.96290806999242), (0.11112534735126, 0.21484763313301), (-0.41368337314182, 0.28216837680365), (0.24133038992960, 0.51294362630238), (-0.66393410674885, -0.08249679629081), (-0.53697829178752, -0.97649903936228), (-0.97224737889348, 0.22081333579837), (0.87392477144549, -0.12796173740361), (0.19050361015753, 0.01602615387195), (-0.46353441212724, -0.95249041539006), (-0.07064096339021, -0.94479803205886), (-0.92444085484466, -0.10457590187436), (-0.83822593578728, -0.01695043208885), (0.75214681811150, -0.99955681042665), (-0.42102998829339, 0.99720941999394), (-0.72094786237696, -0.35008961934255), (0.78843311019251, 0.52851398958271), (0.97394027897442, -0.26695944086561), (0.99206463477946, -0.57010120849429), (0.76789609461795, -0.76519356730966), (-0.82002421836409, -0.73530179553767), (0.81924990025724, 0.99698425250579), (-0.26719850873357, 0.68903369776193), (-0.43311260380975, 0.85321815947490), (0.99194979673836, 0.91876249766422), (-0.80692001248487, -0.32627540663214), (0.43080003649976, -0.21919095636638), (0.67709491937357, -0.95478075822906), (0.56151770568316, -0.70693811747778), (0.10831862810749, -0.08628837174592), (0.91229417540436, -0.65987351408410), (-0.48972893932274, 0.56289246362686), (-0.89033658689697, -0.71656563987082), (0.65269447475094, 0.65916004833932), (0.67439478141121, -0.81684380846796), (-0.47770832416973, -0.16789556203025), (-0.99715979260878, -0.93565784007648), (-0.90889593602546, 0.62034397054380), (-0.06618622548177, -0.23812217221359), (0.99430266919728, 0.18812555317553), (0.97686402381843, -0.28664534366620), (0.94813650221268, -0.97506640027128), (-0.95434497492853, -0.79607978501983), (-0.49104783137150, 0.32895214359663), (0.99881175120751, 0.88993983831354), (0.50449166760303, -0.85995072408434), (0.47162891065108, -0.18680204049569), (-0.62081581361840, 0.75000676218956), (-0.43867015250812, 0.99998069244322), (0.98630563232075, -0.53578899600662), (-0.61510362277374, -0.89515019899997), (-0.03841517601843, -0.69888815681179), (-0.30102157304644, -0.07667808922205), (0.41881284182683, 0.02188098922282), (-0.86135454941237, 0.98947480909359), (0.67226861393788, -0.13494389011014), (-0.70737398842068, -0.76547349325992), (0.94044946687963, 0.09026201157416), (-0.82386352534327, 0.08924768823676), (-0.32070666698656, 0.50143421908753), (0.57593163224487, -0.98966422921509), (-0.36326018419965, 0.07440243123228), (0.99979044674350, -0.14130287347405), (-0.92366023326932, -0.97979298068180), (-0.44607178518598, -0.54233252016394), (0.44226800932956, 0.71326756742752), (0.03671907158312, 0.63606389366675), (0.52175424682195, -0.85396826735705), (-0.94701139690956, -0.01826348194255), (-0.98759606946049, 0.82288714303073), (0.87434794743625, 0.89399495655433), (-0.93412041758744, 0.41374052024363), (0.96063943315511, 0.93116709541280), (0.97534253457837, 0.86150930812689), (0.99642466504163, 0.70190043427512), (-0.94705089665984, -0.29580042814306), (0.91599807087376, -0.98147830385781), ]; #[cfg(test)] mod tests { use super::*; fn kraft_is_one(codes: &[(u8, u32, i32)]) { let sum: f64 = codes.iter().map(|&(l, _, _)| 2f64.powi(-(l as i32))).sum(); assert!((sum - 1.0).abs() < 1e-9, "Kraft sum {sum}"); } fn is_prefix_free(codes: &[(u8, u32, i32)]) { for (i, &(li, ci, _)) in codes.iter().enumerate() { for &(lj, cj, _) in codes.iter().skip(i + 1) { let (short, long) = if li <= lj { (li, lj) } else { (lj, li) }; let (sc, lc) = if li <= lj { (ci, cj) } else { (cj, ci) }; assert_ne!(sc, lc >> (long - short), "{ci:?} prefixes {cj:?}"); } } } #[test] fn env15_f_is_a_complete_prefix_code() { kraft_is_one(&ENV15_F); is_prefix_free(&ENV15_F); } #[test] fn env15_t_is_a_complete_prefix_code() { kraft_is_one(&ENV15_T); is_prefix_free(&ENV15_T); } #[test] fn env30_t_is_a_complete_prefix_code() { kraft_is_one(&ENV30_T); is_prefix_free(&ENV30_T); } #[test] fn env30_f_is_a_complete_prefix_code() { kraft_is_one(&ENV30_F); is_prefix_free(&ENV30_F); } #[test] fn noise_t_is_a_complete_prefix_code() { kraft_is_one(&NOISE_T); is_prefix_free(&NOISE_T); } #[test] fn noise_f_is_a_complete_prefix_code() { kraft_is_one(&NOISE_F); is_prefix_free(&NOISE_F); } #[test] fn envb15_f_is_a_complete_prefix_code() { kraft_is_one(&ENVB15_F); is_prefix_free(&ENVB15_F); } #[test] fn envb15_t_is_a_complete_prefix_code() { kraft_is_one(&ENVB15_T); is_prefix_free(&ENVB15_T); } #[test] fn envb30_t_is_a_complete_prefix_code() { kraft_is_one(&ENVB30_T); is_prefix_free(&ENVB30_T); } #[test] fn envb30_f_is_a_complete_prefix_code() { kraft_is_one(&ENVB30_F); is_prefix_free(&ENVB30_F); } #[test] fn noiseb_t_is_a_complete_prefix_code() { kraft_is_one(&NOISEB_T); is_prefix_free(&NOISEB_T); } #[test] fn noiseb_f_is_a_complete_prefix_code() { kraft_is_one(&NOISEB_F); is_prefix_free(&NOISEB_F); } }