maroontree 0.1.8

AV1 image & AV2 video and image encoder
Documentation
/*
 * Copyright (c) Radzivon Bartoshyk 6/2026. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * 1.  Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 *
 * 2.  Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 *
 * 3.  Neither the name of the copyright holder nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#![allow(clippy::all)]
pub(crate) static TXB_SKIP_TX4_Q0: [u16; 10] = [
    7009, 31669, 30006, 24824, 16538, 3692, 23870, 19113, 10420, 16384,
];
pub(crate) static BASE_LF_TX4_Q0: [[[u16; 5]; 2]; 33] = [
    [
        [27307, 21845, 16384, 10923, 5461],
        [27307, 21845, 16384, 10923, 5461],
    ],
    [
        [30940, 15917, 8756, 4119, 2346],
        [32764, 24597, 10756, 4557, 2291],
    ],
    [
        [25845, 16752, 11062, 5619, 3332],
        [32764, 25364, 16196, 9964, 4490],
    ],
    [
        [27278, 23948, 16954, 12524, 8747],
        [32764, 27716, 19370, 13986, 9377],
    ],
    [
        [29736, 24738, 19681, 15306, 11027],
        [32764, 27949, 22142, 19204, 14761],
    ],
    [
        [30507, 26350, 23609, 20795, 17177],
        [32763, 28855, 23037, 20188, 18928],
    ],
    [
        [30468, 27481, 24221, 20625, 16931],
        [32763, 30161, 26724, 23839, 20789],
    ],
    [
        [31070, 27571, 24493, 21319, 20556],
        [32719, 30643, 28599, 25423, 22176],
    ],
    [
        [32180, 29862, 28576, 26770, 25678],
        [31479, 31471, 29450, 28142, 26939],
    ],
    [[20014, 3758, 1229, 632, 245], [27028, 6121, 799, 309, 36]],
    [
        [24794, 9456, 4025, 1581, 639],
        [32764, 13646, 4653, 1417, 440],
    ],
    [
        [26764, 15015, 7279, 3862, 2076],
        [32764, 21292, 12482, 6795, 3650],
    ],
    [
        [27450, 19862, 11937, 6920, 3857],
        [32764, 24373, 16879, 10390, 5752],
    ],
    [
        [29431, 22607, 16355, 11865, 8039],
        [32764, 26537, 19589, 13736, 9644],
    ],
    [
        [30136, 24512, 19379, 14419, 10711],
        [32764, 27229, 22015, 17227, 13097],
    ],
    [
        [31121, 27787, 24750, 22055, 19838],
        [32635, 30173, 27010, 23596, 20722],
    ],
    [[15310, 2897, 768, 222, 66], [25843, 5680, 1018, 400, 62]],
    [
        [22256, 8265, 3122, 1239, 550],
        [31906, 14824, 5594, 2054, 694],
    ],
    [
        [26259, 15332, 8706, 4470, 2329],
        [32038, 21166, 12318, 6729, 3737],
    ],
    [
        [28434, 19925, 13129, 7961, 4959],
        [31586, 24464, 16706, 10710, 6360],
    ],
    [
        [30005, 24826, 20217, 15895, 12193],
        [32180, 27655, 22513, 18043, 14329],
    ],
    [
        [7507, 2494, 1367, 909, 660],
        [27307, 21845, 16384, 10923, 5461],
    ],
    [
        [21427, 9981, 5438, 3439, 2366],
        [27307, 21845, 16384, 10923, 5461],
    ],
    [
        [24898, 16171, 10454, 6732, 5122],
        [27307, 21845, 16384, 10923, 5461],
    ],
    [
        [23666, 17556, 13172, 10138, 8054],
        [27307, 21845, 16384, 10923, 5461],
    ],
    [
        [30141, 25184, 20231, 16620, 13540],
        [27307, 21845, 16384, 10923, 5461],
    ],
    [
        [30995, 27609, 24384, 21186, 18442],
        [27307, 21845, 16384, 10923, 5461],
    ],
    [
        [31487, 29462, 27204, 25038, 22743],
        [27307, 21845, 16384, 10923, 5461],
    ],
    [[4493, 681, 214, 89, 36], [27307, 21845, 16384, 10923, 5461]],
    [
        [19644, 8487, 3519, 1729, 836],
        [27307, 21845, 16384, 10923, 5461],
    ],
    [
        [25516, 17265, 10778, 6747, 4439],
        [27307, 21845, 16384, 10923, 5461],
    ],
    [
        [26002, 19517, 14248, 10534, 7824],
        [27307, 21845, 16384, 10923, 5461],
    ],
    [
        [30746, 26486, 22209, 18937, 15855],
        [27307, 21845, 16384, 10923, 5461],
    ],
];
pub(crate) static BASE_TX4_Q0: [[[u16; 3]; 2]; 20] = [
    [[20408, 6376, 2825], [24178, 7415, 1873]],
    [[25522, 13272, 6238], [29300, 16536, 7147]],
    [[28760, 20163, 13840], [30769, 23603, 16083]],
    [[29620, 23375, 17868], [31658, 25072, 18646]],
    [[30225, 25242, 20747], [30207, 27323, 22222]],
    [[24576, 16384, 8192], [24576, 16384, 8192]],
    [[24576, 16384, 8192], [24576, 16384, 8192]],
    [[24576, 16384, 8192], [24576, 16384, 8192]],
    [[24576, 16384, 8192], [24576, 16384, 8192]],
    [[24576, 16384, 8192], [24576, 16384, 8192]],
    [[24576, 16384, 8192], [24576, 16384, 8192]],
    [[24576, 16384, 8192], [24576, 16384, 8192]],
    [[24576, 16384, 8192], [24576, 16384, 8192]],
    [[24576, 16384, 8192], [24576, 16384, 8192]],
    [[24576, 16384, 8192], [24576, 16384, 8192]],
    [[4754, 1234, 708], [24576, 16384, 8192]],
    [[19633, 9281, 4169], [24576, 16384, 8192]],
    [[25719, 17400, 12000], [24576, 16384, 8192]],
    [[29659, 24714, 20385], [24576, 16384, 8192]],
    [[24576, 16384, 8192], [24576, 16384, 8192]],
];
pub(crate) static BASE_LF_EOB_TX4_Q0: [[u16; 4]; 4] = [
    [5282, 1628, 989, 704],
    [4505, 1626, 955, 711],
    [5190, 2363, 1566, 1320],
    [2968, 623, 179, 103],
];
pub(crate) static BASE_EOB_TX4_Q0: [[u16; 2]; 4] =
    [[21845, 10923], [21845, 10923], [21845, 10923], [7293, 2979]];
pub(crate) static BR_LF_Q0: [[u16; 3]; 14] = [
    [24825, 18575, 11993],
    [18471, 10368, 6530],
    [22211, 14085, 10218],
    [24479, 16700, 14314],
    [27510, 22038, 19059],
    [28835, 24602, 22088],
    [30303, 27443, 26143],
    [21903, 16338, 13077],
    [18197, 10035, 6662],
    [18696, 9747, 6797],
    [21210, 12515, 9533],
    [24165, 16568, 13302],
    [26127, 19682, 16156],
    [28528, 23725, 20822],
];
pub(crate) static BR_Q0: [[u16; 3]; 7] = [
    [10463, 4025, 2423],
    [10105, 2820, 1448],
    [12992, 4110, 2333],
    [17332, 7455, 4587],
    [21554, 12097, 7914],
    [24220, 15786, 11002],
    [27039, 20775, 15592],
];
pub(crate) static EOB16_Q0: [[u16; 4]; 3] = [
    [30822, 29709, 25934, 17645],
    [32210, 31933, 30029, 26234],
    [24768, 22402, 18302, 13199],
];
pub(crate) static V_TXB_SKIP_TX4_Q0: [u16; 12] = [
    31329, 26577, 18158, 32588, 16384, 16384, 25120, 16620, 8203, 16384, 16384, 16384,
];