Mercurial > libavcodec.hg
annotate i386/h264_i386.h @ 8328:2e654989814e libavcodec
Move documentation of avcodec_register_all() from allcodecs.c to
avcodec.h.
author | stefano |
---|---|
date | Sun, 14 Dec 2008 21:38:03 +0000 |
parents | eebc7209c47f |
children |
rev | line source |
---|---|
1287 | 1 /* |
2 * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder | |
3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> | |
4 * | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3946
diff
changeset
|
5 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3946
diff
changeset
|
6 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3946
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
1287 | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3946
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
1287 | 11 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3946
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
1287 | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Lesser General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Lesser General Public | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3946
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
2967
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
1287 | 20 */ |
2967 | 21 |
1287 | 22 /** |
6604
e226f34ca284
Redo r12838, this time using svn copy to create h264_i386.h from cabac.h.
heydowns
parents:
6603
diff
changeset
|
23 * @file h264_i386.h |
e226f34ca284
Redo r12838, this time using svn copy to create h264_i386.h from cabac.h.
heydowns
parents:
6603
diff
changeset
|
24 * H.264 / AVC / MPEG4 part10 codec. |
e226f34ca284
Redo r12838, this time using svn copy to create h264_i386.h from cabac.h.
heydowns
parents:
6603
diff
changeset
|
25 * non-MMX i386-specific optimizations for H.264 |
e226f34ca284
Redo r12838, this time using svn copy to create h264_i386.h from cabac.h.
heydowns
parents:
6603
diff
changeset
|
26 * @author Michael Niedermayer <michaelni@gmx.at> |
1287 | 27 */ |
28 | |
7760 | 29 #ifndef AVCODEC_I386_H264_I386_H |
30 #define AVCODEC_I386_H264_I386_H | |
1287 | 31 |
6763 | 32 #include "libavcodec/cabac.h" |
2323 | 33 |
6617 | 34 //FIXME use some macros to avoid duplicating get_cabac (cannot be done yet |
35 //as that would make optimization work hard) | |
36 #if defined(ARCH_X86) && defined(HAVE_7REGS) && \ | |
37 defined(HAVE_EBX_AVAILABLE) && \ | |
38 !defined(BROKEN_RELOCATIONS) | |
39 static int decode_significance_x86(CABACContext *c, int max_coeff, | |
40 uint8_t *significant_coeff_ctx_base, | |
41 int *index){ | |
6603
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
42 void *end= significant_coeff_ctx_base + max_coeff - 1; |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
43 int minusstart= -(int)significant_coeff_ctx_base; |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
44 int minusindex= 4-(int)index; |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
45 int coeff_count; |
8031 | 46 __asm__ volatile( |
6603
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
47 "movl "RANGE "(%3), %%esi \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
48 "movl "LOW "(%3), %%ebx \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
49 |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
50 "2: \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
51 |
6617 | 52 BRANCHLESS_GET_CABAC("%%edx", "%3", "(%1)", "%%ebx", |
53 "%%bx", "%%esi", "%%eax", "%%al") | |
6603
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
54 |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
55 "test $1, %%edx \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
56 " jz 3f \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
57 |
6617 | 58 BRANCHLESS_GET_CABAC("%%edx", "%3", "61(%1)", "%%ebx", |
59 "%%bx", "%%esi", "%%eax", "%%al") | |
6603
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
60 |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
61 "mov %2, %%"REG_a" \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
62 "movl %4, %%ecx \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
63 "add %1, %%"REG_c" \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
64 "movl %%ecx, (%%"REG_a") \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
65 |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
66 "test $1, %%edx \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
67 " jnz 4f \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
68 |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
69 "add $4, %%"REG_a" \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
70 "mov %%"REG_a", %2 \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
71 |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
72 "3: \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
73 "add $1, %1 \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
74 "cmp %5, %1 \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
75 " jb 2b \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
76 "mov %2, %%"REG_a" \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
77 "movl %4, %%ecx \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
78 "add %1, %%"REG_c" \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
79 "movl %%ecx, (%%"REG_a") \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
80 "4: \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
81 "add %6, %%eax \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
82 "shr $2, %%eax \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
83 |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
84 "movl %%esi, "RANGE "(%3) \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
85 "movl %%ebx, "LOW "(%3) \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
86 :"=&a"(coeff_count), "+r"(significant_coeff_ctx_base), "+m"(index) |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
87 :"r"(c), "m"(minusstart), "m"(end), "m"(minusindex) |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
88 : "%"REG_c, "%ebx", "%edx", "%esi", "memory" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
89 ); |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
90 return coeff_count; |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
91 } |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
92 |
6617 | 93 static int decode_significance_8x8_x86(CABACContext *c, |
94 uint8_t *significant_coeff_ctx_base, | |
95 int *index, const uint8_t *sig_off){ | |
6603
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
96 int minusindex= 4-(int)index; |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
97 int coeff_count; |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6617
diff
changeset
|
98 x86_reg last=0; |
8031 | 99 __asm__ volatile( |
6603
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
100 "movl "RANGE "(%3), %%esi \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
101 "movl "LOW "(%3), %%ebx \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
102 |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
103 "mov %1, %%"REG_D" \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
104 "2: \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
105 |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
106 "mov %6, %%"REG_a" \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
107 "movzbl (%%"REG_a", %%"REG_D"), %%edi \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
108 "add %5, %%"REG_D" \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
109 |
6617 | 110 BRANCHLESS_GET_CABAC("%%edx", "%3", "(%%"REG_D")", "%%ebx", |
111 "%%bx", "%%esi", "%%eax", "%%al") | |
6603
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
112 |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
113 "mov %1, %%edi \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
114 "test $1, %%edx \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
115 " jz 3f \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
116 |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
117 "movzbl "MANGLE(last_coeff_flag_offset_8x8)"(%%edi), %%edi\n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
118 "add %5, %%"REG_D" \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
119 |
6617 | 120 BRANCHLESS_GET_CABAC("%%edx", "%3", "15(%%"REG_D")", "%%ebx", |
121 "%%bx", "%%esi", "%%eax", "%%al") | |
6603
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
122 |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
123 "mov %2, %%"REG_a" \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
124 "mov %1, %%edi \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
125 "movl %%edi, (%%"REG_a") \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
126 |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
127 "test $1, %%edx \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
128 " jnz 4f \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
129 |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
130 "add $4, %%"REG_a" \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
131 "mov %%"REG_a", %2 \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
132 |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
133 "3: \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
134 "addl $1, %%edi \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
135 "mov %%edi, %1 \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
136 "cmpl $63, %%edi \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
137 " jb 2b \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
138 "mov %2, %%"REG_a" \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
139 "movl %%edi, (%%"REG_a") \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
140 "4: \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
141 "addl %4, %%eax \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
142 "shr $2, %%eax \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
143 |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
144 "movl %%esi, "RANGE "(%3) \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
145 "movl %%ebx, "LOW "(%3) \n\t" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
146 :"=&a"(coeff_count),"+m"(last), "+m"(index) |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
147 :"r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base), "m"(sig_off) |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
148 : "%"REG_c, "%ebx", "%edx", "%esi", "%"REG_D, "memory" |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
149 ); |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
150 return coeff_count; |
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
151 } |
6617 | 152 #endif /* defined(ARCH_X86) && defined(HAVE_7REGS) && */ |
153 /* defined(HAVE_EBX_AVAILABLE) && !defined(BROKEN_RELOCATIONS) */ | |
6603
b560e57e47ff
Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents:
6599
diff
changeset
|
154 |
7760 | 155 #endif /* AVCODEC_I386_H264_I386_H */ |