/src/libavif/ext/aom/av1/common/obmc.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2017, Alliance for Open Media. All rights reserved. |
3 | | * |
4 | | * This source code is subject to the terms of the BSD 2 Clause License and |
5 | | * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License |
6 | | * was not distributed with this source code in the LICENSE file, you can |
7 | | * obtain it at www.aomedia.org/license/software. If the Alliance for Open |
8 | | * Media Patent License 1.0 was not distributed with this source code in the |
9 | | * PATENTS file, you can obtain it at www.aomedia.org/license/patent. |
10 | | */ |
11 | | |
12 | | #ifndef AOM_AV1_COMMON_OBMC_H_ |
13 | | #define AOM_AV1_COMMON_OBMC_H_ |
14 | | |
15 | | typedef void (*overlappable_nb_visitor_t)(MACROBLOCKD *xd, int rel_mi_row, |
16 | | int rel_mi_col, uint8_t op_mi_size, |
17 | | int dir, MB_MODE_INFO *nb_mi, |
18 | | void *fun_ctxt, const int num_planes); |
19 | | |
20 | | static inline void foreach_overlappable_nb_above(const AV1_COMMON *cm, |
21 | | MACROBLOCKD *xd, int nb_max, |
22 | | overlappable_nb_visitor_t fun, |
23 | 1.90M | void *fun_ctxt) { |
24 | 1.90M | if (!xd->up_available) return; |
25 | | |
26 | 1.52M | const int num_planes = av1_num_planes(cm); |
27 | 1.52M | int nb_count = 0; |
28 | 1.52M | const int mi_col = xd->mi_col; |
29 | | // prev_row_mi points into the mi array, starting at the beginning of the |
30 | | // previous row. |
31 | 1.52M | MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride; |
32 | 1.52M | const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols); |
33 | 1.52M | uint8_t mi_step; |
34 | 3.10M | for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max; |
35 | 1.57M | above_mi_col += mi_step) { |
36 | 1.57M | MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col; |
37 | 1.57M | mi_step = |
38 | 1.57M | AOMMIN(mi_size_wide[above_mi[0]->bsize], mi_size_wide[BLOCK_64X64]); |
39 | | // If we're considering a block with width 4, it should be treated as |
40 | | // half of a pair of blocks with chroma information in the second. Move |
41 | | // above_mi_col back to the start of the pair if needed, set above_mbmi |
42 | | // to point at the block with chroma information, and set mi_step to 2 to |
43 | | // step over the entire pair at the end of the iteration. |
44 | 1.57M | if (mi_step == 1) { |
45 | 6.11k | above_mi_col &= ~1; |
46 | 6.11k | above_mi = prev_row_mi + above_mi_col + 1; |
47 | 6.11k | mi_step = 2; |
48 | 6.11k | } |
49 | 1.57M | if (is_neighbor_overlappable(*above_mi)) { |
50 | 755k | ++nb_count; |
51 | 755k | fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0, |
52 | 755k | *above_mi, fun_ctxt, num_planes); |
53 | 755k | } |
54 | 1.57M | } |
55 | 1.52M | } decodeframe.c:foreach_overlappable_nb_above Line | Count | Source | 23 | 10.0k | void *fun_ctxt) { | 24 | 10.0k | if (!xd->up_available) return; | 25 | | | 26 | 10.0k | const int num_planes = av1_num_planes(cm); | 27 | 10.0k | int nb_count = 0; | 28 | 10.0k | const int mi_col = xd->mi_col; | 29 | | // prev_row_mi points into the mi array, starting at the beginning of the | 30 | | // previous row. | 31 | 10.0k | MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride; | 32 | 10.0k | const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols); | 33 | 10.0k | uint8_t mi_step; | 34 | 20.9k | for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max; | 35 | 10.9k | above_mi_col += mi_step) { | 36 | 10.9k | MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col; | 37 | 10.9k | mi_step = | 38 | 10.9k | AOMMIN(mi_size_wide[above_mi[0]->bsize], mi_size_wide[BLOCK_64X64]); | 39 | | // If we're considering a block with width 4, it should be treated as | 40 | | // half of a pair of blocks with chroma information in the second. Move | 41 | | // above_mi_col back to the start of the pair if needed, set above_mbmi | 42 | | // to point at the block with chroma information, and set mi_step to 2 to | 43 | | // step over the entire pair at the end of the iteration. | 44 | 10.9k | if (mi_step == 1) { | 45 | 740 | above_mi_col &= ~1; | 46 | 740 | above_mi = prev_row_mi + above_mi_col + 1; | 47 | 740 | mi_step = 2; | 48 | 740 | } | 49 | 10.9k | if (is_neighbor_overlappable(*above_mi)) { | 50 | 10.7k | ++nb_count; | 51 | 10.7k | fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0, | 52 | 10.7k | *above_mi, fun_ctxt, num_planes); | 53 | 10.7k | } | 54 | 10.9k | } | 55 | 10.0k | } |
Unexecuted instantiation: rdopt.c:foreach_overlappable_nb_above Unexecuted instantiation: reconinter_enc.c:foreach_overlappable_nb_above Unexecuted instantiation: reconinter_enc_sse2.c:foreach_overlappable_nb_above reconinter.c:foreach_overlappable_nb_above Line | Count | Source | 23 | 1.89M | void *fun_ctxt) { | 24 | 1.89M | if (!xd->up_available) return; | 25 | | | 26 | 1.51M | const int num_planes = av1_num_planes(cm); | 27 | 1.51M | int nb_count = 0; | 28 | 1.51M | const int mi_col = xd->mi_col; | 29 | | // prev_row_mi points into the mi array, starting at the beginning of the | 30 | | // previous row. | 31 | 1.51M | MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride; | 32 | 1.51M | const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols); | 33 | 1.51M | uint8_t mi_step; | 34 | 3.07M | for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max; | 35 | 1.56M | above_mi_col += mi_step) { | 36 | 1.56M | MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col; | 37 | 1.56M | mi_step = | 38 | 1.56M | AOMMIN(mi_size_wide[above_mi[0]->bsize], mi_size_wide[BLOCK_64X64]); | 39 | | // If we're considering a block with width 4, it should be treated as | 40 | | // half of a pair of blocks with chroma information in the second. Move | 41 | | // above_mi_col back to the start of the pair if needed, set above_mbmi | 42 | | // to point at the block with chroma information, and set mi_step to 2 to | 43 | | // step over the entire pair at the end of the iteration. | 44 | 1.56M | if (mi_step == 1) { | 45 | 5.37k | above_mi_col &= ~1; | 46 | 5.37k | above_mi = prev_row_mi + above_mi_col + 1; | 47 | 5.37k | mi_step = 2; | 48 | 5.37k | } | 49 | 1.56M | if (is_neighbor_overlappable(*above_mi)) { | 50 | 744k | ++nb_count; | 51 | 744k | fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0, | 52 | 744k | *above_mi, fun_ctxt, num_planes); | 53 | 744k | } | 54 | 1.56M | } | 55 | 1.51M | } |
|
56 | | |
57 | | static inline void foreach_overlappable_nb_left(const AV1_COMMON *cm, |
58 | | MACROBLOCKD *xd, int nb_max, |
59 | | overlappable_nb_visitor_t fun, |
60 | 1.19M | void *fun_ctxt) { |
61 | 1.19M | if (!xd->left_available) return; |
62 | | |
63 | 974k | const int num_planes = av1_num_planes(cm); |
64 | 974k | int nb_count = 0; |
65 | | // prev_col_mi points into the mi array, starting at the top of the |
66 | | // previous column |
67 | 974k | const int mi_row = xd->mi_row; |
68 | 974k | MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride; |
69 | 974k | const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows); |
70 | 974k | uint8_t mi_step; |
71 | 1.98M | for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max; |
72 | 1.00M | left_mi_row += mi_step) { |
73 | 1.00M | MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride; |
74 | 1.00M | mi_step = |
75 | 1.00M | AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]); |
76 | 1.00M | if (mi_step == 1) { |
77 | 2.72k | left_mi_row &= ~1; |
78 | 2.72k | left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride; |
79 | 2.72k | mi_step = 2; |
80 | 2.72k | } |
81 | 1.00M | if (is_neighbor_overlappable(*left_mi)) { |
82 | 370k | ++nb_count; |
83 | 370k | fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi, |
84 | 370k | fun_ctxt, num_planes); |
85 | 370k | } |
86 | 1.00M | } |
87 | 974k | } decodeframe.c:foreach_overlappable_nb_left Line | Count | Source | 60 | 10.9k | void *fun_ctxt) { | 61 | 10.9k | if (!xd->left_available) return; | 62 | | | 63 | 10.9k | const int num_planes = av1_num_planes(cm); | 64 | 10.9k | int nb_count = 0; | 65 | | // prev_col_mi points into the mi array, starting at the top of the | 66 | | // previous column | 67 | 10.9k | const int mi_row = xd->mi_row; | 68 | 10.9k | MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride; | 69 | 10.9k | const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows); | 70 | 10.9k | uint8_t mi_step; | 71 | 22.8k | for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max; | 72 | 11.9k | left_mi_row += mi_step) { | 73 | 11.9k | MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride; | 74 | 11.9k | mi_step = | 75 | 11.9k | AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]); | 76 | 11.9k | if (mi_step == 1) { | 77 | 916 | left_mi_row &= ~1; | 78 | 916 | left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride; | 79 | 916 | mi_step = 2; | 80 | 916 | } | 81 | 11.9k | if (is_neighbor_overlappable(*left_mi)) { | 82 | 11.7k | ++nb_count; | 83 | 11.7k | fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi, | 84 | 11.7k | fun_ctxt, num_planes); | 85 | 11.7k | } | 86 | 11.9k | } | 87 | 10.9k | } |
Unexecuted instantiation: rdopt.c:foreach_overlappable_nb_left Unexecuted instantiation: reconinter_enc.c:foreach_overlappable_nb_left Unexecuted instantiation: reconinter_enc_sse2.c:foreach_overlappable_nb_left reconinter.c:foreach_overlappable_nb_left Line | Count | Source | 60 | 1.18M | void *fun_ctxt) { | 61 | 1.18M | if (!xd->left_available) return; | 62 | | | 63 | 963k | const int num_planes = av1_num_planes(cm); | 64 | 963k | int nb_count = 0; | 65 | | // prev_col_mi points into the mi array, starting at the top of the | 66 | | // previous column | 67 | 963k | const int mi_row = xd->mi_row; | 68 | 963k | MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride; | 69 | 963k | const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows); | 70 | 963k | uint8_t mi_step; | 71 | 1.95M | for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max; | 72 | 994k | left_mi_row += mi_step) { | 73 | 994k | MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride; | 74 | 994k | mi_step = | 75 | 994k | AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]); | 76 | 994k | if (mi_step == 1) { | 77 | 1.80k | left_mi_row &= ~1; | 78 | 1.80k | left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride; | 79 | 1.80k | mi_step = 2; | 80 | 1.80k | } | 81 | 994k | if (is_neighbor_overlappable(*left_mi)) { | 82 | 358k | ++nb_count; | 83 | 358k | fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi, | 84 | 358k | fun_ctxt, num_planes); | 85 | 358k | } | 86 | 994k | } | 87 | 963k | } |
|
88 | | |
89 | | #endif // AOM_AV1_COMMON_OBMC_H_ |