Coverage Report

Created: 2026-08-31 06:20

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/work/dav1d/src/env.h
Line
Count
Source
1
/*
2
 * Copyright © 2018, VideoLAN and dav1d authors
3
 * Copyright © 2018, Two Orioles, LLC
4
 * All rights reserved.
5
 *
6
 * Redistribution and use in source and binary forms, with or without
7
 * modification, are permitted provided that the following conditions are met:
8
 *
9
 * 1. Redistributions of source code must retain the above copyright notice, this
10
 *    list of conditions and the following disclaimer.
11
 *
12
 * 2. Redistributions in binary form must reproduce the above copyright notice,
13
 *    this list of conditions and the following disclaimer in the documentation
14
 *    and/or other materials provided with the distribution.
15
 *
16
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 */
27
28
#ifndef DAV1D_SRC_ENV_H
29
#define DAV1D_SRC_ENV_H
30
31
#include <stddef.h>
32
#include <stdint.h>
33
#include <stdlib.h>
34
35
#include "src/levels.h"
36
#include "src/refmvs.h"
37
#include "src/tables.h"
38
39
typedef struct BlockContext {
40
    uint8_t ALIGN(mode[32], 8);
41
    uint8_t ALIGN(lcoef[32], 8);
42
    uint8_t ALIGN(ccoef[2][32], 8);
43
    uint8_t ALIGN(seg_pred[32], 8);
44
    uint8_t ALIGN(skip[32], 8);
45
    uint8_t ALIGN(skip_mode[32], 8);
46
    uint8_t ALIGN(intra[32], 8);
47
    uint8_t ALIGN(comp_type[32], 8);
48
    int8_t ALIGN(ref[2][32], 8); // -1 means intra
49
    uint8_t ALIGN(filter[2][32], 8); // 3 means unset
50
    int8_t ALIGN(tx_intra[32], 8);
51
    int8_t ALIGN(tx[32], 8);
52
    uint8_t ALIGN(tx_lpf_y[32], 8);
53
    uint8_t ALIGN(tx_lpf_uv[32], 8);
54
    uint8_t ALIGN(partition[16], 8);
55
    uint8_t ALIGN(uvmode[32], 8);
56
    uint8_t ALIGN(pal_sz[32], 8);
57
} BlockContext;
58
59
static inline int get_intra_ctx(const BlockContext *const a,
60
                                const BlockContext *const l,
61
                                const int yb4, const int xb4,
62
                                const int have_top, const int have_left)
63
183k
{
64
183k
    if (have_left) {
65
141k
        if (have_top) {
66
114k
            const int ctx = l->intra[yb4] + a->intra[xb4];
67
114k
            return ctx + (ctx == 2);
68
114k
        } else
69
26.8k
            return l->intra[yb4] * 2;
70
141k
    } else {
71
42.1k
        return have_top ? a->intra[xb4] * 2 : 0;
72
42.1k
    }
73
183k
}
Unexecuted instantiation: lib.c:get_intra_ctx
Unexecuted instantiation: log.c:get_intra_ctx
Unexecuted instantiation: mem.c:get_intra_ctx
Unexecuted instantiation: obu.c:get_intra_ctx
Unexecuted instantiation: picture.c:get_intra_ctx
Unexecuted instantiation: refmvs.c:get_intra_ctx
Unexecuted instantiation: thread_task.c:get_intra_ctx
Unexecuted instantiation: cdf.c:get_intra_ctx
decode.c:get_intra_ctx
Line
Count
Source
63
183k
{
64
183k
    if (have_left) {
65
141k
        if (have_top) {
66
114k
            const int ctx = l->intra[yb4] + a->intra[xb4];
67
114k
            return ctx + (ctx == 2);
68
114k
        } else
69
26.8k
            return l->intra[yb4] * 2;
70
141k
    } else {
71
42.1k
        return have_top ? a->intra[xb4] * 2 : 0;
72
42.1k
    }
73
183k
}
Unexecuted instantiation: recon_tmpl.c:get_intra_ctx
Unexecuted instantiation: cdef_apply_tmpl.c:get_intra_ctx
Unexecuted instantiation: ipred_prepare_tmpl.c:get_intra_ctx
Unexecuted instantiation: lf_apply_tmpl.c:get_intra_ctx
Unexecuted instantiation: lr_apply_tmpl.c:get_intra_ctx
74
75
static inline int get_tx_ctx(const BlockContext *const a,
76
                             const BlockContext *const l,
77
                             const TxfmInfo *const max_tx,
78
                             const int yb4, const int xb4)
79
624k
{
80
624k
    return (l->tx_intra[yb4] >= max_tx->lh) + (a->tx_intra[xb4] >= max_tx->lw);
81
624k
}
Unexecuted instantiation: lib.c:get_tx_ctx
Unexecuted instantiation: log.c:get_tx_ctx
Unexecuted instantiation: mem.c:get_tx_ctx
Unexecuted instantiation: obu.c:get_tx_ctx
Unexecuted instantiation: picture.c:get_tx_ctx
Unexecuted instantiation: refmvs.c:get_tx_ctx
Unexecuted instantiation: thread_task.c:get_tx_ctx
Unexecuted instantiation: cdf.c:get_tx_ctx
decode.c:get_tx_ctx
Line
Count
Source
79
624k
{
80
624k
    return (l->tx_intra[yb4] >= max_tx->lh) + (a->tx_intra[xb4] >= max_tx->lw);
81
624k
}
Unexecuted instantiation: recon_tmpl.c:get_tx_ctx
Unexecuted instantiation: cdef_apply_tmpl.c:get_tx_ctx
Unexecuted instantiation: ipred_prepare_tmpl.c:get_tx_ctx
Unexecuted instantiation: lf_apply_tmpl.c:get_tx_ctx
Unexecuted instantiation: lr_apply_tmpl.c:get_tx_ctx
82
83
static inline int get_partition_ctx(const BlockContext *const a,
84
                                    const BlockContext *const l,
85
                                    const enum BlockLevel bl,
86
                                    const int yb8, const int xb8)
87
2.19M
{
88
2.19M
    return ((a->partition[xb8] >> (4 - bl)) & 1) +
89
2.19M
          (((l->partition[yb8] >> (4 - bl)) & 1) << 1);
90
2.19M
}
Unexecuted instantiation: lib.c:get_partition_ctx
Unexecuted instantiation: log.c:get_partition_ctx
Unexecuted instantiation: mem.c:get_partition_ctx
Unexecuted instantiation: obu.c:get_partition_ctx
Unexecuted instantiation: picture.c:get_partition_ctx
Unexecuted instantiation: refmvs.c:get_partition_ctx
Unexecuted instantiation: thread_task.c:get_partition_ctx
Unexecuted instantiation: cdf.c:get_partition_ctx
decode.c:get_partition_ctx
Line
Count
Source
87
2.19M
{
88
2.19M
    return ((a->partition[xb8] >> (4 - bl)) & 1) +
89
2.19M
          (((l->partition[yb8] >> (4 - bl)) & 1) << 1);
90
2.19M
}
Unexecuted instantiation: recon_tmpl.c:get_partition_ctx
Unexecuted instantiation: cdef_apply_tmpl.c:get_partition_ctx
Unexecuted instantiation: ipred_prepare_tmpl.c:get_partition_ctx
Unexecuted instantiation: lf_apply_tmpl.c:get_partition_ctx
Unexecuted instantiation: lr_apply_tmpl.c:get_partition_ctx
91
92
static inline unsigned gather_left_partition_prob(const uint16_t *const in,
93
                                                  const enum BlockLevel bl)
94
134k
{
95
134k
    unsigned out = in[PARTITION_H - 1] - in[PARTITION_H];
96
    // Exploit the fact that cdfs for PARTITION_SPLIT, PARTITION_T_TOP_SPLIT,
97
    // PARTITION_T_BOTTOM_SPLIT and PARTITION_T_LEFT_SPLIT are neighbors.
98
134k
    out += in[PARTITION_SPLIT - 1] - in[PARTITION_T_LEFT_SPLIT];
99
134k
    if (bl != BL_128X128)
100
114k
        out += in[PARTITION_H4 - 1] - in[PARTITION_H4];
101
134k
    return out;
102
134k
}
Unexecuted instantiation: lib.c:gather_left_partition_prob
Unexecuted instantiation: log.c:gather_left_partition_prob
Unexecuted instantiation: mem.c:gather_left_partition_prob
Unexecuted instantiation: obu.c:gather_left_partition_prob
Unexecuted instantiation: picture.c:gather_left_partition_prob
Unexecuted instantiation: refmvs.c:gather_left_partition_prob
Unexecuted instantiation: thread_task.c:gather_left_partition_prob
Unexecuted instantiation: cdf.c:gather_left_partition_prob
decode.c:gather_left_partition_prob
Line
Count
Source
94
134k
{
95
134k
    unsigned out = in[PARTITION_H - 1] - in[PARTITION_H];
96
    // Exploit the fact that cdfs for PARTITION_SPLIT, PARTITION_T_TOP_SPLIT,
97
    // PARTITION_T_BOTTOM_SPLIT and PARTITION_T_LEFT_SPLIT are neighbors.
98
134k
    out += in[PARTITION_SPLIT - 1] - in[PARTITION_T_LEFT_SPLIT];
99
134k
    if (bl != BL_128X128)
100
114k
        out += in[PARTITION_H4 - 1] - in[PARTITION_H4];
101
134k
    return out;
102
134k
}
Unexecuted instantiation: recon_tmpl.c:gather_left_partition_prob
Unexecuted instantiation: cdef_apply_tmpl.c:gather_left_partition_prob
Unexecuted instantiation: ipred_prepare_tmpl.c:gather_left_partition_prob
Unexecuted instantiation: lf_apply_tmpl.c:gather_left_partition_prob
Unexecuted instantiation: lr_apply_tmpl.c:gather_left_partition_prob
103
104
static inline unsigned gather_top_partition_prob(const uint16_t *const in,
105
                                                 const enum BlockLevel bl)
