annotate i386/h264_i386.h @ 6728:56c5bbd0996f libavcodec

split out some decoder context params to a shared macro
author jbr
date Fri, 02 May 2008 21:33:14 +0000
parents e3a1ff3099d6
children 33896780c612
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1287
michaelni
parents:
diff changeset
1 /*
michaelni
parents:
diff changeset
2 * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
michaelni
parents:
diff changeset
3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
michaelni
parents:
diff changeset
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
michaelni
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
michaelni
parents:
diff changeset
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
michaelni
parents:
diff changeset
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
michaelni
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
michaelni
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
michaelni
parents:
diff changeset
15 * Lesser General Public License for more details.
michaelni
parents:
diff changeset
16 *
michaelni
parents:
diff changeset
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
michaelni
parents:
diff changeset
20 */
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2736
diff changeset
21
1287
michaelni
parents:
diff changeset
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
michaelni
parents:
diff changeset
27 */
michaelni
parents:
diff changeset
28
6604
e226f34ca284 Redo r12838, this time using svn copy to create h264_i386.h from cabac.h.
heydowns
parents: 6603
diff changeset
29 #ifndef FFMPEG_H264_I386_H
e226f34ca284 Redo r12838, this time using svn copy to create h264_i386.h from cabac.h.
heydowns
parents: 6603
diff changeset
30 #define FFMPEG_H264_I386_H
1287
michaelni
parents:
diff changeset
31
michaelni
parents:
diff changeset
32
6604
e226f34ca284 Redo r12838, this time using svn copy to create h264_i386.h from cabac.h.
heydowns
parents: 6603
diff changeset
33 #include "cabac.h"
2323
1c39d9786efd optimization
michael
parents: 2116
diff changeset
34
6617
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
35 //FIXME use some macros to avoid duplicating get_cabac (cannot be done yet
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
36 //as that would make optimization work hard)
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
37 #if defined(ARCH_X86) && defined(HAVE_7REGS) && \
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
38 defined(HAVE_EBX_AVAILABLE) && \
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
39 !defined(BROKEN_RELOCATIONS)
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
40 static int decode_significance_x86(CABACContext *c, int max_coeff,
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
41 uint8_t *significant_coeff_ctx_base,
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
42 int *index){
6603
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
43 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
44 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
45 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
46 int coeff_count;
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
47 asm volatile(
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
48 "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
49 "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
50
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
51 "2: \n\t"
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
52
6617
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
53 BRANCHLESS_GET_CABAC("%%edx", "%3", "(%1)", "%%ebx",
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
54 "%%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
55
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
56 "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
57 " jz 3f \n\t"
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
58
6617
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
59 BRANCHLESS_GET_CABAC("%%edx", "%3", "61(%1)", "%%ebx",
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
60 "%%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
61
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
62 "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
63 "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
64 "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
65 "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
66
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
67 "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
68 " jnz 4f \n\t"
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
69
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
70 "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
71 "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
72
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
73 "3: \n\t"
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
74 "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
75 "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
76 " jb 2b \n\t"
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
77 "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
78 "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
79 "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
80 "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
81 "4: \n\t"
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
82 "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
83 "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
84
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
85 "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
86 "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
87 :"=&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
88 :"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
89 : "%"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
90 );
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
91 return coeff_count;
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
92 }
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
93
6617
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
94 static int decode_significance_8x8_x86(CABACContext *c,
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
95 uint8_t *significant_coeff_ctx_base,
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
96 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
97 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
98 int coeff_count;
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
99 long last=0;
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
100 asm volatile(
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
101 "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
102 "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
103
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
104 "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
105 "2: \n\t"
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
106
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
107 "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
108 "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
109 "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
110
6617
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
111 BRANCHLESS_GET_CABAC("%%edx", "%3", "(%%"REG_D")", "%%ebx",
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
112 "%%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
113
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
114 "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
115 "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
116 " jz 3f \n\t"
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
117
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
118 "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
119 "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
120
6617
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
121 BRANCHLESS_GET_CABAC("%%edx", "%3", "15(%%"REG_D")", "%%ebx",
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
122 "%%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
123
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
124 "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
125 "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
126 "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
127
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
128 "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
129 " jnz 4f \n\t"
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
130
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
131 "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
132 "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
133
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
134 "3: \n\t"
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
135 "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
136 "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
137 "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
138 " jb 2b \n\t"
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
139 "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
140 "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
141 "4: \n\t"
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
142 "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
143 "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
144
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
145 "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
146 "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
147 :"=&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
148 :"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
149 : "%"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
150 );
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
151 return coeff_count;
b560e57e47ff Revert 12838 to redo it the right way (use svn copy to create new
heydowns
parents: 6599
diff changeset
152 }
6617
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
153 #endif /* defined(ARCH_X86) && defined(HAVE_7REGS) && */
e3a1ff3099d6 Cosmetics:
heydowns
parents: 6604
diff changeset
154 /* 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
155
6604
e226f34ca284 Redo r12838, this time using svn copy to create h264_i386.h from cabac.h.
heydowns
parents: 6603
diff changeset
156 #endif /* FFMPEG_H264_I386_H */