annotate h264pred.c @ 9497:cb387dff812d libavcodec

Change buffer check to avoid an unlikely pointer arithmetic overflow.
author reimar
date Fri, 17 Apr 2009 19:49:55 +0000
parents 350827602d26
children f52d07b169b4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
1 /*
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
2 * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
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
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3927
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
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
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
15 * Lesser General Public License for more details.
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
16 *
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 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
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
20 */
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
21
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
22 /**
8718
e9d9d946f213 Use full internal pathname in doxygen @file directives.
diego
parents: 8373
diff changeset
23 * @file libavcodec/h264pred.c
5638
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
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
25 * @author Michael Niedermayer <michaelni@gmx.at>
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
26 */
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
27
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
28 #include "avcodec.h"
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
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
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
31
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
32 static void pred4x4_vertical_c(uint8_t *src, uint8_t *topright, int stride){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
33 const uint32_t a= ((uint32_t*)(src-stride))[0];
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
34 ((uint32_t*)(src+0*stride))[0]= a;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
35 ((uint32_t*)(src+1*stride))[0]= a;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
36 ((uint32_t*)(src+2*stride))[0]= a;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
37 ((uint32_t*)(src+3*stride))[0]= a;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
38 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
39
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
40 static void pred4x4_horizontal_c(uint8_t *src, uint8_t *topright, int stride){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
41 ((uint32_t*)(src+0*stride))[0]= src[-1+0*stride]*0x01010101;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
42 ((uint32_t*)(src+1*stride))[0]= src[-1+1*stride]*0x01010101;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
43 ((uint32_t*)(src+2*stride))[0]= src[-1+2*stride]*0x01010101;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
44 ((uint32_t*)(src+3*stride))[0]= src[-1+3*stride]*0x01010101;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
45 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
46
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
47 static void pred4x4_dc_c(uint8_t *src, uint8_t *topright, int stride){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
48 const int dc= ( src[-stride] + src[1-stride] + src[2-stride] + src[3-stride]
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
49 + src[-1+0*stride] + src[-1+1*stride] + src[-1+2*stride] + src[-1+3*stride] + 4) >>3;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
50
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
51 ((uint32_t*)(src+0*stride))[0]=
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
52 ((uint32_t*)(src+1*stride))[0]=
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
53 ((uint32_t*)(src+2*stride))[0]=
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
54 ((uint32_t*)(src+3*stride))[0]= dc* 0x01010101;
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
55 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
56
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
57 static void pred4x4_left_dc_c(uint8_t *src, uint8_t *topright, int stride){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
58 const int dc= ( src[-1+0*stride] + src[-1+1*stride] + src[-1+2*stride] + src[-1+3*stride] + 2) >>2;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
59
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
60 ((uint32_t*)(src+0*stride))[0]=
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
61 ((uint32_t*)(src+1*stride))[0]=
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
62 ((uint32_t*)(src+2*stride))[0]=
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
63 ((uint32_t*)(src+3*stride))[0]= dc* 0x01010101;
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
64 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
65
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
66 static void pred4x4_top_dc_c(uint8_t *src, uint8_t *topright, int stride){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
67 const int dc= ( src[-stride] + src[1-stride] + src[2-stride] + src[3-stride] + 2) >>2;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
68
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
69 ((uint32_t*)(src+0*stride))[0]=
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
70 ((uint32_t*)(src+1*stride))[0]=
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
71 ((uint32_t*)(src+2*stride))[0]=
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
72 ((uint32_t*)(src+3*stride))[0]= dc* 0x01010101;
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
73 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
74
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
75 static void pred4x4_128_dc_c(uint8_t *src, uint8_t *topright, int stride){
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
76 ((uint32_t*)(src+0*stride))[0]=
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
77 ((uint32_t*)(src+1*stride))[0]=
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
78 ((uint32_t*)(src+2*stride))[0]=
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
79 ((uint32_t*)(src+3*stride))[0]= 128U*0x01010101U;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
80 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
81
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
82
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
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
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
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
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
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
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
100
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
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
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
106
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
107 static void pred4x4_down_right_c(uint8_t *src, uint8_t *topright, int stride){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
108 const int lt= src[-1-1*stride];
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
109 LOAD_TOP_EDGE
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
110 LOAD_LEFT_EDGE
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
111
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
112 src[0+3*stride]=(l3 + 2*l2 + l1 + 2)>>2;
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
113 src[0+2*stride]=
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
114 src[1+3*stride]=(l2 + 2*l1 + l0 + 2)>>2;
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
115 src[0+1*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
116 src[1+2*stride]=
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
117 src[2+3*stride]=(l1 + 2*l0 + lt + 2)>>2;
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
118 src[0+0*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
119 src[1+1*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
120 src[2+2*stride]=
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
121 src[3+3*stride]=(l0 + 2*lt + t0 + 2)>>2;
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
122 src[1+0*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
123 src[2+1*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
124 src[3+2*stride]=(lt + 2*t0 + t1 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
125 src[2+0*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
126 src[3+1*stride]=(t0 + 2*t1 + t2 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
127 src[3+0*stride]=(t1 + 2*t2 + t3 + 2)>>2;
1282
8988af3ae1e8 Warning and compatibility fixes.
mellum
parents: 1269
diff changeset
128 }
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
129
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
130 static void pred4x4_down_left_c(uint8_t *src, uint8_t *topright, int stride){
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
131 LOAD_TOP_EDGE
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
132 LOAD_TOP_RIGHT_EDGE
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
133 // LOAD_LEFT_EDGE
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
134
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
135 src[0+0*stride]=(t0 + t2 + 2*t1 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
136 src[1+0*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
137 src[0+1*stride]=(t1 + t3 + 2*t2 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
138 src[2+0*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
139 src[1+1*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
140 src[0+2*stride]=(t2 + t4 + 2*t3 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
141 src[3+0*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
142 src[2+1*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
143 src[1+2*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
144 src[0+3*stride]=(t3 + t5 + 2*t4 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
145 src[3+1*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
146 src[2+2*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
147 src[1+3*stride]=(t4 + t6 + 2*t5 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
148 src[3+2*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
149 src[2+3*stride]=(t5 + t7 + 2*t6 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
150 src[3+3*stride]=(t6 + 3*t7 + 2)>>2;
1282
8988af3ae1e8 Warning and compatibility fixes.
mellum
parents: 1269
diff changeset
151 }
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
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_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
202 LOAD_TOP_EDGE
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
203 LOAD_TOP_RIGHT_EDGE
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
204 LOAD_LEFT_EDGE
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
205
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
206 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
207 src[1+0*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
208 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
209 src[2+0*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
210 src[1+1*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
211 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
212 src[3+0*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
213 src[2+1*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
214 src[1+2*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
215 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
216 src[3+1*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
217 src[2+2*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
218 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
219 src[3+2*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
220 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
221 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
222 }
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
223
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
224 static void pred4x4_vertical_right_c(uint8_t *src, uint8_t *topright, int stride){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
225 const int lt= src[-1-1*stride];
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
226 LOAD_TOP_EDGE
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
227 LOAD_LEFT_EDGE
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
228
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
229 src[0+0*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
230 src[1+2*stride]=(lt + t0 + 1)>>1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
231 src[1+0*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
232 src[2+2*stride]=(t0 + t1 + 1)>>1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
233 src[2+0*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
234 src[3+2*stride]=(t1 + t2 + 1)>>1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
235 src[3+0*stride]=(t2 + t3 + 1)>>1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
236 src[0+1*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
237 src[1+3*stride]=(l0 + 2*lt + t0 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
238 src[1+1*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
239 src[2+3*stride]=(lt + 2*t0 + t1 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
240 src[2+1*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
241 src[3+3*stride]=(t0 + 2*t1 + t2 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
242 src[3+1*stride]=(t1 + 2*t2 + t3 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
243 src[0+2*stride]=(lt + 2*l0 + l1 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
244 src[0+3*stride]=(l0 + 2*l1 + l2 + 2)>>2;
1282
8988af3ae1e8 Warning and compatibility fixes.
mellum
parents: 1269
diff changeset
245 }
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
246
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
247 static void pred4x4_vertical_left_c(uint8_t *src, uint8_t *topright, int stride){
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
248 LOAD_TOP_EDGE
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
249 LOAD_TOP_RIGHT_EDGE
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
250
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
251 src[0+0*stride]=(t0 + t1 + 1)>>1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
252 src[1+0*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
253 src[0+2*stride]=(t1 + t2 + 1)>>1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
254 src[2+0*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
255 src[1+2*stride]=(t2 + t3 + 1)>>1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
256 src[3+0*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
257 src[2+2*stride]=(t3 + t4+ 1)>>1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
258 src[3+2*stride]=(t4 + t5+ 1)>>1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
259 src[0+1*stride]=(t0 + 2*t1 + t2 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
260 src[1+1*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
261 src[0+3*stride]=(t1 + 2*t2 + t3 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
262 src[2+1*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
263 src[1+3*stride]=(t2 + 2*t3 + t4 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
264 src[3+1*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
265 src[2+3*stride]=(t3 + 2*t4 + t5 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
266 src[3+3*stride]=(t4 + 2*t5 + t6 + 2)>>2;
1282
8988af3ae1e8 Warning and compatibility fixes.
mellum
parents: 1269
diff changeset
267 }
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
268
6036
ce3b68242317 Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents: 5638
diff changeset
269 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
270 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
271 LOAD_TOP_EDGE
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
272 LOAD_TOP_RIGHT_EDGE
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
273
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
274 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
275 src[1+0*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
276 src[0+2*stride]=(t1 + t2 + 1)>>1;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
277 src[2+0*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
278 src[1+2*stride]=(t2 + t3 + 1)>>1;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
279 src[3+0*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
280 src[2+2*stride]=(t3 + t4+ 1)>>1;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
281 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
282 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
283 src[1+1*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
284 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
285 src[2+1*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
286 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
287 src[3+1*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
288 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
289 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
290 }
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
291
6036
ce3b68242317 Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents: 5638
diff changeset
292 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
293 LOAD_LEFT_EDGE
ce3b68242317 Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents: 5638
diff changeset
294 LOAD_DOWN_LEFT_EDGE
ce3b68242317 Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents: 5638
diff changeset
295
ce3b68242317 Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents: 5638
diff changeset
296 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
297 }
ce3b68242317 Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents: 5638
diff changeset
298
ce3b68242317 Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents: 5638
diff changeset
299 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
300 LOAD_LEFT_EDGE
ce3b68242317 Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents: 5638
diff changeset
301
ce3b68242317 Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents: 5638
diff changeset
302 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
303 }
ce3b68242317 Correct spatial prediction mode in RV30/40 for vertical left direction
kostya
parents: 5638
diff changeset
304
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
305 static void pred4x4_horizontal_up_c(uint8_t *src, uint8_t *topright, int stride){
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
306 LOAD_LEFT_EDGE
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
307
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
308 src[0+0*stride]=(l0 + l1 + 1)>>1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
309 src[1+0*stride]=(l0 + 2*l1 + l2 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
310 src[2+0*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
311 src[0+1*stride]=(l1 + l2 + 1)>>1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
312 src[3+0*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
313 src[1+1*stride]=(l1 + 2*l2 + l3 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
314 src[2+1*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
315 src[0+2*stride]=(l2 + l3 + 1)>>1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
316 src[3+1*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
317 src[1+2*stride]=(l2 + 2*l3 + l3 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
318 src[3+2*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
319 src[1+3*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
320 src[0+3*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
321 src[2+2*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
322 src[2+3*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
323 src[3+3*stride]=l3;
1282
8988af3ae1e8 Warning and compatibility fixes.
mellum
parents: 1269
diff changeset
324 }
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
325
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
326 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
327 LOAD_LEFT_EDGE
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
328 LOAD_DOWN_LEFT_EDGE
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
329 LOAD_TOP_EDGE
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
330 LOAD_TOP_RIGHT_EDGE
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
331
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
332 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
333 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
334 src[2+0*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
335 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
336 src[3+0*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
337 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
338 src[2+1*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
339 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
340 src[3+1*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
341 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
342 src[3+2*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
343 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
344 src[0+3*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
345 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
346 src[2+3*stride]=(l4 + l5 + 1)>>1;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
347 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
348 }
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
349
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
350 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
351 LOAD_LEFT_EDGE
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
352 LOAD_TOP_EDGE
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
353 LOAD_TOP_RIGHT_EDGE
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
354
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
355 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
356 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
357 src[2+0*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
358 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
359 src[3+0*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
360 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
361 src[2+1*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
362 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
363 src[3+1*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
364 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
365 src[3+2*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
366 src[1+3*stride]=l3;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
367 src[0+3*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
368 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
369 src[2+3*stride]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
370 src[3+3*stride]=l3;
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
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
373 static void pred4x4_horizontal_down_c(uint8_t *src, uint8_t *topright, int stride){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
374 const int lt= src[-1-1*stride];
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
375 LOAD_TOP_EDGE
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
376 LOAD_LEFT_EDGE
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
377
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
378 src[0+0*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
379 src[2+1*stride]=(lt + l0 + 1)>>1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
380 src[1+0*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
381 src[3+1*stride]=(l0 + 2*lt + t0 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
382 src[2+0*stride]=(lt + 2*t0 + t1 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
383 src[3+0*stride]=(t0 + 2*t1 + t2 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
384 src[0+1*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
385 src[2+2*stride]=(l0 + l1 + 1)>>1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
386 src[1+1*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
387 src[3+2*stride]=(lt + 2*l0 + l1 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
388 src[0+2*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
389 src[2+3*stride]=(l1 + l2+ 1)>>1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
390 src[1+2*stride]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
391 src[3+3*stride]=(l0 + 2*l1 + l2 + 2)>>2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
392 src[0+3*stride]=(l2 + l3 + 1)>>1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
393 src[1+3*stride]=(l1 + 2*l2 + l3 + 2)>>2;
1282
8988af3ae1e8 Warning and compatibility fixes.
mellum
parents: 1269
diff changeset
394 }
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
395
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
396 static void pred16x16_vertical_c(uint8_t *src, int stride){
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
397 int i;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
398 const uint32_t a= ((uint32_t*)(src-stride))[0];
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
399 const uint32_t b= ((uint32_t*)(src-stride))[1];
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
400 const uint32_t c= ((uint32_t*)(src-stride))[2];
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
401 const uint32_t d= ((uint32_t*)(src-stride))[3];
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
402
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
403 for(i=0; i<16; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
404 ((uint32_t*)(src+i*stride))[0]= a;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
405 ((uint32_t*)(src+i*stride))[1]= b;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
406 ((uint32_t*)(src+i*stride))[2]= c;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
407 ((uint32_t*)(src+i*stride))[3]= d;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
408 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
409 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
410
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
411 static void pred16x16_horizontal_c(uint8_t *src, int stride){
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
412 int i;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
413
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
414 for(i=0; i<16; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
415 ((uint32_t*)(src+i*stride))[0]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
416 ((uint32_t*)(src+i*stride))[1]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
417 ((uint32_t*)(src+i*stride))[2]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
418 ((uint32_t*)(src+i*stride))[3]= src[-1+i*stride]*0x01010101;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
419 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
420 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
421
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
422 static void pred16x16_dc_c(uint8_t *src, int stride){
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
423 int i, dc=0;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
424
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
425 for(i=0;i<16; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
426 dc+= src[-1+i*stride];
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
427 }
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
428
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
429 for(i=0;i<16; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
430 dc+= src[i-stride];
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
431 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
432
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
433 dc= 0x01010101*((dc + 16)>>5);
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
434
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
435 for(i=0; i<16; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
436 ((uint32_t*)(src+i*stride))[0]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
437 ((uint32_t*)(src+i*stride))[1]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
438 ((uint32_t*)(src+i*stride))[2]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
439 ((uint32_t*)(src+i*stride))[3]= dc;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
440 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
441 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
442
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
443 static void pred16x16_left_dc_c(uint8_t *src, int stride){
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
444 int i, dc=0;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
445
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
446 for(i=0;i<16; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
447 dc+= src[-1+i*stride];
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
448 }
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
449
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
450 dc= 0x01010101*((dc + 8)>>4);
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
451
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
452 for(i=0; i<16; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
453 ((uint32_t*)(src+i*stride))[0]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
454 ((uint32_t*)(src+i*stride))[1]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
455 ((uint32_t*)(src+i*stride))[2]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
456 ((uint32_t*)(src+i*stride))[3]= dc;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
457 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
458 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
459
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
460 static void pred16x16_top_dc_c(uint8_t *src, int stride){
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
461 int i, dc=0;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
462
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
463 for(i=0;i<16; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
464 dc+= src[i-stride];
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
465 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
466 dc= 0x01010101*((dc + 8)>>4);
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
467
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
468 for(i=0; i<16; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
469 ((uint32_t*)(src+i*stride))[0]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
470 ((uint32_t*)(src+i*stride))[1]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
471 ((uint32_t*)(src+i*stride))[2]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
472 ((uint32_t*)(src+i*stride))[3]= dc;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
473 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
474 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
475
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
476 static void pred16x16_128_dc_c(uint8_t *src, int stride){
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
477 int i;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
478
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
479 for(i=0; i<16; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
480 ((uint32_t*)(src+i*stride))[0]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
481 ((uint32_t*)(src+i*stride))[1]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
482 ((uint32_t*)(src+i*stride))[2]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
483 ((uint32_t*)(src+i*stride))[3]= 0x01010101U*128U;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
484 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
485 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
486
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
487 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
488 int i, j, k;
05a2ac8978ad faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents: 1177
diff changeset
489 int a;
4176
23da44e8fd05 rename cropTbl -> ff_cropTbl
mru
parents: 4164
diff changeset
490 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
491 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
492 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
493 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
494 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
495 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
496 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
497 src1 += stride; src2 -= stride;
05a2ac8978ad faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents: 1177
diff changeset
498 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
499 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
500 }
1234
fc2a7eefa9cc svq3 decoder by anonymous
michaelni
parents: 1219
diff changeset
501 if(svq3){
fc2a7eefa9cc svq3 decoder by anonymous
michaelni
parents: 1219
diff changeset
502 H = ( 5*(H/4) ) / 16;
fc2a7eefa9cc svq3 decoder by anonymous
michaelni
parents: 1219
diff changeset
503 V = ( 5*(V/4) ) / 16;
1330
c05c381a9c47 - fix PLANE_PRED8x8 prediction (H/V are swapped, this is correct!)
tmmm
parents: 1322
diff changeset
504
c05c381a9c47 - fix PLANE_PRED8x8 prediction (H/V are swapped, this is correct!)
tmmm
parents: 1322
diff changeset
505 /* required for 100% accuracy */
c05c381a9c47 - fix PLANE_PRED8x8 prediction (H/V are swapped, this is correct!)
tmmm
parents: 1322
diff changeset
506 i = H; H = V; V = i;
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
507 }else if(rv40){
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
508 H = ( H + (H>>2) ) >> 4;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
509 V = ( V + (V>>2) ) >> 4;
1234
fc2a7eefa9cc svq3 decoder by anonymous
michaelni
parents: 1219
diff changeset
510 }else{
fc2a7eefa9cc svq3 decoder by anonymous
michaelni
parents: 1219
diff changeset
511 H = ( 5*H+32 ) >> 6;
fc2a7eefa9cc svq3 decoder by anonymous
michaelni
parents: 1219
diff changeset
512 V = ( 5*V+32 ) >> 6;
fc2a7eefa9cc svq3 decoder by anonymous
michaelni
parents: 1219
diff changeset
513 }
1184
05a2ac8978ad faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents: 1177
diff changeset
514
05a2ac8978ad faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents: 1177
diff changeset
515 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
516 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
517 int b = a;
05a2ac8978ad faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents: 1177
diff changeset
518 a += V;
05a2ac8978ad faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents: 1177
diff changeset
519 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
520 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
521 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
522 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
523 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
524 b += 4*H;
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
525 }
1184
05a2ac8978ad faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents: 1177
diff changeset
526 src += stride;
05a2ac8978ad faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents: 1177
diff changeset
527 }
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
528 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
529
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
530 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
531 pred16x16_plane_compat_c(src, stride, 0, 0);
1234
fc2a7eefa9cc svq3 decoder by anonymous
michaelni
parents: 1219
diff changeset
532 }
fc2a7eefa9cc svq3 decoder by anonymous
michaelni
parents: 1219
diff changeset
533
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
534 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
535 pred16x16_plane_compat_c(src, stride, 1, 0);
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
536 }
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
537
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
538 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
539 pred16x16_plane_compat_c(src, stride, 0, 1);
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
540 }
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
541
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
542 static void pred8x8_vertical_c(uint8_t *src, int stride){
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
543 int i;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
544 const uint32_t a= ((uint32_t*)(src-stride))[0];
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
545 const uint32_t b= ((uint32_t*)(src-stride))[1];
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
546
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
547 for(i=0; i<8; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
548 ((uint32_t*)(src+i*stride))[0]= a;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
549 ((uint32_t*)(src+i*stride))[1]= b;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
550 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
551 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
552
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
553 static void pred8x8_horizontal_c(uint8_t *src, int stride){
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
554 int i;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
555
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
556 for(i=0; i<8; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
557 ((uint32_t*)(src+i*stride))[0]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
558 ((uint32_t*)(src+i*stride))[1]= src[-1+i*stride]*0x01010101;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
559 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
560 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
561
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
562 static void pred8x8_128_dc_c(uint8_t *src, int stride){
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
563 int i;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
564
2755
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
565 for(i=0; i<8; i++){
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
566 ((uint32_t*)(src+i*stride))[0]=
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
567 ((uint32_t*)(src+i*stride))[1]= 0x01010101U*128U;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
568 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
569 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
570
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
571 static void pred8x8_left_dc_c(uint8_t *src, int stride){
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
572 int i;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
573 int dc0, dc2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
574
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
575 dc0=dc2=0;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
576 for(i=0;i<4; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
577 dc0+= src[-1+i*stride];
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
578 dc2+= src[-1+(i+4)*stride];
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
579 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
580 dc0= 0x01010101*((dc0 + 2)>>2);
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
581 dc2= 0x01010101*((dc2 + 2)>>2);
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
582
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
583 for(i=0; i<4; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
584 ((uint32_t*)(src+i*stride))[0]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
585 ((uint32_t*)(src+i*stride))[1]= dc0;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
586 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
587 for(i=4; i<8; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
588 ((uint32_t*)(src+i*stride))[0]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
589 ((uint32_t*)(src+i*stride))[1]= dc2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
590 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
591 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
592
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
593 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
594 int i;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
595 int dc0;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
596
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
597 dc0=0;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
598 for(i=0;i<8; i++)
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
599 dc0+= src[-1+i*stride];
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
600 dc0= 0x01010101*((dc0 + 4)>>3);
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
601
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
602 for(i=0; i<8; i++){
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
603 ((uint32_t*)(src+i*stride))[0]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
604 ((uint32_t*)(src+i*stride))[1]= 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 }
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
607
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
608 static void pred8x8_top_dc_c(uint8_t *src, int stride){
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
609 int i;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
610 int dc0, dc1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
611
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
612 dc0=dc1=0;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
613 for(i=0;i<4; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
614 dc0+= src[i-stride];
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
615 dc1+= src[4+i-stride];
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
616 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
617 dc0= 0x01010101*((dc0 + 2)>>2);
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
618 dc1= 0x01010101*((dc1 + 2)>>2);
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
619
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
620 for(i=0; i<4; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
621 ((uint32_t*)(src+i*stride))[0]= dc0;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
622 ((uint32_t*)(src+i*stride))[1]= dc1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
623 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
624 for(i=4; i<8; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
625 ((uint32_t*)(src+i*stride))[0]= dc0;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
626 ((uint32_t*)(src+i*stride))[1]= dc1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
627 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
628 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
629
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
630 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
631 int i;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
632 int dc0;
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
633
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
634 dc0=0;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
635 for(i=0;i<8; i++)
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
636 dc0+= src[i-stride];
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
637 dc0= 0x01010101*((dc0 + 4)>>3);
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
639 for(i=0; i<8; i++){
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
640 ((uint32_t*)(src+i*stride))[0]=
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
641 ((uint32_t*)(src+i*stride))[1]= dc0;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
642 }
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
643 }
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
644
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
645
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
646 static void pred8x8_dc_c(uint8_t *src, int stride){
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
647 int i;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
648 int dc0, dc1, dc2, dc3;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
649
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
650 dc0=dc1=dc2=0;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
651 for(i=0;i<4; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
652 dc0+= src[-1+i*stride] + src[i-stride];
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
653 dc1+= src[4+i-stride];
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
654 dc2+= src[-1+(i+4)*stride];
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
655 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
656 dc3= 0x01010101*((dc1 + dc2 + 4)>>3);
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
657 dc0= 0x01010101*((dc0 + 4)>>3);
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
658 dc1= 0x01010101*((dc1 + 2)>>2);
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
659 dc2= 0x01010101*((dc2 + 2)>>2);
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
660
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
661 for(i=0; i<4; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
662 ((uint32_t*)(src+i*stride))[0]= dc0;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
663 ((uint32_t*)(src+i*stride))[1]= dc1;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
664 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
665 for(i=4; i<8; i++){
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
666 ((uint32_t*)(src+i*stride))[0]= dc2;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
667 ((uint32_t*)(src+i*stride))[1]= dc3;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
668 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
669 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
670
7532
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
671 //the following 4 function should not be optimized!
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
672 static void pred8x8_mad_cow_dc_l0t(uint8_t *src, int stride){
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
673 pred8x8_top_dc_c(src, stride);
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
674 pred4x4_dc_c(src, NULL, stride);
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
675 }
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
676
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
677 static void pred8x8_mad_cow_dc_0lt(uint8_t *src, int stride){
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
678 pred8x8_dc_c(src, stride);
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
679 pred4x4_top_dc_c(src, NULL, stride);
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
680 }
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
681
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
682 static void pred8x8_mad_cow_dc_l00(uint8_t *src, int stride){
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
683 pred8x8_left_dc_c(src, stride);
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
684 pred4x4_128_dc_c(src + 4*stride , NULL, stride);
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
685 pred4x4_128_dc_c(src + 4*stride + 4, NULL, stride);
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
686 }
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
687
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
688 static void pred8x8_mad_cow_dc_0l0(uint8_t *src, int stride){
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
689 pred8x8_left_dc_c(src, stride);
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
690 pred4x4_128_dc_c(src , NULL, stride);
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
691 pred4x4_128_dc_c(src + 4, NULL, stride);
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
692 }
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
693
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
694 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
695 int i;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
696 int dc0=0;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
697
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
698 for(i=0;i<4; i++){
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
699 dc0+= src[-1+i*stride] + src[i-stride];
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
700 dc0+= src[4+i-stride];
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
701 dc0+= src[-1+(i+4)*stride];
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
702 }
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
703 dc0= 0x01010101*((dc0 + 8)>>4);
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
704
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
705 for(i=0; i<4; i++){
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
706 ((uint32_t*)(src+i*stride))[0]= dc0;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
707 ((uint32_t*)(src+i*stride))[1]= dc0;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
708 }
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
709 for(i=4; i<8; i++){
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
710 ((uint32_t*)(src+i*stride))[0]= dc0;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
711 ((uint32_t*)(src+i*stride))[1]= dc0;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
712 }
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
713 }
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
714
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
715 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
716 int j, k;
05a2ac8978ad faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents: 1177
diff changeset
717 int a;
4176
23da44e8fd05 rename cropTbl -> ff_cropTbl
mru
parents: 4164
diff changeset
718 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
719 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
720 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
721 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
722 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
723 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
724 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
725 src1 += stride; src2 -= stride;
05a2ac8978ad faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents: 1177
diff changeset
726 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
727 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
728 }
05a2ac8978ad faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents: 1177
diff changeset
729 H = ( 17*H+16 ) >> 5;
05a2ac8978ad faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents: 1177
diff changeset
730 V = ( 17*V+16 ) >> 5;
05a2ac8978ad faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents: 1177
diff changeset
731
05a2ac8978ad faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents: 1177
diff changeset
732 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
733 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
734 int b = a;
05a2ac8978ad faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents: 1177
diff changeset
735 a += V;
05a2ac8978ad faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents: 1177
diff changeset
736 src[0] = cm[ (b ) >> 5 ];
05a2ac8978ad faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents: 1177
diff changeset
737 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
738 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
739 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
740 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
741 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
742 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
743 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
744 src += stride;
05a2ac8978ad faster 8x8 & 16x16 plane prediction by skal (massimin at planet-d dot net)
michaelni
parents: 1177
diff changeset
745 }
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
746 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
747
2755
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
748 #define SRC(x,y) src[(x)+(y)*stride]
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
749 #define PL(y) \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
750 const int l##y = (SRC(-1,y-1) + 2*SRC(-1,y) + SRC(-1,y+1) + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
751 #define PREDICT_8x8_LOAD_LEFT \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
752 const int l0 = ((has_topleft ? SRC(-1,-1) : SRC(-1,0)) \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
753 + 2*SRC(-1,0) + SRC(-1,1) + 2) >> 2; \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
754 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
755 const int l7 av_unused = (SRC(-1,6) + 3*SRC(-1,7) + 2) >> 2
2755
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
756
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
757 #define PT(x) \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
758 const int t##x = (SRC(x-1,-1) + 2*SRC(x,-1) + SRC(x+1,-1) + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
759 #define PREDICT_8x8_LOAD_TOP \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
760 const int t0 = ((has_topleft ? SRC(-1,-1) : SRC(0,-1)) \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
761 + 2*SRC(0,-1) + SRC(1,-1) + 2) >> 2; \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
762 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
763 const int t7 av_unused = ((has_topright ? SRC(8,-1) : SRC(7,-1)) \
2757
fa1c8955e291 remove mixed code/declarations
mru
parents: 2755
diff changeset
764 + 2*SRC(7,-1) + SRC(6,-1) + 2) >> 2
2755
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
765
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
766 #define PTR(x) \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
767 t##x = (SRC(x-1,-1) + 2*SRC(x,-1) + SRC(x+1,-1) + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
768 #define PREDICT_8x8_LOAD_TOPRIGHT \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
769 int t8, t9, t10, t11, t12, t13, t14, t15; \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
770 if(has_topright) { \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
771 PTR(8) PTR(9) PTR(10) PTR(11) PTR(12) PTR(13) PTR(14) \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
772 t15 = (SRC(14,-1) + 3*SRC(15,-1) + 2) >> 2; \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
773 } else t8=t9=t10=t11=t12=t13=t14=t15= SRC(7,-1);
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
774
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
775 #define PREDICT_8x8_LOAD_TOPLEFT \
2757
fa1c8955e291 remove mixed code/declarations
mru
parents: 2755
diff changeset
776 const int lt = (SRC(-1,0) + 2*SRC(-1,-1) + SRC(0,-1) + 2) >> 2
2755
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
777
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
778 #define PREDICT_8x8_DC(v) \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
779 int y; \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
780 for( y = 0; y < 8; y++ ) { \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
781 ((uint32_t*)src)[0] = \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
782 ((uint32_t*)src)[1] = v; \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
783 src += stride; \
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
784 }
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
785
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
786 static void pred8x8l_128_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride)
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
787 {
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
788 PREDICT_8x8_DC(0x80808080);
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
789 }
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
790 static void pred8x8l_left_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride)
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
791 {
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
792 PREDICT_8x8_LOAD_LEFT;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
793 const uint32_t dc = ((l0+l1+l2+l3+l4+l5+l6+l7+4) >> 3) * 0x01010101;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
794 PREDICT_8x8_DC(dc);
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
795 }
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
796 static void pred8x8l_top_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride)
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
797 {
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
798 PREDICT_8x8_LOAD_TOP;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
799 const uint32_t dc = ((t0+t1+t2+t3+t4+t5+t6+t7+4) >> 3) * 0x01010101;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
800 PREDICT_8x8_DC(dc);
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
801 }
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
802 static void pred8x8l_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride)
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
803 {
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
804 PREDICT_8x8_LOAD_LEFT;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
805 PREDICT_8x8_LOAD_TOP;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
806 const uint32_t dc = ((l0+l1+l2+l3+l4+l5+l6+l7
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
807 +t0+t1+t2+t3+t4+t5+t6+t7+8) >> 4) * 0x01010101;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
808 PREDICT_8x8_DC(dc);
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
809 }
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
810 static void pred8x8l_horizontal_c(uint8_t *src, int has_topleft, int has_topright, int stride)
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
811 {
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
812 PREDICT_8x8_LOAD_LEFT;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
813 #define ROW(y) ((uint32_t*)(src+y*stride))[0] =\
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
814 ((uint32_t*)(src+y*stride))[1] = 0x01010101 * l##y
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
815 ROW(0); ROW(1); ROW(2); ROW(3); ROW(4); ROW(5); ROW(6); ROW(7);
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
816 #undef ROW
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
817 }
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
818 static void pred8x8l_vertical_c(uint8_t *src, int has_topleft, int has_topright, int stride)
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
819 {
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
820 int y;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
821 PREDICT_8x8_LOAD_TOP;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
822 src[0] = t0;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
823 src[1] = t1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
824 src[2] = t2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
825 src[3] = t3;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
826 src[4] = t4;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
827 src[5] = t5;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
828 src[6] = t6;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
829 src[7] = t7;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
830 for( y = 1; y < 8; y++ )
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
831 *(uint64_t*)(src+y*stride) = *(uint64_t*)src;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
832 }
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
833 static void pred8x8l_down_left_c(uint8_t *src, int has_topleft, int has_topright, int stride)
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
834 {
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
835 PREDICT_8x8_LOAD_TOP;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
836 PREDICT_8x8_LOAD_TOPRIGHT;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
837 SRC(0,0)= (t0 + 2*t1 + t2 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
838 SRC(0,1)=SRC(1,0)= (t1 + 2*t2 + t3 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
839 SRC(0,2)=SRC(1,1)=SRC(2,0)= (t2 + 2*t3 + t4 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
840 SRC(0,3)=SRC(1,2)=SRC(2,1)=SRC(3,0)= (t3 + 2*t4 + t5 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
841 SRC(0,4)=SRC(1,3)=SRC(2,2)=SRC(3,1)=SRC(4,0)= (t4 + 2*t5 + t6 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
842 SRC(0,5)=SRC(1,4)=SRC(2,3)=SRC(3,2)=SRC(4,1)=SRC(5,0)= (t5 + 2*t6 + t7 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
843 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;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
844 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;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
845 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;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
846 SRC(2,7)=SRC(3,6)=SRC(4,5)=SRC(5,4)=SRC(6,3)=SRC(7,2)= (t9 + 2*t10 + t11 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
847 SRC(3,7)=SRC(4,6)=SRC(5,5)=SRC(6,4)=SRC(7,3)= (t10 + 2*t11 + t12 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
848 SRC(4,7)=SRC(5,6)=SRC(6,5)=SRC(7,4)= (t11 + 2*t12 + t13 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
849 SRC(5,7)=SRC(6,6)=SRC(7,5)= (t12 + 2*t13 + t14 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
850 SRC(6,7)=SRC(7,6)= (t13 + 2*t14 + t15 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
851 SRC(7,7)= (t14 + 3*t15 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
852 }
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
853 static void pred8x8l_down_right_c(uint8_t *src, int has_topleft, int has_topright, int stride)
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
854 {
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
855 PREDICT_8x8_LOAD_TOP;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
856 PREDICT_8x8_LOAD_LEFT;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
857 PREDICT_8x8_LOAD_TOPLEFT;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
858 SRC(0,7)= (l7 + 2*l6 + l5 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
859 SRC(0,6)=SRC(1,7)= (l6 + 2*l5 + l4 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
860 SRC(0,5)=SRC(1,6)=SRC(2,7)= (l5 + 2*l4 + l3 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
861 SRC(0,4)=SRC(1,5)=SRC(2,6)=SRC(3,7)= (l4 + 2*l3 + l2 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
862 SRC(0,3)=SRC(1,4)=SRC(2,5)=SRC(3,6)=SRC(4,7)= (l3 + 2*l2 + l1 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
863 SRC(0,2)=SRC(1,3)=SRC(2,4)=SRC(3,5)=SRC(4,6)=SRC(5,7)= (l2 + 2*l1 + l0 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
864 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;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
865 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;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
866 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;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
867 SRC(2,0)=SRC(3,1)=SRC(4,2)=SRC(5,3)=SRC(6,4)=SRC(7,5)= (t0 + 2*t1 + t2 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
868 SRC(3,0)=SRC(4,1)=SRC(5,2)=SRC(6,3)=SRC(7,4)= (t1 + 2*t2 + t3 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
869 SRC(4,0)=SRC(5,1)=SRC(6,2)=SRC(7,3)= (t2 + 2*t3 + t4 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
870 SRC(5,0)=SRC(6,1)=SRC(7,2)= (t3 + 2*t4 + t5 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
871 SRC(6,0)=SRC(7,1)= (t4 + 2*t5 + t6 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
872 SRC(7,0)= (t5 + 2*t6 + t7 + 2) >> 2;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
873
2755
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
874 }
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
875 static void pred8x8l_vertical_right_c(uint8_t *src, int has_topleft, int has_topright, int stride)
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
876 {
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
877 PREDICT_8x8_LOAD_TOP;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
878 PREDICT_8x8_LOAD_LEFT;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
879 PREDICT_8x8_LOAD_TOPLEFT;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
880 SRC(0,6)= (l5 + 2*l4 + l3 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
881 SRC(0,7)= (l6 + 2*l5 + l4 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
882 SRC(0,4)=SRC(1,6)= (l3 + 2*l2 + l1 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
883 SRC(0,5)=SRC(1,7)= (l4 + 2*l3 + l2 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
884 SRC(0,2)=SRC(1,4)=SRC(2,6)= (l1 + 2*l0 + lt + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
885 SRC(0,3)=SRC(1,5)=SRC(2,7)= (l2 + 2*l1 + l0 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
886 SRC(0,1)=SRC(1,3)=SRC(2,5)=SRC(3,7)= (l0 + 2*lt + t0 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
887 SRC(0,0)=SRC(1,2)=SRC(2,4)=SRC(3,6)= (lt + t0 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
888 SRC(1,1)=SRC(2,3)=SRC(3,5)=SRC(4,7)= (lt + 2*t0 + t1 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
889 SRC(1,0)=SRC(2,2)=SRC(3,4)=SRC(4,6)= (t0 + t1 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
890 SRC(2,1)=SRC(3,3)=SRC(4,5)=SRC(5,7)= (t0 + 2*t1 + t2 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
891 SRC(2,0)=SRC(3,2)=SRC(4,4)=SRC(5,6)= (t1 + t2 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
892 SRC(3,1)=SRC(4,3)=SRC(5,5)=SRC(6,7)= (t1 + 2*t2 + t3 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
893 SRC(3,0)=SRC(4,2)=SRC(5,4)=SRC(6,6)= (t2 + t3 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
894 SRC(4,1)=SRC(5,3)=SRC(6,5)=SRC(7,7)= (t2 + 2*t3 + t4 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
895 SRC(4,0)=SRC(5,2)=SRC(6,4)=SRC(7,6)= (t3 + t4 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
896 SRC(5,1)=SRC(6,3)=SRC(7,5)= (t3 + 2*t4 + t5 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
897 SRC(5,0)=SRC(6,2)=SRC(7,4)= (t4 + t5 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
898 SRC(6,1)=SRC(7,3)= (t4 + 2*t5 + t6 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
899 SRC(6,0)=SRC(7,2)= (t5 + t6 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
900 SRC(7,1)= (t5 + 2*t6 + t7 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
901 SRC(7,0)= (t6 + t7 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
902 }
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
903 static void pred8x8l_horizontal_down_c(uint8_t *src, int has_topleft, int has_topright, int stride)
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
904 {
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
905 PREDICT_8x8_LOAD_TOP;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
906 PREDICT_8x8_LOAD_LEFT;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
907 PREDICT_8x8_LOAD_TOPLEFT;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
908 SRC(0,7)= (l6 + l7 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
909 SRC(1,7)= (l5 + 2*l6 + l7 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
910 SRC(0,6)=SRC(2,7)= (l5 + l6 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
911 SRC(1,6)=SRC(3,7)= (l4 + 2*l5 + l6 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
912 SRC(0,5)=SRC(2,6)=SRC(4,7)= (l4 + l5 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
913 SRC(1,5)=SRC(3,6)=SRC(5,7)= (l3 + 2*l4 + l5 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
914 SRC(0,4)=SRC(2,5)=SRC(4,6)=SRC(6,7)= (l3 + l4 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
915 SRC(1,4)=SRC(3,5)=SRC(5,6)=SRC(7,7)= (l2 + 2*l3 + l4 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
916 SRC(0,3)=SRC(2,4)=SRC(4,5)=SRC(6,6)= (l2 + l3 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
917 SRC(1,3)=SRC(3,4)=SRC(5,5)=SRC(7,6)= (l1 + 2*l2 + l3 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
918 SRC(0,2)=SRC(2,3)=SRC(4,4)=SRC(6,5)= (l1 + l2 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
919 SRC(1,2)=SRC(3,3)=SRC(5,4)=SRC(7,5)= (l0 + 2*l1 + l2 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
920 SRC(0,1)=SRC(2,2)=SRC(4,3)=SRC(6,4)= (l0 + l1 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
921 SRC(1,1)=SRC(3,2)=SRC(5,3)=SRC(7,4)= (lt + 2*l0 + l1 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
922 SRC(0,0)=SRC(2,1)=SRC(4,2)=SRC(6,3)= (lt + l0 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
923 SRC(1,0)=SRC(3,1)=SRC(5,2)=SRC(7,3)= (l0 + 2*lt + t0 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
924 SRC(2,0)=SRC(4,1)=SRC(6,2)= (t1 + 2*t0 + lt + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
925 SRC(3,0)=SRC(5,1)=SRC(7,2)= (t2 + 2*t1 + t0 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
926 SRC(4,0)=SRC(6,1)= (t3 + 2*t2 + t1 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
927 SRC(5,0)=SRC(7,1)= (t4 + 2*t3 + t2 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
928 SRC(6,0)= (t5 + 2*t4 + t3 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
929 SRC(7,0)= (t6 + 2*t5 + t4 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
930 }
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
931 static void pred8x8l_vertical_left_c(uint8_t *src, int has_topleft, int has_topright, int stride)
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
932 {
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
933 PREDICT_8x8_LOAD_TOP;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
934 PREDICT_8x8_LOAD_TOPRIGHT;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
935 SRC(0,0)= (t0 + t1 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
936 SRC(0,1)= (t0 + 2*t1 + t2 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
937 SRC(0,2)=SRC(1,0)= (t1 + t2 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
938 SRC(0,3)=SRC(1,1)= (t1 + 2*t2 + t3 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
939 SRC(0,4)=SRC(1,2)=SRC(2,0)= (t2 + t3 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
940 SRC(0,5)=SRC(1,3)=SRC(2,1)= (t2 + 2*t3 + t4 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
941 SRC(0,6)=SRC(1,4)=SRC(2,2)=SRC(3,0)= (t3 + t4 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
942 SRC(0,7)=SRC(1,5)=SRC(2,3)=SRC(3,1)= (t3 + 2*t4 + t5 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
943 SRC(1,6)=SRC(2,4)=SRC(3,2)=SRC(4,0)= (t4 + t5 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
944 SRC(1,7)=SRC(2,5)=SRC(3,3)=SRC(4,1)= (t4 + 2*t5 + t6 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
945 SRC(2,6)=SRC(3,4)=SRC(4,2)=SRC(5,0)= (t5 + t6 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
946 SRC(2,7)=SRC(3,5)=SRC(4,3)=SRC(5,1)= (t5 + 2*t6 + t7 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
947 SRC(3,6)=SRC(4,4)=SRC(5,2)=SRC(6,0)= (t6 + t7 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
948 SRC(3,7)=SRC(4,5)=SRC(5,3)=SRC(6,1)= (t6 + 2*t7 + t8 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
949 SRC(4,6)=SRC(5,4)=SRC(6,2)=SRC(7,0)= (t7 + t8 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
950 SRC(4,7)=SRC(5,5)=SRC(6,3)=SRC(7,1)= (t7 + 2*t8 + t9 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
951 SRC(5,6)=SRC(6,4)=SRC(7,2)= (t8 + t9 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
952 SRC(5,7)=SRC(6,5)=SRC(7,3)= (t8 + 2*t9 + t10 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
953 SRC(6,6)=SRC(7,4)= (t9 + t10 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
954 SRC(6,7)=SRC(7,5)= (t9 + 2*t10 + t11 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
955 SRC(7,6)= (t10 + t11 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
956 SRC(7,7)= (t10 + 2*t11 + t12 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
957 }
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
958 static void pred8x8l_horizontal_up_c(uint8_t *src, int has_topleft, int has_topright, int stride)
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
959 {
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
960 PREDICT_8x8_LOAD_LEFT;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
961 SRC(0,0)= (l0 + l1 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
962 SRC(1,0)= (l0 + 2*l1 + l2 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
963 SRC(0,1)=SRC(2,0)= (l1 + l2 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
964 SRC(1,1)=SRC(3,0)= (l1 + 2*l2 + l3 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
965 SRC(0,2)=SRC(2,1)=SRC(4,0)= (l2 + l3 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
966 SRC(1,2)=SRC(3,1)=SRC(5,0)= (l2 + 2*l3 + l4 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
967 SRC(0,3)=SRC(2,2)=SRC(4,1)=SRC(6,0)= (l3 + l4 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
968 SRC(1,3)=SRC(3,2)=SRC(5,1)=SRC(7,0)= (l3 + 2*l4 + l5 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
969 SRC(0,4)=SRC(2,3)=SRC(4,2)=SRC(6,1)= (l4 + l5 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
970 SRC(1,4)=SRC(3,3)=SRC(5,2)=SRC(7,1)= (l4 + 2*l5 + l6 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
971 SRC(0,5)=SRC(2,4)=SRC(4,3)=SRC(6,2)= (l5 + l6 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
972 SRC(1,5)=SRC(3,4)=SRC(5,3)=SRC(7,2)= (l5 + 2*l6 + l7 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
973 SRC(0,6)=SRC(2,5)=SRC(4,4)=SRC(6,3)= (l6 + l7 + 1) >> 1;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
974 SRC(1,6)=SRC(3,5)=SRC(5,4)=SRC(7,3)= (l6 + 3*l7 + 2) >> 2;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
975 SRC(0,7)=SRC(1,7)=SRC(2,6)=SRC(2,7)=SRC(3,6)=
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
976 SRC(3,7)=SRC(4,5)=SRC(4,6)=SRC(4,7)=SRC(5,5)=
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
977 SRC(5,6)=SRC(5,7)=SRC(6,4)=SRC(6,5)=SRC(6,6)=
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
978 SRC(6,7)=SRC(7,4)=SRC(7,5)=SRC(7,6)=SRC(7,7)= l7;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
979 }
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
980 #undef PREDICT_8x8_LOAD_LEFT
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
981 #undef PREDICT_8x8_LOAD_TOP
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
982 #undef PREDICT_8x8_LOAD_TOPLEFT
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
983 #undef PREDICT_8x8_LOAD_TOPRIGHT
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
984 #undef PREDICT_8x8_DC
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
985 #undef PTR
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
986 #undef PT
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
987 #undef PL
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
988 #undef SRC
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
989
8349
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
990 static void pred4x4_vertical_add_c(uint8_t *pix, const DCTELEM *block, int stride){
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
991 int i;
8373
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
992 pix -= stride;
8349
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
993 for(i=0; i<4; i++){
8373
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
994 uint8_t v = pix[0];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
995 pix[1*stride]= v += block[0];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
996 pix[2*stride]= v += block[4];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
997 pix[3*stride]= v += block[8];
9486
350827602d26 Remove useless assignments, at least one found by CSA.
michael
parents: 8718
diff changeset
998 pix[4*stride]= v + block[12];
8373
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
999 pix++;
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1000 block++;
8349
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1001 }
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1002 }
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1003
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1004 static void pred4x4_horizontal_add_c(uint8_t *pix, const DCTELEM *block, int stride){
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1005 int i;
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1006 for(i=0; i<4; i++){
8373
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1007 uint8_t v = pix[-1];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1008 pix[0]= v += block[0];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1009 pix[1]= v += block[1];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1010 pix[2]= v += block[2];
9486
350827602d26 Remove useless assignments, at least one found by CSA.
michael
parents: 8718
diff changeset
1011 pix[3]= v + block[3];
8349
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1012 pix+= stride;
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1013 block+= 4;
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1014 }
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1015 }
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1016
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1017 static void pred8x8l_vertical_add_c(uint8_t *pix, const DCTELEM *block, int stride){
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1018 int i;
8373
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1019 pix -= stride;
8349
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1020 for(i=0; i<8; i++){
8373
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1021 uint8_t v = pix[0];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1022 pix[1*stride]= v += block[0];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1023 pix[2*stride]= v += block[8];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1024 pix[3*stride]= v += block[16];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1025 pix[4*stride]= v += block[24];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1026 pix[5*stride]= v += block[32];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1027 pix[6*stride]= v += block[40];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1028 pix[7*stride]= v += block[48];
9486
350827602d26 Remove useless assignments, at least one found by CSA.
michael
parents: 8718
diff changeset
1029 pix[8*stride]= v + block[56];
8373
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1030 pix++;
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1031 block++;
8349
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1032 }
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1033 }
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1034
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1035 static void pred8x8l_horizontal_add_c(uint8_t *pix, const DCTELEM *block, int stride){
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1036 int i;
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1037 for(i=0; i<8; i++){
8373
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1038 uint8_t v = pix[-1];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1039 pix[0]= v += block[0];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1040 pix[1]= v += block[1];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1041 pix[2]= v += block[2];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1042 pix[3]= v += block[3];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1043 pix[4]= v += block[4];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1044 pix[5]= v += block[5];
5961d2deb35f 1.6x faster pred*_vertical_add_c
lorenm
parents: 8349
diff changeset
1045 pix[6]= v += block[6];
9486
350827602d26 Remove useless assignments, at least one found by CSA.
michael
parents: 8718
diff changeset
1046 pix[7]= v + block[7];
8349
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1047 pix+= stride;
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1048 block+= 8;
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1049 }
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1050 }
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1051
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1052 static void pred16x16_vertical_add_c(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1053 int i;
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1054 for(i=0; i<16; i++)
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1055 pred4x4_vertical_add_c(pix + block_offset[i], block + i*16, stride);
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1056 }
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1057
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1058 static void pred16x16_horizontal_add_c(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1059 int i;
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1060 for(i=0; i<16; i++)
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1061 pred4x4_horizontal_add_c(pix + block_offset[i], block + i*16, stride);
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1062 }
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1063
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1064 static void pred8x8_vertical_add_c(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1065 int i;
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1066 for(i=0; i<4; i++)
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1067 pred4x4_vertical_add_c(pix + block_offset[i], block + i*16, stride);
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1068 }
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1069
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1070 static void pred8x8_horizontal_add_c(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1071 int i;
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1072 for(i=0; i<4; i++)
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1073 pred4x4_horizontal_add_c(pix + block_offset[i], block + i*16, stride);
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1074 }
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1075
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1076
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
1077 /**
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
1078 * Sets the intra prediction function pointers.
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
1079 */
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1080 void ff_h264_pred_init(H264PredContext *h, int codec_id){
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
1081 // MpegEncContext * const s = &h->s;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
1082
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1083 if(codec_id != CODEC_ID_RV40){
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1084 h->pred4x4[VERT_PRED ]= pred4x4_vertical_c;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1085 h->pred4x4[HOR_PRED ]= pred4x4_horizontal_c;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1086 h->pred4x4[DC_PRED ]= pred4x4_dc_c;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1087 if(codec_id == CODEC_ID_SVQ3)
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1088 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
1089 else
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1090 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
1091 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
1092 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
1093 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
1094 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
1095 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
1096 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
1097 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
1098 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
1099 }else{
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1100 h->pred4x4[VERT_PRED ]= pred4x4_vertical_c;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1101 h->pred4x4[HOR_PRED ]= pred4x4_horizontal_c;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1102 h->pred4x4[DC_PRED ]= pred4x4_dc_c;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1103 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
1104 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
1105 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
1106 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
1107 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
1108 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
1109 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
1110 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
1111 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
1112 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
1113 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
1114 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
1115 }
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
1116
2755
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
1117 h->pred8x8l[VERT_PRED ]= pred8x8l_vertical_c;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
1118 h->pred8x8l[HOR_PRED ]= pred8x8l_horizontal_c;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
1119 h->pred8x8l[DC_PRED ]= pred8x8l_dc_c;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
1120 h->pred8x8l[DIAG_DOWN_LEFT_PRED ]= pred8x8l_down_left_c;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
1121 h->pred8x8l[DIAG_DOWN_RIGHT_PRED]= pred8x8l_down_right_c;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
1122 h->pred8x8l[VERT_RIGHT_PRED ]= pred8x8l_vertical_right_c;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
1123 h->pred8x8l[HOR_DOWN_PRED ]= pred8x8l_horizontal_down_c;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
1124 h->pred8x8l[VERT_LEFT_PRED ]= pred8x8l_vertical_left_c;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
1125 h->pred8x8l[HOR_UP_PRED ]= pred8x8l_horizontal_up_c;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
1126 h->pred8x8l[LEFT_DC_PRED ]= pred8x8l_left_dc_c;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
1127 h->pred8x8l[TOP_DC_PRED ]= pred8x8l_top_dc_c;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
1128 h->pred8x8l[DC_128_PRED ]= pred8x8l_128_dc_c;
975074f04b95 decode H.264 with 8x8 transform.
lorenm
parents: 2751
diff changeset
1129
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1130 h->pred8x8[VERT_PRED8x8 ]= pred8x8_vertical_c;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1131 h->pred8x8[HOR_PRED8x8 ]= pred8x8_horizontal_c;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1132 h->pred8x8[PLANE_PRED8x8 ]= pred8x8_plane_c;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1133 if(codec_id != CODEC_ID_RV40){
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1134 h->pred8x8[DC_PRED8x8 ]= pred8x8_dc_c;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1135 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
1136 h->pred8x8[TOP_DC_PRED8x8 ]= pred8x8_top_dc_c;
7532
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
1137 h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= pred8x8_mad_cow_dc_l0t;
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
1138 h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= pred8x8_mad_cow_dc_0lt;
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
1139 h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= pred8x8_mad_cow_dc_l00;
c4de4b187b4f Support MBAFF + constrained intra prediction.
michael
parents: 6036
diff changeset
1140 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
1141 }else{
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1142 h->pred8x8[DC_PRED8x8 ]= pred8x8_dc_rv40_c;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1143 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
1144 h->pred8x8[TOP_DC_PRED8x8 ]= pred8x8_top_dc_rv40_c;
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
1145 }
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1146 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
1147
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1148 h->pred16x16[DC_PRED8x8 ]= pred16x16_dc_c;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1149 h->pred16x16[VERT_PRED8x8 ]= pred16x16_vertical_c;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1150 h->pred16x16[HOR_PRED8x8 ]= pred16x16_horizontal_c;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1151 h->pred16x16[PLANE_PRED8x8 ]= pred16x16_plane_c;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1152 switch(codec_id){
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1153 case CODEC_ID_SVQ3:
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1154 h->pred16x16[PLANE_PRED8x8 ]= pred16x16_plane_svq3_c;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1155 break;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1156 case CODEC_ID_RV40:
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1157 h->pred16x16[PLANE_PRED8x8 ]= pred16x16_plane_rv40_c;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1158 break;
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1159 default:
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1160 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
1161 }
5638
4a26dc4ca11d Move H.264 intra prediction functions into their own context
kostya
parents: 5631
diff changeset
1162 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
1163 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
1164 h->pred16x16[DC_128_PRED8x8 ]= pred16x16_128_dc_c;
8349
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1165
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1166 //special lossless h/v prediction for h264
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1167 h->pred4x4_add [VERT_PRED ]= pred4x4_vertical_add_c;
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1168 h->pred4x4_add [ HOR_PRED ]= pred4x4_horizontal_add_c;
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1169 h->pred8x8l_add [VERT_PRED ]= pred8x8l_vertical_add_c;
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1170 h->pred8x8l_add [ HOR_PRED ]= pred8x8l_horizontal_add_c;
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1171 h->pred8x8_add [VERT_PRED8x8]= pred8x8_vertical_add_c;
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1172 h->pred8x8_add [ HOR_PRED8x8]= pred8x8_horizontal_add_c;
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1173 h->pred16x16_add[VERT_PRED8x8]= pred16x16_vertical_add_c;
920ded20b469 Horizontal and vertical prediction functions needed for new lossless mode
michael
parents: 8241
diff changeset
1174 h->pred16x16_add[ HOR_PRED8x8]= pred16x16_horizontal_add_c;
5226
65bffcc5571a Precompute a chroma_qp table with index offset for each pps,
gpoirier
parents: 5225
diff changeset
1175 }