106
306k
{
107
    // Exploit the fact that cdfs for PARTITION_V, PARTITION_SPLIT and
108
    // PARTITION_T_TOP_SPLIT are neighbors.
109
306k
    unsigned out = in[PARTITION_V - 1] - in[PARTITION_T_TOP_SPLIT];
110
    // Exploit the facts that cdfs for PARTITION_T_LEFT_SPLIT and
111
    // PARTITION_T_RIGHT_SPLIT are neighbors, the probability for
112
    // PARTITION_V4 is always zero, and the probability for
113
    // PARTITION_T_RIGHT_SPLIT is zero in 128x128 blocks.
114
306k
    out += in[PARTITION_T_LEFT_SPLIT - 1];
115
306k
    if (bl != BL_128X128)
116
288k
        out += in[PARTITION_V4 - 1] - in[PARTITION_T_RIGHT_SPLIT];
117
306k
    return out;
118
306k
}
Unexecuted instantiation: lib.c:gather_top_partition_prob
Unexecuted instantiation: log.c:gather_top_partition_prob
Unexecuted instantiation: mem.c:gather_top_partition_prob
Unexecuted instantiation: obu.c:gather_top_partition_prob
Unexecuted instantiation: picture.c:gather_top_partition_prob
Unexecuted instantiation: refmvs.c:gather_top_partition_prob
Unexecuted instantiation: thread_task.c:gather_top_partition_prob
Unexecuted instantiation: cdf.c:gather_top_partition_prob
decode.c:gather_top_partition_prob
Line
Count
Source
106
306k
{
107
    // Exploit the fact that cdfs for PARTITION_V, PARTITION_SPLIT and
108
    // PARTITION_T_TOP_SPLIT are neighbors.
109
306k
    unsigned out = in[PARTITION_V - 1] - in[PARTITION_T_TOP_SPLIT];
110
    // Exploit the facts that cdfs for PARTITION_T_LEFT_SPLIT and
111
    // PARTITION_T_RIGHT_SPLIT are neighbors, the probability for
112
    // PARTITION_V4 is always zero, and the probability for
113
    // PARTITION_T_RIGHT_SPLIT is zero in 128x128 blocks.
114
306k
    out += in[PARTITION_T_LEFT_SPLIT - 1];
115
306k
    if (bl != BL_128X128)
116
288k
        out += in[PARTITION_V4 - 1] - in[PARTITION_T_RIGHT_SPLIT];
117
306k
    return out;
118
306k
}
Unexecuted instantiation: recon_tmpl.c:gather_top_partition_prob
Unexecuted instantiation: cdef_apply_tmpl.c:gather_top_partition_prob
Unexecuted instantiation: ipred_prepare_tmpl.c:gather_top_partition_prob
Unexecuted instantiation: lf_apply_tmpl.c:gather_top_partition_prob
Unexecuted instantiation: lr_apply_tmpl.c:gather_top_partition_prob
119
120
static inline enum TxfmType get_uv_inter_txtp(const TxfmInfo *const uvt_dim,
121
                                              const enum TxfmType ytxtp)
122
129k
{
123
129k
    if (uvt_dim->max == TX_32X32)
124
19.4k
        return ytxtp == IDTX ? IDTX : DCT_DCT;
125
110k
    if (uvt_dim->min == TX_16X16 &&
126
7.54k
        ((1 << ytxtp) & ((1 << H_FLIPADST) | (1 << V_FLIPADST) |
127
7.54k
                         (1 << H_ADST) | (1 << V_ADST))))
128
94
    {
129
94
        return DCT_DCT;
130
94
    }
131
132
110k
    return ytxtp;
133
110k
}
Unexecuted instantiation: lib.c:get_uv_inter_txtp
Unexecuted instantiation: log.c:get_uv_inter_txtp
Unexecuted instantiation: mem.c:get_uv_inter_txtp
Unexecuted instantiation: obu.c:get_uv_inter_txtp
Unexecuted instantiation: picture.c:get_uv_inter_txtp
Unexecuted instantiation: refmvs.c:get_uv_inter_txtp
Unexecuted instantiation: thread_task.c:get_uv_inter_txtp
Unexecuted instantiation: cdf.c:get_uv_inter_txtp
Unexecuted instantiation: decode.c:get_uv_inter_txtp
recon_tmpl.c:get_uv_inter_txtp
Line
Count
Source
122
129k
{
123
129k
    if (uvt_dim->max == TX_32X32)
124
19.4k
        return ytxtp == IDTX ? IDTX : DCT_DCT;
125
110k
    if (uvt_dim->min == TX_16X16 &&
126
7.54k
        ((1 << ytxtp) & ((1 << H_FLIPADST) | (1 << V_FLIPADST) |
127
7.54k
                         (1 << H_ADST) | (1 << V_ADST))))
128
94
    {
129
94
        return DCT_DCT;
130
94
    }
131
132
110k
    return ytxtp;
133
110k
}
Unexecuted instantiation: cdef_apply_tmpl.c:get_uv_inter_txtp
Unexecuted instantiation: ipred_prepare_tmpl.c:get_uv_inter_txtp
Unexecuted instantiation: lf_apply_tmpl.c:get_uv_inter_txtp
Unexecuted instantiation: lr_apply_tmpl.c:get_uv_inter_txtp
134
135
static inline int get_filter_ctx(const BlockContext *const a,
136
                                 const BlockContext *const l,
137
                                 const int comp, const int dir, const int ref,
138
                                 const int yb4, const int xb4)
139
172k
{
140
172k
    const int a_filter = (a->ref[0][xb4] == ref || a->ref[1][xb4] == ref) ?
141
102k
                         a->filter[dir][xb4] : DAV1D_N_SWITCHABLE_FILTERS;
142
172k
    const int l_filter = (l->ref[0][yb4] == ref || l->ref[1][yb4] == ref) ?
143
103k
                         l->filter[dir][yb4] : DAV1D_N_SWITCHABLE_FILTERS;
144
145
172k
    if (a_filter == l_filter) {
146
95.3k
        return comp * 4 + a_filter;
147
95.3k
    } else if (a_filter == DAV1D_N_SWITCHABLE_FILTERS) {
148
34.6k
        return comp * 4 + l_filter;
149
42.4k
    } else if (l_filter == DAV1D_N_SWITCHABLE_FILTERS) {
150
34.2k
        return comp * 4 + a_filter;
151
34.2k
    } else {
152
8.19k
        return comp * 4 + DAV1D_N_SWITCHABLE_FILTERS;
153
8.19k
    }
154
172k
}
Unexecuted instantiation: lib.c:get_filter_ctx
Unexecuted instantiation: log.c:get_filter_ctx
Unexecuted instantiation: mem.c:get_filter_ctx
Unexecuted instantiation: obu.c:get_filter_ctx
Unexecuted instantiation: picture.c:get_filter_ctx
Unexecuted instantiation: refmvs.c:get_filter_ctx
Unexecuted instantiation: thread_task.c:get_filter_ctx
Unexecuted instantiation: cdf.c:get_filter_ctx
decode.c:get_filter_ctx
Line
Count
Source
139
172k
{
140
172k
    const int a_filter = (a->ref[0][xb4] == ref || a->ref[1][xb4] == ref) ?
141
102k
                         a->filter[dir][xb4] : DAV1D_N_SWITCHABLE_FILTERS;
142
172k
    const int l_filter = (l->ref[0][yb4] == ref || l->ref[1][yb4] == ref) ?
143
103k
                         l->filter[dir][yb4] : DAV1D_N_SWITCHABLE_FILTERS;
144
145
172k
    if (a_filter == l_filter) {
146
95.3k
        return comp * 4 + a_filter;
147
95.3k
    } else if (a_filter == DAV1D_N_SWITCHABLE_FILTERS) {
148
34.6k
        return comp * 4 + l_filter;
149
42.4k
    } else if (l_filter == DAV1D_N_SWITCHABLE_FILTERS) {
150
34.2k
        return comp * 4 + a_filter;
151
34.2k
    } else {
152
8.19k
        return comp * 4 + DAV1D_N_SWITCHABLE_FILTERS;
153
8.19k
    }
154
172k
}
Unexecuted instantiation: recon_tmpl.c:get_filter_ctx
Unexecuted instantiation: cdef_apply_tmpl.c:get_filter_ctx
Unexecuted instantiation: ipred_prepare_tmpl.c:get_filter_ctx
Unexecuted instantiation: lf_apply_tmpl.c:get_filter_ctx
Unexecuted instantiation: lr_apply_tmpl.c:get_filter_ctx
155
156
static inline int get_comp_ctx(const BlockContext *const a,
157
                               const BlockContext *const l,
158
                               const int yb4, const int xb4,
159
                               const int have_top, const int have_left)
