annotate x86/vp56_arith.h @ 12503:3fff0806404a libavcodec

Support deinterlacing of YUVJ420P.
author banan
date Mon, 20 Sep 2010 11:34:27 +0000
parents d0b25641338b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12256
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
1 /**
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
2 * VP5 and VP6 compatible video decoder (arith decoder)
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
3 *
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
4 * Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
5 * Copyright (C) 2010 Eli Friedman
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
6 *
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
7 * This file is part of FFmpeg.
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
8 *
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
9 * FFmpeg is free software; you can redistribute it and/or
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
10 * modify it under the terms of the GNU Lesser General Public
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
11 * License as published by the Free Software Foundation; either
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
12 * version 2.1 of the License, or (at your option) any later version.
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
13 *
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
14 * FFmpeg is distributed in the hope that it will be useful,
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
17 * Lesser General Public License for more details.
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
18 *
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
19 * You should have received a copy of the GNU Lesser General Public
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
20 * License along with FFmpeg; if not, write to the Free Software
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
22 */
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
23
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
24 #ifndef AVCODEC_X86_VP56_ARITH_H
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
25 #define AVCODEC_X86_VP56_ARITH_H
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
26
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
27 #if HAVE_FAST_CMOV
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
28 #define vp56_rac_get_prob vp56_rac_get_prob
12353
eba266986930 VP5/6/8: add one inline missed in r24677
darkshikari
parents: 12256
diff changeset
29 static av_always_inline int vp56_rac_get_prob(VP56RangeCoder *c, uint8_t prob)
12256
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
30 {
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
31 unsigned int code_word = vp56_rac_renorm(c);
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
32 unsigned int high = c->high;
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
33 unsigned int low = 1 + (((high - 1) * prob) >> 8);
12385
d0b25641338b VP5/6/8: ~7% faster arithmetic decoding
darkshikari
parents: 12353
diff changeset
34 unsigned int low_shift = low << 16;
12256
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
35 int bit = 0;
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
36
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
37 __asm__(
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
38 "subl %4, %1 \n\t"
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
39 "subl %3, %2 \n\t"
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
40 "leal (%2, %3), %3 \n\t"
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
41 "setae %b0 \n\t"
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
42 "cmovb %4, %1 \n\t"
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
43 "cmovb %3, %2 \n\t"
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
44 : "+q"(bit), "+r"(high), "+r"(code_word), "+r"(low_shift)
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
45 : "r"(low)
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
46 );
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
47
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
48 c->high = high;
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
49 c->code_word = code_word;
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
50 return bit;
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
51 }
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
52 #endif
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
53
6e6c92d36c4b Inline asm for VP56 arith coder
conrad
parents:
diff changeset
54 #endif /* AVCODEC_X86_VP56_ARITH_H */