Coverage Report

Created: 2026-10-28 08:13

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ffmpeg/libavcodec/v210_template.c
Line
Count
Source
1
/*
2
 * Copyright (C) 2009 Michael Niedermayer <michaelni@gmx.at>
3
 * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
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 "bytestream.h"
23
#include "internal.h"
24
25
static void RENAME(v210_enc)(AVCodecContext *avctx,
26
        uint8_t *dst, const AVFrame *pic)
27
6.55k
{
28
6.55k
    V210EncContext *s = avctx->priv_data;
29
6.55k
    int aligned_width = ((avctx->width + 47) / 48) * 48;
30
6.55k
    int stride = aligned_width * 8 / 3;
31
6.55k
    int line_padding = stride - ((avctx->width * 8 + 11) / 12) * 4;
32
6.55k
    int h, w;
33
6.55k
    const TYPE *y = (const TYPE *)pic->data[0];
34
6.55k
    const TYPE *u = (const TYPE *)pic->data[1];
35
6.55k
    const TYPE *v = (const TYPE *)pic->data[2];
36
6.55k
    const int sample_size = 6 * s->RENAME(sample_factor);
37
6.55k
    const int sample_w    = avctx->width / sample_size;
38
39
2.30M
    for (h = 0; h < avctx->height; h++) {
40
2.29M
        uint32_t val;
41
2.29M
        w = sample_w * sample_size;
42
2.29M
        s->RENAME(pack_line)(y, u, v, dst, w);
43
44
2.29M
        y += w;
45
2.29M
        u += w >> 1;
46
2.29M
        v += w >> 1;
47
2.29M
        dst += sample_w * 16 * s->RENAME(sample_factor);
48
49
2.62M
        for (; w < avctx->width - 5; w += 6) {
50
330k
            WRITE_PIXELS(u, y, v, DEPTH);
51
330k
            WRITE_PIXELS(y, u, y, DEPTH);
52
330k
            WRITE_PIXELS(v, y, u, DEPTH);
53
330k
            WRITE_PIXELS(y, v, y, DEPTH);
54
330k
        }
55
2.29M
        if (w < avctx->width - 1) {
56
2.22M
            WRITE_PIXELS(u, y, v, DEPTH);
57
58
2.22M
            val = CLIP(*y++, DEPTH) << (10-DEPTH);
59
2.22M
            if (w == avctx->width - 2) {
60
899k
                AV_WL32(dst, val);
61
899k
                dst += 4;
62
899k
            }
63
2.22M
        }
64
2.29M
        if (w < avctx->width - 3) {
65
1.32M
            val |= (CLIP(*u++, DEPTH) << (20-DEPTH)) | (CLIP(*y++, DEPTH) << (30-DEPTH));
66
1.32M
            AV_WL32(dst, val);
67
1.32M
            dst += 4;
68
69
1.32M
            val = CLIP(*v++, DEPTH) << (10-DEPTH) | (CLIP(*y++, DEPTH) << (20-DEPTH));
70
1.32M
            AV_WL32(dst, val);
71
1.32M
            dst += 4;
72
1.32M
        }
73
74
2.29M
        memset(dst, 0, line_padding);
75
2.29M
        dst += line_padding;
76
2.29M
        y += pic->linesize[0] / BYTES_PER_PIXEL - avctx->width;
77
2.29M
        u += pic->linesize[1] / BYTES_PER_PIXEL - avctx->width / 2;
78
2.29M
        v += pic->linesize[2] / BYTES_PER_PIXEL - avctx->width / 2;
79
2.29M
    }
80
6.55k
}
v210enc.c:v210_enc_10
Line
Count
Source
27
1.38k
{
28
1.38k
    V210EncContext *s = avctx->priv_data;
29
1.38k
    int aligned_width = ((avctx->width + 47) / 48) * 48;
30
1.38k
    int stride = aligned_width * 8 / 3;
31
1.38k
    int line_padding = stride - ((avctx->width * 8 + 11) / 12) * 4;
32
1.38k
    int h, w;
33
1.38k
    const TYPE *y = (const TYPE *)pic->data[0];
34
1.38k
    const TYPE *u = (const TYPE *)pic->data[1];
35
1.38k
    const TYPE *v = (const TYPE *)pic->data[2];
36
1.38k
    const int sample_size = 6 * s->RENAME(sample_factor);
37
1.38k
    const int sample_w    = avctx->width / sample_size;
38
39
1.19M
    for (h = 0; h < avctx->height; h++) {
40
1.19M
        uint32_t val;
41
1.19M
        w = sample_w * sample_size;
42
1.19M
        s->RENAME(pack_line)(y, u, v, dst, w);
43
44
1.19M
        y += w;
45
1.19M
        u += w >> 1;
46
1.19M
        v += w >> 1;
47
1.19M
        dst += sample_w * 16 * s->RENAME(sample_factor);
48
49
1.19M
        for (; w < avctx->width - 5; w += 6) {
50
0
            WRITE_PIXELS(u, y, v, DEPTH);
51
0
            WRITE_PIXELS(y, u, y, DEPTH);
52
0
            WRITE_PIXELS(v, y, u, DEPTH);
53
0
            WRITE_PIXELS(y, v, y, DEPTH);
54
0
        }
55
1.19M
        if (w < avctx->width - 1) {
56
1.19M
            WRITE_PIXELS(u, y, v, DEPTH);
57
58
1.19M
            val = CLIP(*y++, DEPTH) << (10-DEPTH);
59
1.19M
            if (w == avctx->width - 2) {
60
695k
                AV_WL32(dst, val);
61
695k
                dst += 4;
62
695k
            }
63
1.19M
        }
64
1.19M
        if (w < avctx->width - 3) {
65
498k
            val |= (CLIP(*u++, DEPTH) << (20-DEPTH)) | (CLIP(*y++, DEPTH) << (30-DEPTH));
66
498k
            AV_WL32(dst, val);
67
498k
            dst += 4;
68
69
498k
            val = CLIP(*v++, DEPTH) << (10-DEPTH) | (CLIP(*y++, DEPTH) << (20-DEPTH));
70
498k
            AV_WL32(dst, val);
71
498k
            dst += 4;
72
498k
        }
73
74
1.19M
        memset(dst, 0, line_padding);
75
1.19M
        dst += line_padding;
76
1.19M
        y += pic->linesize[0] / BYTES_PER_PIXEL - avctx->width;
77
1.19M
        u += pic->linesize[1] / BYTES_PER_PIXEL - avctx->width / 2;
78
1.19M
        v += pic->linesize[2] / BYTES_PER_PIXEL - avctx->width / 2;
79
1.19M
    }
80
1.38k
}
v210enc.c:v210_enc_8
Line
Count
Source
27
5.17k
{
28
5.17k
    V210EncContext *s = avctx->priv_data;
29
5.17k
    int aligned_width = ((avctx->width + 47) / 48) * 48;
30
5.17k
    int stride = aligned_width * 8 / 3;
31
5.17k
    int line_padding = stride - ((avctx->width * 8 + 11) / 12) * 4;
32
5.17k
    int h, w;
33
5.17k
    const TYPE *y = (const TYPE *)pic->data[0];
34
5.17k
    const TYPE *u = (const TYPE *)pic->data[1];
35
5.17k
    const TYPE *v = (const TYPE *)pic->data[2];
36
5.17k
    const int sample_size = 6 * s->RENAME(sample_factor);
37
5.17k
    const int sample_w    = avctx->width / sample_size;
38
39
1.10M
    for (h = 0; h < avctx->height; h++) {
40
1.10M
        uint32_t val;
41
1.10M
        w = sample_w * sample_size;
42
1.10M
        s->RENAME(pack_line)(y, u, v, dst, w);
43
44
1.10M
        y += w;
45
1.10M
        u += w >> 1;
46
1.10M
        v += w >> 1;
47
1.10M
        dst += sample_w * 16 * s->RENAME(sample_factor);
48
49
1.43M
        for (; w < avctx->width - 5; w += 6) {
50
330k
            WRITE_PIXELS(u, y, v, DEPTH);
51
330k
            WRITE_PIXELS(y, u, y, DEPTH);
52
330k
            WRITE_PIXELS(v, y, u, DEPTH);
53
330k
            WRITE_PIXELS(y, v, y, DEPTH);
54
330k
        }
55
1.10M
        if (w < avctx->width - 1) {
56
1.02M
            WRITE_PIXELS(u, y, v, DEPTH);
57
58
1.02M
            val = CLIP(*y++, DEPTH) << (10-DEPTH);
59
1.02M
            if (w == avctx->width - 2) {
60
203k
                AV_WL32(dst, val);
61
203k
                dst += 4;
62
203k
            }
63
1.02M
        }
64
1.10M
        if (w < avctx->width - 3) {
65
823k
            val |= (CLIP(*u++, DEPTH) << (20-DEPTH)) | (CLIP(*y++, DEPTH) << (30-DEPTH));
66
823k
            AV_WL32(dst, val);
67
823k
            dst += 4;
68
69
823k
            val = CLIP(*v++, DEPTH) << (10-DEPTH) | (CLIP(*y++, DEPTH) << (20-DEPTH));
70
823k
            AV_WL32(dst, val);
71
823k
            dst += 4;
72
823k
        }
73
74
1.10M
        memset(dst, 0, line_padding);
75
1.10M
        dst += line_padding;
76
1.10M
        y += pic->linesize[0] / BYTES_PER_PIXEL - avctx->width;
77
1.10M
        u += pic->linesize[1] / BYTES_PER_PIXEL - avctx->width / 2;
78
1.10M
        v += pic->linesize[2] / BYTES_PER_PIXEL - avctx->width / 2;
79
1.10M
    }
80
5.17k
}