Debian Codegraph @

.cargo/vendor/rav1e/src/asm/shared/transform/mod.rs

raw
1 // Copyright (c) 2019-2022, The rav1e contributors. All rights reserved
2 //
3 // This source code is subject to the terms of the BSD 2 Clause License and
4 // the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
5 // was not distributed with this source code in the LICENSE file, you can
6 // obtain it at www.aomedia.org/license/software. If the Alliance for Open
7 // Media Patent License 1.0 was not distributed with this source code in the
8 // PATENTS file, you can obtain it at www.aomedia.org/license/patent.
9
10 pub mod forward;
11 pub mod inverse;
12
13 use crate::transform::*;
14 use std::ops::Index;
15
16 impl<T> Index<TxSize> for [T; TxSize::TX_SIZES_ALL] {
17 type Output = T;
18 #[inline]
19 fn index(&self, tx_size: TxSize) -> &Self::Output {
20 // SAFETY: values of TxSize are < TX_SIZES_ALL
21 unsafe { self.get_unchecked(tx_size as usize) }
22 }
23 }
24
25 impl<T> Index<TxType> for [T; TX_TYPES] {
26 type Output = T;
27 #[inline]
28 fn index(&self, tx_type: TxType) -> &Self::Output {
29 // SAFETY: Wraps WHT_WHT to DCT_DCT
30 unsafe { self.get_unchecked((tx_type as usize) & 15) }
31 }
32 }
33
34 impl<T> Index<TxType> for [T; TX_TYPES_PLUS_LL] {
35 type Output = T;
36 #[inline]
37 fn index(&self, tx_type: TxType) -> &Self::Output {
38 // SAFETY: values of TxType are < TX_TYPES_PLUS_LL
39 unsafe { self.get_unchecked(tx_type as usize) }
40 }
41 }