Mercurial > libavcodec.hg
annotate h264pred.c @ 5767:32b404ec4c19 libavcodec
Partial PAFF implementation at macroblock level.
PAFF support disabled until implementation complete.
patch by Jeff Downs, heydowns a borg d com
original thread:
Subject: [FFmpeg-devel] [PATCH] Implement PAFF in H.264
Date: 18/09/07 20:30
| author | andoma |
|---|---|
| date | Thu, 04 Oct 2007 06:33:26 +0000 |
| parents | 4a26dc4ca11d |
| children | ce3b68242317 |
| 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 |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
291 static void pred4x4_vertical_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
|
292 LOAD_TOP_EDGE |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
293 LOAD_TOP_RIGHT_EDGE |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
294 LOAD_LEFT_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; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
304 src[0+1*stride]=(t0 + 2*t1 + t2 + l2 + 2*l3 + l3 + 4)>>3; |
|
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 |
| 1168 | 314 static void pred4x4_horizontal_up_c(uint8_t *src, uint8_t *topright, int stride){ |
| 2967 | 315 LOAD_LEFT_EDGE |
| 1168 | 316 |
| 317 src[0+0*stride]=(l0 + l1 + 1)>>1; | |
| 318 src[1+0*stride]=(l0 + 2*l1 + l2 + 2)>>2; | |
| 319 src[2+0*stride]= | |
| 320 src[0+1*stride]=(l1 + l2 + 1)>>1; | |
| 321 src[3+0*stride]= | |
| 322 src[1+1*stride]=(l1 + 2*l2 + l3 + 2)>>2; | |
| 323 src[2+1*stride]= | |
| 324 src[0+2*stride]=(l2 + l3 + 1)>>1; | |
| 325 src[3+1*stride]= | |
| 326 src[1+2*stride]=(l2 + 2*l3 + l3 + 2)>>2; | |
| 327 src[3+2*stride]= | |
| 328 src[1+3*stride]= | |
| 329 src[0+3*stride]= | |
| 330 src[2+2*stride]= | |
| 331 src[2+3*stride]= | |
| 332 src[3+3*stride]=l3; | |
| 1282 | 333 } |
| 2967 | 334 |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
335 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
|
336 LOAD_LEFT_EDGE |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
337 LOAD_DOWN_LEFT_EDGE |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
338 LOAD_TOP_EDGE |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
339 LOAD_TOP_RIGHT_EDGE |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
340 |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
341 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
|
342 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
|
343 src[2+0*stride]= |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
344 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
|
345 src[3+0*stride]= |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
346 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
|
347 src[2+1*stride]= |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
348 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
|
349 src[3+1*stride]= |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
350 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
|
351 src[3+2*stride]= |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
352 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
|
353 src[0+3*stride]= |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
354 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
|
355 src[2+3*stride]=(l4 + l5 + 1)>>1; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
356 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
|
357 } |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
358 |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
359 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
|
360 LOAD_LEFT_EDGE |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
361 LOAD_TOP_EDGE |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
362 LOAD_TOP_RIGHT_EDGE |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
363 |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
364 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
|
365 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
|
366 src[2+0*stride]= |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
367 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
|
368 src[3+0*stride]= |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
369 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
|
370 src[2+1*stride]= |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
371 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
|
372 src[3+1*stride]= |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
373 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
|
374 src[3+2*stride]= |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
375 src[1+3*stride]=l3; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
376 src[0+3*stride]= |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
377 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
|
378 src[2+3*stride]= |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
379 src[3+3*stride]=l3; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
380 } |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
381 |
| 1168 | 382 static void pred4x4_horizontal_down_c(uint8_t *src, uint8_t *topright, int stride){ |
| 383 const int lt= src[-1-1*stride]; | |
| 2967 | 384 LOAD_TOP_EDGE |
| 385 LOAD_LEFT_EDGE | |
| 1168 | 386 |
| 387 src[0+0*stride]= | |
| 388 src[2+1*stride]=(lt + l0 + 1)>>1; | |
| 389 src[1+0*stride]= | |
| 390 src[3+1*stride]=(l0 + 2*lt + t0 + 2)>>2; | |
| 391 src[2+0*stride]=(lt + 2*t0 + t1 + 2)>>2; | |
| 392 src[3+0*stride]=(t0 + 2*t1 + t2 + 2)>>2; | |
| 393 src[0+1*stride]= | |
| 394 src[2+2*stride]=(l0 + l1 + 1)>>1; | |
| 395 src[1+1*stride]= | |
| 396 src[3+2*stride]=(lt + 2*l0 + l1 + 2)>>2; | |
| 397 src[0+2*stride]= | |
| 398 src[2+3*stride]=(l1 + l2+ 1)>>1; | |
| 399 src[1+2*stride]= | |
| 400 src[3+3*stride]=(l0 + 2*l1 + l2 + 2)>>2; | |
| 401 src[0+3*stride]=(l2 + l3 + 1)>>1; | |
| 402 src[1+3*stride]=(l1 + 2*l2 + l3 + 2)>>2; | |
| 1282 | 403 } |
| 1168 | 404 |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
405 static void pred16x16_vertical_c(uint8_t *src, int stride){ |
| 1168 | 406 int i; |
| 407 const uint32_t a= ((uint32_t*)(src-stride))[0]; | |
| 408 const uint32_t b= ((uint32_t*)(src-stride))[1]; | |
| 409 const uint32_t c= ((uint32_t*)(src-stride))[2]; | |
| 410 const uint32_t d= ((uint32_t*)(src-stride))[3]; | |
| 2967 | 411 |
| 1168 | 412 for(i=0; i<16; i++){ |
| 413 ((uint32_t*)(src+i*stride))[0]= a; | |
| 414 ((uint32_t*)(src+i*stride))[1]= b; | |
| 415 ((uint32_t*)(src+i*stride))[2]= c; | |
| 416 ((uint32_t*)(src+i*stride))[3]= d; | |
| 417 } | |
| 418 } | |
| 419 | |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
420 static void pred16x16_horizontal_c(uint8_t *src, int stride){ |
| 1168 | 421 int i; |
| 422 | |
| 423 for(i=0; i<16; i++){ | |
| 424 ((uint32_t*)(src+i*stride))[0]= | |
| 425 ((uint32_t*)(src+i*stride))[1]= | |
| 426 ((uint32_t*)(src+i*stride))[2]= | |
| 427 ((uint32_t*)(src+i*stride))[3]= src[-1+i*stride]*0x01010101; | |
| 428 } | |
| 429 } | |
| 430 | |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
431 static void pred16x16_dc_c(uint8_t *src, int stride){ |
| 1168 | 432 int i, dc=0; |
| 433 | |
| 434 for(i=0;i<16; i++){ | |
| 435 dc+= src[-1+i*stride]; | |
| 436 } | |
| 2967 | 437 |
| 1168 | 438 for(i=0;i<16; i++){ |
| 439 dc+= src[i-stride]; | |
| 440 } | |
| 441 | |
| 442 dc= 0x01010101*((dc + 16)>>5); | |
| 443 | |
| 444 for(i=0; i<16; i++){ | |
| 445 ((uint32_t*)(src+i*stride))[0]= | |
| 446 ((uint32_t*)(src+i*stride))[1]= | |
| 447 ((uint32_t*)(src+i*stride))[2]= | |
| 448 ((uint32_t*)(src+i*stride))[3]= dc; | |
| 449 } | |
| 450 } | |
| 451 | |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
452 static void pred16x16_left_dc_c(uint8_t *src, int stride){ |
| 1168 | 453 int i, dc=0; |
| 454 | |
| 455 for(i=0;i<16; i++){ | |
| 456 dc+= src[-1+i*stride]; | |
| 457 } | |
| 2967 | 458 |
| 1168 | 459 dc= 0x01010101*((dc + 8)>>4); |
| 460 | |
| 461 for(i=0; i<16; i++){ | |
| 462 ((uint32_t*)(src+i*stride))[0]= | |
| 463 ((uint32_t*)(src+i*stride))[1]= | |
| 464 ((uint32_t*)(src+i*stride))[2]= | |
| 465 ((uint32_t*)(src+i*stride))[3]= dc; | |
| 466 } | |
| 467 } | |
| 468 | |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
469 static void pred16x16_top_dc_c(uint8_t *src, int stride){ |
| 1168 | 470 int i, dc=0; |
| 471 | |
| 472 for(i=0;i<16; i++){ | |
| 473 dc+= src[i-stride]; | |
| 474 } | |
| 475 dc= 0x01010101*((dc + 8)>>4); | |
| 476 | |
| 477 for(i=0; i<16; i++){ | |
| 478 ((uint32_t*)(src+i*stride))[0]= | |
| 479 ((uint32_t*)(src+i*stride))[1]= | |
| 480 ((uint32_t*)(src+i*stride))[2]= | |
| 481 ((uint32_t*)(src+i*stride))[3]= dc; | |
| 482 } | |
| 483 } | |
| 484 | |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
485 static void pred16x16_128_dc_c(uint8_t *src, int stride){ |
| 1168 | 486 int i; |
| 487 | |
| 488 for(i=0; i<16; i++){ | |
| 489 ((uint32_t*)(src+i*stride))[0]= | |
| 490 ((uint32_t*)(src+i*stride))[1]= | |
| 491 ((uint32_t*)(src+i*stride))[2]= | |
| 492 ((uint32_t*)(src+i*stride))[3]= 0x01010101U*128U; | |
| 493 } | |
| 494 } | |
| 495 | |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
496 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
|
497 int i, j, k; |
|
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
498 int a; |
| 4176 | 499 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
|
500 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
|
501 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
|
502 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
|
503 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
|
504 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
|
505 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
|
506 src1 += stride; src2 -= stride; |
|
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
507 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
|
508 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
|
509 } |
| 1234 | 510 if(svq3){ |
| 511 H = ( 5*(H/4) ) / 16; | |
| 512 V = ( 5*(V/4) ) / 16; | |
|
1330
c05c381a9c47
- fix PLANE_PRED8x8 prediction (H/V are swapped, this is correct!)
tmmm
parents:
1322
diff
changeset
|
513 |
|
c05c381a9c47
- fix PLANE_PRED8x8 prediction (H/V are swapped, this is correct!)
tmmm
parents:
1322
diff
changeset
|
514 /* required for 100% accuracy */ |
|
c05c381a9c47
- fix PLANE_PRED8x8 prediction (H/V are swapped, this is correct!)
tmmm
parents:
1322
diff
changeset
|
515 i = H; H = V; V = i; |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
516 }else if(rv40){ |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
517 H = ( H + (H>>2) ) >> 4; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
518 V = ( V + (V>>2) ) >> 4; |
| 1234 | 519 }else{ |
| 520 H = ( 5*H+32 ) >> 6; | |
| 521 V = ( 5*V+32 ) >> 6; | |
| 522 } | |
|
1184
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
523 |
|
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
524 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
|
525 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
|
526 int b = a; |
|
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
527 a += V; |
|
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
528 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
|
529 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
|
530 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
|
531 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
|
532 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
|
533 b += 4*H; |
| 1168 | 534 } |
|
1184
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
535 src += stride; |
|
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
536 } |
| 1168 | 537 } |
| 538 | |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
539 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
|
540 pred16x16_plane_compat_c(src, stride, 0, 0); |
| 1234 | 541 } |
| 542 | |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
543 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
|
544 pred16x16_plane_compat_c(src, stride, 1, 0); |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
545 } |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
546 |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
547 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
|
548 pred16x16_plane_compat_c(src, stride, 0, 1); |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
549 } |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
550 |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
551 static void pred8x8_vertical_c(uint8_t *src, int stride){ |
| 1168 | 552 int i; |
| 553 const uint32_t a= ((uint32_t*)(src-stride))[0]; | |
| 554 const uint32_t b= ((uint32_t*)(src-stride))[1]; | |
| 2967 | 555 |
| 1168 | 556 for(i=0; i<8; i++){ |
| 557 ((uint32_t*)(src+i*stride))[0]= a; | |
| 558 ((uint32_t*)(src+i*stride))[1]= b; | |
| 559 } | |
| 560 } | |
| 561 | |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
562 static void pred8x8_horizontal_c(uint8_t *src, int stride){ |
| 1168 | 563 int i; |
| 564 | |
| 565 for(i=0; i<8; i++){ | |
| 566 ((uint32_t*)(src+i*stride))[0]= | |
| 567 ((uint32_t*)(src+i*stride))[1]= src[-1+i*stride]*0x01010101; | |
| 568 } | |
| 569 } | |
| 570 | |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
571 static void pred8x8_128_dc_c(uint8_t *src, int stride){ |
| 1168 | 572 int i; |
| 573 | |
| 2755 | 574 for(i=0; i<8; i++){ |
| 2967 | 575 ((uint32_t*)(src+i*stride))[0]= |
| 1168 | 576 ((uint32_t*)(src+i*stride))[1]= 0x01010101U*128U; |
| 577 } | |
| 578 } | |
| 579 | |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
580 static void pred8x8_left_dc_c(uint8_t *src, int stride){ |
| 1168 | 581 int i; |
| 582 int dc0, dc2; | |
| 583 | |
| 584 dc0=dc2=0; | |
| 585 for(i=0;i<4; i++){ | |
| 586 dc0+= src[-1+i*stride]; | |
| 587 dc2+= src[-1+(i+4)*stride]; | |
| 588 } | |
| 589 dc0= 0x01010101*((dc0 + 2)>>2); | |
| 590 dc2= 0x01010101*((dc2 + 2)>>2); | |
| 591 | |
| 592 for(i=0; i<4; i++){ | |
| 593 ((uint32_t*)(src+i*stride))[0]= | |
| 594 ((uint32_t*)(src+i*stride))[1]= dc0; | |
| 595 } | |
| 596 for(i=4; i<8; i++){ | |
| 597 ((uint32_t*)(src+i*stride))[0]= | |
| 598 ((uint32_t*)(src+i*stride))[1]= dc2; | |
| 599 } | |
| 600 } | |
| 601 | |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
602 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
|
603 int i; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
604 int dc0; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
605 |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
606 dc0=0; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
607 for(i=0;i<8; i++) |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
608 dc0+= src[-1+i*stride]; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
609 dc0= 0x01010101*((dc0 + 4)>>3); |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
610 |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
611 for(i=0; i<8; i++){ |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
612 ((uint32_t*)(src+i*stride))[0]= |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
613 ((uint32_t*)(src+i*stride))[1]= dc0; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
614 } |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
615 } |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
616 |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
617 static void pred8x8_top_dc_c(uint8_t *src, int stride){ |
| 1168 | 618 int i; |
| 619 int dc0, dc1; | |
| 620 | |
| 621 dc0=dc1=0; | |
| 622 for(i=0;i<4; i++){ | |
| 623 dc0+= src[i-stride]; | |
| 624 dc1+= src[4+i-stride]; | |
| 625 } | |
| 626 dc0= 0x01010101*((dc0 + 2)>>2); | |
| 627 dc1= 0x01010101*((dc1 + 2)>>2); | |
| 628 | |
| 629 for(i=0; i<4; i++){ | |
| 630 ((uint32_t*)(src+i*stride))[0]= dc0; | |
| 631 ((uint32_t*)(src+i*stride))[1]= dc1; | |
| 632 } | |
| 633 for(i=4; i<8; i++){ | |
| 634 ((uint32_t*)(src+i*stride))[0]= dc0; | |
| 635 ((uint32_t*)(src+i*stride))[1]= dc1; | |
| 636 } | |
| 637 } | |
| 638 | |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
639 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
|
640 int i; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
641 int dc0; |
| 1168 | 642 |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
643 dc0=0; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
644 for(i=0;i<8; i++) |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
645 dc0+= src[i-stride]; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
646 dc0= 0x01010101*((dc0 + 4)>>3); |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
647 |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
648 for(i=0; i<8; i++){ |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
649 ((uint32_t*)(src+i*stride))[0]= |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
650 ((uint32_t*)(src+i*stride))[1]= dc0; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
651 } |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
652 } |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
653 |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
654 |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
655 static void pred8x8_dc_c(uint8_t *src, int stride){ |
| 1168 | 656 int i; |
| 657 int dc0, dc1, dc2, dc3; | |
| 658 | |
| 659 dc0=dc1=dc2=0; | |
| 660 for(i=0;i<4; i++){ | |
| 661 dc0+= src[-1+i*stride] + src[i-stride]; | |
| 662 dc1+= src[4+i-stride]; | |
| 663 dc2+= src[-1+(i+4)*stride]; | |
| 664 } | |
| 665 dc3= 0x01010101*((dc1 + dc2 + 4)>>3); | |
| 666 dc0= 0x01010101*((dc0 + 4)>>3); | |
| 667 dc1= 0x01010101*((dc1 + 2)>>2); | |
| 668 dc2= 0x01010101*((dc2 + 2)>>2); | |
| 669 | |
| 670 for(i=0; i<4; i++){ | |
| 671 ((uint32_t*)(src+i*stride))[0]= dc0; | |
| 672 ((uint32_t*)(src+i*stride))[1]= dc1; | |
| 673 } | |
| 674 for(i=4; i<8; i++){ | |
| 675 ((uint32_t*)(src+i*stride))[0]= dc2; | |
| 676 ((uint32_t*)(src+i*stride))[1]= dc3; | |
| 677 } | |
| 678 } | |
| 679 | |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
680 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
|
681 int i; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
682 int dc0=0; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
683 |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
684 for(i=0;i<4; i++){ |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
685 dc0+= src[-1+i*stride] + src[i-stride]; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
686 dc0+= src[4+i-stride]; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
687 dc0+= src[-1+(i+4)*stride]; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
688 } |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
689 dc0= 0x01010101*((dc0 + 8)>>4); |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
690 |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
691 for(i=0; i<4; i++){ |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
692 ((uint32_t*)(src+i*stride))[0]= dc0; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
693 ((uint32_t*)(src+i*stride))[1]= dc0; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
694 } |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
695 for(i=4; i<8; i++){ |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
696 ((uint32_t*)(src+i*stride))[0]= dc0; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
697 ((uint32_t*)(src+i*stride))[1]= dc0; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
698 } |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
699 } |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
700 |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
701 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
|
702 int j, k; |
|
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
703 int a; |
| 4176 | 704 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
|
705 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
|
706 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
|
707 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
|
708 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
|
709 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
|
710 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
|
711 src1 += stride; src2 -= stride; |
|
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
712 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
|
713 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
|
714 } |
|
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
715 H = ( 17*H+16 ) >> 5; |
|
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
716 V = ( 17*V+16 ) >> 5; |
|
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
717 |
|
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
718 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
|
719 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
|
720 int b = a; |
|
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
721 a += V; |
|
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
722 src[0] = cm[ (b ) >> 5 ]; |
|
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
723 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
|
724 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
|
725 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
|
726 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
|
727 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
|
728 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
|
729 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
|
730 src += stride; |
|
05a2ac8978ad
faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents:
1177
diff
changeset
|
731 } |
| 1168 | 732 } |
| 733 | |
| 2755 | 734 #define SRC(x,y) src[(x)+(y)*stride] |
| 735 #define PL(y) \ | |
| 736 const int l##y = (SRC(-1,y-1) + 2*SRC(-1,y) + SRC(-1,y+1) + 2) >> 2; | |
| 737 #define PREDICT_8x8_LOAD_LEFT \ | |
| 738 const int l0 = ((has_topleft ? SRC(-1,-1) : SRC(-1,0)) \ | |
| 739 + 2*SRC(-1,0) + SRC(-1,1) + 2) >> 2; \ | |
| 740 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
|
741 const int l7 av_unused = (SRC(-1,6) + 3*SRC(-1,7) + 2) >> 2 |
| 2755 | 742 |
| 743 #define PT(x) \ | |
| 744 const int t##x = (SRC(x-1,-1) + 2*SRC(x,-1) + SRC(x+1,-1) + 2) >> 2; | |
| 745 #define PREDICT_8x8_LOAD_TOP \ | |
| 746 const int t0 = ((has_topleft ? SRC(-1,-1) : SRC(0,-1)) \ | |
| 747 + 2*SRC(0,-1) + SRC(1,-1) + 2) >> 2; \ | |
| 748 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
|
749 const int t7 av_unused = ((has_topright ? SRC(8,-1) : SRC(7,-1)) \ |
| 2757 | 750 + 2*SRC(7,-1) + SRC(6,-1) + 2) >> 2 |
| 2755 | 751 |
| 752 #define PTR(x) \ | |
| 753 t##x = (SRC(x-1,-1) + 2*SRC(x,-1) + SRC(x+1,-1) + 2) >> 2; | |
| 754 #define PREDICT_8x8_LOAD_TOPRIGHT \ | |
| 755 int t8, t9, t10, t11, t12, t13, t14, t15; \ | |
| 756 if(has_topright) { \ | |
| 757 PTR(8) PTR(9) PTR(10) PTR(11) PTR(12) PTR(13) PTR(14) \ | |
| 758 t15 = (SRC(14,-1) + 3*SRC(15,-1) + 2) >> 2; \ | |
| 759 } else t8=t9=t10=t11=t12=t13=t14=t15= SRC(7,-1); | |
| 760 | |
| 761 #define PREDICT_8x8_LOAD_TOPLEFT \ | |
| 2757 | 762 const int lt = (SRC(-1,0) + 2*SRC(-1,-1) + SRC(0,-1) + 2) >> 2 |
| 2755 | 763 |
| 764 #define PREDICT_8x8_DC(v) \ | |
| 765 int y; \ | |
| 766 for( y = 0; y < 8; y++ ) { \ | |
| 767 ((uint32_t*)src)[0] = \ | |
| 768 ((uint32_t*)src)[1] = v; \ | |
| 769 src += stride; \ | |
| 770 } | |
| 771 | |
| 772 static void pred8x8l_128_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
| 773 { | |
| 774 PREDICT_8x8_DC(0x80808080); | |
| 775 } | |
| 776 static void pred8x8l_left_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
| 777 { | |
| 778 PREDICT_8x8_LOAD_LEFT; | |
| 779 const uint32_t dc = ((l0+l1+l2+l3+l4+l5+l6+l7+4) >> 3) * 0x01010101; | |
| 780 PREDICT_8x8_DC(dc); | |
| 781 } | |
| 782 static void pred8x8l_top_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
| 783 { | |
| 784 PREDICT_8x8_LOAD_TOP; | |
| 785 const uint32_t dc = ((t0+t1+t2+t3+t4+t5+t6+t7+4) >> 3) * 0x01010101; | |
| 786 PREDICT_8x8_DC(dc); | |
| 787 } | |
| 788 static void pred8x8l_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
| 789 { | |
| 790 PREDICT_8x8_LOAD_LEFT; | |
| 791 PREDICT_8x8_LOAD_TOP; | |
| 792 const uint32_t dc = ((l0+l1+l2+l3+l4+l5+l6+l7 | |
| 793 +t0+t1+t2+t3+t4+t5+t6+t7+8) >> 4) * 0x01010101; | |
| 794 PREDICT_8x8_DC(dc); | |
| 795 } | |
| 796 static void pred8x8l_horizontal_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
| 797 { | |
| 798 PREDICT_8x8_LOAD_LEFT; | |
| 799 #define ROW(y) ((uint32_t*)(src+y*stride))[0] =\ | |
| 800 ((uint32_t*)(src+y*stride))[1] = 0x01010101 * l##y | |
| 801 ROW(0); ROW(1); ROW(2); ROW(3); ROW(4); ROW(5); ROW(6); ROW(7); | |
| 802 #undef ROW | |
| 803 } | |
| 804 static void pred8x8l_vertical_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
| 805 { | |
| 806 int y; | |
| 807 PREDICT_8x8_LOAD_TOP; | |
| 808 src[0] = t0; | |
| 809 src[1] = t1; | |
| 810 src[2] = t2; | |
| 811 src[3] = t3; | |
| 812 src[4] = t4; | |
| 813 src[5] = t5; | |
| 814 src[6] = t6; | |
| 815 src[7] = t7; | |
| 816 for( y = 1; y < 8; y++ ) | |
| 817 *(uint64_t*)(src+y*stride) = *(uint64_t*)src; | |
| 818 } | |
| 819 static void pred8x8l_down_left_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
| 820 { | |
| 821 PREDICT_8x8_LOAD_TOP; | |
| 822 PREDICT_8x8_LOAD_TOPRIGHT; | |
| 823 SRC(0,0)= (t0 + 2*t1 + t2 + 2) >> 2; | |
| 824 SRC(0,1)=SRC(1,0)= (t1 + 2*t2 + t3 + 2) >> 2; | |
| 825 SRC(0,2)=SRC(1,1)=SRC(2,0)= (t2 + 2*t3 + t4 + 2) >> 2; | |
| 826 SRC(0,3)=SRC(1,2)=SRC(2,1)=SRC(3,0)= (t3 + 2*t4 + t5 + 2) >> 2; | |
| 827 SRC(0,4)=SRC(1,3)=SRC(2,2)=SRC(3,1)=SRC(4,0)= (t4 + 2*t5 + t6 + 2) >> 2; | |
| 828 SRC(0,5)=SRC(1,4)=SRC(2,3)=SRC(3,2)=SRC(4,1)=SRC(5,0)= (t5 + 2*t6 + t7 + 2) >> 2; | |
| 829 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; | |
| 830 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; | |
| 831 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; | |
| 832 SRC(2,7)=SRC(3,6)=SRC(4,5)=SRC(5,4)=SRC(6,3)=SRC(7,2)= (t9 + 2*t10 + t11 + 2) >> 2; | |
| 833 SRC(3,7)=SRC(4,6)=SRC(5,5)=SRC(6,4)=SRC(7,3)= (t10 + 2*t11 + t12 + 2) >> 2; | |
| 834 SRC(4,7)=SRC(5,6)=SRC(6,5)=SRC(7,4)= (t11 + 2*t12 + t13 + 2) >> 2; | |
| 835 SRC(5,7)=SRC(6,6)=SRC(7,5)= (t12 + 2*t13 + t14 + 2) >> 2; | |
| 836 SRC(6,7)=SRC(7,6)= (t13 + 2*t14 + t15 + 2) >> 2; | |
| 837 SRC(7,7)= (t14 + 3*t15 + 2) >> 2; | |
| 838 } | |
| 839 static void pred8x8l_down_right_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
| 840 { | |
| 841 PREDICT_8x8_LOAD_TOP; | |
| 842 PREDICT_8x8_LOAD_LEFT; | |
| 843 PREDICT_8x8_LOAD_TOPLEFT; | |
| 844 SRC(0,7)= (l7 + 2*l6 + l5 + 2) >> 2; | |
| 845 SRC(0,6)=SRC(1,7)= (l6 + 2*l5 + l4 + 2) >> 2; | |
| 846 SRC(0,5)=SRC(1,6)=SRC(2,7)= (l5 + 2*l4 + l3 + 2) >> 2; | |
| 847 SRC(0,4)=SRC(1,5)=SRC(2,6)=SRC(3,7)= (l4 + 2*l3 + l2 + 2) >> 2; | |
| 848 SRC(0,3)=SRC(1,4)=SRC(2,5)=SRC(3,6)=SRC(4,7)= (l3 + 2*l2 + l1 + 2) >> 2; | |
| 849 SRC(0,2)=SRC(1,3)=SRC(2,4)=SRC(3,5)=SRC(4,6)=SRC(5,7)= (l2 + 2*l1 + l0 + 2) >> 2; | |
| 850 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; | |
| 851 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; | |
| 852 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; | |
| 853 SRC(2,0)=SRC(3,1)=SRC(4,2)=SRC(5,3)=SRC(6,4)=SRC(7,5)= (t0 + 2*t1 + t2 + 2) >> 2; | |
| 854 SRC(3,0)=SRC(4,1)=SRC(5,2)=SRC(6,3)=SRC(7,4)= (t1 + 2*t2 + t3 + 2) >> 2; | |
| 855 SRC(4,0)=SRC(5,1)=SRC(6,2)=SRC(7,3)= (t2 + 2*t3 + t4 + 2) >> 2; | |
| 856 SRC(5,0)=SRC(6,1)=SRC(7,2)= (t3 + 2*t4 + t5 + 2) >> 2; | |
| 857 SRC(6,0)=SRC(7,1)= (t4 + 2*t5 + t6 + 2) >> 2; | |
| 858 SRC(7,0)= (t5 + 2*t6 + t7 + 2) >> 2; | |
| 2967 | 859 |
| 2755 | 860 } |
| 861 static void pred8x8l_vertical_right_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
| 862 { | |
| 863 PREDICT_8x8_LOAD_TOP; | |
| 864 PREDICT_8x8_LOAD_LEFT; | |
| 865 PREDICT_8x8_LOAD_TOPLEFT; | |
| 866 SRC(0,6)= (l5 + 2*l4 + l3 + 2) >> 2; | |
| 867 SRC(0,7)= (l6 + 2*l5 + l4 + 2) >> 2; | |
| 868 SRC(0,4)=SRC(1,6)= (l3 + 2*l2 + l1 + 2) >> 2; | |
| 869 SRC(0,5)=SRC(1,7)= (l4 + 2*l3 + l2 + 2) >> 2; | |
| 870 SRC(0,2)=SRC(1,4)=SRC(2,6)= (l1 + 2*l0 + lt + 2) >> 2; | |
| 871 SRC(0,3)=SRC(1,5)=SRC(2,7)= (l2 + 2*l1 + l0 + 2) >> 2; | |
| 872 SRC(0,1)=SRC(1,3)=SRC(2,5)=SRC(3,7)= (l0 + 2*lt + t0 + 2) >> 2; | |
| 873 SRC(0,0)=SRC(1,2)=SRC(2,4)=SRC(3,6)= (lt + t0 + 1) >> 1; | |
| 874 SRC(1,1)=SRC(2,3)=SRC(3,5)=SRC(4,7)= (lt + 2*t0 + t1 + 2) >> 2; | |
| 875 SRC(1,0)=SRC(2,2)=SRC(3,4)=SRC(4,6)= (t0 + t1 + 1) >> 1; | |
| 876 SRC(2,1)=SRC(3,3)=SRC(4,5)=SRC(5,7)= (t0 + 2*t1 + t2 + 2) >> 2; | |
| 877 SRC(2,0)=SRC(3,2)=SRC(4,4)=SRC(5,6)= (t1 + t2 + 1) >> 1; | |
| 878 SRC(3,1)=SRC(4,3)=SRC(5,5)=SRC(6,7)= (t1 + 2*t2 + t3 + 2) >> 2; | |
| 879 SRC(3,0)=SRC(4,2)=SRC(5,4)=SRC(6,6)= (t2 + t3 + 1) >> 1; | |
| 880 SRC(4,1)=SRC(5,3)=SRC(6,5)=SRC(7,7)= (t2 + 2*t3 + t4 + 2) >> 2; | |
| 881 SRC(4,0)=SRC(5,2)=SRC(6,4)=SRC(7,6)= (t3 + t4 + 1) >> 1; | |
| 882 SRC(5,1)=SRC(6,3)=SRC(7,5)= (t3 + 2*t4 + t5 + 2) >> 2; | |
| 883 SRC(5,0)=SRC(6,2)=SRC(7,4)= (t4 + t5 + 1) >> 1; | |
| 884 SRC(6,1)=SRC(7,3)= (t4 + 2*t5 + t6 + 2) >> 2; | |
| 885 SRC(6,0)=SRC(7,2)= (t5 + t6 + 1) >> 1; | |
| 886 SRC(7,1)= (t5 + 2*t6 + t7 + 2) >> 2; | |
| 887 SRC(7,0)= (t6 + t7 + 1) >> 1; | |
| 888 } | |
| 889 static void pred8x8l_horizontal_down_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
| 890 { | |
| 891 PREDICT_8x8_LOAD_TOP; | |
| 892 PREDICT_8x8_LOAD_LEFT; | |
| 893 PREDICT_8x8_LOAD_TOPLEFT; | |
| 894 SRC(0,7)= (l6 + l7 + 1) >> 1; | |
| 895 SRC(1,7)= (l5 + 2*l6 + l7 + 2) >> 2; | |
| 896 SRC(0,6)=SRC(2,7)= (l5 + l6 + 1) >> 1; | |
| 897 SRC(1,6)=SRC(3,7)= (l4 + 2*l5 + l6 + 2) >> 2; | |
| 898 SRC(0,5)=SRC(2,6)=SRC(4,7)= (l4 + l5 + 1) >> 1; | |
| 899 SRC(1,5)=SRC(3,6)=SRC(5,7)= (l3 + 2*l4 + l5 + 2) >> 2; | |
| 900 SRC(0,4)=SRC(2,5)=SRC(4,6)=SRC(6,7)= (l3 + l4 + 1) >> 1; | |
| 901 SRC(1,4)=SRC(3,5)=SRC(5,6)=SRC(7,7)= (l2 + 2*l3 + l4 + 2) >> 2; | |
| 902 SRC(0,3)=SRC(2,4)=SRC(4,5)=SRC(6,6)= (l2 + l3 + 1) >> 1; | |
| 903 SRC(1,3)=SRC(3,4)=SRC(5,5)=SRC(7,6)= (l1 + 2*l2 + l3 + 2) >> 2; | |
| 904 SRC(0,2)=SRC(2,3)=SRC(4,4)=SRC(6,5)= (l1 + l2 + 1) >> 1; | |
| 905 SRC(1,2)=SRC(3,3)=SRC(5,4)=SRC(7,5)= (l0 + 2*l1 + l2 + 2) >> 2; | |
| 906 SRC(0,1)=SRC(2,2)=SRC(4,3)=SRC(6,4)= (l0 + l1 + 1) >> 1; | |
| 907 SRC(1,1)=SRC(3,2)=SRC(5,3)=SRC(7,4)= (lt + 2*l0 + l1 + 2) >> 2; | |
| 908 SRC(0,0)=SRC(2,1)=SRC(4,2)=SRC(6,3)= (lt + l0 + 1) >> 1; | |
| 909 SRC(1,0)=SRC(3,1)=SRC(5,2)=SRC(7,3)= (l0 + 2*lt + t0 + 2) >> 2; | |
| 910 SRC(2,0)=SRC(4,1)=SRC(6,2)= (t1 + 2*t0 + lt + 2) >> 2; | |
| 911 SRC(3,0)=SRC(5,1)=SRC(7,2)= (t2 + 2*t1 + t0 + 2) >> 2; | |
| 912 SRC(4,0)=SRC(6,1)= (t3 + 2*t2 + t1 + 2) >> 2; | |
| 913 SRC(5,0)=SRC(7,1)= (t4 + 2*t3 + t2 + 2) >> 2; | |
| 914 SRC(6,0)= (t5 + 2*t4 + t3 + 2) >> 2; | |
| 915 SRC(7,0)= (t6 + 2*t5 + t4 + 2) >> 2; | |
| 916 } | |
| 917 static void pred8x8l_vertical_left_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
| 918 { | |
| 919 PREDICT_8x8_LOAD_TOP; | |
| 920 PREDICT_8x8_LOAD_TOPRIGHT; | |
| 921 SRC(0,0)= (t0 + t1 + 1) >> 1; | |
| 922 SRC(0,1)= (t0 + 2*t1 + t2 + 2) >> 2; | |
| 923 SRC(0,2)=SRC(1,0)= (t1 + t2 + 1) >> 1; | |
| 924 SRC(0,3)=SRC(1,1)= (t1 + 2*t2 + t3 + 2) >> 2; | |
| 925 SRC(0,4)=SRC(1,2)=SRC(2,0)= (t2 + t3 + 1) >> 1; | |
| 926 SRC(0,5)=SRC(1,3)=SRC(2,1)= (t2 + 2*t3 + t4 + 2) >> 2; | |
| 927 SRC(0,6)=SRC(1,4)=SRC(2,2)=SRC(3,0)= (t3 + t4 + 1) >> 1; | |
| 928 SRC(0,7)=SRC(1,5)=SRC(2,3)=SRC(3,1)= (t3 + 2*t4 + t5 + 2) >> 2; | |
| 929 SRC(1,6)=SRC(2,4)=SRC(3,2)=SRC(4,0)= (t4 + t5 + 1) >> 1; | |
| 930 SRC(1,7)=SRC(2,5)=SRC(3,3)=SRC(4,1)= (t4 + 2*t5 + t6 + 2) >> 2; | |
| 931 SRC(2,6)=SRC(3,4)=SRC(4,2)=SRC(5,0)= (t5 + t6 + 1) >> 1; | |
| 932 SRC(2,7)=SRC(3,5)=SRC(4,3)=SRC(5,1)= (t5 + 2*t6 + t7 + 2) >> 2; | |
| 933 SRC(3,6)=SRC(4,4)=SRC(5,2)=SRC(6,0)= (t6 + t7 + 1) >> 1; | |
| 934 SRC(3,7)=SRC(4,5)=SRC(5,3)=SRC(6,1)= (t6 + 2*t7 + t8 + 2) >> 2; | |
| 935 SRC(4,6)=SRC(5,4)=SRC(6,2)=SRC(7,0)= (t7 + t8 + 1) >> 1; | |
| 936 SRC(4,7)=SRC(5,5)=SRC(6,3)=SRC(7,1)= (t7 + 2*t8 + t9 + 2) >> 2; | |
| 937 SRC(5,6)=SRC(6,4)=SRC(7,2)= (t8 + t9 + 1) >> 1; | |
| 938 SRC(5,7)=SRC(6,5)=SRC(7,3)= (t8 + 2*t9 + t10 + 2) >> 2; | |
| 939 SRC(6,6)=SRC(7,4)= (t9 + t10 + 1) >> 1; | |
| 940 SRC(6,7)=SRC(7,5)= (t9 + 2*t10 + t11 + 2) >> 2; | |
| 941 SRC(7,6)= (t10 + t11 + 1) >> 1; | |
| 942 SRC(7,7)= (t10 + 2*t11 + t12 + 2) >> 2; | |
| 943 } | |
| 944 static void pred8x8l_horizontal_up_c(uint8_t *src, int has_topleft, int has_topright, int stride) | |
| 945 { | |
| 946 PREDICT_8x8_LOAD_LEFT; | |
| 947 SRC(0,0)= (l0 + l1 + 1) >> 1; | |
| 948 SRC(1,0)= (l0 + 2*l1 + l2 + 2) >> 2; | |
| 949 SRC(0,1)=SRC(2,0)= (l1 + l2 + 1) >> 1; | |
| 950 SRC(1,1)=SRC(3,0)= (l1 + 2*l2 + l3 + 2) >> 2; | |
| 951 SRC(0,2)=SRC(2,1)=SRC(4,0)= (l2 + l3 + 1) >> 1; | |
| 952 SRC(1,2)=SRC(3,1)=SRC(5,0)= (l2 + 2*l3 + l4 + 2) >> 2; | |
| 953 SRC(0,3)=SRC(2,2)=SRC(4,1)=SRC(6,0)= (l3 + l4 + 1) >> 1; | |
| 954 SRC(1,3)=SRC(3,2)=SRC(5,1)=SRC(7,0)= (l3 + 2*l4 + l5 + 2) >> 2; | |
| 955 SRC(0,4)=SRC(2,3)=SRC(4,2)=SRC(6,1)= (l4 + l5 + 1) >> 1; | |
| 956 SRC(1,4)=SRC(3,3)=SRC(5,2)=SRC(7,1)= (l4 + 2*l5 + l6 + 2) >> 2; | |
| 957 SRC(0,5)=SRC(2,4)=SRC(4,3)=SRC(6,2)= (l5 + l6 + 1) >> 1; | |
| 958 SRC(1,5)=SRC(3,4)=SRC(5,3)=SRC(7,2)= (l5 + 2*l6 + l7 + 2) >> 2; | |
| 959 SRC(0,6)=SRC(2,5)=SRC(4,4)=SRC(6,3)= (l6 + l7 + 1) >> 1; | |
| 960 SRC(1,6)=SRC(3,5)=SRC(5,4)=SRC(7,3)= (l6 + 3*l7 + 2) >> 2; | |
| 961 SRC(0,7)=SRC(1,7)=SRC(2,6)=SRC(2,7)=SRC(3,6)= | |
| 962 SRC(3,7)=SRC(4,5)=SRC(4,6)=SRC(4,7)=SRC(5,5)= | |
| 963 SRC(5,6)=SRC(5,7)=SRC(6,4)=SRC(6,5)=SRC(6,6)= | |
| 964 SRC(6,7)=SRC(7,4)=SRC(7,5)=SRC(7,6)=SRC(7,7)= l7; | |
| 965 } | |
| 966 #undef PREDICT_8x8_LOAD_LEFT | |
| 967 #undef PREDICT_8x8_LOAD_TOP | |
| 968 #undef PREDICT_8x8_LOAD_TOPLEFT | |
| 969 #undef PREDICT_8x8_LOAD_TOPRIGHT | |
| 970 #undef PREDICT_8x8_DC | |
| 971 #undef PTR | |
| 972 #undef PT | |
| 973 #undef PL | |
| 974 #undef SRC | |
| 975 | |
| 1168 | 976 /** |
| 977 * Sets the intra prediction function pointers. | |
| 978 */ | |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
979 void ff_h264_pred_init(H264PredContext *h, int codec_id){ |
| 1168 | 980 // MpegEncContext * const s = &h->s; |
| 981 | |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
982 if(codec_id != CODEC_ID_RV40){ |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
983 h->pred4x4[VERT_PRED ]= pred4x4_vertical_c; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
984 h->pred4x4[HOR_PRED ]= pred4x4_horizontal_c; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
985 h->pred4x4[DC_PRED ]= pred4x4_dc_c; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
986 if(codec_id == CODEC_ID_SVQ3) |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
987 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
|
988 else |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
989 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
|
990 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
|
991 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
|
992 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
|
993 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
|
994 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
|
995 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
|
996 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
|
997 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
|
998 }else{ |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
999 h->pred4x4[VERT_PRED ]= pred4x4_vertical_c; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1000 h->pred4x4[HOR_PRED ]= pred4x4_horizontal_c; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1001 h->pred4x4[DC_PRED ]= pred4x4_dc_c; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1002 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
|
1003 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
|
1004 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
|
1005 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
|
1006 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
|
1007 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
|
1008 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
|
1009 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
|
1010 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
|
1011 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
|
1012 h->pred4x4[HOR_UP_PRED_RV40_NODOWN]= pred4x4_horizontal_up_rv40_nodown_c; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1013 } |
| 1168 | 1014 |
| 2755 | 1015 h->pred8x8l[VERT_PRED ]= pred8x8l_vertical_c; |
| 1016 h->pred8x8l[HOR_PRED ]= pred8x8l_horizontal_c; | |
| 1017 h->pred8x8l[DC_PRED ]= pred8x8l_dc_c; | |
| 1018 h->pred8x8l[DIAG_DOWN_LEFT_PRED ]= pred8x8l_down_left_c; | |
| 1019 h->pred8x8l[DIAG_DOWN_RIGHT_PRED]= pred8x8l_down_right_c; | |
| 1020 h->pred8x8l[VERT_RIGHT_PRED ]= pred8x8l_vertical_right_c; | |
| 1021 h->pred8x8l[HOR_DOWN_PRED ]= pred8x8l_horizontal_down_c; | |
| 1022 h->pred8x8l[VERT_LEFT_PRED ]= pred8x8l_vertical_left_c; | |
| 1023 h->pred8x8l[HOR_UP_PRED ]= pred8x8l_horizontal_up_c; | |
| 1024 h->pred8x8l[LEFT_DC_PRED ]= pred8x8l_left_dc_c; | |
| 1025 h->pred8x8l[TOP_DC_PRED ]= pred8x8l_top_dc_c; | |
| 1026 h->pred8x8l[DC_128_PRED ]= pred8x8l_128_dc_c; | |
| 1027 | |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1028 h->pred8x8[VERT_PRED8x8 ]= pred8x8_vertical_c; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1029 h->pred8x8[HOR_PRED8x8 ]= pred8x8_horizontal_c; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1030 h->pred8x8[PLANE_PRED8x8 ]= pred8x8_plane_c; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1031 if(codec_id != CODEC_ID_RV40){ |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1032 h->pred8x8[DC_PRED8x8 ]= pred8x8_dc_c; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1033 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
|
1034 h->pred8x8[TOP_DC_PRED8x8 ]= pred8x8_top_dc_c; |
|
3105
2d35fb3cb940
h264: special case dc-only idct. ~1% faster overall
lorenm
parents:
3101
diff
changeset
|
1035 }else{ |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1036 h->pred8x8[DC_PRED8x8 ]= pred8x8_dc_rv40_c; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1037 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
|
1038 h->pred8x8[TOP_DC_PRED8x8 ]= pred8x8_top_dc_rv40_c; |
| 1168 | 1039 } |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1040 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
|
1041 |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1042 h->pred16x16[DC_PRED8x8 ]= pred16x16_dc_c; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1043 h->pred16x16[VERT_PRED8x8 ]= pred16x16_vertical_c; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1044 h->pred16x16[HOR_PRED8x8 ]= pred16x16_horizontal_c; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1045 h->pred16x16[PLANE_PRED8x8 ]= pred16x16_plane_c; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1046 switch(codec_id){ |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1047 case CODEC_ID_SVQ3: |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1048 h->pred16x16[PLANE_PRED8x8 ]= pred16x16_plane_svq3_c; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1049 break; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1050 case CODEC_ID_RV40: |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1051 h->pred16x16[PLANE_PRED8x8 ]= pred16x16_plane_rv40_c; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1052 break; |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1053 default: |
|
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1054 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
|
1055 } |
|
5638
4a26dc4ca11d
Move H.264 intra prediction functions into their own context
kostya
parents:
5631
diff
changeset
|
1056 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
|
1057 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
|
1058 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
|
1059 } |