160
79.4k
{
161
79.4k
    if (have_top) {
162
60.3k
        if (have_left) {
163
46.5k
            if (a->comp_type[xb4]) {
164
23.9k
                if (l->comp_type[yb4]) {
165
16.4k
                    return 4;
166
16.4k
                } else {
167
                    // 4U means intra (-1) or bwd (>= 4)
168
7.49k
                    return 2 + ((unsigned)l->ref[0][yb4] >= 4U);
169
7.49k
                }
170
23.9k
            } else if (l->comp_type[yb4]) {
171
                // 4U means intra (-1) or bwd (>= 4)
172
8.38k
                return 2 + ((unsigned)a->ref[0][xb4] >= 4U);
173
14.1k
            } else {
174
14.1k
                return (l->ref[0][yb4] >= 4) ^ (a->ref[0][xb4] >= 4);
175
14.1k
            }
176
46.5k
        } else {
177
13.8k
            return a->comp_type[xb4] ? 3 : a->ref[0][xb4] >= 4;
178
13.8k
        }
179
60.3k
    } else if (have_left) {
180
11.5k
        return l->comp_type[yb4] ? 3 : l->ref[0][yb4] >= 4;
181
11.5k
    } else {
182
7.57k
        return 1;
183
7.57k
    }
184
79.4k
}
Unexecuted instantiation: lib.c:get_comp_ctx
Unexecuted instantiation: log.c:get_comp_ctx
Unexecuted instantiation: mem.c:get_comp_ctx
Unexecuted instantiation: obu.c:get_comp_ctx
Unexecuted instantiation: picture.c:get_comp_ctx
Unexecuted instantiation: refmvs.c:get_comp_ctx
Unexecuted instantiation: thread_task.c:get_comp_ctx
Unexecuted instantiation: cdf.c:get_comp_ctx
decode.c:get_comp_ctx
Line
Count
Source
160
79.4k
{
161
79.4k
    if (have_top) {
162
60.3k
        if (have_left) {
163
46.5k
            if (a->comp_type[xb4]) {
164
23.9k
                if (l->comp_type[yb4]) {
165
16.4k
                    return 4;
166
16.4k
                } else {
167
                    // 4U means intra (-1) or bwd (>= 4)
168
7.49k
                    return 2 + ((unsigned)l->ref[0][yb4] >= 4U);
169
7.49k
                }
170
23.9k
            } else if (l->comp_type[yb4]) {
171
                // 4U means intra (-1) or bwd (>= 4)
172
8.38k
                return 2 + ((unsigned)a->ref[0][xb4] >= 4U);
173
14.1k
            } else {
174
14.1k
                return (l->ref[0][yb4] >= 4) ^ (a->ref[0][xb4] >= 4);
175
14.1k
            }
176
46.5k
        } else {
177
13.8k
            return a->comp_type[xb4] ? 3 : a->ref[0][xb4] >= 4;
178
13.8k
        }
179
60.3k
    } else if (have_left) {
180
11.5k
        return l->comp_type[yb4] ? 3 : l->ref[0][yb4] >= 4;
181
11.5k
    } else {
182
7.57k
        return 1;
183
7.57k
    }
184
79.4k
}
Unexecuted instantiation: recon_tmpl.c:get_comp_ctx
Unexecuted instantiation: cdef_apply_tmpl.c:get_comp_ctx
Unexecuted instantiation: ipred_prepare_tmpl.c:get_comp_ctx
Unexecuted instantiation: lf_apply_tmpl.c:get_comp_ctx
Unexecuted instantiation: lr_apply_tmpl.c:get_comp_ctx
185
186
static inline int get_comp_dir_ctx(const BlockContext *const a,
187
                                   const BlockContext *const l,
188
                                   const int yb4, const int xb4,
189
                                   const int have_top, const int have_left)
190
45.7k
{
191
45.7k
#define has_uni_comp(edge, off) \
192
51.1k
    ((edge->ref[0][off] < 4) == (edge->ref[1][off] < 4))
193
194
45.7k
    if (have_top && have_left) {
195
29.5k
        const int a_intra = a->intra[xb4], l_intra = l->intra[yb4];
196
197
29.5k
        if (a_intra && l_intra) return 2;
198
29.4k
        if (a_intra || l_intra) {
199
1.02k
            const BlockContext *const edge = a_intra ? l : a;
200
1.02k
            const int off = a_intra ? yb4 : xb4;
201
202
1.02k
            if (edge->comp_type[off] == COMP_INTER_NONE) return 2;
203
759
            return 1 + 2 * has_uni_comp(edge, off);
204
1.02k
        }
205
206
28.4k
        const int a_comp = a->comp_type[xb4] != COMP_INTER_NONE;
207
28.4k
        const int l_comp = l->comp_type[yb4] != COMP_INTER_NONE;
208
28.4k
        const int a_ref0 = a->ref[0][xb4], l_ref0 = l->ref[0][yb4];
209
210
28.4k
        if (!a_comp && !l_comp) {
211
2.60k
            return 1 + 2 * ((a_ref0 >= 4) == (l_ref0 >= 4));
212
25.7k
        } else if (!a_comp || !l_comp) {
213
10.2k
            const BlockContext *const edge = a_comp ? a : l;
214
10.2k
            const int off = a_comp ? xb4 : yb4;
215
216
10.2k
            if (!has_uni_comp(edge, off)) return 1;
217
1.89k
            return 3 + ((a_ref0 >= 4) == (l_ref0 >= 4));
218
15.5k
        } else {
219
15.5k
            const int a_uni = has_uni_comp(a, xb4), l_uni = has_uni_comp(l, yb4);
220
221
15.5k
            if (!a_uni && !l_uni) return 0;
222
3.70k
            if (!a_uni || !l_uni) return 2;
223
1.27k
            return 3 + ((a_ref0 == 4) == (l_ref0 == 4));
224
3.70k
        }
225
28.4k
    } else if (have_top || have_left) {
226
12.6k
        const BlockContext *const edge = have_left ? l : a;
227
12.6k
        const int off = have_left ? yb4 : xb4;
228
229
12.6k
        if (edge->intra[off]) return 2;
230
12.5k
        if (edge->comp_type[off] == COMP_INTER_NONE) return 2;
231
9.10k
        return 4 * has_uni_comp(edge, off);
232
12.5k
    } else {
233
3.49k
        return 2;
234
3.49k
    }
235
45.7k
}
Unexecuted instantiation: lib.c:get_comp_dir_ctx
Unexecuted instantiation: log.c:get_comp_dir_ctx
Unexecuted instantiation: mem.c:get_comp_dir_ctx
Unexecuted instantiation: obu.c:get_comp_dir_ctx
Unexecuted instantiation: picture.c:get_comp_dir_ctx
Unexecuted instantiation: refmvs.c:get_comp_dir_ctx
Unexecuted instantiation: thread_task.c:get_comp_dir_ctx
Unexecuted instantiation: cdf.c:get_comp_dir_ctx
decode.c:get_comp_dir_ctx
Line
Count
Source
190
45.7k
{
191
45.7k
#define has_uni_comp(edge, off) \
192
45.7k
    ((edge->ref[0][off] < 4) == (edge->ref[1][off] < 4))
193
194
45.7k
    if (have_top && have_left) {
195
29.5k
        const int a_intra = a->intra[xb4], l_intra = l->intra[yb4];
196
197
29.5k
        if (a_intra && l_intra) return 2;
198
29.4k
        if (a_intra || l_intra) {
199
1.02k
            const BlockContext *const edge = a_intra ? l : a;
200
1.02k
            const int off = a_intra ? yb4 : xb4;
201
202
1.02k
            if (edge->comp_type[off] == COMP_INTER_NONE) return 2;
203
759
            return 1 + 2 * has_uni_comp(edge, off);
204
1.02k
        }
205
206
28.4k
        const int a_comp = a->comp_type[xb4] != COMP_INTER_NONE;
207
28.4k
        const int l_comp = l->comp_type[yb4] != COMP_INTER_NONE;
208
28.4k
        const int a_ref0 = a->ref[0][xb4], l_ref0 = l->ref[0][yb4];
209
210
28.4k
        if (!a_comp && !l_comp) {
211
2.60k
            return 1 + 2 * ((a_ref0 >= 4) == (l_ref0 >= 4));
212
25.7k
        } else if (!a_comp || !l_comp) {
213
10.2k
            const BlockContext *const edge = a_comp ? a : l;
214
10.2k
            const int off = a_comp ? xb4 : yb4;
215
216
10.2k
            if (!has_uni_comp(edge, off)) return 1;
217
1.89k
            return 3 + ((a_ref0 >= 4) == (l_ref0 >= 4));
218
15.5k
        } else {
219
15.5k
            const int a_uni = has_uni_comp(a, xb4), l_uni = has_uni_comp(l, yb4);
220
221
15.5k
            if (!a_uni && !l_uni) return 0;
222
3.70k
            if (!a_uni || !l_uni) return 2;
223
1.27k
            return 3 + ((a_ref0 == 4) == (l_ref0 == 4));
224
3.70k
        }
225
28.4k
    } else if (have_top || have_left) {
226
12.6k
        const BlockContext *const edge = have_left ? l : a;
227
12.6k
        const int off = have_left ? yb4 : xb4;
228
229
12.6k
        if (edge->intra[off]) return 2;
230
12.5k
        if (edge->comp_type[off] == COMP_INTER_NONE) return 2;
231
9.10k
        return 4 * has_uni_comp(edge, off);
232
12.5k
    } else {
233
3.49k
        return 2;
234
3.49k
    }
235
45.7k
}
Unexecuted instantiation: recon_tmpl.c:get_comp_dir_ctx
Unexecuted instantiation: cdef_apply_tmpl.c:get_comp_dir_ctx
Unexecuted instantiation: ipred_prepare_tmpl.c:get_comp_dir_ctx
Unexecuted instantiation: lf_apply_tmpl.c:get_comp_dir_ctx
Unexecuted instantiation: lr_apply_tmpl.c:get_comp_dir_ctx
236
237
static inline int get_poc_diff(const int order_hint_n_bits,
238
                               const int poc0, const int poc1)
