/src/avm/avm_dsp/recenter.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2021, Alliance for Open Media. All rights reserved |
3 | | * |
4 | | * This source code is subject to the terms of the BSD 3-Clause Clear License |
5 | | * and the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear |
6 | | * License was not distributed with this source code in the LICENSE file, you |
7 | | * can obtain it at aomedia.org/license/software-license/bsd-3-c-c/. If the |
8 | | * Alliance for Open Media Patent License 1.0 was not distributed with this |
9 | | * source code in the PATENTS file, you can obtain it at |
10 | | * aomedia.org/license/patent-license/. |
11 | | */ |
12 | | |
13 | | #ifndef AVM_AVM_DSP_RECENTER_H_ |
14 | | #define AVM_AVM_DSP_RECENTER_H_ |
15 | | |
16 | | #include "config/avm_config.h" |
17 | | |
18 | | #include "avm/avm_integer.h" |
19 | | |
20 | | // Inverse recenters a non-negative literal v around a reference r |
21 | 261k | static INLINE uint16_t inv_recenter_nonneg(uint16_t r, uint16_t v) { |
22 | 261k | if (v > (r << 1)) |
23 | 7.61k | return v; |
24 | 253k | else if ((v & 1) == 0) |
25 | 177k | return (v >> 1) + r; |
26 | 76.4k | else |
27 | 76.4k | return r - ((v + 1) >> 1); |
28 | 261k | } Unexecuted instantiation: av2_dx_iface.c:inv_recenter_nonneg Unexecuted instantiation: annexF.c:inv_recenter_nonneg decodeframe.c:inv_recenter_nonneg Line | Count | Source | 21 | 75.2k | static INLINE uint16_t inv_recenter_nonneg(uint16_t r, uint16_t v) { | 22 | 75.2k | if (v > (r << 1)) | 23 | 6.05k | return v; | 24 | 69.2k | else if ((v & 1) == 0) | 25 | 33.9k | return (v >> 1) + r; | 26 | 35.2k | else | 27 | 35.2k | return r - ((v + 1) >> 1); | 28 | 75.2k | } |
Unexecuted instantiation: decodemv.c:inv_recenter_nonneg Unexecuted instantiation: decoder.c:inv_recenter_nonneg Unexecuted instantiation: decodetxb.c:inv_recenter_nonneg Unexecuted instantiation: detokenize.c:inv_recenter_nonneg Unexecuted instantiation: obu_fgm.c:inv_recenter_nonneg Unexecuted instantiation: obu.c:inv_recenter_nonneg Unexecuted instantiation: obu_ci.c:inv_recenter_nonneg Unexecuted instantiation: obu_atlas.c:inv_recenter_nonneg Unexecuted instantiation: obu_lcr.c:inv_recenter_nonneg Unexecuted instantiation: obu_ops.c:inv_recenter_nonneg Unexecuted instantiation: obu_buf.c:inv_recenter_nonneg bitreader_buffer.c:inv_recenter_nonneg Line | Count | Source | 21 | 185k | static INLINE uint16_t inv_recenter_nonneg(uint16_t r, uint16_t v) { | 22 | 185k | if (v > (r << 1)) | 23 | 1.55k | return v; | 24 | 184k | else if ((v & 1) == 0) | 25 | 143k | return (v >> 1) + r; | 26 | 41.1k | else | 27 | 41.1k | return r - ((v + 1) >> 1); | 28 | 185k | } |
Unexecuted instantiation: binary_codes_reader.c:inv_recenter_nonneg Unexecuted instantiation: bitreader.c:inv_recenter_nonneg Unexecuted instantiation: level.c:inv_recenter_nonneg Unexecuted instantiation: hr_coding.c:inv_recenter_nonneg Unexecuted instantiation: obu_qm.c:inv_recenter_nonneg Unexecuted instantiation: bitwriter_buffer.c:inv_recenter_nonneg |
29 | | |
30 | | // Inverse recenters a non-negative literal v in [0, n-1] around a |
31 | | // reference r also in [0, n-1] |
32 | | static INLINE uint16_t inv_recenter_finite_nonneg(uint16_t n, uint16_t r, |
33 | 261k | uint16_t v) { |
34 | 261k | if ((r << 1) <= n) { |
35 | 205k | return inv_recenter_nonneg(r, v); |
36 | 205k | } else { |
37 | 55.3k | return n - 1 - inv_recenter_nonneg(n - 1 - r, v); |
38 | 55.3k | } |
39 | 261k | } Unexecuted instantiation: av2_dx_iface.c:inv_recenter_finite_nonneg Unexecuted instantiation: annexF.c:inv_recenter_finite_nonneg decodeframe.c:inv_recenter_finite_nonneg Line | Count | Source | 33 | 75.2k | uint16_t v) { | 34 | 75.2k | if ((r << 1) <= n) { | 35 | 55.3k | return inv_recenter_nonneg(r, v); | 36 | 55.3k | } else { | 37 | 19.9k | return n - 1 - inv_recenter_nonneg(n - 1 - r, v); | 38 | 19.9k | } | 39 | 75.2k | } |
Unexecuted instantiation: decodemv.c:inv_recenter_finite_nonneg Unexecuted instantiation: decoder.c:inv_recenter_finite_nonneg Unexecuted instantiation: decodetxb.c:inv_recenter_finite_nonneg Unexecuted instantiation: detokenize.c:inv_recenter_finite_nonneg Unexecuted instantiation: obu_fgm.c:inv_recenter_finite_nonneg Unexecuted instantiation: obu.c:inv_recenter_finite_nonneg Unexecuted instantiation: obu_ci.c:inv_recenter_finite_nonneg Unexecuted instantiation: obu_atlas.c:inv_recenter_finite_nonneg Unexecuted instantiation: obu_lcr.c:inv_recenter_finite_nonneg Unexecuted instantiation: obu_ops.c:inv_recenter_finite_nonneg Unexecuted instantiation: obu_buf.c:inv_recenter_finite_nonneg bitreader_buffer.c:inv_recenter_finite_nonneg Line | Count | Source | 33 | 185k | uint16_t v) { | 34 | 185k | if ((r << 1) <= n) { | 35 | 150k | return inv_recenter_nonneg(r, v); | 36 | 150k | } else { | 37 | 35.4k | return n - 1 - inv_recenter_nonneg(n - 1 - r, v); | 38 | 35.4k | } | 39 | 185k | } |
Unexecuted instantiation: binary_codes_reader.c:inv_recenter_finite_nonneg Unexecuted instantiation: bitreader.c:inv_recenter_finite_nonneg Unexecuted instantiation: level.c:inv_recenter_finite_nonneg Unexecuted instantiation: hr_coding.c:inv_recenter_finite_nonneg Unexecuted instantiation: obu_qm.c:inv_recenter_finite_nonneg Unexecuted instantiation: bitwriter_buffer.c:inv_recenter_finite_nonneg |
40 | | |
41 | | // Recenters a non-negative literal v around a reference r |
42 | 0 | static INLINE uint16_t recenter_nonneg(uint16_t r, uint16_t v) { |
43 | 0 | if (v > (r << 1)) |
44 | 0 | return v; |
45 | 0 | else if (v >= r) |
46 | 0 | return ((v - r) << 1); |
47 | 0 | else |
48 | 0 | return ((r - v) << 1) - 1; |
49 | 0 | } Unexecuted instantiation: av2_dx_iface.c:recenter_nonneg Unexecuted instantiation: annexF.c:recenter_nonneg Unexecuted instantiation: decodeframe.c:recenter_nonneg Unexecuted instantiation: decodemv.c:recenter_nonneg Unexecuted instantiation: decoder.c:recenter_nonneg Unexecuted instantiation: decodetxb.c:recenter_nonneg Unexecuted instantiation: detokenize.c:recenter_nonneg Unexecuted instantiation: obu_fgm.c:recenter_nonneg Unexecuted instantiation: obu.c:recenter_nonneg Unexecuted instantiation: obu_ci.c:recenter_nonneg Unexecuted instantiation: obu_atlas.c:recenter_nonneg Unexecuted instantiation: obu_lcr.c:recenter_nonneg Unexecuted instantiation: obu_ops.c:recenter_nonneg Unexecuted instantiation: obu_buf.c:recenter_nonneg Unexecuted instantiation: bitreader_buffer.c:recenter_nonneg Unexecuted instantiation: binary_codes_reader.c:recenter_nonneg Unexecuted instantiation: bitreader.c:recenter_nonneg Unexecuted instantiation: level.c:recenter_nonneg Unexecuted instantiation: hr_coding.c:recenter_nonneg Unexecuted instantiation: obu_qm.c:recenter_nonneg Unexecuted instantiation: bitwriter_buffer.c:recenter_nonneg |
50 | | |
51 | | // Recenters a non-negative literal v in [0, n-1] around a |
52 | | // reference r also in [0, n-1] |
53 | | static INLINE uint16_t recenter_finite_nonneg(uint16_t n, uint16_t r, |
54 | 0 | uint16_t v) { |
55 | 0 | if ((r << 1) <= n) { |
56 | 0 | return recenter_nonneg(r, v); |
57 | 0 | } else { |
58 | 0 | return recenter_nonneg(n - 1 - r, n - 1 - v); |
59 | 0 | } |
60 | 0 | } Unexecuted instantiation: av2_dx_iface.c:recenter_finite_nonneg Unexecuted instantiation: annexF.c:recenter_finite_nonneg Unexecuted instantiation: decodeframe.c:recenter_finite_nonneg Unexecuted instantiation: decodemv.c:recenter_finite_nonneg Unexecuted instantiation: decoder.c:recenter_finite_nonneg Unexecuted instantiation: decodetxb.c:recenter_finite_nonneg Unexecuted instantiation: detokenize.c:recenter_finite_nonneg Unexecuted instantiation: obu_fgm.c:recenter_finite_nonneg Unexecuted instantiation: obu.c:recenter_finite_nonneg Unexecuted instantiation: obu_ci.c:recenter_finite_nonneg Unexecuted instantiation: obu_atlas.c:recenter_finite_nonneg Unexecuted instantiation: obu_lcr.c:recenter_finite_nonneg Unexecuted instantiation: obu_ops.c:recenter_finite_nonneg Unexecuted instantiation: obu_buf.c:recenter_finite_nonneg Unexecuted instantiation: bitreader_buffer.c:recenter_finite_nonneg Unexecuted instantiation: binary_codes_reader.c:recenter_finite_nonneg Unexecuted instantiation: bitreader.c:recenter_finite_nonneg Unexecuted instantiation: level.c:recenter_finite_nonneg Unexecuted instantiation: hr_coding.c:recenter_finite_nonneg Unexecuted instantiation: obu_qm.c:recenter_finite_nonneg Unexecuted instantiation: bitwriter_buffer.c:recenter_finite_nonneg |
61 | | |
62 | | #endif // AVM_AVM_DSP_RECENTER_H_ |