annotate intrax8dsp.c @ 6915:77ce2329f620 libavcodec

redundant
author michael
date Wed, 28 May 2008 01:30:59 +0000
parents fbd10e6dfbe1
children e9d9d946f213
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
1 /*
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
2 * This file is part of FFmpeg.
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
3 *
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
4 * FFmpeg is free software; you can redistribute it and/or
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
5 * modify it under the terms of the GNU Lesser General Public
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
6 * License as published by the Free Software Foundation; either
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
7 * version 2.1 of the License, or (at your option) any later version.
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
8 *
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
9 * FFmpeg is distributed in the hope that it will be useful,
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
12 * Lesser General Public License for more details.
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
13 *
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
14 * You should have received a copy of the GNU Lesser General Public
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
15 * License along with FFmpeg; if not, write to the Free Software
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
17 */
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
18
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
19 /**
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
20 * @file intrax8dsp.c
5906
595a2f31430e misc spelling/grammar/wording fixes in comments
diego
parents: 5890
diff changeset
21 *@brief IntraX8 frame subdecoder image manipulation routines
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
22 */
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
23
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
24 #include "dsputil.h"
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
25
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
26 /*
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
27 area positions, #3 is 1 pixel only, other are 8 pixels
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
28 |66666666|
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
29 3|44444444|55555555|
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
30 - -+--------+--------+
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
31 1 2|XXXXXXXX|
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
32 1 2|XXXXXXXX|
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
33 1 2|XXXXXXXX|
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
34 1 2|XXXXXXXX|
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
35 1 2|XXXXXXXX|
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
36 1 2|XXXXXXXX|
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
37 1 2|XXXXXXXX|
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
38 1 2|XXXXXXXX|
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
39 ^-start
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
40 */
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
41
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
42 #define area1 (0)
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
43 #define area2 (8)
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
44 #define area3 (8+8)
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
45 #define area4 (8+8+1)
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
46 #define area5 (8+8+1+8)
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
47 #define area6 (8+8+1+16)
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
48
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
49 /**
5906
595a2f31430e misc spelling/grammar/wording fixes in comments
diego
parents: 5890
diff changeset
50 Collect statistics and prepare the edge pixels required by the other spatial compensation functions.
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
51
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
52 * @param src pointer to the beginning of the processed block
5906
595a2f31430e misc spelling/grammar/wording fixes in comments
diego
parents: 5890
diff changeset
53 * @param dst pointer to emu_edge, edge pixels are stored the way other compensation routines do.
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
54 * @param linesize byte offset between 2 vertical pixels in the source image
5906
595a2f31430e misc spelling/grammar/wording fixes in comments
diego
parents: 5890
diff changeset
55 * @param range pointer to the variable where the edge pixel range is to be stored (max-min values)
595a2f31430e misc spelling/grammar/wording fixes in comments
diego
parents: 5890
diff changeset
56 * @param psum pointer to the variable where the edge pixel sum is to be stored
595a2f31430e misc spelling/grammar/wording fixes in comments
diego
parents: 5890
diff changeset
57 * @param edges Informs this routine that the block is on an image border, so it has to interpolate the missing edge pixels.
595a2f31430e misc spelling/grammar/wording fixes in comments
diego
parents: 5890
diff changeset
58 and some of the edge pixels should be interpolated, the flag has the following meaning:
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
59 1 - mb_x==0 - first block in the row, interpolate area #1,#2,#3;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
60 2 - mb_y==0 - first row, interpolate area #3,#4,#5,#6;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
61 note: 1|2 - mb_x==mb_y==0 - first block, use 0x80 value for all areas;
5906
595a2f31430e misc spelling/grammar/wording fixes in comments
diego
parents: 5890
diff changeset
62 4 - mb_x>= (mb_width-1) last block in the row, interpolate area #5;
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
63 */
5907
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
64 static void x8_setup_spatial_compensation(uint8_t *src, uint8_t *dst, int linesize,
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
65 int * range, int * psum, int edges){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
66 uint8_t * ptr;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
67 int sum;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
68 int i;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
69 int min_pix,max_pix;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
70 uint8_t c;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
71
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
72 if((edges&3)==3){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
73 *psum=0x80*(8+1+8+2);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
74 *range=0;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
75 memset(dst,0x80,16+1+16+8);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
76 //this triggers flat_dc for sure.
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
77 //flat_dc avoids all (other) prediction modes, but requires dc_level decoding.
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
78 return;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
79 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
80
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
81 min_pix=256;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
82 max_pix=-1;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
83
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
84 sum=0;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
85
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
86 if(!(edges&1)){//(mb_x!=0)//there is previous block on this row
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
87 ptr=src-1;//left column, area 2
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
88 for(i=7;i>=0;i--){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
89 c=*(ptr-1);//area1, same mb as area2, no need to check
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
90 dst[area1+i]=c;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
91 c=*(ptr);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
92
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
93 sum+=c;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
94 min_pix=FFMIN(min_pix,c);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
95 max_pix=FFMAX(max_pix,c);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
96 dst[area2+i]=c;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
97
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
98 ptr+=linesize;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
99 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
100 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
101
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
102 if(!(edges&2)){ //(mb_y!=0)//there is row above
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
103 ptr=src-linesize;//top line
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
104 for(i=0;i<8;i++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
105 c=*(ptr+i);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
106 sum+=c;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
107 min_pix=FFMIN(min_pix, c);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
108 max_pix=FFMAX(max_pix, c);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
109 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
110 if(edges&4){//last block on the row?
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
111 memset(dst+area5,c,8);//set with last pixel fr
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
112 memcpy(dst+area4, ptr, 8);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
113 }else{
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
114 memcpy(dst+area4, ptr, 16);//both area4 and 5
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
115 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
116 memcpy(dst+area6, ptr-linesize, 8);//area6 always present in the above block
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
117 }
5906
595a2f31430e misc spelling/grammar/wording fixes in comments
diego
parents: 5890
diff changeset
118 //now calculate the stuff we need
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
119 if(edges&3){//mb_x==0 || mb_y==0){
5888
55a1e9f82bb7 factorize
michael
parents: 5887
diff changeset
120 int avg=(sum+4)>>3;
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
121 if(edges&1){ //(mb_x==0) {//implies mb_y!=0
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
122 memset(dst+area1,avg,8+8+1);//areas 1,2 and 3 are averaged
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
123 }else{//implies y==0 x!=0
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
124 memset(dst+area3,avg, 1+16+8);//areas 3, 4,5,6
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
125 }
5888
55a1e9f82bb7 factorize
michael
parents: 5887
diff changeset
126 sum+=avg*9;
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
127 }else{
5906
595a2f31430e misc spelling/grammar/wording fixes in comments
diego
parents: 5890
diff changeset
128 uint8_t c=*(src-1-linesize);//the edge pixel, in the top line and left column
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
129 dst[area3]=c;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
130 sum+=c;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
131 //edge pixel is not part of min/max
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
132 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
133 (*range) = max_pix - min_pix;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
134 sum += *(dst+area5) + *(dst+area5+1);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
135 *psum = sum;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
136 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
137
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
138
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
139 static const uint16_t zero_prediction_weights[64*2] = {
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
140 640, 640, 669, 480, 708, 354, 748, 257, 792, 198, 760, 143, 808, 101, 772, 72,
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
141 480, 669, 537, 537, 598, 416, 661, 316, 719, 250, 707, 185, 768, 134, 745, 97,
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
142 354, 708, 416, 598, 488, 488, 564, 388, 634, 317, 642, 241, 716, 179, 706, 132,
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
143 257, 748, 316, 661, 388, 564, 469, 469, 543, 395, 571, 311, 655, 238, 660, 180,
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
144 198, 792, 250, 719, 317, 634, 395, 543, 469, 469, 507, 380, 597, 299, 616, 231,
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
145 161, 855, 206, 788, 266, 710, 340, 623, 411, 548, 455, 455, 548, 366, 576, 288,
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
146 122, 972, 159, 914, 211, 842, 276, 758, 341, 682, 389, 584, 483, 483, 520, 390,
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
147 110, 1172, 144, 1107, 193, 1028, 254, 932, 317, 846, 366, 731, 458, 611, 499, 499
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
148 };
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
149
5907
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
150 static void spatial_compensation_0(uint8_t *src , uint8_t *dst, int linesize){
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
151 int i,j;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
152 int x,y;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
153 unsigned int p;//power divided by 2
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
154 int a;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
155 uint16_t left_sum[2][8];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
156 uint16_t top_sum[2][8];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
157 memset(left_sum,0,2*8*sizeof(uint16_t));
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
158 memset( top_sum,0,2*8*sizeof(uint16_t));
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
159
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
160 for(i=0;i<8;i++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
161 a=src[area2+7-i]<<4;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
162 for(j=0;j<8;j++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
163 p=abs(i-j);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
164 left_sum[p&1][j]+= a>>(p>>1);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
165 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
166 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
167
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
168 for(i=0;i<8;i++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
169 a=src[area4+i]<<4;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
170 for(j=0;j<8;j++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
171 p=abs(i-j);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
172 top_sum[p&1][j]+= a>>(p>>1);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
173 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
174 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
175 for(;i<10;i++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
176 a=src[area4+i]<<4;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
177 for(j=5;j<8;j++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
178 p=abs(i-j);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
179 top_sum[p&1][j]+= a>>(p>>1);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
180 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
181 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
182 for(;i<12;i++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
183 a=src[area4+i]<<4;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
184 for(j=7;j<8;j++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
185 p=abs(i-j);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
186 top_sum[p&1][j]+= a>>(p>>1);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
187 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
188 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
189
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
190 for(i=0;i<8;i++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
191 top_sum [0][i]+=(top_sum [1][i]*181 + 128 )>>8;//181 is sqrt(2)/2
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
192 left_sum[0][i]+=(left_sum[1][i]*181 + 128 )>>8;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
193 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
194 for(y=0;y<8;y++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
195 for(x=0;x<8;x++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
196 dst[x] = (
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
197 (uint32_t)top_sum [0][x]*zero_prediction_weights[y*16+x*2+0] +
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
198 (uint32_t)left_sum[0][y]*zero_prediction_weights[y*16+x*2+1] +
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
199 0x8000
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
200 )>>16;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
201 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
202 dst+=linesize;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
203 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
204 }
5907
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
205 static void spatial_compensation_1(uint8_t *src , uint8_t *dst, int linesize){
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
206 int x,y;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
207
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
208 for(y=0;y<8;y++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
209 for(x=0;x<8;x++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
210 dst[x]=src[area4 + FFMIN(2*y+x+2, 15) ];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
211 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
212 dst+=linesize;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
213 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
214 }
5907
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
215 static void spatial_compensation_2(uint8_t *src , uint8_t *dst, int linesize){
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
216 int x,y;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
217
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
218 for(y=0;y<8;y++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
219 for(x=0;x<8;x++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
220 dst[x]=src[area4 +1+y+x];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
221 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
222 dst+=linesize;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
223 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
224 }
5907
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
225 static void spatial_compensation_3(uint8_t *src , uint8_t *dst, int linesize){
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
226 int x,y;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
227
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
228 for(y=0;y<8;y++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
229 for(x=0;x<8;x++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
230 dst[x]=src[area4 +((y+1)>>1)+x];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
231 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
232 dst+=linesize;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
233 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
234 }
5907
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
235 static void spatial_compensation_4(uint8_t *src , uint8_t *dst, int linesize){
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
236 int x,y;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
237
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
238 for(y=0;y<8;y++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
239 for(x=0;x<8;x++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
240 dst[x]=( src[area4+x] + src[area6+x] + 1 )>>1;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
241 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
242 dst+=linesize;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
243 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
244 }
5907
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
245 static void spatial_compensation_5(uint8_t *src , uint8_t *dst, int linesize){
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
246 int x,y;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
247
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
248 for(y=0;y<8;y++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
249 for(x=0;x<8;x++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
250 if(2*x-y<0){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
251 dst[x]=src[area2+9+2*x-y];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
252 }else{
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
253 dst[x]=src[area4 +x-((y+1)>>1)];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
254 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
255 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
256 dst+=linesize;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
257 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
258 }
5907
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
259 static void spatial_compensation_6(uint8_t *src , uint8_t *dst, int linesize){
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
260 int x,y;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
261
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
262 for(y=0;y<8;y++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
263 for(x=0;x<8;x++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
264 dst[x]=src[area3+x-y];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
265 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
266 dst+=linesize;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
267 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
268 }
5907
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
269 static void spatial_compensation_7(uint8_t *src , uint8_t *dst, int linesize){
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
270 int x,y;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
271
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
272 for(y=0;y<8;y++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
273 for(x=0;x<8;x++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
274 if(x-2*y>0){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
275 dst[x]=( src[area3-1+x-2*y] + src[area3+x-2*y] + 1)>>1;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
276 }else{
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
277 dst[x]=src[area2+8-y +(x>>1)];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
278 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
279 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
280 dst+=linesize;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
281 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
282 }
5907
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
283 static void spatial_compensation_8(uint8_t *src , uint8_t *dst, int linesize){
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
284 int x,y;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
285
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
286 for(y=0;y<8;y++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
287 for(x=0;x<8;x++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
288 dst[x]=( src[area1+7-y] + src[area2+7-y] + 1 )>>1;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
289 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
290 dst+=linesize;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
291 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
292 }
5907
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
293 static void spatial_compensation_9(uint8_t *src , uint8_t *dst, int linesize){
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
294 int x,y;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
295
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
296 for(y=0;y<8;y++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
297 for(x=0;x<8;x++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
298 dst[x]=src[area2+6-FFMIN(x+y,6)];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
299 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
300 dst+=linesize;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
301 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
302 }
5907
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
303 static void spatial_compensation_10(uint8_t *src , uint8_t *dst, int linesize){
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
304 int x,y;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
305
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
306 for(y=0;y<8;y++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
307 for(x=0;x<8;x++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
308 dst[x]=(src[area2+7-y]*(8-x)+src[area4+x]*x+4)>>3;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
309 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
310 dst+=linesize;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
311 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
312 }
5907
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
313 static void spatial_compensation_11(uint8_t *src , uint8_t *dst, int linesize){
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
314 int x,y;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
315
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
316 for(y=0;y<8;y++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
317 for(x=0;x<8;x++){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
318 dst[x]=(src[area2+7-y]*y+src[area4+x]*(8-y)+4)>>3;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
319 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
320 dst+=linesize;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
321 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
322 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
323
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
324 static void x8_loop_filter(uint8_t * ptr, const int a_stride, const int b_stride, int quant){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
325 int i,t;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
326 int p0,p1,p2,p3,p4,p5,p6,p7,p8,p9;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
327 int ql=(quant+10)>>3;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
328
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
329 for(i=0; i<8; i++,ptr+=b_stride){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
330 p0=ptr[-5*a_stride];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
331 p1=ptr[-4*a_stride];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
332 p2=ptr[-3*a_stride];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
333 p3=ptr[-2*a_stride];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
334 p4=ptr[-1*a_stride];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
335 p5=ptr[ 0 ];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
336 p6=ptr[ 1*a_stride];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
337 p7=ptr[ 2*a_stride];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
338 p8=ptr[ 3*a_stride];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
339 p9=ptr[ 4*a_stride];
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
340
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
341 t=
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
342 (FFABS(p1-p2) <= ql) +
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
343 (FFABS(p2-p3) <= ql) +
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
344 (FFABS(p3-p4) <= ql) +
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
345 (FFABS(p4-p5) <= ql);
5906
595a2f31430e misc spelling/grammar/wording fixes in comments
diego
parents: 5890
diff changeset
346 if(t>0){//You need at least 1 to be able to reach a total score of 6.
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
347 t+=
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
348 (FFABS(p5-p6) <= ql) +
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
349 (FFABS(p6-p7) <= ql) +
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
350 (FFABS(p7-p8) <= ql) +
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
351 (FFABS(p8-p9) <= ql) +
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
352 (FFABS(p0-p1) <= ql);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
353 if(t>=6){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
354 int min,max;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
355
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
356 min=max=p1;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
357 min=FFMIN(min,p3); max=FFMAX(max,p3);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
358 min=FFMIN(min,p5); max=FFMAX(max,p5);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
359 min=FFMIN(min,p8); max=FFMAX(max,p8);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
360 if(max-min<2*quant){//early stop
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
361 min=FFMIN(min,p2); max=FFMAX(max,p2);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
362 min=FFMIN(min,p4); max=FFMAX(max,p4);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
363 min=FFMIN(min,p6); max=FFMAX(max,p6);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
364 min=FFMIN(min,p7); max=FFMAX(max,p7);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
365 if(max-min<2*quant){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
366 ptr[-2*a_stride]=(4*p2 + 3*p3 + 1*p7 + 4)>>3;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
367 ptr[-1*a_stride]=(3*p2 + 3*p4 + 2*p7 + 4)>>3;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
368 ptr[ 0 ]=(2*p2 + 3*p5 + 3*p7 + 4)>>3;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
369 ptr[ 1*a_stride]=(1*p2 + 3*p6 + 4*p7 + 4)>>3;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
370 continue;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
371 };
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
372 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
373 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
374 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
375 {
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
376 int x,x0,x1,x2;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
377 int m;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
378
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
379 x0 = (2*p3 - 5*p4 + 5*p5 - 2*p6 + 4)>>3;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
380 if(FFABS(x0) < quant){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
381 x1=(2*p1 - 5*p2 + 5*p3 - 2*p4 + 4)>>3;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
382 x2=(2*p5 - 5*p6 + 5*p7 - 2*p8 + 4)>>3;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
383
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
384 x=FFABS(x0) - FFMIN( FFABS(x1), FFABS(x2) );
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
385 m=p4-p5;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
386
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
387 if( x > 0 && (m^x0) <0){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
388 int32_t sign;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
389
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
390 sign=m>>31;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
391 m=(m^sign)-sign;//abs(m)
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
392 m>>=1;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
393
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
394 x=(5*x)>>3;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
395
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
396 if(x>m) x=m;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
397
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
398 x=(x^sign)-sign;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
399
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
400 ptr[-1*a_stride] -= x;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
401 ptr[ 0] += x;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
402 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
403 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
404 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
405 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
406 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
407
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
408 static void x8_h_loop_filter(uint8_t *src, int stride, int qscale){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
409 x8_loop_filter(src, stride, 1, qscale);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
410 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
411
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
412 static void x8_v_loop_filter(uint8_t *src, int stride, int qscale){
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
413 x8_loop_filter(src, 1, stride, qscale);
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
414 }
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
415
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
416 void ff_intrax8dsp_init(DSPContext* dsp, AVCodecContext *avctx) {
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
417 dsp->x8_h_loop_filter=x8_h_loop_filter;
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
418 dsp->x8_v_loop_filter=x8_v_loop_filter;
5907
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
419 dsp->x8_setup_spatial_compensation=x8_setup_spatial_compensation;
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
420 dsp->x8_spatial_compensation[0]=spatial_compensation_0;
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
421 dsp->x8_spatial_compensation[1]=spatial_compensation_1;
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
422 dsp->x8_spatial_compensation[2]=spatial_compensation_2;
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
423 dsp->x8_spatial_compensation[3]=spatial_compensation_3;
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
424 dsp->x8_spatial_compensation[4]=spatial_compensation_4;
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
425 dsp->x8_spatial_compensation[5]=spatial_compensation_5;
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
426 dsp->x8_spatial_compensation[6]=spatial_compensation_6;
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
427 dsp->x8_spatial_compensation[7]=spatial_compensation_7;
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
428 dsp->x8_spatial_compensation[8]=spatial_compensation_8;
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
429 dsp->x8_spatial_compensation[9]=spatial_compensation_9;
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
430 dsp->x8_spatial_compensation[10]=spatial_compensation_10;
fbd10e6dfbe1 cosmetics: Fix spacial --> spatial typo in function names.
diego
parents: 5906
diff changeset
431 dsp->x8_spatial_compensation[11]=spatial_compensation_11;
5887
83ac4620c6ed intrax8 decoder patch by "someone"
michael
parents:
diff changeset
432 }