239
940k
{
240
940k
    if (!order_hint_n_bits) return 0;
241
594k
    const int mask = 1 << (order_hint_n_bits - 1);
242
594k
    const int diff = poc0 - poc1;
243
594k
    return (diff & (mask - 1)) - (diff & mask);
244
940k
}
Unexecuted instantiation: lib.c:get_poc_diff
Unexecuted instantiation: log.c:get_poc_diff
Unexecuted instantiation: mem.c:get_poc_diff
obu.c:get_poc_diff
Line
Count
Source
239
145k
{
240
145k
    if (!order_hint_n_bits) return 0;
241
145k
    const int mask = 1 << (order_hint_n_bits - 1);
242
145k
    const int diff = poc0 - poc1;
243
145k
    return (diff & (mask - 1)) - (diff & mask);
244
145k
}
Unexecuted instantiation: picture.c:get_poc_diff
refmvs.c:get_poc_diff
Line
Count
Source
239
362k
{
240
362k
    if (!order_hint_n_bits) return 0;
241
187k
    const int mask = 1 << (order_hint_n_bits - 1);
242
187k
    const int diff = poc0 - poc1;
243
187k
    return (diff & (mask - 1)) - (diff & mask);
244
362k
}
Unexecuted instantiation: thread_task.c:get_poc_diff
Unexecuted instantiation: cdf.c:get_poc_diff
decode.c:get_poc_diff
Line
Count
Source
239
432k
{
240
432k
    if (!order_hint_n_bits) return 0;
241
261k
    const int mask = 1 << (order_hint_n_bits - 1);
242
261k
    const int diff = poc0 - poc1;
243
261k
    return (diff & (mask - 1)) - (diff & mask);
244
432k
}
Unexecuted instantiation: recon_tmpl.c:get_poc_diff
Unexecuted instantiation: cdef_apply_tmpl.c:get_poc_diff
Unexecuted instantiation: ipred_prepare_tmpl.c:get_poc_diff
Unexecuted instantiation: lf_apply_tmpl.c:get_poc_diff
Unexecuted instantiation: lr_apply_tmpl.c:get_poc_diff
245
246
static inline int get_jnt_comp_ctx(const int order_hint_n_bits, const int poc,
247
                                   const int ref0poc, const int ref1poc,
248
                                   const BlockContext *const a,
249
                                   const BlockContext *const l,
250
                                   const int yb4, const int xb4)
251
5.25k
{
252
5.25k
    const int d0 = abs(get_poc_diff(order_hint_n_bits, ref0poc, poc));
253
5.25k
    const int d1 = abs(get_poc_diff(order_hint_n_bits, poc, ref1poc));
254
5.25k
    const int offset = d0 == d1;
255
5.25k
    const int a_ctx = a->comp_type[xb4] >= COMP_INTER_AVG ||
256
3.67k
                      a->ref[0][xb4] == 6;
257
5.25k
    const int l_ctx = l->comp_type[yb4] >= COMP_INTER_AVG ||
258
4.02k
                      l->ref[0][yb4] == 6;
259
260
5.25k
    return 3 * offset + a_ctx + l_ctx;
261
5.25k
}
Unexecuted instantiation: lib.c:get_jnt_comp_ctx
Unexecuted instantiation: log.c:get_jnt_comp_ctx
Unexecuted instantiation: mem.c:get_jnt_comp_ctx
Unexecuted instantiation: obu.c:get_jnt_comp_ctx
Unexecuted instantiation: picture.c:get_jnt_comp_ctx
Unexecuted instantiation: refmvs.c:get_jnt_comp_ctx
Unexecuted instantiation: thread_task.c:get_jnt_comp_ctx
Unexecuted instantiation: cdf.c:get_jnt_comp_ctx
decode.c:get_jnt_comp_ctx
Line
Count
Source
251
5.25k
{
252
5.25k
    const int d0 = abs(get_poc_diff(order_hint_n_bits, ref0poc, poc));
253
5.25k
    const int d1 = abs(get_poc_diff(order_hint_n_bits, poc, ref1poc));
254
5.25k
    const int offset = d0 == d1;
255
5.25k
    const int a_ctx = a->comp_type[xb4] >= COMP_INTER_AVG ||
256
3.67k
                      a->ref[0][xb4] == 6;
257
5.25k
    const int l_ctx = l->comp_type[yb4] >= COMP_INTER_AVG ||
258
4.02k
                      l->ref[0][yb4] == 6;
259
260
5.25k
    return 3 * offset + a_ctx + l_ctx;
261
5.25k
}
Unexecuted instantiation: recon_tmpl.c:get_jnt_comp_ctx
Unexecuted instantiation: cdef_apply_tmpl.c:get_jnt_comp_ctx
Unexecuted instantiation: ipred_prepare_tmpl.c:get_jnt_comp_ctx
Unexecuted instantiation: lf_apply_tmpl.c:get_jnt_comp_ctx
Unexecuted instantiation: lr_apply_tmpl.c:get_jnt_comp_ctx
262
263
static inline int get_mask_comp_ctx(const BlockContext *const a,
264
                                    const BlockContext *const l,
265
                                    const int yb4, const int xb4)
266
33.9k
{
267
33.9k
    const int a_ctx = a->comp_type[xb4] >= COMP_INTER_SEG ? 1 :
268
33.9k
                      a->ref[0][xb4] == 6 ? 3 : 0;
269
33.9k
    const int l_ctx = l->comp_type[yb4] >= COMP_INTER_SEG ? 1 :
270
33.9k
                      l->ref[0][yb4] == 6 ? 3 : 0;
271
272
33.9k
    return imin(a_ctx + l_ctx, 5);
273
33.9k
}
Unexecuted instantiation: lib.c:get_mask_comp_ctx
Unexecuted instantiation: log.c:get_mask_comp_ctx
Unexecuted instantiation: mem.c:get_mask_comp_ctx
Unexecuted instantiation: obu.c:get_mask_comp_ctx
Unexecuted instantiation: picture.c:get_mask_comp_ctx
Unexecuted instantiation: refmvs.c:get_mask_comp_ctx
Unexecuted instantiation: thread_task.c:get_mask_comp_ctx
Unexecuted instantiation: cdf.c:get_mask_comp_ctx
decode.c:get_mask_comp_ctx
Line
Count
Source
266
33.9k
{
267
33.9k
    const int a_ctx = a->comp_type[xb4] >= COMP_INTER_SEG ? 1 :
268
33.9k
                      a->ref[0][xb4] == 6 ? 3 : 0;
269
33.9k
    const int l_ctx = l->comp_type[yb4] >= COMP_INTER_SEG ? 1 :
270
33.9k
                      l->ref[0][yb4] == 6 ? 3 : 0;
271
272
33.9k
    return imin(a_ctx + l_ctx, 5);
273
33.9k
}
Unexecuted instantiation: recon_tmpl.c:get_mask_comp_ctx
Unexecuted instantiation: cdef_apply_tmpl.c:get_mask_comp_ctx
Unexecuted instantiation: ipred_prepare_tmpl.c:get_mask_comp_ctx
Unexecuted instantiation: lf_apply_tmpl.c:get_mask_comp_ctx
Unexecuted instantiation: lr_apply_tmpl.c:get_mask_comp_ctx
274
275
60.3k
#define av1_get_ref_2_ctx av1_get_bwd_ref_ctx
276
26.2k
#define av1_get_ref_3_ctx av1_get_fwd_ref_ctx
277
3.52k
#define av1_get_ref_4_ctx av1_get_fwd_ref_1_ctx
278
22.7k
#define av1_get_ref_5_ctx av1_get_fwd_ref_2_ctx
279
20.3k
#define av1_get_ref_6_ctx av1_get_bwd_ref_1_ctx
280
7.21k
#define av1_get_uni_p_ctx av1_get_ref_ctx
281
3.17k
#define av1_get_uni_p2_ctx av1_get_fwd_ref_2_ctx
282
283
static inline int av1_get_ref_ctx(const BlockContext *const a,
284
                                  const BlockContext *const l,
285
                                  const int yb4, const int xb4,
286
                                  int have_top, int have_left)
287
130k
{
288
130k
    int cnt[2] = { 0 };
289
290
130k
    if (have_top && !a->intra[xb4]) {
291
94.8k
        cnt[a->ref[0][xb4] >= 4]++;
292
94.8k
        if (a->comp_type[xb4]) cnt[a->ref[1][xb4] >= 4]++;
293
94.8k
    }
294
295
130k
    if (have_left && !l->intra[yb4]) {
296
96.3k
        cnt[l->ref[0][yb4] >= 4]++;
297
96.3k
        if (l->comp_type[yb4]) cnt[l->ref[1][yb4] >= 4]++;
298
96.3k
    }
299
300
130k
    return cnt[0] == cnt[1] ? 1 : cnt[0] < cnt[1] ? 0 : 2;
301
130k
}
Unexecuted instantiation: lib.c:av1_get_ref_ctx
Unexecuted instantiation: log.c:av1_get_ref_ctx
Unexecuted instantiation: mem.c:av1_get_ref_ctx
Unexecuted instantiation: obu.c:av1_get_ref_ctx
Unexecuted instantiation: picture.c:av1_get_ref_ctx
Unexecuted instantiation: refmvs.c:av1_get_ref_ctx
Unexecuted instantiation: thread_task.c:av1_get_ref_ctx
Unexecuted instantiation: cdf.c:av1_get_ref_ctx
decode.c:av1_get_ref_ctx
Line
Count
Source
287
130k
{
288
130k
    int cnt[2] = { 0 };
289
290
130k
    if (have_top && !a->intra[xb4]) {
291
94.8k
        cnt[a->ref[0][xb4] >= 4]++;
292
94.8k
        if (a->comp_type[xb4]) cnt[a->ref[1][xb4] >= 4]++;
293
94.8k
    }
294
295
130k
    if (have_left && !l->intra[yb4]) {
296
96.3k
        cnt[l->ref[0][yb4] >= 4]++;
297
96.3k
        if (l->comp_type[yb4]) cnt[l->ref[1][yb4] >= 4]++;
298
96.3k
    }
299
300
130k
    return cnt[0] == cnt[1] ? 1 : cnt[0] < cnt[1] ? 0 : 2;
301
130k
}
Unexecuted instantiation: recon_tmpl.c:av1_get_ref_ctx
Unexecuted instantiation: cdef_apply_tmpl.c:av1_get_ref_ctx
Unexecuted instantiation: ipred_prepare_tmpl.c:av1_get_ref_ctx
Unexecuted instantiation: lf_apply_tmpl.c:av1_get_ref_ctx
Unexecuted instantiation: lr_apply_tmpl.c:av1_get_ref_ctx
302
303
static inline int av1_get_fwd_ref_ctx(const BlockContext *const a,
304
                                      const BlockContext *const l,
305
                                      const int yb4, const int xb4,
306
                                      const int have_top, const int have_left)
