FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/utvideodsp.c
Date: 2022-01-21 12:56:39
Exec Total Coverage
Lines: 29 29 100.0%
Branches: 8 8 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
21 #include "config.h"
22 #include "libavutil/attributes.h"
23 #include "utvideodsp.h"
24
25 31 static void restore_rgb_planes_c(uint8_t *src_r,
26 uint8_t *src_g,
27 uint8_t *src_b,
28 ptrdiff_t linesize_r,
29 ptrdiff_t linesize_g,
30 ptrdiff_t linesize_b,
31 int width, int height)
32 {
33 uint8_t r, g, b;
34 int i, j;
35
36
2/2
✓ Branch 0 taken 12781 times.
✓ Branch 1 taken 31 times.
12812 for (j = 0; j < height; j++) {
37
2/2
✓ Branch 0 taken 8253145 times.
✓ Branch 1 taken 12781 times.
8265926 for (i = 0; i < width; i++) {
38 8253145 r = src_r[i];
39 8253145 g = src_g[i];
40 8253145 b = src_b[i];
41 8253145 src_r[i] = r + g - 0x80;
42 8253145 src_b[i] = b + g - 0x80;
43 }
44 12781 src_r += linesize_r;
45 12781 src_g += linesize_g;
46 12781 src_b += linesize_b;
47 }
48 31 }
49
50 3 static void restore_rgb_planes10_c(uint16_t *src_r,
51 uint16_t *src_g,
52 uint16_t *src_b,
53 ptrdiff_t linesize_r,
54 ptrdiff_t linesize_g,
55 ptrdiff_t linesize_b,
56 int width, int height)
57 {
58 int r, g, b;
59 int i, j;
60
61
2/2
✓ Branch 0 taken 360 times.
✓ Branch 1 taken 3 times.
363 for (j = 0; j < height; j++) {
62
2/2
✓ Branch 0 taken 86400 times.
✓ Branch 1 taken 360 times.
86760 for (i = 0; i < width; i++) {
63 86400 r = src_r[i];
64 86400 g = src_g[i];
65 86400 b = src_b[i];
66 86400 src_r[i] = (r + g - 0x200) & 0x3FF;
67 86400 src_b[i] = (b + g - 0x200) & 0x3FF;
68 }
69 360 src_r += linesize_r;
70 360 src_g += linesize_g;
71 360 src_b += linesize_b;
72 }
73 3 }
74
75 59 av_cold void ff_utvideodsp_init(UTVideoDSPContext *c)
76 {
77 59 c->restore_rgb_planes = restore_rgb_planes_c;
78 59 c->restore_rgb_planes10 = restore_rgb_planes10_c;
79
80 if (ARCH_X86)
81 59 ff_utvideodsp_init_x86(c);
82 59 }
83