FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/blockdsp.c
Date: 2021-09-24 20:55:06
Exec Total Coverage
Lines: 23 23 100.0%
Branches: 4 4 100.0%

Line Branch Exec Source
1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #include <stdint.h>
20 #include <string.h>
21
22 #include "config.h"
23 #include "libavutil/attributes.h"
24 #include "avcodec.h"
25 #include "blockdsp.h"
26
27 45131515 static void clear_block_c(int16_t *block)
28 {
29 45131515 memset(block, 0, sizeof(int16_t) * 64);
30 45131515 }
31
32 3745540 static void clear_blocks_c(int16_t *blocks)
33 {
34 3745540 memset(blocks, 0, sizeof(int16_t) * 6 * 64);
35 3745540 }
36
37 5108 static void fill_block16_c(uint8_t *block, uint8_t value, ptrdiff_t line_size,
38 int h)
39 {
40 int i;
41
42
2/2
✓ Branch 0 taken 81728 times.
✓ Branch 1 taken 5108 times.
86836 for (i = 0; i < h; i++) {
43 81728 memset(block, value, 16);
44 81728 block += line_size;
45 }
46 5108 }
47
48 32003 static void fill_block8_c(uint8_t *block, uint8_t value, ptrdiff_t line_size,
49 int h)
50 {
51 int i;
52
53
2/2
✓ Branch 0 taken 256024 times.
✓ Branch 1 taken 32003 times.
288027 for (i = 0; i < h; i++) {
54 256024 memset(block, value, 8);
55 256024 block += line_size;
56 }
57 32003 }
58
59 1373 av_cold void ff_blockdsp_init(BlockDSPContext *c, AVCodecContext *avctx)
60 {
61 1373 c->clear_block = clear_block_c;
62 1373 c->clear_blocks = clear_blocks_c;
63
64 1373 c->fill_block_tab[0] = fill_block16_c;
65 1373 c->fill_block_tab[1] = fill_block8_c;
66
67 if (ARCH_ALPHA)
68 ff_blockdsp_init_alpha(c);
69 if (ARCH_ARM)
70 ff_blockdsp_init_arm(c);
71 if (ARCH_PPC)
72 ff_blockdsp_init_ppc(c);
73 if (ARCH_X86)
74 1373 ff_blockdsp_init_x86(c, avctx);
75 if (ARCH_MIPS)
76 ff_blockdsp_init_mips(c);
77 1373 }
78