307
101k
{
308
101k
    int cnt[4] = { 0 };
309
310
101k
    if (have_top && !a->intra[xb4]) {
311
76.3k
        if (a->ref[0][xb4] < 4) cnt[a->ref[0][xb4]]++;
312
76.3k
        if (a->comp_type[xb4] && a->ref[1][xb4] < 4) cnt[a->ref[1][xb4]]++;
313
76.3k
    }
314
315
101k
    if (have_left && !l->intra[yb4]) {
316
75.2k
        if (l->ref[0][yb4] < 4) cnt[l->ref[0][yb4]]++;
317
75.2k
        if (l->comp_type[yb4] && l->ref[1][yb4] < 4) cnt[l->ref[1][yb4]]++;
318
75.2k
    }
319
320
101k
    cnt[0] += cnt[1];
321
101k
    cnt[2] += cnt[3];
322
323
101k
    return cnt[0] == cnt[2] ? 1 : cnt[0] < cnt[2] ? 0 : 2;
324
101k
}
Unexecuted instantiation: lib.c:av1_get_fwd_ref_ctx
Unexecuted instantiation: log.c:av1_get_fwd_ref_ctx
Unexecuted instantiation: mem.c:av1_get_fwd_ref_ctx
Unexecuted instantiation: obu.c:av1_get_fwd_ref_ctx
Unexecuted instantiation: picture.c:av1_get_fwd_ref_ctx
Unexecuted instantiation: refmvs.c:av1_get_fwd_ref_ctx
Unexecuted instantiation: thread_task.c:av1_get_fwd_ref_ctx
Unexecuted instantiation: cdf.c:av1_get_fwd_ref_ctx
decode.c:av1_get_fwd_ref_ctx
Line
Count
Source
307
101k
{
308
101k
    int cnt[4] = { 0 };
309
310
101k
    if (have_top && !a->intra[xb4]) {
311
76.3k
        if (a->ref[0][xb4] < 4) cnt[a->ref[0][xb4]]++;
312
76.3k
        if (a->comp_type[xb4] && a->ref[1][xb4] < 4) cnt[a->ref[1][xb4]]++;
313
76.3k
    }
314
315
101k
    if (have_left && !l->intra[yb4]) {
316
75.2k
        if (l->ref[0][yb4] < 4) cnt[l->ref[0][yb4]]++;
317
75.2k
        if (l->comp_type[yb4] && l->ref[1][yb4] < 4) cnt[l->ref[1][yb4]]++;
318
75.2k
    }
319
320
101k
    cnt[0] += cnt[1];
321
101k
    cnt[2] += cnt[3];
322
323
101k
    return cnt[0] == cnt[2] ? 1 : cnt[0] < cnt[2] ? 0 : 2;
324
101k
}
Unexecuted instantiation: recon_tmpl.c:av1_get_fwd_ref_ctx
Unexecuted instantiation: cdef_apply_tmpl.c:av1_get_fwd_ref_ctx
Unexecuted instantiation: ipred_prepare_tmpl.c:av1_get_fwd_ref_ctx
Unexecuted instantiation: lf_apply_tmpl.c:av1_get_fwd_ref_ctx
Unexecuted instantiation: lr_apply_tmpl.c:av1_get_fwd_ref_ctx
325
326
static inline int av1_get_fwd_ref_1_ctx(const BlockContext *const a,
327
                                        const BlockContext *const l,
328
                                        const int yb4, const int xb4,
329
                                        const int have_top, const int have_left)
330
62.2k
{
331
62.2k
    int cnt[2] = { 0 };
332
333
62.2k
    if (have_top && !a->intra[xb4]) {
334
50.1k
        if (a->ref[0][xb4] < 2) cnt[a->ref[0][xb4]]++;
335
50.1k
        if (a->comp_type[xb4] && a->ref[1][xb4] < 2) cnt[a->ref[1][xb4]]++;
336
50.1k
    }
337
338
62.2k
    if (have_left && !l->intra[yb4]) {
339
48.3k
        if (l->ref[0][yb4] < 2) cnt[l->ref[0][yb4]]++;
340
48.3k
        if (l->comp_type[yb4] && l->ref[1][yb4] < 2) cnt[l->ref[1][yb4]]++;
341
48.3k
    }
342
343
62.2k
    return cnt[0] == cnt[1] ? 1 : cnt[0] < cnt[1] ? 0 : 2;
344
62.2k
}
Unexecuted instantiation: lib.c:av1_get_fwd_ref_1_ctx
Unexecuted instantiation: log.c:av1_get_fwd_ref_1_ctx
Unexecuted instantiation: mem.c:av1_get_fwd_ref_1_ctx
Unexecuted instantiation: obu.c:av1_get_fwd_ref_1_ctx
Unexecuted instantiation: picture.c:av1_get_fwd_ref_1_ctx
Unexecuted instantiation: refmvs.c:av1_get_fwd_ref_1_ctx
Unexecuted instantiation: thread_task.c:av1_get_fwd_ref_1_ctx
Unexecuted instantiation: cdf.c:av1_get_fwd_ref_1_ctx
decode.c:av1_get_fwd_ref_1_ctx
Line
Count
Source
330
62.2k
{
331
62.2k
    int cnt[2] = { 0 };
332
333
62.2k
    if (have_top && !a->intra[xb4]) {
334
50.1k
        if (a->ref[0][xb4] < 2) cnt[a->ref[0][xb4]]++;
335
50.1k
        if (a->comp_type[xb4] && a->ref[1][xb4] < 2) cnt[a->ref[1][xb4]]++;
336
50.1k
    }
337
338
62.2k
    if (have_left && !l->intra[yb4]) {
339
48.3k
        if (l->ref[0][yb4] < 2) cnt[l->ref[0][yb4]]++;
340
48.3k
        if (l->comp_type[yb4] && l->ref[1][yb4] < 2) cnt[l->ref[1][yb4]]++;
341
48.3k
    }
342
343
62.2k
    return cnt[0] == cnt[1] ? 1 : cnt[0] < cnt[1] ? 0 : 2;
344
62.2k
}
Unexecuted instantiation: recon_tmpl.c:av1_get_fwd_ref_1_ctx
Unexecuted instantiation: cdef_apply_tmpl.c:av1_get_fwd_ref_1_ctx
Unexecuted instantiation: ipred_prepare_tmpl.c:av1_get_fwd_ref_1_ctx
Unexecuted instantiation: lf_apply_tmpl.c:av1_get_fwd_ref_1_ctx
Unexecuted instantiation: lr_apply_tmpl.c:av1_get_fwd_ref_1_ctx
345
346
static inline int av1_get_fwd_ref_2_ctx(const BlockContext *const a,
347
                                        const BlockContext *const l,
348
                                        const int yb4, const int xb4,
349
                                        const int have_top, const int have_left)
