../../../ffmpeg/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
20 / 32
62.5%
Branches:
28 / 44
63.6%
Functions:
20 / 32
62.5%

libavcodec/hpel_template.c
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 ptrdiff_t dst_stride, \
33 ptrdiff_t src_stride1, \
34 ptrdiff_t 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 * (int)sizeof(pixel)]); \
44 b = AV_RN4P(&src2[i * src_stride2 + 4 * (int)sizeof(pixel)]); \
45 OP(*((pixel4 *) &dst[i * dst_stride + 4 * (int)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 ptrdiff_t dst_stride, \
54 ptrdiff_t src_stride1, \
55 ptrdiff_t 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 ptrdiff_t dst_stride, \
71 ptrdiff_t src_stride1, \
72 ptrdiff_t 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 ptrdiff_t dst_stride, \
88 ptrdiff_t src_stride1, \
89 ptrdiff_t 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
14/22
avg_pixels2_l2_8:
✓ Branch 6 → 3 taken 142 times.
✓ Branch 6 → 7 taken 28 times.
avg_pixels4_l2_10:
✓ Branch 6 → 3 taken 1920 times.
✓ Branch 6 → 7 taken 480 times.
avg_pixels4_l2_12:
✗ Branch 6 → 3 not taken.
✗ Branch 6 → 7 not taken.
avg_pixels4_l2_14:
✗ Branch 6 → 3 not taken.
✗ Branch 6 → 7 not taken.
avg_pixels4_l2_8:
✓ Branch 6 → 3 taken 14234684 times.
✓ Branch 6 → 7 taken 3558584 times.
avg_pixels4_l2_9:
✓ Branch 6 → 3 taken 1296 times.
✓ Branch 6 → 7 taken 324 times.
avg_pixels8_l2_10:
✓ Branch 8 → 3 taken 1030480 times.
✓ Branch 8 → 9 taken 81596 times.
avg_pixels8_l2_12:
✗ Branch 8 → 3 not taken.
✗ Branch 8 → 9 not taken.
avg_pixels8_l2_14:
✗ Branch 8 → 3 not taken.
✗ Branch 8 → 9 not taken.
avg_pixels8_l2_8:
✓ Branch 8 → 3 taken 166324232 times.
✓ Branch 8 → 9 taken 12373452 times.
avg_pixels8_l2_9:
✓ Branch 8 → 3 taken 181840 times.
✓ Branch 8 → 9 taken 17570 times.
198811166 DEF_HPEL(avg, op_avg)
104
14/22
put_pixels2_l2_8:
✓ Branch 5 → 3 taken 116074 times.
✓ Branch 5 → 6 taken 57952 times.
put_pixels4_l2_10:
✓ Branch 5 → 3 taken 6492 times.
✓ Branch 5 → 6 taken 1623 times.
put_pixels4_l2_12:
✗ Branch 5 → 3 not taken.
✗ Branch 5 → 6 not taken.
put_pixels4_l2_14:
✗ Branch 5 → 3 not taken.
✗ Branch 5 → 6 not taken.
put_pixels4_l2_8:
✓ Branch 5 → 3 taken 45737380 times.
✓ Branch 5 → 6 taken 11434198 times.
put_pixels4_l2_9:
✓ Branch 5 → 3 taken 91364 times.
✓ Branch 5 → 6 taken 22841 times.
put_pixels8_l2_10:
✓ Branch 6 → 3 taken 4258952 times.
✓ Branch 6 → 7 taken 368101 times.
put_pixels8_l2_12:
✗ Branch 6 → 3 not taken.
✗ Branch 6 → 7 not taken.
put_pixels8_l2_14:
✗ Branch 6 → 3 not taken.
✗ Branch 6 → 7 not taken.
put_pixels8_l2_8:
✓ Branch 6 → 3 taken 465340485 times.
✓ Branch 6 → 7 taken 38181169 times.
put_pixels8_l2_9:
✓ Branch 6 → 3 taken 570408 times.
✓ Branch 6 → 7 taken 55117 times.
571975156 DEF_HPEL(put, op_put)
105 #undef op_avg
106 #undef op_put
107