Coverage Report

Created: 2026-11-13 08:07

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibMedia/Subsampling.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2024, Gregory Bertilson <zaggy1024@gmail.com>
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#pragma once
8
9
#include <LibGfx/Size.h>
10
11
namespace Media {
12
13
struct Subsampling {
14
public:
15
    Subsampling(bool x, bool y)
16
1.02k
        : m_x(x)
17
1.02k
        , m_y(y)
18
1.02k
    {
19
1.02k
    }
20
21
    Subsampling() = default;
22
23
2.05k
    bool x() const { return m_x; }
24
2.05k
    bool y() const { return m_y; }
25
26
    static u32 subsampled_size(bool subsampled, u32 size)
27
21.0M
    {
28
21.0M
        u32 subsampled_as_int = static_cast<u32>(subsampled);
29
21.0M
        return (size + subsampled_as_int) >> subsampled_as_int;
30
21.0M
    }
31
32
    template<Integral T>
33
    Gfx::Size<T> subsampled_size(Gfx::Size<T> size) const
34
2.05k
    {
35
2.05k
        return {
36
2.05k
            subsampled_size(x(), size.width()),
37
2.05k
            subsampled_size(y(), size.height())
38
2.05k
        };
39
2.05k
    }
_ZNK5Media11Subsampling15subsampled_sizeITkN2AK8Concepts8IntegralEmEEN3Gfx4SizeIT_EES7_
Line
Count
Source
34
1.02k
    {
35
1.02k
        return {
36
1.02k
            subsampled_size(x(), size.width()),
37
1.02k
            subsampled_size(y(), size.height())
38
1.02k
        };
39
1.02k
    }
_ZNK5Media11Subsampling15subsampled_sizeITkN2AK8Concepts8IntegralEjEEN3Gfx4SizeIT_EES7_
Line
Count
Source
34
1.02k
    {
35
1.02k
        return {
36
1.02k
            subsampled_size(x(), size.width()),
37
1.02k
            subsampled_size(y(), size.height())
38
1.02k
        };
39
1.02k
    }
40
41
private:
42
    bool m_x = false;
43
    bool m_y = false;
44
};
45
46
}