350
42.1k
{
351
42.1k
    int cnt[2] = { 0 };
352
353
42.1k
    if (have_top && !a->intra[xb4]) {
354
28.5k
        if ((a->ref[0][xb4] ^ 2U) < 2) cnt[a->ref[0][xb4] - 2]++;
355
28.5k
        if (a->comp_type[xb4] && (a->ref[1][xb4] ^ 2U) < 2) cnt[a->ref[1][xb4] - 2]++;
356
28.5k
    }
357
358
42.1k
    if (have_left && !l->intra[yb4]) {
359
29.2k
        if ((l->ref[0][yb4] ^ 2U) < 2) cnt[l->ref[0][yb4] - 2]++;
360
29.2k
        if (l->comp_type[yb4] && (l->ref[1][yb4] ^ 2U) < 2) cnt[l->ref[1][yb4] - 2]++;
361
29.2k
    }
362
363
42.1k
    return cnt[0] == cnt[1] ? 1 : cnt[0] < cnt[1] ? 0 : 2;
364
42.1k
}
Unexecuted instantiation: lib.c:av1_get_fwd_ref_2_ctx
Unexecuted instantiation: log.c:av1_get_fwd_ref_2_ctx
Unexecuted instantiation: mem.c:av1_get_fwd_ref_2_ctx
Unexecuted instantiation: obu.c:av1_get_fwd_ref_2_ctx
Unexecuted instantiation: picture.c:av1_get_fwd_ref_2_ctx
Unexecuted instantiation: refmvs.c:av1_get_fwd_ref_2_ctx
Unexecuted instantiation: thread_task.c:av1_get_fwd_ref_2_ctx
Unexecuted instantiation: cdf.c:av1_get_fwd_ref_2_ctx
decode.c:av1_get_fwd_ref_2_ctx
Line
Count
Source
350
42.1k
{
351
42.1k
    int cnt[2] = { 0 };
352
353
42.1k
    if (have_top && !a->intra[xb4]) {
354
28.5k
        if ((a->ref[0][xb4] ^ 2U) < 2) cnt[a->ref[0][xb4] - 2]++;
355
28.5k
        if (a->comp_type[xb4] && (a->ref[1][xb4] ^ 2U) < 2) cnt[a->ref[1][xb4] - 2]++;
356
28.5k
    }
357
358
42.1k
    if (have_left && !l->intra[yb4]) {
359
29.2k
        if ((l->ref[0][yb4] ^ 2U) < 2) cnt[l->ref[0][yb4] - 2]++;
360
29.2k
        if (l->comp_type[yb4] && (l->ref[1][yb4] ^ 2U) < 2) cnt[l->ref[1][yb4] - 2]++;
361
29.2k
    }
362
363
42.1k
    return cnt[0] == cnt[1] ? 1 : cnt[0] < cnt[1] ? 0 : 2;
364
42.1k
}
Unexecuted instantiation: recon_tmpl.c:av1_get_fwd_ref_2_ctx
Unexecuted instantiation: cdef_apply_tmpl.c:av1_get_fwd_ref_2_ctx
Unexecuted instantiation: ipred_prepare_tmpl.c:av1_get_fwd_ref_2_ctx
Unexecuted instantiation: lf_apply_tmpl.c:av1_get_fwd_ref_2_ctx
Unexecuted instantiation: lr_apply_tmpl.c:av1_get_fwd_ref_2_ctx
365
366
static inline int av1_get_bwd_ref_ctx(const BlockContext *const a,
367
                                      const BlockContext *const l,
368
                                      const int yb4, const int xb4,
369
                                      const int have_top, const int have_left)
370
98.8k
{
371
98.8k
    int cnt[3] = { 0 };
372
373
98.8k
    if (have_top && !a->intra[xb4]) {
374
73.3k
        if (a->ref[0][xb4] >= 4) cnt[a->ref[0][xb4] - 4]++;
375
73.3k
        if (a->comp_type[xb4] && a->ref[1][xb4] >= 4) cnt[a->ref[1][xb4] - 4]++;
376
73.3k
    }
377
378
98.8k
    if (have_left && !l->intra[yb4]) {
379
75.5k
        if (l->ref[0][yb4] >= 4) cnt[l->ref[0][yb4] - 4]++;
380
75.5k
        if (l->comp_type[yb4] && l->ref[1][yb4] >= 4) cnt[l->ref[1][yb4] - 4]++;
381
75.5k
    }
382
383
98.8k
    cnt[1] += cnt[0];
384
385
98.8k
    return cnt[2] == cnt[1] ? 1 : cnt[1] < cnt[2] ? 0 : 2;
386
98.8k
}
Unexecuted instantiation: lib.c:av1_get_bwd_ref_ctx
Unexecuted instantiation: log.c:av1_get_bwd_ref_ctx
Unexecuted instantiation: mem.c:av1_get_bwd_ref_ctx
Unexecuted instantiation: obu.c:av1_get_bwd_ref_ctx
Unexecuted instantiation: picture.c:av1_get_bwd_ref_ctx
Unexecuted instantiation: refmvs.c:av1_get_bwd_ref_ctx
Unexecuted instantiation: thread_task.c:av1_get_bwd_ref_ctx
Unexecuted instantiation: cdf.c:av1_get_bwd_ref_ctx
decode.c:av1_get_bwd_ref_ctx
Line
Count
Source
370
98.8k
{
371
98.8k
    int cnt[3] = { 0 };
372
373
98.8k
    if (have_top && !a->intra[xb4]) {
374
73.3k
        if (a->ref[0][xb4] >= 4) cnt[a->ref[0][xb4] - 4]++;
375
73.3k
        if (a->comp_type[xb4] && a->ref[1][xb4] >= 4) cnt[a->ref[1][xb4] - 4]++;
376
73.3k
    }
377
378
98.8k
    if (have_left && !l->intra[yb4]) {
379
75.5k
        if (l->ref[0][yb4] >= 4) cnt[l->ref[0][yb4] - 4]++;
380
75.5k
        if (l->comp_type[yb4] && l->ref[1][yb4] >= 4) cnt[l->ref[1][yb4] - 4]++;
381
75.5k
    }
382
383
98.8k
    cnt[1] += cnt[0];
384
385
98.8k
    return cnt[2] == cnt[1] ? 1 : cnt[1] < cnt[2] ? 0 : 2;
386
98.8k
}
Unexecuted instantiation: recon_tmpl.c:av1_get_bwd_ref_ctx
Unexecuted instantiation: cdef_apply_tmpl.c:av1_get_bwd_ref_ctx
Unexecuted instantiation: ipred_prepare_tmpl.c:av1_get_bwd_ref_ctx
Unexecuted instantiation: lf_apply_tmpl.c:av1_get_bwd_ref_ctx
Unexecuted instantiation: lr_apply_tmpl.c:av1_get_bwd_ref_ctx
387
388
static inline int av1_get_bwd_ref_1_ctx(const BlockContext *const a,
389
                                        const BlockContext *const l,
390
                                        const int yb4, const int xb4,
391
                                        const int have_top, const int have_left)
392
37.0k
{
393
37.0k
    int cnt[3] = { 0 };
394
395
37.0k
    if (have_top && !a->intra[xb4]) {
396
28.6k
        if (a->ref[0][xb4] >= 4) cnt[a->ref[0][xb4] - 4]++;
397
28.6k
        if (a->comp_type[xb4] && a->ref[1][xb4] >= 4) cnt[a->ref[1][xb4] - 4]++;
398
28.6k
    }
399
400
37.0k
    if (have_left && !l->intra[yb4]) {
401
27.1k
        if (l->ref[0][yb4] >= 4) cnt[l->ref[0][yb4] - 4]++;
402
27.1k
        if (l->comp_type[yb4] && l->ref[1][yb4] >= 4) cnt[l->ref[1][yb4] - 4]++;
403
27.1k
    }
404
405
37.0k
    return cnt[0] == cnt[1] ? 1 : cnt[0] < cnt[1] ? 0 : 2;
406
37.0k
}
Unexecuted instantiation: lib.c:av1_get_bwd_ref_1_ctx
Unexecuted instantiation: log.c:av1_get_bwd_ref_1_ctx
Unexecuted instantiation: mem.c:av1_get_bwd_ref_1_ctx
Unexecuted instantiation: obu.c:av1_get_bwd_ref_1_ctx
Unexecuted instantiation: picture.c:av1_get_bwd_ref_1_ctx
Unexecuted instantiation: refmvs.c:av1_get_bwd_ref_1_ctx
Unexecuted instantiation: thread_task.c:av1_get_bwd_ref_1_ctx
Unexecuted instantiation: cdf.c:av1_get_bwd_ref_1_ctx
decode.c:av1_get_bwd_ref_1_ctx
Line
Count
Source
392
37.0k
{
393
37.0k
    int cnt[3] = { 0 };
394
395
37.0k
    if (have_top && !a->intra[xb4]) {
396
28.6k
        if (a->ref[0][xb4] >= 4) cnt[a->ref[0][xb4] - 4]++;
397
28.6k
        if (a->comp_type[xb4] && a->ref[1][xb4] >= 4) cnt[a->ref[1][xb4] - 4]++;
398
28.6k
    }
399
400
37.0k
    if (have_left && !l->intra[yb4]) {
401
27.1k
        if (l->ref[0][yb4] >= 4) cnt[l->ref[0][yb4] - 4]++;
402
27.1k
        if (l->comp_type[yb4] && l->ref[1][yb4] >= 4) cnt[l->ref[1][yb4] - 4]++;
403
27.1k
    }
404
405
37.0k
    return cnt[0] == cnt[1] ? 1 : cnt[0] < cnt[1] ? 0 : 2;
406
37.0k
}
Unexecuted instantiation: recon_tmpl.c:av1_get_bwd_ref_1_ctx
Unexecuted instantiation: cdef_apply_tmpl.c:av1_get_bwd_ref_1_ctx
Unexecuted instantiation: ipred_prepare_tmpl.c:av1_get_bwd_ref_1_ctx
Unexecuted instantiation: lf_apply_tmpl.c:av1_get_bwd_ref_1_ctx
Unexecuted instantiation: lr_apply_tmpl.c:av1_get_bwd_ref_1_ctx
407
408
static inline int av1_get_uni_p1_ctx(const BlockContext *const a,
409
                                     const BlockContext *const l,
410
                                     const int yb4, const int xb4,
411
                                     const int have_top, const int have_left)
