FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/vvc/dsp.c
Date: 2024-11-20 23:03:26
Exec Total Coverage
Lines: 25 25 100.0%
Functions: 2 2 100.0%
Branches: 7 7 100.0%

Line Branch Exec Source
1 /*
2 * VVC DSP
3 *
4 * Copyright (C) 2021 Nuo Mi
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 #include "dsp.h"
24 #include "ctu.h"
25 #include "itx_1d.h"
26
27 #define VVC_SIGN(v) (v < 0 ? -1 : !!v)
28
29 11784599 static int vvc_sad(const int16_t *src0, const int16_t *src1, int dx, int dy,
30 const int block_w, const int block_h)
31 {
32 11784599 int sad = 0;
33 11784599 dx -= 2;
34 11784599 dy -= 2;
35 11784599 src0 += (2 + dy) * MAX_PB_SIZE + 2 + dx;
36 11784599 src1 += (2 - dy) * MAX_PB_SIZE + 2 - dx;
37
2/2
✓ Branch 0 taken 92844900 times.
✓ Branch 1 taken 11784599 times.
104629499 for (int y = 0; y < block_h; y += 2) {
38
2/2
✓ Branch 0 taken 1459492544 times.
✓ Branch 1 taken 92844900 times.
1552337444 for (int x = 0; x < block_w; x++) {
39 1459492544 sad += FFABS(src0[x] - src1[x]);
40 }
41 92844900 src0 += 2 * MAX_PB_SIZE;
42 92844900 src1 += 2 * MAX_PB_SIZE;
43 }
44 11784599 return sad;
45 }
46
47 typedef struct IntraEdgeParams {
48 uint8_t* top;
49 uint8_t* left;
50 int filter_flag;
51
52 uint16_t left_array[6 * MAX_TB_SIZE + 5];
53 uint16_t filtered_left_array[6 * MAX_TB_SIZE + 5];
54 uint16_t top_array[6 * MAX_TB_SIZE + 5];
55 uint16_t filtered_top_array[6 * MAX_TB_SIZE + 5];
56 } IntraEdgeParams;
57
58 #define PROF_BORDER_EXT 1
59 #define PROF_BLOCK_SIZE (AFFINE_MIN_BLOCK_SIZE + PROF_BORDER_EXT * 2)
60
61 #define BDOF_BORDER_EXT 1
62 #define BDOF_BLOCK_SIZE 16
63 #define BDOF_MIN_BLOCK_SIZE 4
64
65 #define BIT_DEPTH 8
66 #include "dsp_template.c"
67 #undef BIT_DEPTH
68
69 #define BIT_DEPTH 10
70 #include "dsp_template.c"
71 #undef BIT_DEPTH
72
73 #define BIT_DEPTH 12
74 #include "dsp_template.c"
75 #undef BIT_DEPTH
76
77 1300 void ff_vvc_dsp_init(VVCDSPContext *vvcdsp, int bit_depth)
78 {
79 #undef FUNC
80 #define FUNC(a, depth) a ## _ ## depth
81
82 #define VVC_DSP(depth) \
83 FUNC(ff_vvc_inter_dsp_init, depth)(&vvcdsp->inter); \
84 FUNC(ff_vvc_intra_dsp_init, depth)(&vvcdsp->intra); \
85 FUNC(ff_vvc_itx_dsp_init, depth)(&vvcdsp->itx); \
86 FUNC(ff_vvc_lmcs_dsp_init, depth)(&vvcdsp->lmcs); \
87 FUNC(ff_vvc_lf_dsp_init, depth)(&vvcdsp->lf); \
88 FUNC(ff_vvc_sao_dsp_init, depth)(&vvcdsp->sao); \
89 FUNC(ff_vvc_alf_dsp_init, depth)(&vvcdsp->alf); \
90
91
3/3
✓ Branch 0 taken 117 times.
✓ Branch 1 taken 1031 times.
✓ Branch 2 taken 152 times.
1300 switch (bit_depth) {
92 117 case 12:
93 117 VVC_DSP(12);
94 117 break;
95 1031 case 10:
96 1031 VVC_DSP(10);
97 1031 break;
98 152 default:
99 152 VVC_DSP(8);
100 152 break;
101 }
102
103 #if ARCH_AARCH64
104 ff_vvc_dsp_init_aarch64(vvcdsp, bit_depth);
105 #elif ARCH_RISCV
106 ff_vvc_dsp_init_riscv(vvcdsp, bit_depth);
107 #elif ARCH_X86
108 1300 ff_vvc_dsp_init_x86(vvcdsp, bit_depth);
109 #endif
110 1300 }
111