FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/dirac_dwt.c
Date: 2021-11-29 18:02:40
Exec Total Coverage
Lines: 27 30 90.0%
Branches: 12 14 85.7%

Line Branch Exec Source
1 /*
2 * Copyright (C) 2004-2010 Michael Niedermayer <michaelni@gmx.at>
3 * Copyright (C) 2008 David Conrad
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/attributes.h"
23 #include "libavutil/common.h"
24 #include "dirac_dwt.h"
25
26 #define TEMPLATE_8bit
27 #include "dirac_dwt_template.c"
28
29 #define TEMPLATE_10bit
30 #include "dirac_dwt_template.c"
31
32 #define TEMPLATE_12bit
33 #include "dirac_dwt_template.c"
34
35 780 int ff_spatial_idwt_init(DWTContext *d, DWTPlane *p, enum dwt_type type,
36 int decomposition_count, int bit_depth)
37 {
38 780 int ret = 0;
39
40 780 d->buffer = p->buf;
41 780 d->width = p->width;
42 780 d->height = p->height;
43 780 d->stride = p->stride;
44 780 d->temp = p->tmp;
45 780 d->decomposition_count = decomposition_count;
46
47
2/2
✓ Branch 0 taken 348 times.
✓ Branch 1 taken 432 times.
780 if (bit_depth == 8)
48 348 ret = ff_spatial_idwt_init_8bit(d, type);
49
2/2
✓ Branch 0 taken 270 times.
✓ Branch 1 taken 162 times.
432 else if (bit_depth == 10)
50 270 ret = ff_spatial_idwt_init_10bit(d, type);
51
1/2
✓ Branch 0 taken 162 times.
✗ Branch 1 not taken.
162 else if (bit_depth == 12)
52 162 ret = ff_spatial_idwt_init_12bit(d, type);
53 else
54 av_log(NULL, AV_LOG_WARNING, "Unsupported bit depth = %i\n", bit_depth);
55
56
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 780 times.
780 if (ret) {
57 av_log(NULL, AV_LOG_ERROR, "Unknown wavelet type %d\n", type);
58 return AVERROR_INVALIDDATA;
59 }
60
61
2/2
✓ Branch 0 taken 348 times.
✓ Branch 1 taken 432 times.
780 if (ARCH_X86 && bit_depth == 8)
62 348 ff_spatial_idwt_init_x86(d, type);
63 780 return 0;
64 }
65
66 13440 void ff_spatial_idwt_slice2(DWTContext *d, int y)
67 {
68 13440 int level, support = d->support;
69
70
2/2
✓ Branch 0 taken 50040 times.
✓ Branch 1 taken 13440 times.
63480 for (level = d->decomposition_count-1; level >= 0; level--) {
71 50040 int wl = d->width >> level;
72 50040 int hl = d->height >> level;
73 50040 int stride_l = d->stride << level;
74
75
2/2
✓ Branch 0 taken 179562 times.
✓ Branch 1 taken 50040 times.
229602 while (d->cs[level].y <= FFMIN((y>>level)+support, hl))
76 179562 d->spatial_compose(d, level, wl, hl, stride_l);
77 }
78 13440 }
79