Mercurial > libavcodec.hg
annotate h264pred.c @ 7950:9d2399045441 libavcodec
Check allocations on init.
author | benoit |
---|---|
date | Tue, 30 Sep 2008 09:54:13 +0000 |
parents | c4de4b187b4f |
children | 585572f14e2c |
rev | line source |
---|---|
1168 | 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:
3927
diff
changeset
|
5 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3927
diff
changeset
|
6 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3927
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
1168 | 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:
3927
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
1168 | 11 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3927
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
1168 | 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:
3927
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:
3029
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
1168 | 20 */ |
2967 | 21 |
1168 | 22 /** |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
23 * @file h264pred.c |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
24 * H.264 / AVC / MPEG4 part10 prediction functions. |
1168 | 25 * @author Michael Niedermayer <michaelni@gmx.at> |
26 */ | |
27 | |
28 #include "avcodec.h" | |
29 #include "mpegvideo.h" | |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
30 #include "h264pred.h" |
1168 | 31 |
32 static void pred4x4_vertical_c(uint8_t *src, uint8_t *topright, int stride){ | |
33 const uint32_t a= ((uint32_t*)(src-stride))[0]; | |
34 ((uint32_t*)(src+0*stride))[0]= a; | |
35 ((uint32_t*)(src+1*stride))[0]= a; | |
36 ((uint32_t*)(src+2*stride))[0]= a; | |
37 ((uint32_t*)(src+3*stride))[0]= a; | |
38 } | |
39 | |
40 static void pred4x4_horizontal_c(uint8_t *src, uint8_t *topright, int stride){ | |
41 ((uint32_t*)(src+0*stride))[0]= src[-1+0*stride]*0x01010101; | |
42 ((uint32_t*)(src+1*stride))[0]= src[-1+1*stride]*0x01010101; | |
43 ((uint32_t*)(src+2*stride))[0]= src[-1+2*stride]*0x01010101; | |
44 ((uint32_t*)(src+3*stride))[0]= src[-1+3*stride]*0x01010101; | |
45 } | |
46 | |
47 static void pred4x4_dc_c(uint8_t *src, uint8_t *topright, int stride){ | |
48 const int dc= ( src[-stride] + src[1-stride] + src[2-stride] + src[3-stride] | |
49 + src[-1+0*stride] + src[-1+1*stride] + src[-1+2*stride] + src[-1+3*stride] + 4) >>3; | |
2967 | 50 |
51 ((uint32_t*)(src+0*stride))[0]= | |
52 ((uint32_t*)(src+1*stride))[0]= | |
53 ((uint32_t*)(src+2*stride))[0]= | |
54 ((uint32_t*)(src+3*stride))[0]= dc* 0x01010101; | |
1168 | 55 } |
56 | |
57 static void pred4x4_left_dc_c(uint8_t *src, uint8_t *topright, int stride){ | |
58 const int dc= ( src[-1+0*stride] + src[-1+1*stride] + src[-1+2*stride] + src[-1+3*stride] + 2) >>2; | |
2967 | 59 |
60 ((uint32_t*)(src+0*stride))[0]= | |
61 ((uint32_t*)(src+1*stride))[0]= | |
62 ((uint32_t*)(src+2*stride))[0]= | |
63 ((uint32_t*)(src+3*stride))[0]= dc* 0x01010101; | |
1168 | 64 } |
65 | |
66 static void pred4x4_top_dc_c(uint8_t *src, uint8_t *topright, int stride){ | |
67 const int dc= ( src[-stride] + src[1-stride] + src[2-stride] + src[3-stride] + 2) >>2; | |
2967 | 68 |
69 ((uint32_t*)(src+0*stride))[0]= | |
70 ((uint32_t*)(src+1*stride))[0]= | |
71 ((uint32_t*)(src+2*stride))[0]= | |
72 ((uint32_t*)(src+3*stride))[0]= dc* 0x01010101; | |
1168 | 73 } |
74 | |
75 static void pred4x4_128_dc_c(uint8_t *src, uint8_t *topright, int stride){ | |
2967 | 76 ((uint32_t*)(src+0*stride))[0]= |
77 ((uint32_t*)(src+1*stride))[0]= | |
78 ((uint32_t*)(src+2*stride))[0]= | |
1168 | 79 ((uint32_t*)(src+3*stride))[0]= 128U*0x01010101U; |
80 } | |
81 | |
82 | |
83 #define LOAD_TOP_RIGHT_EDGE\ | |
5083
ce36118abbbb
rename attribute_unused to av_unused and moves its declaration to common.h
benoit
parents:
5079
diff
changeset
|
84 const int av_unused t4= topright[0];\ |
ce36118abbbb
rename attribute_unused to av_unused and moves its declaration to common.h
benoit
parents:
5079
diff
changeset
|
85 const int av_unused t5= topright[1];\ |
ce36118abbbb
rename attribute_unused to av_unused and moves its declaration to common.h
benoit
parents:
5079
diff
changeset
|
86 const int av_unused t6= topright[2];\ |
ce36118abbbb
rename attribute_unused to av_unused and moves its declaration to common.h
benoit
parents:
5079
diff
changeset
|
87 const int av_unused t7= topright[3];\ |
1168 | 88 |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
89 #define LOAD_DOWN_LEFT_EDGE\ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
90 const int av_unused l4= src[-1+4*stride];\ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
91 const int av_unused l5= src[-1+5*stride];\ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
92 const int av_unused l6= src[-1+6*stride];\ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
93 const int av_unused l7= src[-1+7*stride];\ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
94 |
1168 | 95 #define LOAD_LEFT_EDGE\ |
5083
ce36118abbbb
rename attribute_unused to av_unused and moves its declaration to common.h
benoit
parents:
5079
diff
changeset
|
96 const int av_unused l0= src[-1+0*stride];\ |
ce36118abbbb
rename attribute_unused to av_unused and moves its declaration to common.h
benoit
parents:
5079
diff
changeset
|
97 const int av_unused l1= src[-1+1*stride];\ |
ce36118abbbb
rename attribute_unused to av_unused and moves its declaration to common.h
benoit
parents:
5079
diff
changeset
|
98 const int av_unused l2= src[-1+2*stride];\ |
ce36118abbbb
rename attribute_unused to av_unused and moves its declaration to common.h
benoit
parents:
5079
diff
changeset
|
99 const int av_unused l3= src[-1+3*stride];\ |
1168 | 100 |
101 #define LOAD_TOP_EDGE\ | |
5083
ce36118abbbb
rename attribute_unused to av_unused and moves its declaration to common.h
benoit
parents:
5079
diff
changeset
|
102 const int av_unused t0= src[ 0-1*stride];\ |
ce36118abbbb
rename attribute_unused to av_unused and moves its declaration to common.h
benoit
parents:
5079
diff
changeset
|
103 const int av_unused t1= src[ 1-1*stride];\ |
ce36118abbbb
rename attribute_unused to av_unused and moves its declaration to common.h
benoit
parents:
5079
diff
changeset
|
104 const int av_unused t2= src[ 2-1*stride];\ |
ce36118abbbb
rename attribute_unused to av_unused and moves its declaration to common.h
benoit
parents:
5079
diff
changeset
|
105 const int av_unused t3= src[ 3-1*stride];\ |
1168 | 106 |
107 static void pred4x4_down_right_c(uint8_t *src, uint8_t *topright, int stride){ | |
108 const int lt= src[-1-1*stride]; | |
109 LOAD_TOP_EDGE | |
110 LOAD_LEFT_EDGE | |
111 | |
2967 | 112 src[0+3*stride]=(l3 + 2*l2 + l1 + 2)>>2; |
1168 | 113 src[0+2*stride]= |
2967 | 114 src[1+3*stride]=(l2 + 2*l1 + l0 + 2)>>2; |
1168 | 115 src[0+1*stride]= |
116 src[1+2*stride]= | |
2967 | 117 src[2+3*stride]=(l1 + 2*l0 + lt + 2)>>2; |
1168 | 118 src[0+0*stride]= |
119 src[1+1*stride]= | |
120 src[2+2*stride]= | |
2967 | 121 src[3+3*stride]=(l0 + 2*lt + t0 + 2)>>2; |
1168 | 122 src[1+0*stride]= |
123 src[2+1*stride]= | |
124 src[3+2*stride]=(lt + 2*t0 + t1 + 2)>>2; | |
125 src[2+0*stride]= | |
126 src[3+1*stride]=(t0 + 2*t1 + t2 + 2)>>2; | |
127 src[3+0*stride]=(t1 + 2*t2 + t3 + 2)>>2; | |
1282 | 128 } |
1168 | 129 |
130 static void pred4x4_down_left_c(uint8_t *src, uint8_t *topright, int stride){ | |
2967 | 131 LOAD_TOP_EDGE |
132 LOAD_TOP_RIGHT_EDGE | |
133 // LOAD_LEFT_EDGE | |
1168 | 134 |
135 src[0+0*stride]=(t0 + t2 + 2*t1 + 2)>>2; | |
136 src[1+0*stride]= | |
137 src[0+1*stride]=(t1 + t3 + 2*t2 + 2)>>2; | |
138 src[2+0*stride]= | |
139 src[1+1*stride]= | |
140 src[0+2*stride]=(t2 + t4 + 2*t3 + 2)>>2; | |
141 src[3+0*stride]= | |
142 src[2+1*stride]= | |
143 src[1+2*stride]= | |
144 src[0+3*stride]=(t3 + t5 + 2*t4 + 2)>>2; | |
145 src[3+1*stride]= | |
146 src[2+2*stride]= | |
147 src[1+3*stride]=(t4 + t6 + 2*t5 + 2)>>2; | |
148 src[3+2*stride]= | |
149 src[2+3*stride]=(t5 + t7 + 2*t6 + 2)>>2; | |
150 src[3+3*stride]=(t6 + 3*t7 + 2)>>2; | |
1282 | 151 } |
1168 | 152 |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
153 static void pred4x4_down_left_svq3_c(uint8_t *src, uint8_t *topright, int stride){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
154 LOAD_TOP_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
155 LOAD_LEFT_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
156 const av_unused int unu0= t0; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
157 const av_unused int unu1= l0; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
158 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
159 src[0+0*stride]=(l1 + t1)>>1; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
160 src[1+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
161 src[0+1*stride]=(l2 + t2)>>1; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
162 src[2+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
163 src[1+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
164 src[0+2*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
165 src[3+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
166 src[2+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
167 src[1+2*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
168 src[0+3*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
169 src[3+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
170 src[2+2*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
171 src[1+3*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
172 src[3+2*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
173 src[2+3*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
174 src[3+3*stride]=(l3 + t3)>>1; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
175 } |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
176 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
177 static void pred4x4_down_left_rv40_c(uint8_t *src, uint8_t *topright, int stride){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
178 LOAD_TOP_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
179 LOAD_TOP_RIGHT_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
180 LOAD_LEFT_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
181 LOAD_DOWN_LEFT_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
182 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
183 src[0+0*stride]=(t0 + t2 + 2*t1 + 2 + l0 + l2 + 2*l1 + 2)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
184 src[1+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
185 src[0+1*stride]=(t1 + t3 + 2*t2 + 2 + l1 + l3 + 2*l2 + 2)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
186 src[2+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
187 src[1+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
188 src[0+2*stride]=(t2 + t4 + 2*t3 + 2 + l2 + l4 + 2*l3 + 2)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
189 src[3+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
190 src[2+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
191 src[1+2*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
192 src[0+3*stride]=(t3 + t5 + 2*t4 + 2 + l3 + l5 + 2*l4 + 2)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
193 src[3+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
194 src[2+2*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
195 src[1+3*stride]=(t4 + t6 + 2*t5 + 2 + l4 + l6 + 2*l5 + 2)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
196 src[3+2*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
197 src[2+3*stride]=(t5 + t7 + 2*t6 + 2 + l5 + l7 + 2*l6 + 2)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
198 src[3+3*stride]=(t6 + t7 + 1 + l6 + l7 + 1)>>2; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
199 } |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
200 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
201 static void pred4x4_down_left_rv40_notop_c(uint8_t *src, uint8_t *topright, int stride){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
202 LOAD_LEFT_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
203 LOAD_DOWN_LEFT_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
204 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
205 src[0+0*stride]=(l0 + l2 + 2*l1 + 2)>>2; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
206 src[1+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
207 src[0+1*stride]=(l1 + l3 + 2*l2 + 2)>>2; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
208 src[2+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
209 src[1+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
210 src[0+2*stride]=(l2 + l4 + 2*l3 + 2)>>2; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
211 src[3+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
212 src[2+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
213 src[1+2*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
214 src[0+3*stride]=(l3 + l5 + 2*l4 + 2)>>2; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
215 src[3+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
216 src[2+2*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
217 src[1+3*stride]=(l4 + l6 + 2*l5 + 2)>>2; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
218 src[3+2*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
219 src[2+3*stride]=(l5 + l7 + 2*l6 + 2)>>2; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
220 src[3+3*stride]=(l6 + l7 + 1)>>1; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
221 } |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
222 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
223 static void pred4x4_down_left_rv40_nodown_c(uint8_t *src, uint8_t *topright, int stride){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
224 LOAD_TOP_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
225 LOAD_TOP_RIGHT_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
226 LOAD_LEFT_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
227 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
228 src[0+0*stride]=(t0 + t2 + 2*t1 + 2 + l0 + l2 + 2*l1 + 2)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
229 src[1+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
230 src[0+1*stride]=(t1 + t3 + 2*t2 + 2 + l1 + l3 + 2*l2 + 2)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
231 src[2+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
232 src[1+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
233 src[0+2*stride]=(t2 + t4 + 2*t3 + 2 + l2 + 3*l3 + 2)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
234 src[3+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
235 src[2+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
236 src[1+2*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
237 src[0+3*stride]=(t3 + t5 + 2*t4 + 2 + l3*4 + 2)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
238 src[3+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
239 src[2+2*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
240 src[1+3*stride]=(t4 + t6 + 2*t5 + 2 + l3*4 + 2)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
241 src[3+2*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
242 src[2+3*stride]=(t5 + t7 + 2*t6 + 2 + l3*4 + 2)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
243 src[3+3*stride]=(t6 + t7 + 1 + 2*l3 + 1)>>2; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
244 } |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
245 |
1168 | 246 static void pred4x4_vertical_right_c(uint8_t *src, uint8_t *topright, int stride){ |
247 const int lt= src[-1-1*stride]; | |
2967 | 248 LOAD_TOP_EDGE |
249 LOAD_LEFT_EDGE | |
1168 | 250 |
251 src[0+0*stride]= | |
252 src[1+2*stride]=(lt + t0 + 1)>>1; | |
253 src[1+0*stride]= | |
254 src[2+2*stride]=(t0 + t1 + 1)>>1; | |
255 src[2+0*stride]= | |
256 src[3+2*stride]=(t1 + t2 + 1)>>1; | |
257 src[3+0*stride]=(t2 + t3 + 1)>>1; | |
258 src[0+1*stride]= | |
259 src[1+3*stride]=(l0 + 2*lt + t0 + 2)>>2; | |
260 src[1+1*stride]= | |
261 src[2+3*stride]=(lt + 2*t0 + t1 + 2)>>2; | |
262 src[2+1*stride]= | |
263 src[3+3*stride]=(t0 + 2*t1 + t2 + 2)>>2; | |
264 src[3+1*stride]=(t1 + 2*t2 + t3 + 2)>>2; | |
265 src[0+2*stride]=(lt + 2*l0 + l1 + 2)>>2; | |
266 src[0+3*stride]=(l0 + 2*l1 + l2 + 2)>>2; | |
1282 | 267 } |
1168 | 268 |
269 static void pred4x4_vertical_left_c(uint8_t *src, uint8_t *topright, int stride){ | |
2967 | 270 LOAD_TOP_EDGE |
271 LOAD_TOP_RIGHT_EDGE | |
1168 | 272 |
273 src[0+0*stride]=(t0 + t1 + 1)>>1; | |
274 src[1+0*stride]= | |
275 src[0+2*stride]=(t1 + t2 + 1)>>1; | |
276 src[2+0*stride]= | |
277 src[1+2*stride]=(t2 + t3 + 1)>>1; | |
278 src[3+0*stride]= | |
279 src[2+2*stride]=(t3 + t4+ 1)>>1; | |
280 src[3+2*stride]=(t4 + t5+ 1)>>1; | |
281 src[0+1*stride]=(t0 + 2*t1 + t2 + 2)>>2; | |
282 src[1+1*stride]= | |
283 src[0+3*stride]=(t1 + 2*t2 + t3 + 2)>>2; | |
284 src[2+1*stride]= | |
285 src[1+3*stride]=(t2 + 2*t3 + t4 + 2)>>2; | |
286 src[3+1*stride]= | |
287 src[2+3*stride]=(t3 + 2*t4 + t5 + 2)>>2; | |
288 src[3+3*stride]=(t4 + 2*t5 + t6 + 2)>>2; | |
1282 | 289 } |
1168 | 290 |
6036
ce3b68242317
Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents:
5638
diff
changeset
|
291 static void pred4x4_vertical_left_rv40(uint8_t *src, uint8_t *topright, int stride, |
ce3b68242317
Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents:
5638
diff
changeset
|
292 const int l0, const int l1, const int l2, const int l3, const int l4){ |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
293 LOAD_TOP_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
294 LOAD_TOP_RIGHT_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
295 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
296 src[0+0*stride]=(2*t0 + 2*t1 + l1 + 2*l2 + l3 + 4)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
297 src[1+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
298 src[0+2*stride]=(t1 + t2 + 1)>>1; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
299 src[2+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
300 src[1+2*stride]=(t2 + t3 + 1)>>1; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
301 src[3+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
302 src[2+2*stride]=(t3 + t4+ 1)>>1; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
303 src[3+2*stride]=(t4 + t5+ 1)>>1; |
6036
ce3b68242317
Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents:
5638
diff
changeset
|
304 src[0+1*stride]=(t0 + 2*t1 + t2 + l2 + 2*l3 + l4 + 4)>>3; |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
305 src[1+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
306 src[0+3*stride]=(t1 + 2*t2 + t3 + 2)>>2; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
307 src[2+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
308 src[1+3*stride]=(t2 + 2*t3 + t4 + 2)>>2; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
309 src[3+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
310 src[2+3*stride]=(t3 + 2*t4 + t5 + 2)>>2; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
311 src[3+3*stride]=(t4 + 2*t5 + t6 + 2)>>2; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
312 } |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
313 |
6036
ce3b68242317
Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents:
5638
diff
changeset
|
314 static void pred4x4_vertical_left_rv40_c(uint8_t *src, uint8_t *topright, int stride){ |
ce3b68242317
Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents:
5638
diff
changeset
|
315 LOAD_LEFT_EDGE |
ce3b68242317
Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents:
5638
diff
changeset
|
316 LOAD_DOWN_LEFT_EDGE |
ce3b68242317
Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents:
5638
diff
changeset
|
317 |
ce3b68242317
Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents:
5638
diff
changeset
|
318 pred4x4_vertical_left_rv40(src, topright, stride, l0, l1, l2, l3, l4); |
ce3b68242317
Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents:
5638
diff
changeset
|
319 } |
ce3b68242317
Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents:
5638
diff
changeset
|
320 |
ce3b68242317
Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents:
5638
diff
changeset
|
321 static void pred4x4_vertical_left_rv40_nodown_c(uint8_t *src, uint8_t *topright, int stride){ |
ce3b68242317
Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents:
5638
diff
changeset
|
322 LOAD_LEFT_EDGE |
ce3b68242317
Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents:
5638
diff
changeset
|
323 |
ce3b68242317
Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents:
5638
diff
changeset
|
324 pred4x4_vertical_left_rv40(src, topright, stride, l0, l1, l2, l3, l3); |
ce3b68242317
Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents:
5638
diff
changeset
|
325 } |
ce3b68242317
Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents:
5638
diff
changeset
|
326 |
1168 | 327 static void pred4x4_horizontal_up_c(uint8_t *src, uint8_t *topright, int stride){ |
2967 | 328 LOAD_LEFT_EDGE |
1168 | 329 |
330 src[0+0*stride]=(l0 + l1 + 1)>>1; | |
331 src[1+0*stride]=(l0 + 2*l1 + l2 + 2)>>2; | |
332 src[2+0*stride]= | |
333 src[0+1*stride]=(l1 + l2 + 1)>>1; | |
334 src[3+0*stride]= | |
335 src[1+1*stride]=(l1 + 2*l2 + l3 + 2)>>2; | |
336 src[2+1*stride]= | |
337 src[0+2*stride]=(l2 + l3 + 1)>>1; | |
338 src[3+1*stride]= | |
339 src[1+2*stride]=(l2 + 2*l3 + l3 + 2)>>2; | |
340 src[3+2*stride]= | |
341 src[1+3*stride]= | |
342 src[0+3*stride]= | |
343 src[2+2*stride]= | |
344 src[2+3*stride]= | |
345 src[3+3*stride]=l3; | |
1282 | 346 } |
2967 | 347 |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
348 static void pred4x4_horizontal_up_rv40_c(uint8_t *src, uint8_t *topright, int stride){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
349 LOAD_LEFT_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
350 LOAD_DOWN_LEFT_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
351 LOAD_TOP_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
352 LOAD_TOP_RIGHT_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
353 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
354 src[0+0*stride]=(t1 + 2*t2 + t3 + 2*l0 + 2*l1 + 4)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
355 src[1+0*stride]=(t2 + 2*t3 + t4 + l0 + 2*l1 + l2 + 4)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
356 src[2+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
357 src[0+1*stride]=(t3 + 2*t4 + t5 + 2*l1 + 2*l2 + 4)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
358 src[3+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
359 src[1+1*stride]=(t4 + 2*t5 + t6 + l1 + 2*l2 + l3 + 4)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
360 src[2+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
361 src[0+2*stride]=(t5 + 2*t6 + t7 + 2*l2 + 2*l3 + 4)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
362 src[3+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
363 src[1+2*stride]=(t6 + 3*t7 + l2 + 3*l3 + 4)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
364 src[3+2*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
365 src[1+3*stride]=(l3 + 2*l4 + l5 + 2)>>2; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
366 src[0+3*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
367 src[2+2*stride]=(t6 + t7 + l3 + l4 + 2)>>2; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
368 src[2+3*stride]=(l4 + l5 + 1)>>1; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
369 src[3+3*stride]=(l4 + 2*l5 + l6 + 2)>>2; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
370 } |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
371 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
372 static void pred4x4_horizontal_up_rv40_nodown_c(uint8_t *src, uint8_t *topright, int stride){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
373 LOAD_LEFT_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
374 LOAD_TOP_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
375 LOAD_TOP_RIGHT_EDGE |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
376 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
377 src[0+0*stride]=(t1 + 2*t2 + t3 + 2*l0 + 2*l1 + 4)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
378 src[1+0*stride]=(t2 + 2*t3 + t4 + l0 + 2*l1 + l2 + 4)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
379 src[2+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
380 src[0+1*stride]=(t3 + 2*t4 + t5 + 2*l1 + 2*l2 + 4)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
381 src[3+0*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
382 src[1+1*stride]=(t4 + 2*t5 + t6 + l1 + 2*l2 + l3 + 4)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
383 src[2+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
384 src[0+2*stride]=(t5 + 2*t6 + t7 + 2*l2 + 2*l3 + 4)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
385 src[3+1*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
386 src[1+2*stride]=(t6 + 3*t7 + l2 + 3*l3 + 4)>>3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
387 src[3+2*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
388 src[1+3*stride]=l3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
389 src[0+3*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
390 src[2+2*stride]=(t6 + t7 + 2*l3 + 2)>>2; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
391 src[2+3*stride]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
392 src[3+3*stride]=l3; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
393 } |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
394 |
1168 | 395 static void pred4x4_horizontal_down_c(uint8_t *src, uint8_t *topright, int stride){ |
396 const int lt= src[-1-1*stride]; | |
2967 | 397 LOAD_TOP_EDGE |
398 LOAD_LEFT_EDGE | |
1168 | 399 |
400 src[0+0*stride]= | |
401 src[2+1*stride]=(lt + l0 + 1)>>1; | |
402 src[1+0*stride]= | |
403 src[3+1*stride]=(l0 + 2*lt + t0 + 2)>>2; | |
404 src[2+0*stride]=(lt + 2*t0 + t1 + 2)>>2; | |
405 src[3+0*stride]=(t0 + 2*t1 + t2 + 2)>>2; | |
406 src[0+1*stride]= | |
407 src[2+2*stride]=(l0 + l1 + 1)>>1; | |
408 src[1+1*stride]= | |
409 src[3+2*stride]=(lt + 2*l0 + l1 + 2)>>2; | |
410 src[0+2*stride]= | |
411 src[2+3*stride]=(l1 + l2+ 1)>>1; | |
412 src[1+2*stride]= | |
413 src[3+3*stride]=(l0 + 2*l1 + l2 + 2)>>2; | |
414 src[0+3*stride]=(l2 + l3 + 1)>>1; | |
415 src[1+3*stride]=(l1 + 2*l2 + l3 + 2)>>2; | |
1282 | 416 } |
1168 | 417 |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
418 static void pred16x16_vertical_c(uint8_t *src, int stride){ |
1168 | 419 int i; |
420 const uint32_t a= ((uint32_t*)(src-stride))[0]; | |
421 const uint32_t b= ((uint32_t*)(src-stride))[1]; | |
422 const uint32_t c= ((uint32_t*)(src-stride))[2]; | |
423 const uint32_t d= ((uint32_t*)(src-stride))[3]; | |
2967 | 424 |
1168 | 425 for(i=0; i<16; i++){ |
426 ((uint32_t*)(src+i*stride))[0]= a; | |
427 ((uint32_t*)(src+i*stride))[1]= b; | |
428 ((uint32_t*)(src+i*stride))[2]= c; | |
429 ((uint32_t*)(src+i*stride))[3]= d; | |
430 } | |
431 } | |
432 | |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
433 static void pred16x16_horizontal_c(uint8_t *src, int stride){ |
1168 | 434 int i; |
435 | |
436 for(i=0; i<16; i++){ | |
437 ((uint32_t*)(src+i*stride))[0]= | |
438 ((uint32_t*)(src+i*stride))[1]= | |
439 ((uint32_t*)(src+i*stride))[2]= | |
440 ((uint32_t*)(src+i*stride))[3]= src[-1+i*stride]*0x01010101; | |
441 } | |
442 } | |
443 | |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
444 static void pred16x16_dc_c(uint8_t *src, int stride){ |
1168 | 445 int i, dc=0; |
446 | |
447 for(i=0;i<16; i++){ | |
448 dc+= src[-1+i*stride]; | |
449 } | |
2967 | 450 |
1168 | 451 for(i=0;i<16; i++){ |
452 dc+= src[i-stride]; | |
453 } | |
454 | |
455 dc= 0x01010101*((dc + 16)>>5); | |
456 | |
457 for(i=0; i<16; i++){ | |
458 ((uint32_t*)(src+i*stride))[0]= | |
459 ((uint32_t*)(src+i*stride))[1]= | |
460 ((uint32_t*)(src+i*stride))[2]= | |
461 ((uint32_t*)(src+i*stride))[3]= dc; | |
462 } | |
463 } | |
464 | |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
465 static void pred16x16_left_dc_c(uint8_t *src, int stride){ |
1168 | 466 int i, dc=0; |
467 | |
468 for(i=0;i<16; i++){ | |
469 dc+= src[-1+i*stride]; | |
470 } | |
2967 | 471 |
1168 | 472 dc= 0x01010101*((dc + 8)>>4); |
473 | |
474 for(i=0; i<16; i++){ | |
475 ((uint32_t*)(src+i*stride))[0]= | |
476 ((uint32_t*)(src+i*stride))[1]= | |
477 ((uint32_t*)(src+i*stride))[2]= | |
478 ((uint32_t*)(src+i*stride))[3]= dc; | |
479 } | |
480 } | |
481 | |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
482 static void pred16x16_top_dc_c(uint8_t *src, int stride){ |
1168 | 483 int i, dc=0; |
484 | |
485 for(i=0;i<16; i++){ | |
486 dc+= src[i-stride]; | |
487 } | |
488 dc= 0x01010101*((dc + 8)>>4); | |
489 | |
490 for(i=0; i<16; i++){ | |
491 ((uint32_t*)(src+i*stride))[0]= | |
492 ((uint32_t*)(src+i*stride))[1]= | |
493 ((uint32_t*)(src+i*stride))[2]= | |
494 ((uint32_t*)(src+i*stride))[3]= dc; | |
495 } | |
496 } | |
497 | |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
498 static void pred16x16_128_dc_c(uint8_t *src, int stride){ |
1168 | 499 int i; |
500 | |
501 for(i=0; i<16; i++){ | |
502 ((uint32_t*)(src+i*stride))[0]= | |
503 ((uint32_t*)(src+i*stride))[1]= | |
504 ((uint32_t*)(src+i*stride))[2]= | |
505 ((uint32_t*)(src+i*stride))[3]= 0x01010101U*128U; | |
506 } | |
507 } | |
508 | |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
509 static inline void pred16x16_plane_compat_c(uint8_t *src, int stride, const int svq3, const int rv40){ |
1184
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
510 int i, j, k; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
511 int a; |
4176 | 512 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
1184
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
513 const uint8_t * const src0 = src+7-stride; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
514 const uint8_t *src1 = src+8*stride-1; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
515 const uint8_t *src2 = src1-2*stride; // == src+6*stride-1; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
516 int H = src0[1] - src0[-1]; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
517 int V = src1[0] - src2[ 0]; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
518 for(k=2; k<=8; ++k) { |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
519 src1 += stride; src2 -= stride; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
520 H += k*(src0[k] - src0[-k]); |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
521 V += k*(src1[0] - src2[ 0]); |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
522 } |
1234 | 523 if(svq3){ |
524 H = ( 5*(H/4) ) / 16; | |
525 V = ( 5*(V/4) ) / 16; | |
1330
c05c381a9c47
- fix PLANE_PRED8x8 prediction (H/V are swapped, this is correct!)
tmmm
parents:
1322
diff
changeset
|
526 |
c05c381a9c47
- fix PLANE_PRED8x8 prediction (H/V are swapped, this is correct!)
tmmm
parents:
1322
diff
changeset
|
527 /* required for 100% accuracy */ |
c05c381a9c47
- fix PLANE_PRED8x8 prediction (H/V are swapped, this is correct!)
tmmm
parents:
1322
diff
changeset
|
528 i = H; H = V; V = i; |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
529 }else if(rv40){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
530 H = ( H + (H>>2) ) >> 4; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
531 V = ( V + (V>>2) ) >> 4; |
1234 | 532 }else{ |
533 H = ( 5*H+32 ) >> 6; | |
534 V = ( 5*V+32 ) >> 6; | |
535 } | |
1184
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
536 |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
537 a = 16*(src1[0] + src2[16] + 1) - 7*(V+H); |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
538 for(j=16; j>0; --j) { |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
539 int b = a; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
540 a += V; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
541 for(i=-16; i<0; i+=4) { |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
542 src[16+i] = cm[ (b ) >> 5 ]; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
543 src[17+i] = cm[ (b+ H) >> 5 ]; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
544 src[18+i] = cm[ (b+2*H) >> 5 ]; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
545 src[19+i] = cm[ (b+3*H) >> 5 ]; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
546 b += 4*H; |
1168 | 547 } |
1184
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
548 src += stride; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
549 } |
1168 | 550 } |
551 | |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
552 static void pred16x16_plane_c(uint8_t *src, int stride){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
553 pred16x16_plane_compat_c(src, stride, 0, 0); |
1234 | 554 } |
555 | |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
556 static void pred16x16_plane_svq3_c(uint8_t *src, int stride){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
557 pred16x16_plane_compat_c(src, stride, 1, 0); |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
558 } |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
559 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
560 static void pred16x16_plane_rv40_c(uint8_t *src, int stride){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
561 pred16x16_plane_compat_c(src, stride, 0, 1); |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
562 } |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
563 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
564 static void pred8x8_vertical_c(uint8_t *src, int stride){ |
1168 | 565 int i; |
566 const uint32_t a= ((uint32_t*)(src-stride))[0]; | |
567 const uint32_t b= ((uint32_t*)(src-stride))[1]; | |
2967 | 568 |
1168 | 569 for(i=0; i<8; i++){ |
570 ((uint32_t*)(src+i*stride))[0]= a; | |
571 ((uint32_t*)(src+i*stride))[1]= b; | |
572 } | |
573 } | |
574 | |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
575 static void pred8x8_horizontal_c(uint8_t *src, int stride){ |
1168 | 576 int i; |
577 | |
578 for(i=0; i<8; i++){ | |
579 ((uint32_t*)(src+i*stride))[0]= | |
580 ((uint32_t*)(src+i*stride))[1]= src[-1+i*stride]*0x01010101; | |
581 } | |
582 } | |
583 | |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
584 static void pred8x8_128_dc_c(uint8_t *src, int stride){ |
1168 | 585 int i; |
586 | |
2755 | 587 for(i=0; i<8; i++){ |
2967 | 588 ((uint32_t*)(src+i*stride))[0]= |
1168 | 589 ((uint32_t*)(src+i*stride))[1]= 0x01010101U*128U; |
590 } | |
591 } | |
592 | |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
593 static void pred8x8_left_dc_c(uint8_t *src, int stride){ |
1168 | 594 int i; |
595 int dc0, dc2; | |
596 | |
597 dc0=dc2=0; | |
598 for(i=0;i<4; i++){ | |
599 dc0+= src[-1+i*stride]; | |
600 dc2+= src[-1+(i+4)*stride]; | |
601 } | |
602 dc0= 0x01010101*((dc0 + 2)>>2); | |
603 dc2= 0x01010101*((dc2 + 2)>>2); | |
604 | |
605 for(i=0; i<4; i++){ | |
606 ((uint32_t*)(src+i*stride))[0]= | |
607 ((uint32_t*)(src+i*stride))[1]= dc0; | |
608 } | |
609 for(i=4; i<8; i++){ | |
610 ((uint32_t*)(src+i*stride))[0]= | |
611 ((uint32_t*)(src+i*stride))[1]= dc2; | |
612 } | |
613 } | |
614 | |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
615 static void pred8x8_left_dc_rv40_c(uint8_t *src, int stride){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
616 int i; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
617 int dc0; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
618 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
619 dc0=0; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
620 for(i=0;i<8; i++) |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
621 dc0+= src[-1+i*stride]; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
622 dc0= 0x01010101*((dc0 + 4)>>3); |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
623 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
624 for(i=0; i<8; i++){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
625 ((uint32_t*)(src+i*stride))[0]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
626 ((uint32_t*)(src+i*stride))[1]= dc0; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
627 } |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
628 } |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
629 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
630 static void pred8x8_top_dc_c(uint8_t *src, int stride){ |
1168 | 631 int i; |
632 int dc0, dc1; | |
633 | |
634 dc0=dc1=0; | |
635 for(i=0;i<4; i++){ | |
636 dc0+= src[i-stride]; | |
637 dc1+= src[4+i-stride]; | |
638 } | |
639 dc0= 0x01010101*((dc0 + 2)>>2); | |
640 dc1= 0x01010101*((dc1 + 2)>>2); | |
641 | |
642 for(i=0; i<4; i++){ | |
643 ((uint32_t*)(src+i*stride))[0]= dc0; | |
644 ((uint32_t*)(src+i*stride))[1]= dc1; | |
645 } | |
646 for(i=4; i<8; i++){ | |
647 ((uint32_t*)(src+i*stride))[0]= dc0; | |
648 ((uint32_t*)(src+i*stride))[1]= dc1; | |
649 } | |
650 } | |
651 | |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
652 static void pred8x8_top_dc_rv40_c(uint8_t *src, int stride){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
653 int i; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
654 int dc0; |
1168 | 655 |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
656 dc0=0; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
657 for(i=0;i<8; i++) |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
658 dc0+= src[i-stride]; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
659 dc0= 0x01010101*((dc0 + 4)>>3); |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
660 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
661 for(i=0; i<8; i++){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
662 ((uint32_t*)(src+i*stride))[0]= |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
663 ((uint32_t*)(src+i*stride))[1]= dc0; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
664 } |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
665 } |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
666 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
667 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
668 static void pred8x8_dc_c(uint8_t *src, int stride){ |
1168 | 669 int i; |
670 int dc0, dc1, dc2, dc3; | |
671 | |
672 dc0=dc1=dc2=0; | |
673 for(i=0;i<4; i++){ | |
674 dc0+= src[-1+i*stride] + src[i-stride]; | |
675 dc1+= src[4+i-stride]; | |
676 dc2+= src[-1+(i+4)*stride]; | |
677 } | |
678 dc3= 0x01010101*((dc1 + dc2 + 4)>>3); | |
679 dc0= 0x01010101*((dc0 + 4)>>3); | |
680 dc1= 0x01010101*((dc1 + 2)>>2); | |
681 dc2= 0x01010101*((dc2 + 2)>>2); | |
682 | |
683 for(i=0; i<4; i++){ | |
684 ((uint32_t*)(src+i*stride))[0]= dc0; | |
685 ((uint32_t*)(src+i*stride))[1]= dc1; | |
686 } | |
687 for(i=4; i<8; i++){ | |
688 ((uint32_t*)(src+i*stride))[0]= dc2; | |
689 ((uint32_t*)(src+i*stride))[1]= dc3; | |
690 } | |
691 } | |
692 | |
7532 | 693 //the following 4 function should not be optimized! |
694 static void pred8x8_mad_cow_dc_l0t(uint8_t *src, int stride){ | |
695 pred8x8_top_dc_c(src, stride); | |
696 pred4x4_dc_c(src, NULL, stride); | |
697 } | |
698 | |
699 static void pred8x8_mad_cow_dc_0lt(uint8_t *src, int stride){ | |
700 pred8x8_dc_c(src, stride); | |
701 pred4x4_top_dc_c(src, NULL, stride); | |
702 } | |
703 | |
704 static void pred8x8_mad_cow_dc_l00(uint8_t *src, int stride){ | |
705 pred8x8_left_dc_c(src, stride); | |
706 pred4x4_128_dc_c(src + 4*stride , NULL, stride); | |
707 pred4x4_128_dc_c(src + 4*stride + 4, NULL, stride); | |
708 } | |
709 | |
710 static void pred8x8_mad_cow_dc_0l0(uint8_t *src, int stride){ | |
711 pred8x8_left_dc_c(src, stride); | |
712 pred4x4_128_dc_c(src , NULL, stride); | |
713 pred4x4_128_dc_c(src + 4, NULL, stride); | |
714 } | |
715 | |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
716 static void pred8x8_dc_rv40_c(uint8_t *src, int stride){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
717 int i; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
718 int dc0=0; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
719 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
720 for(i=0;i<4; i++){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
721 dc0+= src[-1+i*stride] + src[i-stride]; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
722 dc0+= src[4+i-stride]; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
723 dc0+= src[-1+(i+4)*stride]; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
724 } |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
725 dc0= 0x01010101*((dc0 + 8)>>4); |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
726 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
727 for(i=0; i<4; i++){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
728 ((uint32_t*)(src+i*stride))[0]= dc0; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
729 ((uint32_t*)(src+i*stride))[1]= dc0; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
730 } |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
731 for(i=4; i<8; i++){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
732 ((uint32_t*)(src+i*stride))[0]= dc0; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
733 ((uint32_t*)(src+i*stride))[1]= dc0; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
734 } |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
735 } |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
736 |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
737 static void pred8x8_plane_c(uint8_t *src, int stride){ |
1184
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
738 int j, k; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
739 int a; |
4176 | 740 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
1184
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
741 const uint8_t * const src0 = src+3-stride; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
742 const uint8_t *src1 = src+4*stride-1; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
743 const uint8_t *src2 = src1-2*stride; // == src+2*stride-1; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
744 int H = src0[1] - src0[-1]; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
745 int V = src1[0] - src2[ 0]; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
746 for(k=2; k<=4; ++k) { |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
747 src1 += stride; src2 -= stride; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
748 H += k*(src0[k] - src0[-k]); |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
749 V += k*(src1[0] - src2[ 0]); |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
750 } |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
751 H = ( 17*H+16 ) >> 5; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
752 V = ( 17*V+16 ) >> 5; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
753 |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
754 a = 16*(src1[0] + src2[8]+1) - 3*(V+H); |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
755 for(j=8; j>0; --j) { |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
756 int b = a; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
757 a += V; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
758 src[0] = cm[ (b ) >> 5 ]; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
759 src[1] = cm[ (b+ H) >> 5 ]; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
760 src[2] = cm[ (b+2*H) >> 5 ]; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
761 src[3] = cm[ (b+3*H) >> 5 ]; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
762 src[4] = cm[ (b+4*H) >> 5 ]; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
763 src[5] = cm[ (b+5*H) >> 5 ]; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
764 src[6] = cm[ (b+6*H) >> 5 ]; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
765 src[7] = cm[ (b+7*H) >> 5 ]; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
766 src += stride; |
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
767 } |
1168 | 768 } |
769 | |
2755 | 770 #define SRC(x,y) src[(x)+(y)*stride] |
771 #define PL(y) \ | |
772 const int l##y = (SRC(-1,y-1) + 2*SRC(-1,y) + SRC(-1,y+1) + 2) >> 2; | |
773 #define PREDICT_8x8_LOAD_LEFT \ | |
774 const int l0 = ((has_topleft ? SRC(-1,-1) : SRC(-1,0)) \ | |
775 + 2*SRC(-1,0) + SRC(-1,1) + 2) >> 2; \ | |
776 PL(1) PL(2) PL(3) PL(4) PL(5) PL(6) \ | |
5083
ce36118abbbb
rename attribute_unused to av_unused and moves its declaration to common.h
benoit
parents:
5079
diff
changeset
|
777 const int l7 av_unused = (SRC(-1,6) + 3*SRC(-1,7) + 2) >> 2 |
2755 | 778 |
779 #define PT(x) \ | |
780 const int t##x = (SRC(x-1,-1) + 2*SRC(x,-1) + SRC(x+1,-1) + 2) >> 2; | |
781 #define PREDICT_8x8_LOAD_TOP \ | |
782 const int t0 = ((has_topleft ? SRC(-1,-1) : SRC(0,-1)) \ | |
783 + 2*SRC(0,-1) + SRC(1,-1) + 2) >> 2; \ | |
784 PT(1) PT(2) PT(3) PT(4) PT(5) PT(6) \ | |
5083
ce36118abbbb
rename attribute_unused to av_unused and moves its declaration to common.h
benoit
parents:
5079
diff
changeset
|
785 const int t7 av_unused = ((has_topright ? SRC(8,-1) : SRC(7,-1)) \ |
2757 | 786 + 2*SRC(7,-1) + SRC(6,-1) + 2) >> 2 |
2755 | 787 |
788 #define PTR(x) \ | |
789 t##x = (SRC(x-1,-1) + 2*SRC(x,-1) + SRC(x+1,-1) + 2) >> 2; | |
790 #define PREDICT_8x8_LOAD_TOPRIGHT \ | |
791 int t8, t9, t10, t11, t12, t13, t14, t15; \ | |
792 if(has_topright) { \ | |
793 PTR(8) PTR(9) PTR(10) PTR(11) PTR(12) PTR(13) PTR(14) \ | |
794 t15 = (SRC(14,-1) + 3*SRC(15,-1) + 2) >> 2; \ | |
795 } else t8=t9=t10=t11=t12=t13=t14=t15= SRC(7,-1); | |
796 | |
797 #define PREDICT_8x8_LOAD_TOPLEFT \ | |
2757 | 798 const int lt = (SRC(-1,0) + 2*SRC(-1,-1) + SRC(0,-1) + 2) >> 2 |
2755 | 799 |
800 #define PREDICT_8x8_DC(v) \ | |
801 int y; \ | |
802 for( y = 0; y < 8; y++ ) { \ | |
803 ((uint32_t*)src)[0] = \ | |
804 ((uint32_t*)src)[1] = v; \ | |
805 src += stride; \ | |
806 } | |
807 | |
808 static void pred8x8l_128_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
809 { | |
810 PREDICT_8x8_DC(0x80808080); | |
811 } | |
812 static void pred8x8l_left_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
813 { | |
814 PREDICT_8x8_LOAD_LEFT; | |
815 const uint32_t dc = ((l0+l1+l2+l3+l4+l5+l6+l7+4) >> 3) * 0x01010101; | |
816 PREDICT_8x8_DC(dc); | |
817 } | |
818 static void pred8x8l_top_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
819 { | |
820 PREDICT_8x8_LOAD_TOP; | |
821 const uint32_t dc = ((t0+t1+t2+t3+t4+t5+t6+t7+4) >> 3) * 0x01010101; | |
822 PREDICT_8x8_DC(dc); | |
823 } | |
824 static void pred8x8l_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
825 { | |
826 PREDICT_8x8_LOAD_LEFT; | |
827 PREDICT_8x8_LOAD_TOP; | |
828 const uint32_t dc = ((l0+l1+l2+l3+l4+l5+l6+l7 | |
829 +t0+t1+t2+t3+t4+t5+t6+t7+8) >> 4) * 0x01010101; | |
830 PREDICT_8x8_DC(dc); | |
831 } | |
832 static void pred8x8l_horizontal_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
833 { | |
834 PREDICT_8x8_LOAD_LEFT; | |
835 #define ROW(y) ((uint32_t*)(src+y*stride))[0] =\ | |
836 ((uint32_t*)(src+y*stride))[1] = 0x01010101 * l##y | |
837 ROW(0); ROW(1); ROW(2); ROW(3); ROW(4); ROW(5); ROW(6); ROW(7); | |
838 #undef ROW | |
839 } | |
840 static void pred8x8l_vertical_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
841 { | |
842 int y; | |
843 PREDICT_8x8_LOAD_TOP; | |
844 src[0] = t0; | |
845 src[1] = t1; | |
846 src[2] = t2; | |
847 src[3] = t3; | |
848 src[4] = t4; | |
849 src[5] = t5; | |
850 src[6] = t6; | |
851 src[7] = t7; | |
852 for( y = 1; y < 8; y++ ) | |
853 *(uint64_t*)(src+y*stride) = *(uint64_t*)src; | |
854 } | |
855 static void pred8x8l_down_left_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
856 { | |
857 PREDICT_8x8_LOAD_TOP; | |
858 PREDICT_8x8_LOAD_TOPRIGHT; | |
859 SRC(0,0)= (t0 + 2*t1 + t2 + 2) >> 2; | |
860 SRC(0,1)=SRC(1,0)= (t1 + 2*t2 + t3 + 2) >> 2; | |
861 SRC(0,2)=SRC(1,1)=SRC(2,0)= (t2 + 2*t3 + t4 + 2) >> 2; | |
862 SRC(0,3)=SRC(1,2)=SRC(2,1)=SRC(3,0)= (t3 + 2*t4 + t5 + 2) >> 2; | |
863 SRC(0,4)=SRC(1,3)=SRC(2,2)=SRC(3,1)=SRC(4,0)= (t4 + 2*t5 + t6 + 2) >> 2; | |
864 SRC(0,5)=SRC(1,4)=SRC(2,3)=SRC(3,2)=SRC(4,1)=SRC(5,0)= (t5 + 2*t6 + t7 + 2) >> 2; | |
865 SRC(0,6)=SRC(1,5)=SRC(2,4)=SRC(3,3)=SRC(4,2)=SRC(5,1)=SRC(6,0)= (t6 + 2*t7 + t8 + 2) >> 2; | |
866 SRC(0,7)=SRC(1,6)=SRC(2,5)=SRC(3,4)=SRC(4,3)=SRC(5,2)=SRC(6,1)=SRC(7,0)= (t7 + 2*t8 + t9 + 2) >> 2; | |
867 SRC(1,7)=SRC(2,6)=SRC(3,5)=SRC(4,4)=SRC(5,3)=SRC(6,2)=SRC(7,1)= (t8 + 2*t9 + t10 + 2) >> 2; | |
868 SRC(2,7)=SRC(3,6)=SRC(4,5)=SRC(5,4)=SRC(6,3)=SRC(7,2)= (t9 + 2*t10 + t11 + 2) >> 2; | |
869 SRC(3,7)=SRC(4,6)=SRC(5,5)=SRC(6,4)=SRC(7,3)= (t10 + 2*t11 + t12 + 2) >> 2; | |
870 SRC(4,7)=SRC(5,6)=SRC(6,5)=SRC(7,4)= (t11 + 2*t12 + t13 + 2) >> 2; | |
871 SRC(5,7)=SRC(6,6)=SRC(7,5)= (t12 + 2*t13 + t14 + 2) >> 2; | |
872 SRC(6,7)=SRC(7,6)= (t13 + 2*t14 + t15 + 2) >> 2; | |
873 SRC(7,7)= (t14 + 3*t15 + 2) >> 2; | |
874 } | |
875 static void pred8x8l_down_right_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
876 { | |
877 PREDICT_8x8_LOAD_TOP; | |
878 PREDICT_8x8_LOAD_LEFT; | |
879 PREDICT_8x8_LOAD_TOPLEFT; | |
880 SRC(0,7)= (l7 + 2*l6 + l5 + 2) >> 2; | |
881 SRC(0,6)=SRC(1,7)= (l6 + 2*l5 + l4 + 2) >> 2; | |
882 SRC(0,5)=SRC(1,6)=SRC(2,7)= (l5 + 2*l4 + l3 + 2) >> 2; | |
883 SRC(0,4)=SRC(1,5)=SRC(2,6)=SRC(3,7)= (l4 + 2*l3 + l2 + 2) >> 2; | |
884 SRC(0,3)=SRC(1,4)=SRC(2,5)=SRC(3,6)=SRC(4,7)= (l3 + 2*l2 + l1 + 2) >> 2; | |
885 SRC(0,2)=SRC(1,3)=SRC(2,4)=SRC(3,5)=SRC(4,6)=SRC(5,7)= (l2 + 2*l1 + l0 + 2) >> 2; | |
886 SRC(0,1)=SRC(1,2)=SRC(2,3)=SRC(3,4)=SRC(4,5)=SRC(5,6)=SRC(6,7)= (l1 + 2*l0 + lt + 2) >> 2; | |
887 SRC(0,0)=SRC(1,1)=SRC(2,2)=SRC(3,3)=SRC(4,4)=SRC(5,5)=SRC(6,6)=SRC(7,7)= (l0 + 2*lt + t0 + 2) >> 2; | |
888 SRC(1,0)=SRC(2,1)=SRC(3,2)=SRC(4,3)=SRC(5,4)=SRC(6,5)=SRC(7,6)= (lt + 2*t0 + t1 + 2) >> 2; | |
889 SRC(2,0)=SRC(3,1)=SRC(4,2)=SRC(5,3)=SRC(6,4)=SRC(7,5)= (t0 + 2*t1 + t2 + 2) >> 2; | |
890 SRC(3,0)=SRC(4,1)=SRC(5,2)=SRC(6,3)=SRC(7,4)= (t1 + 2*t2 + t3 + 2) >> 2; | |
891 SRC(4,0)=SRC(5,1)=SRC(6,2)=SRC(7,3)= (t2 + 2*t3 + t4 + 2) >> 2; | |
892 SRC(5,0)=SRC(6,1)=SRC(7,2)= (t3 + 2*t4 + t5 + 2) >> 2; | |
893 SRC(6,0)=SRC(7,1)= (t4 + 2*t5 + t6 + 2) >> 2; | |
894 SRC(7,0)= (t5 + 2*t6 + t7 + 2) >> 2; | |
2967 | 895 |
2755 | 896 } |
897 static void pred8x8l_vertical_right_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
898 { | |
899 PREDICT_8x8_LOAD_TOP; | |
900 PREDICT_8x8_LOAD_LEFT; | |
901 PREDICT_8x8_LOAD_TOPLEFT; | |
902 SRC(0,6)= (l5 + 2*l4 + l3 + 2) >> 2; | |
903 SRC(0,7)= (l6 + 2*l5 + l4 + 2) >> 2; | |
904 SRC(0,4)=SRC(1,6)= (l3 + 2*l2 + l1 + 2) >> 2; | |
905 SRC(0,5)=SRC(1,7)= (l4 + 2*l3 + l2 + 2) >> 2; | |
906 SRC(0,2)=SRC(1,4)=SRC(2,6)= (l1 + 2*l0 + lt + 2) >> 2; | |
907 SRC(0,3)=SRC(1,5)=SRC(2,7)= (l2 + 2*l1 + l0 + 2) >> 2; | |
908 SRC(0,1)=SRC(1,3)=SRC(2,5)=SRC(3,7)= (l0 + 2*lt + t0 + 2) >> 2; | |
909 SRC(0,0)=SRC(1,2)=SRC(2,4)=SRC(3,6)= (lt + t0 + 1) >> 1; | |
910 SRC(1,1)=SRC(2,3)=SRC(3,5)=SRC(4,7)= (lt + 2*t0 + t1 + 2) >> 2; | |
911 SRC(1,0)=SRC(2,2)=SRC(3,4)=SRC(4,6)= (t0 + t1 + 1) >> 1; | |
912 SRC(2,1)=SRC(3,3)=SRC(4,5)=SRC(5,7)= (t0 + 2*t1 + t2 + 2) >> 2; | |
913 SRC(2,0)=SRC(3,2)=SRC(4,4)=SRC(5,6)= (t1 + t2 + 1) >> 1; | |
914 SRC(3,1)=SRC(4,3)=SRC(5,5)=SRC(6,7)= (t1 + 2*t2 + t3 + 2) >> 2; | |
915 SRC(3,0)=SRC(4,2)=SRC(5,4)=SRC(6,6)= (t2 + t3 + 1) >> 1; | |
916 SRC(4,1)=SRC(5,3)=SRC(6,5)=SRC(7,7)= (t2 + 2*t3 + t4 + 2) >> 2; | |
917 SRC(4,0)=SRC(5,2)=SRC(6,4)=SRC(7,6)= (t3 + t4 + 1) >> 1; | |
918 SRC(5,1)=SRC(6,3)=SRC(7,5)= (t3 + 2*t4 + t5 + 2) >> 2; | |
919 SRC(5,0)=SRC(6,2)=SRC(7,4)= (t4 + t5 + 1) >> 1; | |
920 SRC(6,1)=SRC(7,3)= (t4 + 2*t5 + t6 + 2) >> 2; | |
921 SRC(6,0)=SRC(7,2)= (t5 + t6 + 1) >> 1; | |
922 SRC(7,1)= (t5 + 2*t6 + t7 + 2) >> 2; | |
923 SRC(7,0)= (t6 + t7 + 1) >> 1; | |
924 } | |
925 static void pred8x8l_horizontal_down_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
926 { | |
927 PREDICT_8x8_LOAD_TOP; | |
928 PREDICT_8x8_LOAD_LEFT; | |
929 PREDICT_8x8_LOAD_TOPLEFT; | |
930 SRC(0,7)= (l6 + l7 + 1) >> 1; | |
931 SRC(1,7)= (l5 + 2*l6 + l7 + 2) >> 2; | |
932 SRC(0,6)=SRC(2,7)= (l5 + l6 + 1) >> 1; | |
933 SRC(1,6)=SRC(3,7)= (l4 + 2*l5 + l6 + 2) >> 2; | |
934 SRC(0,5)=SRC(2,6)=SRC(4,7)= (l4 + l5 + 1) >> 1; | |
935 SRC(1,5)=SRC(3,6)=SRC(5,7)= (l3 + 2*l4 + l5 + 2) >> 2; | |
936 SRC(0,4)=SRC(2,5)=SRC(4,6)=SRC(6,7)= (l3 + l4 + 1) >> 1; | |
937 SRC(1,4)=SRC(3,5)=SRC(5,6)=SRC(7,7)= (l2 + 2*l3 + l4 + 2) >> 2; | |
938 SRC(0,3)=SRC(2,4)=SRC(4,5)=SRC(6,6)= (l2 + l3 + 1) >> 1; | |
939 SRC(1,3)=SRC(3,4)=SRC(5,5)=SRC(7,6)= (l1 + 2*l2 + l3 + 2) >> 2; | |
940 SRC(0,2)=SRC(2,3)=SRC(4,4)=SRC(6,5)= (l1 + l2 + 1) >> 1; | |
941 SRC(1,2)=SRC(3,3)=SRC(5,4)=SRC(7,5)= (l0 + 2*l1 + l2 + 2) >> 2; | |
942 SRC(0,1)=SRC(2,2)=SRC(4,3)=SRC(6,4)= (l0 + l1 + 1) >> 1; | |
943 SRC(1,1)=SRC(3,2)=SRC(5,3)=SRC(7,4)= (lt + 2*l0 + l1 + 2) >> 2; | |
944 SRC(0,0)=SRC(2,1)=SRC(4,2)=SRC(6,3)= (lt + l0 + 1) >> 1; | |
945 SRC(1,0)=SRC(3,1)=SRC(5,2)=SRC(7,3)= (l0 + 2*lt + t0 + 2) >> 2; | |
946 SRC(2,0)=SRC(4,1)=SRC(6,2)= (t1 + 2*t0 + lt + 2) >> 2; | |
947 SRC(3,0)=SRC(5,1)=SRC(7,2)= (t2 + 2*t1 + t0 + 2) >> 2; | |
948 SRC(4,0)=SRC(6,1)= (t3 + 2*t2 + t1 + 2) >> 2; | |
949 SRC(5,0)=SRC(7,1)= (t4 + 2*t3 + t2 + 2) >> 2; | |
950 SRC(6,0)= (t5 + 2*t4 + t3 + 2) >> 2; | |
951 SRC(7,0)= (t6 + 2*t5 + t4 + 2) >> 2; | |
952 } | |
953 static void pred8x8l_vertical_left_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
954 { | |
955 PREDICT_8x8_LOAD_TOP; | |
956 PREDICT_8x8_LOAD_TOPRIGHT; | |
957 SRC(0,0)= (t0 + t1 + 1) >> 1; | |
958 SRC(0,1)= (t0 + 2*t1 + t2 + 2) >> 2; | |
959 SRC(0,2)=SRC(1,0)= (t1 + t2 + 1) >> 1; | |
960 SRC(0,3)=SRC(1,1)= (t1 + 2*t2 + t3 + 2) >> 2; | |
961 SRC(0,4)=SRC(1,2)=SRC(2,0)= (t2 + t3 + 1) >> 1; | |
962 SRC(0,5)=SRC(1,3)=SRC(2,1)= (t2 + 2*t3 + t4 + 2) >> 2; | |
963 SRC(0,6)=SRC(1,4)=SRC(2,2)=SRC(3,0)= (t3 + t4 + 1) >> 1; | |
964 SRC(0,7)=SRC(1,5)=SRC(2,3)=SRC(3,1)= (t3 + 2*t4 + t5 + 2) >> 2; | |
965 SRC(1,6)=SRC(2,4)=SRC(3,2)=SRC(4,0)= (t4 + t5 + 1) >> 1; | |
966 SRC(1,7)=SRC(2,5)=SRC(3,3)=SRC(4,1)= (t4 + 2*t5 + t6 + 2) >> 2; | |
967 SRC(2,6)=SRC(3,4)=SRC(4,2)=SRC(5,0)= (t5 + t6 + 1) >> 1; | |
968 SRC(2,7)=SRC(3,5)=SRC(4,3)=SRC(5,1)= (t5 + 2*t6 + t7 + 2) >> 2; | |
969 SRC(3,6)=SRC(4,4)=SRC(5,2)=SRC(6,0)= (t6 + t7 + 1) >> 1; | |
970 SRC(3,7)=SRC(4,5)=SRC(5,3)=SRC(6,1)= (t6 + 2*t7 + t8 + 2) >> 2; | |
971 SRC(4,6)=SRC(5,4)=SRC(6,2)=SRC(7,0)= (t7 + t8 + 1) >> 1; | |
972 SRC(4,7)=SRC(5,5)=SRC(6,3)=SRC(7,1)= (t7 + 2*t8 + t9 + 2) >> 2; | |
973 SRC(5,6)=SRC(6,4)=SRC(7,2)= (t8 + t9 + 1) >> 1; | |
974 SRC(5,7)=SRC(6,5)=SRC(7,3)= (t8 + 2*t9 + t10 + 2) >> 2; | |
975 SRC(6,6)=SRC(7,4)= (t9 + t10 + 1) >> 1; | |
976 SRC(6,7)=SRC(7,5)= (t9 + 2*t10 + t11 + 2) >> 2; | |
977 SRC(7,6)= (t10 + t11 + 1) >> 1; | |
978 SRC(7,7)= (t10 + 2*t11 + t12 + 2) >> 2; | |
979 } | |
980 static void pred8x8l_horizontal_up_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
981 { | |
982 PREDICT_8x8_LOAD_LEFT; | |
983 SRC(0,0)= (l0 + l1 + 1) >> 1; | |
984 SRC(1,0)= (l0 + 2*l1 + l2 + 2) >> 2; | |
985 SRC(0,1)=SRC(2,0)= (l1 + l2 + 1) >> 1; | |
986 SRC(1,1)=SRC(3,0)= (l1 + 2*l2 + l3 + 2) >> 2; | |
987 SRC(0,2)=SRC(2,1)=SRC(4,0)= (l2 + l3 + 1) >> 1; | |
988 SRC(1,2)=SRC(3,1)=SRC(5,0)= (l2 + 2*l3 + l4 + 2) >> 2; | |
989 SRC(0,3)=SRC(2,2)=SRC(4,1)=SRC(6,0)= (l3 + l4 + 1) >> 1; | |
990 SRC(1,3)=SRC(3,2)=SRC(5,1)=SRC(7,0)= (l3 + 2*l4 + l5 + 2) >> 2; | |
991 SRC(0,4)=SRC(2,3)=SRC(4,2)=SRC(6,1)= (l4 + l5 + 1) >> 1; | |
992 SRC(1,4)=SRC(3,3)=SRC(5,2)=SRC(7,1)= (l4 + 2*l5 + l6 + 2) >> 2; | |
993 SRC(0,5)=SRC(2,4)=SRC(4,3)=SRC(6,2)= (l5 + l6 + 1) >> 1; | |
994 SRC(1,5)=SRC(3,4)=SRC(5,3)=SRC(7,2)= (l5 + 2*l6 + l7 + 2) >> 2; | |
995 SRC(0,6)=SRC(2,5)=SRC(4,4)=SRC(6,3)= (l6 + l7 + 1) >> 1; | |
996 SRC(1,6)=SRC(3,5)=SRC(5,4)=SRC(7,3)= (l6 + 3*l7 + 2) >> 2; | |
997 SRC(0,7)=SRC(1,7)=SRC(2,6)=SRC(2,7)=SRC(3,6)= | |
998 SRC(3,7)=SRC(4,5)=SRC(4,6)=SRC(4,7)=SRC(5,5)= | |
999 SRC(5,6)=SRC(5,7)=SRC(6,4)=SRC(6,5)=SRC(6,6)= | |
1000 SRC(6,7)=SRC(7,4)=SRC(7,5)=SRC(7,6)=SRC(7,7)= l7; | |
1001 } | |
1002 #undef PREDICT_8x8_LOAD_LEFT | |
1003 #undef PREDICT_8x8_LOAD_TOP | |
1004 #undef PREDICT_8x8_LOAD_TOPLEFT | |
1005 #undef PREDICT_8x8_LOAD_TOPRIGHT | |
1006 #undef PREDICT_8x8_DC | |
1007 #undef PTR | |
1008 #undef PT | |
1009 #undef PL | |
1010 #undef SRC | |
1011 | |
1168 | 1012 /** |
1013 * Sets the intra prediction function pointers. | |
1014 */ | |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1015 void ff_h264_pred_init(H264PredContext *h, int codec_id){ |
1168 | 1016 // MpegEncContext * const s = &h->s; |
1017 | |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1018 if(codec_id != CODEC_ID_RV40){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1019 h->pred4x4[VERT_PRED ]= pred4x4_vertical_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1020 h->pred4x4[HOR_PRED ]= pred4x4_horizontal_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1021 h->pred4x4[DC_PRED ]= pred4x4_dc_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1022 if(codec_id == CODEC_ID_SVQ3) |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1023 h->pred4x4[DIAG_DOWN_LEFT_PRED ]= pred4x4_down_left_svq3_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1024 else |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1025 h->pred4x4[DIAG_DOWN_LEFT_PRED ]= pred4x4_down_left_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1026 h->pred4x4[DIAG_DOWN_RIGHT_PRED]= pred4x4_down_right_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1027 h->pred4x4[VERT_RIGHT_PRED ]= pred4x4_vertical_right_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1028 h->pred4x4[HOR_DOWN_PRED ]= pred4x4_horizontal_down_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1029 h->pred4x4[VERT_LEFT_PRED ]= pred4x4_vertical_left_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1030 h->pred4x4[HOR_UP_PRED ]= pred4x4_horizontal_up_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1031 h->pred4x4[LEFT_DC_PRED ]= pred4x4_left_dc_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1032 h->pred4x4[TOP_DC_PRED ]= pred4x4_top_dc_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1033 h->pred4x4[DC_128_PRED ]= pred4x4_128_dc_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1034 }else{ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1035 h->pred4x4[VERT_PRED ]= pred4x4_vertical_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1036 h->pred4x4[HOR_PRED ]= pred4x4_horizontal_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1037 h->pred4x4[DC_PRED ]= pred4x4_dc_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1038 h->pred4x4[DIAG_DOWN_LEFT_PRED ]= pred4x4_down_left_rv40_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1039 h->pred4x4[DIAG_DOWN_RIGHT_PRED]= pred4x4_down_right_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1040 h->pred4x4[VERT_RIGHT_PRED ]= pred4x4_vertical_right_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1041 h->pred4x4[HOR_DOWN_PRED ]= pred4x4_horizontal_down_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1042 h->pred4x4[VERT_LEFT_PRED ]= pred4x4_vertical_left_rv40_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1043 h->pred4x4[HOR_UP_PRED ]= pred4x4_horizontal_up_rv40_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1044 h->pred4x4[LEFT_DC_PRED ]= pred4x4_left_dc_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1045 h->pred4x4[TOP_DC_PRED ]= pred4x4_top_dc_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1046 h->pred4x4[DC_128_PRED ]= pred4x4_128_dc_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1047 h->pred4x4[DIAG_DOWN_LEFT_PRED_RV40_NODOWN]= pred4x4_down_left_rv40_nodown_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1048 h->pred4x4[HOR_UP_PRED_RV40_NODOWN]= pred4x4_horizontal_up_rv40_nodown_c; |
6036
ce3b68242317
Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents:
5638
diff
changeset
|
1049 h->pred4x4[VERT_LEFT_PRED_RV40_NODOWN]= pred4x4_vertical_left_rv40_nodown_c; |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1050 } |
1168 | 1051 |
2755 | 1052 h->pred8x8l[VERT_PRED ]= pred8x8l_vertical_c; |
1053 h->pred8x8l[HOR_PRED ]= pred8x8l_horizontal_c; | |
1054 h->pred8x8l[DC_PRED ]= pred8x8l_dc_c; | |
1055 h->pred8x8l[DIAG_DOWN_LEFT_PRED ]= pred8x8l_down_left_c; | |
1056 h->pred8x8l[DIAG_DOWN_RIGHT_PRED]= pred8x8l_down_right_c; | |
1057 h->pred8x8l[VERT_RIGHT_PRED ]= pred8x8l_vertical_right_c; | |
1058 h->pred8x8l[HOR_DOWN_PRED ]= pred8x8l_horizontal_down_c; | |
1059 h->pred8x8l[VERT_LEFT_PRED ]= pred8x8l_vertical_left_c; | |
1060 h->pred8x8l[HOR_UP_PRED ]= pred8x8l_horizontal_up_c; | |
1061 h->pred8x8l[LEFT_DC_PRED ]= pred8x8l_left_dc_c; | |
1062 h->pred8x8l[TOP_DC_PRED ]= pred8x8l_top_dc_c; | |
1063 h->pred8x8l[DC_128_PRED ]= pred8x8l_128_dc_c; | |
1064 | |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1065 h->pred8x8[VERT_PRED8x8 ]= pred8x8_vertical_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1066 h->pred8x8[HOR_PRED8x8 ]= pred8x8_horizontal_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1067 h->pred8x8[PLANE_PRED8x8 ]= pred8x8_plane_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1068 if(codec_id != CODEC_ID_RV40){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1069 h->pred8x8[DC_PRED8x8 ]= pred8x8_dc_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1070 h->pred8x8[LEFT_DC_PRED8x8]= pred8x8_left_dc_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1071 h->pred8x8[TOP_DC_PRED8x8 ]= pred8x8_top_dc_c; |
7532 | 1072 h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= pred8x8_mad_cow_dc_l0t; |
1073 h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= pred8x8_mad_cow_dc_0lt; | |
1074 h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= pred8x8_mad_cow_dc_l00; | |
1075 h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= pred8x8_mad_cow_dc_0l0; | |
3105
2d35fb3cb940
h264: special case dc-only idct. ~1% faster overall
lorenm
parents:
3101
diff
changeset
|
1076 }else{ |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1077 h->pred8x8[DC_PRED8x8 ]= pred8x8_dc_rv40_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1078 h->pred8x8[LEFT_DC_PRED8x8]= pred8x8_left_dc_rv40_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1079 h->pred8x8[TOP_DC_PRED8x8 ]= pred8x8_top_dc_rv40_c; |
1168 | 1080 } |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1081 h->pred8x8[DC_128_PRED8x8 ]= pred8x8_128_dc_c; |
1908
e20fd60b215c
h264 - progressive I frame CABAC support patch by (Laurent Aimar <fenrir at via dot ecp dot fr>)
michael
parents:
1899
diff
changeset
|
1082 |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1083 h->pred16x16[DC_PRED8x8 ]= pred16x16_dc_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1084 h->pred16x16[VERT_PRED8x8 ]= pred16x16_vertical_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1085 h->pred16x16[HOR_PRED8x8 ]= pred16x16_horizontal_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1086 h->pred16x16[PLANE_PRED8x8 ]= pred16x16_plane_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1087 switch(codec_id){ |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1088 case CODEC_ID_SVQ3: |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1089 h->pred16x16[PLANE_PRED8x8 ]= pred16x16_plane_svq3_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1090 break; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1091 case CODEC_ID_RV40: |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1092 h->pred16x16[PLANE_PRED8x8 ]= pred16x16_plane_rv40_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1093 break; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1094 default: |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1095 h->pred16x16[PLANE_PRED8x8 ]= pred16x16_plane_c; |
2581
ae72796e722f
This is the second patch for MBAFF support, this adds the deblocking
michael
parents:
2580
diff
changeset
|
1096 } |
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1097 h->pred16x16[LEFT_DC_PRED8x8]= pred16x16_left_dc_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1098 h->pred16x16[TOP_DC_PRED8x8 ]= pred16x16_top_dc_c; |
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1099 h->pred16x16[DC_128_PRED8x8 ]= pred16x16_128_dc_c; |
5226
65bffcc5571a
Precompute a chroma_qp table with index offset for each pps,
gpoirier
parents:
5225
diff
changeset
|
1100 } |