412
4.88k
{
413
4.88k
    int cnt[3] = { 0 };
414
415
4.88k
    if (have_top && !a->intra[xb4]) {
416
3.79k
        if (a->ref[0][xb4] - 1U < 3) cnt[a->ref[0][xb4] - 1]++;
417
3.79k
        if (a->comp_type[xb4] && a->ref[1][xb4] - 1U < 3) cnt[a->ref[1][xb4] - 1]++;
418
3.79k
    }
419
420
4.88k
    if (have_left && !l->intra[yb4]) {
421
3.44k
        if (l->ref[0][yb4] - 1U < 3) cnt[l->ref[0][yb4] - 1]++;
422
3.44k
        if (l->comp_type[yb4] && l->ref[1][yb4] - 1U < 3) cnt[l->ref[1][yb4] - 1]++;
423
3.44k
    }
424
425
4.88k
    cnt[1] += cnt[2];
426
427
4.88k
    return cnt[0] == cnt[1] ? 1 : cnt[0] < cnt[1] ? 0 : 2;
428
4.88k
}
Unexecuted instantiation: lib.c:av1_get_uni_p1_ctx
Unexecuted instantiation: log.c:av1_get_uni_p1_ctx
Unexecuted instantiation: mem.c:av1_get_uni_p1_ctx
Unexecuted instantiation: obu.c:av1_get_uni_p1_ctx
Unexecuted instantiation: picture.c:av1_get_uni_p1_ctx
Unexecuted instantiation: refmvs.c:av1_get_uni_p1_ctx
Unexecuted instantiation: thread_task.c:av1_get_uni_p1_ctx
Unexecuted instantiation: cdf.c:av1_get_uni_p1_ctx
decode.c:av1_get_uni_p1_ctx
Line
Count
Source
412
4.88k
{
413
4.88k
    int cnt[3] = { 0 };
414
415
4.88k
    if (have_top && !a->intra[xb4]) {
416
3.79k
        if (a->ref[0][xb4] - 1U < 3) cnt[a->ref[0][xb4] - 1]++;
417
3.79k
        if (a->comp_type[xb4] && a->ref[1][xb4] - 1U < 3) cnt[a->ref[1][xb4] - 1]++;
418
3.79k
    }
419
420
4.88k
    if (have_left && !l->intra[yb4]) {
421
3.44k
        if (l->ref[0][yb4] - 1U < 3) cnt[l->ref[0][yb4] - 1]++;
422
3.44k
        if (l->comp_type[yb4] && l->ref[1][yb4] - 1U < 3) cnt[l->ref[1][yb4] - 1]++;
423
3.44k
    }
424
425
4.88k
    cnt[1] += cnt[2];
426
427
4.88k
    return cnt[0] == cnt[1] ? 1 : cnt[0] < cnt[1] ? 0 : 2;
428
4.88k
}
Unexecuted instantiation: recon_tmpl.c:av1_get_uni_p1_ctx
Unexecuted instantiation: cdef_apply_tmpl.c:av1_get_uni_p1_ctx
Unexecuted instantiation: ipred_prepare_tmpl.c:av1_get_uni_p1_ctx
Unexecuted instantiation: lf_apply_tmpl.c:av1_get_uni_p1_ctx
Unexecuted instantiation: lr_apply_tmpl.c:av1_get_uni_p1_ctx
429
430
static inline int get_drl_context(const refmvs_candidate *const ref_mv_stack,
431
                                  const int ref_idx)
432
48.5k
{
433
48.5k
    if (ref_mv_stack[ref_idx].weight >= 640)
434
35.7k
        return ref_mv_stack[ref_idx + 1].weight < 640;
435
436
12.8k
    return ref_mv_stack[ref_idx + 1].weight < 640 ? 2 : 0;
437
48.5k
}
Unexecuted instantiation: lib.c:get_drl_context
Unexecuted instantiation: log.c:get_drl_context
Unexecuted instantiation: mem.c:get_drl_context
Unexecuted instantiation: obu.c:get_drl_context
Unexecuted instantiation: picture.c:get_drl_context
Unexecuted instantiation: refmvs.c:get_drl_context
Unexecuted instantiation: thread_task.c:get_drl_context
Unexecuted instantiation: cdf.c:get_drl_context
decode.c:get_drl_context
Line
Count
Source
432
48.5k
{
433
48.5k
    if (ref_mv_stack[ref_idx].weight >= 640)
434
35.7k
        return ref_mv_stack[ref_idx + 1].weight < 640;
435
436
12.8k
    return ref_mv_stack[ref_idx + 1].weight < 640 ? 2 : 0;
437
48.5k
}
Unexecuted instantiation: recon_tmpl.c:get_drl_context
Unexecuted instantiation: cdef_apply_tmpl.c:get_drl_context
Unexecuted instantiation: ipred_prepare_tmpl.c:get_drl_context
Unexecuted instantiation: lf_apply_tmpl.c:get_drl_context
Unexecuted instantiation: lr_apply_tmpl.c:get_drl_context
438
439
static inline unsigned get_cur_frame_segid(const int by, const int bx,
440
                                           const int have_top,
441
                                           const int have_left,
442
                                           int *const seg_ctx,
443
                                           const uint8_t *cur_seg_map,
444
                                           const ptrdiff_t stride)
445
1.14M
{
446
1.14M
    cur_seg_map += bx + by * stride;
447
1.14M
    if (have_left && have_top) {
448
962k
        const int l = cur_seg_map[-1];
449
962k
        const int a = cur_seg_map[-stride];
450
962k
        const int al = cur_seg_map[-(stride + 1)];
451
452
962k
        if (l == a && al == l) *seg_ctx = 2;
453
691k
        else if (l == a || al == l || a == al) *seg_ctx = 1;
454
181k
        else *seg_ctx = 0;
455
962k
        return a == al ? a : l;
456
962k
    } else {
457
182k
        *seg_ctx = 0;
458
182k
        return have_left ? cur_seg_map[-1] : have_top ? cur_seg_map[-stride] : 0;
459
182k
    }
460
1.14M
}
Unexecuted instantiation: lib.c:get_cur_frame_segid
Unexecuted instantiation: log.c:get_cur_frame_segid
Unexecuted instantiation: mem.c:get_cur_frame_segid
Unexecuted instantiation: obu.c:get_cur_frame_segid
Unexecuted instantiation: picture.c:get_cur_frame_segid
Unexecuted instantiation: refmvs.c:get_cur_frame_segid
Unexecuted instantiation: thread_task.c:get_cur_frame_segid
Unexecuted instantiation: cdf.c:get_cur_frame_segid
decode.c:get_cur_frame_segid
Line
Count
Source
445
1.14M
{
446
1.14M
    cur_seg_map += bx + by * stride;
447
1.14M
    if (have_left && have_top) {
448
962k
        const int l = cur_seg_map[-1];
449
962k
        const int a = cur_seg_map[-stride];
450
962k
        const int al = cur_seg_map[-(stride + 1)];
451
452
962k
        if (l == a && al == l) *seg_ctx = 2;
453
691k
        else if (l == a || al == l || a == al) *seg_ctx = 1;
454
181k
        else *seg_ctx = 0;
455
962k
        return a == al ? a : l;
456
962k
    } else {
457
182k
        *seg_ctx = 0;
458
182k
        return have_left ? cur_seg_map[-1] : have_top ? cur_seg_map[-stride] : 0;
459
182k
    }
460
1.14M
}
Unexecuted instantiation: recon_tmpl.c:get_cur_frame_segid
Unexecuted instantiation: cdef_apply_tmpl.c:get_cur_frame_segid
Unexecuted instantiation: ipred_prepare_tmpl.c:get_cur_frame_segid
Unexecuted instantiation: lf_apply_tmpl.c:get_cur_frame_segid
Unexecuted instantiation: lr_apply_tmpl.c:get_cur_frame_segid
461
462
23.8k
static inline void fix_int_mv_precision(mv *const mv) {
463
23.8k
    mv->x = (mv->x - (mv->x >> 15) + 3) & ~7U;
464
23.8k
    mv->y = (mv->y - (mv->y >> 15) + 3) & ~7U;
465
23.8k
}
Unexecuted instantiation: lib.c:fix_int_mv_precision
Unexecuted instantiation: log.c:fix_int_mv_precision
Unexecuted instantiation: mem.c:fix_int_mv_precision
Unexecuted instantiation: obu.c:fix_int_mv_precision
Unexecuted instantiation: picture.c:fix_int_mv_precision
refmvs.c:fix_int_mv_precision
Line
Count
Source
462
8.83k
static inline void fix_int_mv_precision(mv *const mv) {
463
8.83k
    mv->x = (mv->x - (mv->x >> 15) + 3) & ~7U;
464
8.83k
    mv->y = (mv->y - (mv->y >> 15) + 3) & ~7U;
465
8.83k
}
Unexecuted instantiation: thread_task.c:fix_int_mv_precision
Unexecuted instantiation: cdf.c:fix_int_mv_precision
decode.c:fix_int_mv_precision
Line
Count
Source
462
14.9k
static inline void fix_int_mv_precision(mv *const mv) {
463
14.9k
    mv->x = (mv->x - (mv->x >> 15) + 3) & ~7U;
464
14.9k
    mv->y = (mv->y - (mv->y >> 15) + 3) & ~7U;
465
14.9k
}
Unexecuted instantiation: recon_tmpl.c:fix_int_mv_precision
Unexecuted instantiation: cdef_apply_tmpl.c:fix_int_mv_precision
Unexecuted instantiation: ipred_prepare_tmpl.c:fix_int_mv_precision
Unexecuted instantiation: lf_apply_tmpl.c:fix_int_mv_precision
Unexecuted instantiation: lr_apply_tmpl.c:fix_int_mv_precision
466
467
static inline void fix_mv_precision(const Dav1dFrameHeader *const hdr,
468
                                    mv *const mv)
