FFmpeg
vpx_arith.h
Go to the documentation of this file.
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 #define vpx_rac_get_prob vpx_rac_get_prob
34 {
35  unsigned int code_word = vpx_rac_renorm(c);
36  unsigned int low = 1 + (((c->high - 1) * prob) >> 8);
37  unsigned int low_shift = low << 16;
38  int bit = 0;
39  c->code_word = code_word;
40 
41  __asm__(
42  "subl %4, %1 \n\t"
43  "subl %3, %2 \n\t"
44  "setae %b0 \n\t"
45  "cmovb %4, %1 \n\t"
46  "cmovb %5, %2 \n\t"
47  : "+q"(bit), "+&r"(c->high), "+&r"(c->code_word)
48  : "r"(low_shift), "r"(low), "r"(code_word)
49  );
50 
51  return bit;
52 }
53 #endif
54 
55 #endif /* AVCODEC_X86_VPX_ARITH_H */
VPXRangeCoder
Definition: vpx_rac.h:35
bit
#define bit(string, value)
Definition: cbs_mpeg2.c:56
vpx_rac_renorm
static av_always_inline unsigned int vpx_rac_renorm(VPXRangeCoder *c)
Definition: vpx_rac.h:58
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
asm.h
attributes.h
av_always_inline
#define av_always_inline
Definition: attributes.h:49
__asm__
__asm__(".macro parse_r var r\n\t" "\\var = -1\n\t" _IFC_REG(0) _IFC_REG(1) _IFC_REG(2) _IFC_REG(3) _IFC_REG(4) _IFC_REG(5) _IFC_REG(6) _IFC_REG(7) _IFC_REG(8) _IFC_REG(9) _IFC_REG(10) _IFC_REG(11) _IFC_REG(12) _IFC_REG(13) _IFC_REG(14) _IFC_REG(15) _IFC_REG(16) _IFC_REG(17) _IFC_REG(18) _IFC_REG(19) _IFC_REG(20) _IFC_REG(21) _IFC_REG(22) _IFC_REG(23) _IFC_REG(24) _IFC_REG(25) _IFC_REG(26) _IFC_REG(27) _IFC_REG(28) _IFC_REG(29) _IFC_REG(30) _IFC_REG(31) ".iflt \\var\n\t" ".error \"Unable to parse register name \\r\"\n\t" ".endif\n\t" ".endm")
prob
#define prob(name, subs,...)
Definition: cbs_vp9.c:325
vpx_rac_get_prob
#define vpx_rac_get_prob
Definition: vpx_rac.h:82