FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/hpel_template.c
Date: 2021-09-22 05:58:22
Exec Total Coverage
Lines: 2 2 100.0%
Branches: 7 7 100.0%

Line Branch Exec Source
1 /*
2 * Copyright (c) 2000, 2001 Fabrice Bellard
3 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include "libavutil/intreadwrite.h"
23
24 #include "pixels.h"
25
26 #include "bit_depth_template.c"
27
28 #define DEF_HPEL(OPNAME, OP) \
29 static inline void FUNC(OPNAME ## _pixels8_l2)(uint8_t *dst, \
30 const uint8_t *src1, \
31 const uint8_t *src2, \
32 int dst_stride, \
33 int src_stride1, \
34 int src_stride2, \
35 int h) \
36 { \
37 int i; \
38 for (i = 0; i < h; i++) { \
39 pixel4 a, b; \
40 a = AV_RN4P(&src1[i * src_stride1]); \
41 b = AV_RN4P(&src2[i * src_stride2]); \
42 OP(*((pixel4 *) &dst[i * dst_stride]), rnd_avg_pixel4(a, b)); \
43 a = AV_RN4P(&src1[i * src_stride1 + 4 * sizeof(pixel)]); \
44 b = AV_RN4P(&src2[i * src_stride2 + 4 * sizeof(pixel)]); \
45 OP(*((pixel4 *) &dst[i * dst_stride + 4 * sizeof(pixel)]), \
46 rnd_avg_pixel4(a, b)); \
47 } \
48 } \
49 \
50 static inline void FUNC(OPNAME ## _pixels4_l2)(uint8_t *dst, \
51 const uint8_t *src1, \
52 const uint8_t *src2, \
53 int dst_stride, \
54 int src_stride1, \
55 int src_stride2, \
56 int h) \
57 { \
58 int i; \
59 for (i = 0; i < h; i++) { \
60 pixel4 a, b; \
61 a = AV_RN4P(&src1[i * src_stride1]); \
62 b = AV_RN4P(&src2[i * src_stride2]); \
63 OP(*((pixel4 *) &dst[i * dst_stride]), rnd_avg_pixel4(a, b)); \
64 } \
65 } \
66 \
67 static inline void FUNC(OPNAME ## _pixels2_l2)(uint8_t *dst, \
68 const uint8_t *src1, \
69 const uint8_t *src2, \
70 int dst_stride, \
71 int src_stride1, \
72 int src_stride2, \
73 int h) \
74 { \
75 int i; \
76 for (i = 0; i < h; i++) { \
77 pixel4 a, b; \
78 a = AV_RN2P(&src1[i * src_stride1]); \
79 b = AV_RN2P(&src2[i * src_stride2]); \
80 OP(*((pixel2 *) &dst[i * dst_stride]), rnd_avg_pixel4(a, b)); \
81 } \
82 } \
83 \
84 static inline void FUNC(OPNAME ## _pixels16_l2)(uint8_t *dst, \
85 const uint8_t *src1, \
86 const uint8_t *src2, \
87 int dst_stride, \
88 int src_stride1, \
89 int src_stride2, \
90 int h) \
91 { \
92 FUNC(OPNAME ## _pixels8_l2)(dst, src1, src2, dst_stride, \
93 src_stride1, src_stride2, h); \
94 FUNC(OPNAME ## _pixels8_l2)(dst + 8 * sizeof(pixel), \
95 src1 + 8 * sizeof(pixel), \
96 src2 + 8 * sizeof(pixel), \
97 dst_stride, src_stride1, \
98 src_stride2, h); \
99 } \
100
101 #define op_avg(a, b) a = rnd_avg_pixel4(a, b)
102 #define op_put(a, b) a = b
103
4/4
✓ Branch 2 taken 14233164 times.
✓ Branch 3 taken 3558216 times.
✓ Branch 4 taken 166658408 times.
✓ Branch 5 taken 12369951 times.
395584428 DEF_HPEL(avg, op_avg)
104
3/3
✓ Branch 1 taken 45263660 times.
✓ Branch 2 taken 420100833 times.
✓ Branch 3 taken 32998297 times.
503134929 DEF_HPEL(put, op_put)
105 #undef op_avg
106 #undef op_put
107