Coverage Report

Created: 2026-04-01 07:49

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/x264/common/rectangle.h
Line
Count
Source
1
/*****************************************************************************
2
 * rectangle.h: rectangle filling
3
 *****************************************************************************
4
 * Copyright (C) 2003-2025 x264 project
5
 *
6
 * Authors: Fiona Glaser <fiona@x264.com>
7
 *          Loren Merritt <lorenm@u.washington.edu>
8
 *
9
 * This program is free software; you can redistribute it and/or modify
10
 * it under the terms of the GNU General Public License as published by
11
 * the Free Software Foundation; either version 2 of the License, or
12
 * (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
22
 *
23
 * This program is also available under a commercial proprietary license.
24
 * For more information, contact us at licensing@x264.com.
25
 *****************************************************************************/
26
27
/* This function should only be called with constant w / h / s arguments! */
28
static ALWAYS_INLINE void x264_macroblock_cache_rect( void *dst, int w, int h, int s, uint32_t v )
29
0
{
30
0
    uint8_t *d = dst;
31
0
    uint16_t v2 = s >= 2 ? v : v * 0x101;
32
0
    uint32_t v4 = s >= 4 ? v : s >= 2 ? v * 0x10001 : v * 0x1010101;
33
0
    uint64_t v8 = v4 + ((uint64_t)v4 << 32);
34
0
    s *= 8;
35
36
0
    if( w == 2 )
37
0
    {
38
0
        M16( d+s*0 ) = v2;
39
0
        if( h == 1 ) return;
40
0
        M16( d+s*1 ) = v2;
41
0
        if( h == 2 ) return;
42
0
        M16( d+s*2 ) = v2;
43
0
        M16( d+s*3 ) = v2;
44
0
    }
45
0
    else if( w == 4 )
46
0
    {
47
0
        M32( d+s*0 ) = v4;
48
0
        if( h == 1 ) return;
49
0
        M32( d+s*1 ) = v4;
50
0
        if( h == 2 ) return;
51
0
        M32( d+s*2 ) = v4;
52
0
        M32( d+s*3 ) = v4;
53
0
    }
54
0
    else if( w == 8 )
55
0
    {
56
0
        if( WORD_SIZE == 8 )
57
0
        {
58
0
            M64( d+s*0 ) = v8;
59
0
            if( h == 1 ) return;
60
0
            M64( d+s*1 ) = v8;
61
0
            if( h == 2 ) return;
62
0
            M64( d+s*2 ) = v8;
63
0
            M64( d+s*3 ) = v8;
64
0
        }
65
0
        else
66
0
        {
67
0
            M32( d+s*0+0 ) = v4;
68
0
            M32( d+s*0+4 ) = v4;
69
0
            if( h == 1 ) return;
70
0
            M32( d+s*1+0 ) = v4;
71
0
            M32( d+s*1+4 ) = v4;
72
0
            if( h == 2 ) return;
73
0
            M32( d+s*2+0 ) = v4;
74
0
            M32( d+s*2+4 ) = v4;
75
0
            M32( d+s*3+0 ) = v4;
76
0
            M32( d+s*3+4 ) = v4;
77
0
        }
78
0
    }
79
0
    else if( w == 16 )
80
0
    {
81
        /* height 1, width 16 doesn't occur */
82
0
        assert( h != 1 );
83
0
#if HAVE_VECTOREXT && defined(__SSE__)
84
0
        v4si v16 = {v,v,v,v};
85
86
0
        M128( d+s*0+0 ) = (__m128)v16;
87
0
        M128( d+s*1+0 ) = (__m128)v16;
88
0
        if( h == 2 ) return;
89
0
        M128( d+s*2+0 ) = (__m128)v16;
90
0
        M128( d+s*3+0 ) = (__m128)v16;
91
#else
92
        if( WORD_SIZE == 8 )
93
        {
94
            do
95
            {
96
                M64( d+s*0+0 ) = v8;
97
                M64( d+s*0+8 ) = v8;
98
                M64( d+s*1+0 ) = v8;
99
                M64( d+s*1+8 ) = v8;
100
                h -= 2;
101
                d += s*2;
102
            } while( h );
103
        }
104
        else
105
        {
106
            do
107
            {
108
                M32( d+ 0 ) = v4;
109
                M32( d+ 4 ) = v4;
110
                M32( d+ 8 ) = v4;
111
                M32( d+12 ) = v4;
112
                d += s;
113
            } while( --h );
114
        }
115
#endif
116
0
    }
117
0
    else
118
0
        assert(0);
119
0
}
Unexecuted instantiation: bitstream.c:x264_macroblock_cache_rect
Unexecuted instantiation: encoder.c:x264_macroblock_cache_rect
Unexecuted instantiation: lookahead.c:x264_macroblock_cache_rect
Unexecuted instantiation: threadpool.c:x264_macroblock_cache_rect
Unexecuted instantiation: mc.c:x264_macroblock_cache_rect
Unexecuted instantiation: predict.c:x264_macroblock_cache_rect
Unexecuted instantiation: pixel.c:x264_macroblock_cache_rect
Unexecuted instantiation: macroblock.c:x264_macroblock_cache_rect
Unexecuted instantiation: frame.c:x264_macroblock_cache_rect
Unexecuted instantiation: dct.c:x264_macroblock_cache_rect
Unexecuted instantiation: cabac.c:x264_macroblock_cache_rect
Unexecuted instantiation: common.c:x264_macroblock_cache_rect
Unexecuted instantiation: set.c:x264_macroblock_cache_rect
Unexecuted instantiation: quant.c:x264_macroblock_cache_rect
Unexecuted instantiation: deblock.c:x264_macroblock_cache_rect
Unexecuted instantiation: vlc.c:x264_macroblock_cache_rect
Unexecuted instantiation: mvpred.c:x264_macroblock_cache_rect
Unexecuted instantiation: analyse.c:x264_macroblock_cache_rect
Unexecuted instantiation: me.c:x264_macroblock_cache_rect
Unexecuted instantiation: ratecontrol.c:x264_macroblock_cache_rect
Unexecuted instantiation: cavlc.c:x264_macroblock_cache_rect
Unexecuted instantiation: rectangle.c:x264_macroblock_cache_rect
120
121
0
#define x264_cache_mv_func_table x264_template(cache_mv_func_table)
122
extern void (*x264_cache_mv_func_table[10])(void *, uint32_t);
123
0
#define x264_cache_mvd_func_table x264_template(cache_mvd_func_table)
124
extern void (*x264_cache_mvd_func_table[10])(void *, uint32_t);
125
0
#define x264_cache_ref_func_table x264_template(cache_ref_func_table)
126
extern void (*x264_cache_ref_func_table[10])(void *, uint32_t);
127
128
0
#define x264_macroblock_cache_mv_ptr( a, x, y, w, h, l, mv ) x264_macroblock_cache_mv( a, x, y, w, h, l, M32( mv ) )
129
static ALWAYS_INLINE void x264_macroblock_cache_mv( x264_t *h, int x, int y, int width, int height, int i_list, uint32_t mv )
130
0
{
131
0
    void *mv_cache = &h->mb.cache.mv[i_list][X264_SCAN8_0+x+8*y];
132
0
    if( x264_nonconstant_p( width ) || x264_nonconstant_p( height ) )
133
0
        x264_cache_mv_func_table[width + (height<<1)-3]( mv_cache, mv );
134
0
    else
135
0
        x264_macroblock_cache_rect( mv_cache, width*4, height, 4, mv );
136
0
}
Unexecuted instantiation: bitstream.c:x264_macroblock_cache_mv
Unexecuted instantiation: encoder.c:x264_macroblock_cache_mv
Unexecuted instantiation: lookahead.c:x264_macroblock_cache_mv
Unexecuted instantiation: threadpool.c:x264_macroblock_cache_mv
Unexecuted instantiation: mc.c:x264_macroblock_cache_mv
Unexecuted instantiation: predict.c:x264_macroblock_cache_mv
Unexecuted instantiation: pixel.c:x264_macroblock_cache_mv
Unexecuted instantiation: macroblock.c:x264_macroblock_cache_mv
Unexecuted instantiation: frame.c:x264_macroblock_cache_mv
Unexecuted instantiation: dct.c:x264_macroblock_cache_mv
Unexecuted instantiation: cabac.c:x264_macroblock_cache_mv
Unexecuted instantiation: common.c:x264_macroblock_cache_mv
Unexecuted instantiation: set.c:x264_macroblock_cache_mv
Unexecuted instantiation: quant.c:x264_macroblock_cache_mv
Unexecuted instantiation: deblock.c:x264_macroblock_cache_mv
Unexecuted instantiation: vlc.c:x264_macroblock_cache_mv
Unexecuted instantiation: mvpred.c:x264_macroblock_cache_mv
Unexecuted instantiation: analyse.c:x264_macroblock_cache_mv
Unexecuted instantiation: me.c:x264_macroblock_cache_mv
Unexecuted instantiation: ratecontrol.c:x264_macroblock_cache_mv
Unexecuted instantiation: cavlc.c:x264_macroblock_cache_mv
Unexecuted instantiation: rectangle.c:x264_macroblock_cache_mv
137
static ALWAYS_INLINE void x264_macroblock_cache_mvd( x264_t *h, int x, int y, int width, int height, int i_list, uint16_t mvd )
138
0
{
139
0
    void *mvd_cache = &h->mb.cache.mvd[i_list][X264_SCAN8_0+x+8*y];
140
0
    if( x264_nonconstant_p( width ) || x264_nonconstant_p( height ) )
141
0
        x264_cache_mvd_func_table[width + (height<<1)-3]( mvd_cache, mvd );
142
0
    else
143
0
        x264_macroblock_cache_rect( mvd_cache, width*2, height, 2, mvd );
144
0
}
Unexecuted instantiation: bitstream.c:x264_macroblock_cache_mvd
Unexecuted instantiation: encoder.c:x264_macroblock_cache_mvd
Unexecuted instantiation: lookahead.c:x264_macroblock_cache_mvd
Unexecuted instantiation: threadpool.c:x264_macroblock_cache_mvd
Unexecuted instantiation: mc.c:x264_macroblock_cache_mvd
Unexecuted instantiation: predict.c:x264_macroblock_cache_mvd
Unexecuted instantiation: pixel.c:x264_macroblock_cache_mvd
Unexecuted instantiation: macroblock.c:x264_macroblock_cache_mvd
Unexecuted instantiation: frame.c:x264_macroblock_cache_mvd
Unexecuted instantiation: dct.c:x264_macroblock_cache_mvd
Unexecuted instantiation: cabac.c:x264_macroblock_cache_mvd
Unexecuted instantiation: common.c:x264_macroblock_cache_mvd
Unexecuted instantiation: set.c:x264_macroblock_cache_mvd
Unexecuted instantiation: quant.c:x264_macroblock_cache_mvd
Unexecuted instantiation: deblock.c:x264_macroblock_cache_mvd
Unexecuted instantiation: vlc.c:x264_macroblock_cache_mvd
Unexecuted instantiation: mvpred.c:x264_macroblock_cache_mvd
Unexecuted instantiation: analyse.c:x264_macroblock_cache_mvd
Unexecuted instantiation: me.c:x264_macroblock_cache_mvd
Unexecuted instantiation: ratecontrol.c:x264_macroblock_cache_mvd
Unexecuted instantiation: cavlc.c:x264_macroblock_cache_mvd
Unexecuted instantiation: rectangle.c:x264_macroblock_cache_mvd
145
static ALWAYS_INLINE void x264_macroblock_cache_ref( x264_t *h, int x, int y, int width, int height, int i_list, int8_t ref )
146
0
{
147
0
    void *ref_cache = &h->mb.cache.ref[i_list][X264_SCAN8_0+x+8*y];
148
0
    if( x264_nonconstant_p( width ) || x264_nonconstant_p( height ) )
149
0
        x264_cache_ref_func_table[width + (height<<1)-3]( ref_cache, (uint8_t)ref );
150
0
    else
151
0
        x264_macroblock_cache_rect( ref_cache, width, height, 1, (uint8_t)ref );
152
0
}
Unexecuted instantiation: bitstream.c:x264_macroblock_cache_ref
Unexecuted instantiation: encoder.c:x264_macroblock_cache_ref
Unexecuted instantiation: lookahead.c:x264_macroblock_cache_ref
Unexecuted instantiation: threadpool.c:x264_macroblock_cache_ref
Unexecuted instantiation: mc.c:x264_macroblock_cache_ref
Unexecuted instantiation: predict.c:x264_macroblock_cache_ref
Unexecuted instantiation: pixel.c:x264_macroblock_cache_ref
Unexecuted instantiation: macroblock.c:x264_macroblock_cache_ref
Unexecuted instantiation: frame.c:x264_macroblock_cache_ref
Unexecuted instantiation: dct.c:x264_macroblock_cache_ref
Unexecuted instantiation: cabac.c:x264_macroblock_cache_ref
Unexecuted instantiation: common.c:x264_macroblock_cache_ref
Unexecuted instantiation: set.c:x264_macroblock_cache_ref
Unexecuted instantiation: quant.c:x264_macroblock_cache_ref
Unexecuted instantiation: deblock.c:x264_macroblock_cache_ref
Unexecuted instantiation: vlc.c:x264_macroblock_cache_ref
Unexecuted instantiation: mvpred.c:x264_macroblock_cache_ref
Unexecuted instantiation: analyse.c:x264_macroblock_cache_ref
Unexecuted instantiation: me.c:x264_macroblock_cache_ref
Unexecuted instantiation: ratecontrol.c:x264_macroblock_cache_ref
Unexecuted instantiation: cavlc.c:x264_macroblock_cache_ref
Unexecuted instantiation: rectangle.c:x264_macroblock_cache_ref
153
static ALWAYS_INLINE void x264_macroblock_cache_skip( x264_t *h, int x, int y, int width, int height, int b_skip )
154
0
{
155
0
    x264_macroblock_cache_rect( &h->mb.cache.skip[X264_SCAN8_0+x+8*y], width, height, 1, b_skip );
156
0
}
Unexecuted instantiation: bitstream.c:x264_macroblock_cache_skip
Unexecuted instantiation: encoder.c:x264_macroblock_cache_skip
Unexecuted instantiation: lookahead.c:x264_macroblock_cache_skip
Unexecuted instantiation: threadpool.c:x264_macroblock_cache_skip
Unexecuted instantiation: mc.c:x264_macroblock_cache_skip
Unexecuted instantiation: predict.c:x264_macroblock_cache_skip
Unexecuted instantiation: pixel.c:x264_macroblock_cache_skip
Unexecuted instantiation: macroblock.c:x264_macroblock_cache_skip
Unexecuted instantiation: frame.c:x264_macroblock_cache_skip
Unexecuted instantiation: dct.c:x264_macroblock_cache_skip
Unexecuted instantiation: cabac.c:x264_macroblock_cache_skip
Unexecuted instantiation: common.c:x264_macroblock_cache_skip
Unexecuted instantiation: set.c:x264_macroblock_cache_skip
Unexecuted instantiation: quant.c:x264_macroblock_cache_skip
Unexecuted instantiation: deblock.c:x264_macroblock_cache_skip
Unexecuted instantiation: vlc.c:x264_macroblock_cache_skip
Unexecuted instantiation: mvpred.c:x264_macroblock_cache_skip
Unexecuted instantiation: analyse.c:x264_macroblock_cache_skip
Unexecuted instantiation: me.c:x264_macroblock_cache_skip
Unexecuted instantiation: ratecontrol.c:x264_macroblock_cache_skip
Unexecuted instantiation: cavlc.c:x264_macroblock_cache_skip
Unexecuted instantiation: rectangle.c:x264_macroblock_cache_skip
157
static ALWAYS_INLINE void x264_macroblock_cache_intra8x8_pred( x264_t *h, int x, int y, int i_mode )
158
0
{
159
0
    x264_macroblock_cache_rect( &h->mb.cache.intra4x4_pred_mode[X264_SCAN8_0+x+8*y], 2, 2, 1, i_mode );
160
0
}
Unexecuted instantiation: bitstream.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: encoder.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: lookahead.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: threadpool.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: mc.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: predict.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: pixel.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: macroblock.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: frame.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: dct.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: cabac.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: common.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: set.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: quant.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: deblock.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: vlc.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: mvpred.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: analyse.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: me.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: ratecontrol.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: cavlc.c:x264_macroblock_cache_intra8x8_pred
Unexecuted instantiation: rectangle.c:x264_macroblock_cache_intra8x8_pred