Coverage Report

Created: 2024-09-06 07:53

/src/ffmpeg/libavcodec/x86/vpx_arith.h
Line
Count
Source
1
/**
2
 * VP5 and VP6 compatible video decoder (arith decoder)
3
 *
4
 * Copyright (C) 2006  Aurelien Jacobs <aurel@gnuage.org>
5
 * Copyright (C) 2010  Eli Friedman
6
 *
7
 * This file is part of FFmpeg.
8
 *
9
 * FFmpeg is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU Lesser General Public
11
 * License as published by the Free Software Foundation; either
12
 * version 2.1 of the License, or (at your option) any later version.
13
 *
14
 * FFmpeg 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 GNU
17
 * Lesser General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU Lesser General Public
20
 * License along with FFmpeg; if not, write to the Free Software
21
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
 */
23
24
#ifndef AVCODEC_X86_VPX_ARITH_H
25
#define AVCODEC_X86_VPX_ARITH_H
26
27
#include "libavutil/x86/asm.h"
28
29
#if HAVE_INLINE_ASM && HAVE_FAST_CMOV && HAVE_6REGS
30
#include "libavutil/attributes.h"
31
32
2.37G
#define vpx_rac_get_prob vpx_rac_get_prob
33
static av_always_inline int vpx_rac_get_prob(VPXRangeCoder *c, uint8_t prob)
34
2.37G
{
35
2.37G
    unsigned int code_word = vpx_rac_renorm(c);
36
2.37G
    unsigned int low = 1 + (((c->high - 1) * prob) >> 8);
37
2.37G
    unsigned int low_shift = low << 16;
38
2.37G
    int bit = 0;
39
2.37G
    c->code_word = code_word;
40
41
2.37G
    __asm__(
42
2.37G
        "subl  %4, %1      \n\t"
43
2.37G
        "subl  %3, %2      \n\t"
44
2.37G
        "setae %b0         \n\t"
45
2.37G
        "cmovb %4, %1      \n\t"
46
2.37G
        "cmovb %5, %2      \n\t"
47
2.37G
        : "+q"(bit), "+&r"(c->high), "+&r"(c->code_word)
48
2.37G
        : "r"(low_shift), "r"(low), "r"(code_word)
49
2.37G
    );
50
51
2.37G
    return bit;
52
2.37G
}
vp5.c:vpx_rac_get_prob
Line
Count
Source
34
355M
{
35
355M
    unsigned int code_word = vpx_rac_renorm(c);
36
355M
    unsigned int low = 1 + (((c->high - 1) * prob) >> 8);
37
355M
    unsigned int low_shift = low << 16;
38
355M
    int bit = 0;
39
355M
    c->code_word = code_word;
40
41
355M
    __asm__(
42
355M
        "subl  %4, %1      \n\t"
43
355M
        "subl  %3, %2      \n\t"
44
355M
        "setae %b0         \n\t"
45
355M
        "cmovb %4, %1      \n\t"
46
355M
        "cmovb %5, %2      \n\t"
47
355M
        : "+q"(bit), "+&r"(c->high), "+&r"(c->code_word)
48
355M
        : "r"(low_shift), "r"(low), "r"(code_word)
49
355M
    );
50
51
355M
    return bit;
52
355M
}
Unexecuted instantiation: vp56.c:vpx_rac_get_prob
Unexecuted instantiation: vp56data.c:vpx_rac_get_prob
Unexecuted instantiation: vpx_rac.c:vpx_rac_get_prob
vp6.c:vpx_rac_get_prob
Line
Count
Source
34
708M
{
35
708M
    unsigned int code_word = vpx_rac_renorm(c);
36
708M
    unsigned int low = 1 + (((c->high - 1) * prob) >> 8);
37
708M
    unsigned int low_shift = low << 16;
38
708M
    int bit = 0;
39
708M
    c->code_word = code_word;
40
41
708M
    __asm__(
42
708M
        "subl  %4, %1      \n\t"
43
708M
        "subl  %3, %2      \n\t"
44
708M
        "setae %b0         \n\t"
45
708M
        "cmovb %4, %1      \n\t"
46
708M
        "cmovb %5, %2      \n\t"
47
708M
        : "+q"(bit), "+&r"(c->high), "+&r"(c->code_word)
48
708M
        : "r"(low_shift), "r"(low), "r"(code_word)
49
708M
    );
50
51
708M
    return bit;
52
708M
}
vp9.c:vpx_rac_get_prob
Line
Count
Source
34
25.3M
{
35
25.3M
    unsigned int code_word = vpx_rac_renorm(c);
36
25.3M
    unsigned int low = 1 + (((c->high - 1) * prob) >> 8);
37
25.3M
    unsigned int low_shift = low << 16;
38
25.3M
    int bit = 0;
39
25.3M
    c->code_word = code_word;
40
41
25.3M
    __asm__(
42
25.3M
        "subl  %4, %1      \n\t"
43
25.3M
        "subl  %3, %2      \n\t"
44
25.3M
        "setae %b0         \n\t"
45
25.3M
        "cmovb %4, %1      \n\t"
46
25.3M
        "cmovb %5, %2      \n\t"
47
25.3M
        : "+q"(bit), "+&r"(c->high), "+&r"(c->code_word)
48
25.3M
        : "r"(low_shift), "r"(low), "r"(code_word)
49
25.3M
    );
50
51
25.3M
    return bit;
52
25.3M
}
vp9block.c:vpx_rac_get_prob
Line
Count
Source
34
136M
{
35
136M
    unsigned int code_word = vpx_rac_renorm(c);
36
136M
    unsigned int low = 1 + (((c->high - 1) * prob) >> 8);
37
136M
    unsigned int low_shift = low << 16;
38
136M
    int bit = 0;
39
136M
    c->code_word = code_word;
40
41
136M
    __asm__(
42
136M
        "subl  %4, %1      \n\t"
43
136M
        "subl  %3, %2      \n\t"
44
136M
        "setae %b0         \n\t"
45
136M
        "cmovb %4, %1      \n\t"
46
136M
        "cmovb %5, %2      \n\t"
47
136M
        : "+q"(bit), "+&r"(c->high), "+&r"(c->code_word)
48
136M
        : "r"(low_shift), "r"(low), "r"(code_word)
49
136M
    );
50
51
136M
    return bit;
52
136M
}
Unexecuted instantiation: vp9data.c:vpx_rac_get_prob
Unexecuted instantiation: vp9lpf.c:vpx_rac_get_prob
vp9mvs.c:vpx_rac_get_prob
Line
Count
Source
34
203M
{
35
203M
    unsigned int code_word = vpx_rac_renorm(c);
36
203M
    unsigned int low = 1 + (((c->high - 1) * prob) >> 8);
37
203M
    unsigned int low_shift = low << 16;
38
203M
    int bit = 0;
39
203M
    c->code_word = code_word;
40
41
203M
    __asm__(
42
203M
        "subl  %4, %1      \n\t"
43
203M
        "subl  %3, %2      \n\t"
44
203M
        "setae %b0         \n\t"
45
203M
        "cmovb %4, %1      \n\t"
46
203M
        "cmovb %5, %2      \n\t"
47
203M
        : "+q"(bit), "+&r"(c->high), "+&r"(c->code_word)
48
203M
        : "r"(low_shift), "r"(low), "r"(code_word)
49
203M
    );
50
51
203M
    return bit;
52
203M
}
Unexecuted instantiation: vp9prob.c:vpx_rac_get_prob
Unexecuted instantiation: vp9recon.c:vpx_rac_get_prob
vp8.c:vpx_rac_get_prob
Line
Count
Source
34
943M
{
35
943M
    unsigned int code_word = vpx_rac_renorm(c);
36
943M
    unsigned int low = 1 + (((c->high - 1) * prob) >> 8);
37
943M
    unsigned int low_shift = low << 16;
38
943M
    int bit = 0;
39
943M
    c->code_word = code_word;
40
41
943M
    __asm__(
42
943M
        "subl  %4, %1      \n\t"
43
943M
        "subl  %3, %2      \n\t"
44
943M
        "setae %b0         \n\t"
45
943M
        "cmovb %4, %1      \n\t"
46
943M
        "cmovb %5, %2      \n\t"
47
943M
        : "+q"(bit), "+&r"(c->high), "+&r"(c->code_word)
48
943M
        : "r"(low_shift), "r"(low), "r"(code_word)
49
943M
    );
50
51
943M
    return bit;
52
943M
}
Unexecuted instantiation: webp.c:vpx_rac_get_prob
53
#endif
54
55
#endif /* AVCODEC_X86_VPX_ARITH_H */