annotate ppc/asm.S @ 12253:112b3a0db187 libavcodec

Decode DCT tokens by branching to a different code path for each branch on the huffman tree, instead of traversing the tree in a while loop. Based on the similar optimization in libvpx's detokenize.c 10% faster at normal bitrates, and 30% faster for high-bitrate intra-only
author conrad
date Fri, 23 Jul 2010 21:46:17 +0000
parents 1532477cc30f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12045
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
1 /*
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
2 * Copyright (c) 2009 Loren Merritt
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
3 *
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
4 * This file is part of FFmpeg.
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
5 *
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
10 *
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
14 * Lesser General Public License for more details.
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
15 *
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
19 */
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
20
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
21 #include "config.h"
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
22
12087
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
23 #define GLUE(a, b) a ## b
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
24 #define JOIN(a, b) GLUE(a, b)
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
25 #define X(s) JOIN(EXTERN_ASM, s)
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
26
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
27 #if ARCH_PPC64
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
28
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
29 #define PTR .quad
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
30 #define lp ld
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
31 #define lpx ldx
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
32 #define stp std
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
33 #define stpu stdu
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
34 #define PS 8
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
35 #define L(s) JOIN(., s)
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
36
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
37 .macro extfunc name
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
38 .global X(\name)
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
39 .section .opd, "aw"
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
40 X(\name):
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
41 .quad L(\name), .TOC.@tocbase, 0
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
42 .previous
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
43 .type X(\name), STT_FUNC
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
44 L(\name):
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
45 .endm
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
46
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
47 .macro movrel rd, sym
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
48 ld \rd, \sym@got(r2)
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
49 .endm
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
50
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
51 #else /* ARCH_PPC64 */
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
52
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
53 #define PTR .int
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
54 #define lp lwz
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
55 #define lpx lwzx
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
56 #define stp stw
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
57 #define stpu stwu
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
58 #define PS 4
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
59 #define L(s) s
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
60
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
61 .macro extfunc name
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
62 .global X(\name)
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
63 .type X(\name), STT_FUNC
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
64 X(\name):
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
65 \name:
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
66 .endm
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
67
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
68 .macro movrel rd, sym
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
69 #if CONFIG_PIC
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
70 lwz \rd, \sym@got(r2)
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
71 #else
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
72 lis \rd, \sym@ha
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
73 la \rd, \sym@l(\rd)
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
74 #endif
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
75 .endm
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
76
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
77 #endif /* ARCH_PPC64 */
1532477cc30f PPC: add some asm support macros
mru
parents: 12045
diff changeset
78
12045
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
79 #if HAVE_IBM_ASM
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
80
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
81 .macro DEFINE_REG n
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
82 .equiv r\n, \n
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
83 .equiv f\n, \n
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
84 .equiv v\n, \n
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
85 .endm
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
86
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
87 DEFINE_REG 0
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
88 DEFINE_REG 1
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
89 DEFINE_REG 2
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
90 DEFINE_REG 3
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
91 DEFINE_REG 4
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
92 DEFINE_REG 5
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
93 DEFINE_REG 6
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
94 DEFINE_REG 7
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
95 DEFINE_REG 8
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
96 DEFINE_REG 9
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
97 DEFINE_REG 10
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
98 DEFINE_REG 11
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
99 DEFINE_REG 12
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
100 DEFINE_REG 13
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
101 DEFINE_REG 14
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
102 DEFINE_REG 15
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
103 DEFINE_REG 16
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
104 DEFINE_REG 17
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
105 DEFINE_REG 18
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
106 DEFINE_REG 19
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
107 DEFINE_REG 20
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
108 DEFINE_REG 21
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
109 DEFINE_REG 22
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
110 DEFINE_REG 23
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
111 DEFINE_REG 24
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
112 DEFINE_REG 25
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
113 DEFINE_REG 26
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
114 DEFINE_REG 27
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
115 DEFINE_REG 28
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
116 DEFINE_REG 29
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
117 DEFINE_REG 30
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
118 DEFINE_REG 31
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
119
f399ea693f46 Check whether IBM or Apple PPC assembler syntax is used
mru
parents:
diff changeset
120 #endif /* HAVE_IBM_ASM */