FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/vc1_pred.h
Date: 2021-09-24 03:35:22
Exec Total Coverage
Lines: 7 7 100.0%
Branches: 4 4 100.0%

Line Branch Exec Source
1 /*
2 * VC-1 and WMV3 decoder
3 * Copyright (c) 2006-2007 Konstantin Shishkov
4 * Partly based on vc9.c (c) 2005 Anonymous, Alex Beregszaszi, Michael Niedermayer
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 #ifndef AVCODEC_VC1_PRED_H
24 #define AVCODEC_VC1_PRED_H
25
26 #include "vc1.h"
27 #include "vc1data.h"
28
29 void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y,
30 int mv1, int r_x, int r_y, uint8_t* is_intra,
31 int pred_flag, int dir);
32 void ff_vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y,
33 int mvn, int r_x, int r_y, uint8_t* is_intra,
34 int dir);
35 void ff_vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2],
36 int direct, int mvtype);
37 void ff_vc1_pred_b_mv_intfi(VC1Context *v, int n, int *dmv_x, int *dmv_y,
38 int mv1, int *pred_flag);
39
40 154028 static av_always_inline int scale_mv(int value, int bfrac, int inv, int qs)
41 {
42 154028 int n = bfrac;
43
44 #if B_FRACTION_DEN==256
45
2/2
✓ Branch 0 taken 77014 times.
✓ Branch 1 taken 77014 times.
154028 if (inv)
46 77014 n -= 256;
47
2/2
✓ Branch 0 taken 8104 times.
✓ Branch 1 taken 145924 times.
154028 if (!qs)
48 8104 return 2 * ((value * n + 255) >> 9);
49 145924 return (value * n + 128) >> 8;
50 #else
51 if (inv)
52 n -= B_FRACTION_DEN;
53 if (!qs)
54 return 2 * ((value * n + B_FRACTION_DEN - 1) / (2 * B_FRACTION_DEN));
55 return (value * n + B_FRACTION_DEN/2) / B_FRACTION_DEN;
56 #endif
57 }
58
59 #endif /* AVCODEC_VC1_PRED_H */
60