469
171k
{
470
171k
    if (hdr->force_integer_mv) {
471
12.7k
        fix_int_mv_precision(mv);
472
158k
    } else if (!hdr->hp) {
473
67.0k
        mv->x = (mv->x - (mv->x >> 15)) & ~1U;
474
67.0k
        mv->y = (mv->y - (mv->y >> 15)) & ~1U;
475
67.0k
    }
476
171k
}
Unexecuted instantiation: lib.c:fix_mv_precision
Unexecuted instantiation: log.c:fix_mv_precision
Unexecuted instantiation: mem.c:fix_mv_precision
Unexecuted instantiation: obu.c:fix_mv_precision
Unexecuted instantiation: picture.c:fix_mv_precision
refmvs.c:fix_mv_precision
Line
Count
Source
469
23.2k
{
470
23.2k
    if (hdr->force_integer_mv) {
471
471
        fix_int_mv_precision(mv);
472
22.8k
    } else if (!hdr->hp) {
473
6.38k
        mv->x = (mv->x - (mv->x >> 15)) & ~1U;
474
6.38k
        mv->y = (mv->y - (mv->y >> 15)) & ~1U;
475
6.38k
    }
476
23.2k
}
Unexecuted instantiation: thread_task.c:fix_mv_precision
Unexecuted instantiation: cdf.c:fix_mv_precision
decode.c:fix_mv_precision
Line
Count
Source
469
148k
{
470
148k
    if (hdr->force_integer_mv) {
471
12.2k
        fix_int_mv_precision(mv);
472
136k
    } else if (!hdr->hp) {
473
60.7k
        mv->x = (mv->x - (mv->x >> 15)) & ~1U;
474
60.7k
        mv->y = (mv->y - (mv->y >> 15)) & ~1U;
475
60.7k
    }
476
148k
}
Unexecuted instantiation: recon_tmpl.c:fix_mv_precision
Unexecuted instantiation: cdef_apply_tmpl.c:fix_mv_precision
Unexecuted instantiation: ipred_prepare_tmpl.c:fix_mv_precision
Unexecuted instantiation: lf_apply_tmpl.c:fix_mv_precision
Unexecuted instantiation: lr_apply_tmpl.c:fix_mv_precision
477
478
static inline mv get_gmv_2d(const Dav1dWarpedMotionParams *const gmv,
479
                            const int bx4, const int by4,
480
                            const int bw4, const int bh4,
481
                            const Dav1dFrameHeader *const hdr)
482
320k
{
483
320k
    switch (gmv->type) {
484
71.0k
    case DAV1D_WM_TYPE_ROT_ZOOM:
485
71.0k
        assert(gmv->matrix[5] ==  gmv->matrix[2]);
486
71.0k
        assert(gmv->matrix[4] == -gmv->matrix[3]);
487
        // fall-through
488
71.0k
    default:
489
95.1k
    case DAV1D_WM_TYPE_AFFINE: {
490
95.1k
        const int x = bx4 * 4 + bw4 * 2 - 1;
491
95.1k
        const int y = by4 * 4 + bh4 * 2 - 1;
492
95.1k
        const int xc = (gmv->matrix[2] - (1 << 16)) * x +
493
95.1k
                       gmv->matrix[3] * y + gmv->matrix[0];
494
95.1k
        const int yc = (gmv->matrix[5] - (1 << 16)) * y +
495
95.1k
                       gmv->matrix[4] * x + gmv->matrix[1];
496
95.1k
        const int shift = 16 - (3 - !hdr->hp);
497
95.1k
        const int round = (1 << shift) >> 1;
498
95.1k
        mv res = (mv) {
499
95.1k
            .y = apply_sign(((abs(yc) + round) >> shift) << !hdr->hp, yc),
500
95.1k
            .x = apply_sign(((abs(xc) + round) >> shift) << !hdr->hp, xc),
501
95.1k
        };
502
95.1k
        if (hdr->force_integer_mv)
503
8.66k
            fix_int_mv_precision(&res);
504
95.1k
        return res;
505
71.0k
    }
506
21.2k
    case DAV1D_WM_TYPE_TRANSLATION: {
507
21.2k
        mv res = (mv) {
508
21.2k
            .y = gmv->matrix[0] >> 13,
509
21.2k
            .x = gmv->matrix[1] >> 13,
510
21.2k
        };
511
21.2k
        if (hdr->force_integer_mv)
512
2.45k
            fix_int_mv_precision(&res);
513
21.2k
        return res;
514
71.0k
    }
515
203k
    case DAV1D_WM_TYPE_IDENTITY:
516
203k
        return (mv) { .x = 0, .y = 0 };
517
320k
    }
518
320k
}
Unexecuted instantiation: lib.c:get_gmv_2d
Unexecuted instantiation: log.c:get_gmv_2d
Unexecuted instantiation: mem.c:get_gmv_2d
Unexecuted instantiation: obu.c:get_gmv_2d
Unexecuted instantiation: picture.c:get_gmv_2d
refmvs.c:get_gmv_2d
Line
Count
Source
482
261k
{
483
261k
    switch (gmv->type) {
484
59.9k
    case DAV1D_WM_TYPE_ROT_ZOOM:
485
59.9k
        assert(gmv->matrix[5] ==  gmv->matrix[2]);
486
59.9k
        assert(gmv->matrix[4] == -gmv->matrix[3]);
487
        // fall-through
488
59.9k
    default:
489
79.5k
    case DAV1D_WM_TYPE_AFFINE: {
490
79.5k
        const int x = bx4 * 4 + bw4 * 2 - 1;
491
79.5k
        const int y = by4 * 4 + bh4 * 2 - 1;
492
79.5k
        const int xc = (gmv->matrix[2] - (1 << 16)) * x +
493
79.5k
                       gmv->matrix[3] * y + gmv->matrix[0];
494
79.5k
        const int yc = (gmv->matrix[5] - (1 << 16)) * y +
495
79.5k
                       gmv->matrix[4] * x + gmv->matrix[1];
496
79.5k
        const int shift = 16 - (3 - !hdr->hp);
497
79.5k
        const int round = (1 << shift) >> 1;
498
79.5k
        mv res = (mv) {
499
79.5k
            .y = apply_sign(((abs(yc) + round) >> shift) << !hdr->hp, yc),
500
79.5k
            .x = apply_sign(((abs(xc) + round) >> shift) << !hdr->hp, xc),
501
79.5k
        };
502
79.5k
        if (hdr->force_integer_mv)
503
6.82k
            fix_int_mv_precision(&res);
504
79.5k
        return res;
505
59.9k
    }
506
14.9k
    case DAV1D_WM_TYPE_TRANSLATION: {
507
14.9k
        mv res = (mv) {
508
14.9k
            .y = gmv->matrix[0] >> 13,
509
14.9k
            .x = gmv->matrix[1] >> 13,
510
14.9k
        };
511
14.9k
        if (hdr->force_integer_mv)
512
1.53k
            fix_int_mv_precision(&res);
513
14.9k
        return res;
514
59.9k
    }
515
167k
    case DAV1D_WM_TYPE_IDENTITY:
516
167k
        return (mv) { .x = 0, .y = 0 };
517
261k
    }
518
261k
}
Unexecuted instantiation: thread_task.c:get_gmv_2d
Unexecuted instantiation: cdf.c:get_gmv_2d
decode.c:get_gmv_2d
Line
Count
Source
482
58.8k
{
483
58.8k
    switch (gmv->type) {
484
11.0k
    case DAV1D_WM_TYPE_ROT_ZOOM:
485
11.0k
        assert(gmv->matrix[5] ==  gmv->matrix[2]);
486
11.0k
        assert(gmv->matrix[4] == -gmv->matrix[3]);
487
        // fall-through
488
11.0k
    default:
489
15.5k
    case DAV1D_WM_TYPE_AFFINE: {
490
15.5k
        const int x = bx4 * 4 + bw4 * 2 - 1;
491
15.5k
        const int y = by4 * 4 + bh4 * 2 - 1;
492
15.5k
        const int xc = (gmv->matrix[2] - (1 << 16)) * x +
493
15.5k
                       gmv->matrix[3] * y + gmv->matrix[0];
494
15.5k
        const int yc = (gmv->matrix[5] - (1 << 16)) * y +
495
15.5k
                       gmv->matrix[4] * x + gmv->matrix[1];
496
15.5k
        const int shift = 16 - (3 - !hdr->hp);
497
15.5k
        const int round = (1 << shift) >> 1;
498
15.5k
        mv res = (mv) {
499
15.5k
            .y = apply_sign(((abs(yc) + round) >> shift) << !hdr->hp, yc),
500
15.5k
            .x = apply_sign(((abs(xc) + round) >> shift) << !hdr->hp, xc),
501
15.5k
        };
502
15.5k
        if (hdr->force_integer_mv)
503
1.83k
            fix_int_mv_precision(&res);
504
15.5k
        return res;
505
11.0k
    }
506
6.35k
    case DAV1D_WM_TYPE_TRANSLATION: {
507
6.35k
        mv res = (mv) {
508
6.35k
            .y = gmv->matrix[0] >> 13,
509
6.35k
            .x = gmv->matrix[1] >> 13,
510
6.35k
        };
511
6.35k
        if (hdr->force_integer_mv)
512
912
            fix_int_mv_precision(&res);
513
6.35k
        return res;
514
11.0k
    }
515
36.9k
    case DAV1D_WM_TYPE_IDENTITY:
516
36.9k
        return (mv) { .x = 0, .y = 0 };
517
58.8k
    }
518
58.8k
}
Unexecuted instantiation: recon_tmpl.c:get_gmv_2d
Unexecuted instantiation: cdef_apply_tmpl.c:get_gmv_2d
Unexecuted instantiation: ipred_prepare_tmpl.c:get_gmv_2d
Unexecuted instantiation: lf_apply_tmpl.c:get_gmv_2d
Unexecuted instantiation: lr_apply_tmpl.c:get_gmv_2d
519
520
#endif /* DAV1D_SRC_ENV_H */