comparison libmpcodecs/vf_spp.c @ 11295:8b9ae87aff0f

10l
author michael
date Mon, 27 Oct 2003 19:14:38 +0000
parents 47b69dcf384d
children 86916e46d445
comparison
equal deleted inserted replaced
11294:e5f08b2e05e6 11295:8b9ae87aff0f
97 memset(dst, 0, 64*sizeof(DCTELEM)); 97 memset(dst, 0, 64*sizeof(DCTELEM));
98 dst[0]= (src[0] + 4)>>3;; 98 dst[0]= (src[0] + 4)>>3;;
99 99
100 for(i=1; i<64; i++){ 100 for(i=1; i<64; i++){
101 int level= qinv*src[i]; 101 int level= qinv*src[i];
102
103 if(((unsigned)(level+threshold1))>threshold2){ 102 if(((unsigned)(level+threshold1))>threshold2){
104 const int j= permutation[i]; 103 const int j= permutation[i];
105 if(level>0){ 104 if(level>0){
106 level= (bias + level)>>SHIFT; 105 level= (bias + level)>>SHIFT;
107 dst[j]= level*qmul + qadd; 106 dst[j]= level*qmul + qadd;
161 } 160 }
162 for(i=0; i<count; i++){ 161 for(i=0; i<count; i++){
163 const int x1= x + offset[i][0]; 162 const int x1= x + offset[i][0];
164 const int y1= y + offset[i][1]; 163 const int y1= y + offset[i][1];
165 const int index= x1 + y1*stride; 164 const int index= x1 + y1*stride;
166
167 p->dsp.get_pixels(block, p->src + index, stride); 165 p->dsp.get_pixels(block, p->src + index, stride);
168 p->dsp.fdct(block); 166 p->dsp.fdct(block);
169 requantize(block2, block, qp, p->dsp.idct_permutation); 167 requantize(block2, block, qp, p->dsp.idct_permutation);
170 p->dsp.idct(block2); 168 p->dsp.idct(block2);
171 add_block(p->temp + index, stride, block2); 169 add_block(p->temp + index, stride, block2);
172 } 170 }
173 } 171 }
174 } 172 }
175 173
174 #define STORE(pos) \
175 temp= ((p->temp[index + pos]<<log2_scale) + d[pos])>>6;\
176 if(temp & 0x100) temp= ~(temp>>31);\
177 dst[x + y*dst_stride + pos]= temp;
178
176 for(y=0; y<height; y++){ 179 for(y=0; y<height; y++){
177 uint8_t *d= dither[y&7]; 180 uint8_t *d= dither[y&7];
178 for(x=0; x<width; x+=8){ 181 for(x=0; x<width; x+=8){
179 const int index= 8 + 8*stride + x + y*stride; 182 const int index= 8 + 8*stride + x + y*stride;
180 dst[x + y*src_stride + 0]= ((p->temp[index + 0]<<log2_scale) + d[0])>>6; 183 int temp;
181 dst[x + y*src_stride + 1]= ((p->temp[index + 1]<<log2_scale) + d[1])>>6; 184 STORE(0);
182 dst[x + y*src_stride + 2]= ((p->temp[index + 2]<<log2_scale) + d[2])>>6; 185 STORE(1);
183 dst[x + y*src_stride + 3]= ((p->temp[index + 3]<<log2_scale) + d[3])>>6; 186 STORE(2);
184 dst[x + y*src_stride + 4]= ((p->temp[index + 4]<<log2_scale) + d[4])>>6; 187 STORE(3);
185 dst[x + y*src_stride + 5]= ((p->temp[index + 5]<<log2_scale) + d[5])>>6; 188 STORE(4);
186 dst[x + y*src_stride + 6]= ((p->temp[index + 6]<<log2_scale) + d[6])>>6; 189 STORE(5);
187 dst[x + y*src_stride + 7]= ((p->temp[index + 7]<<log2_scale) + d[7])>>6; 190 STORE(6);
191 STORE(7);
188 } 192 }
189 } 193 }
194 #if 0
195 for(y=0; y<height; y++){
196 for(x=0; x<width; x++){
197 if((((x>>6) ^ (y>>6)) & 1) == 0)
198 dst[x + y*dst_stride]= p->src[8 + 8*stride + x + y*stride];
199 if((x&63) == 0 || (y&63)==0)
200 dst[x + y*dst_stride] += 128;
201 }
202 }
203 #endif
190 //FIXME reorder for better caching 204 //FIXME reorder for better caching
191 } 205 }
192 206
193 static int config(struct vf_instance_s* vf, 207 static int config(struct vf_instance_s* vf,
194 int width, int height, int d_width, int d_height, 208 int width, int height, int d_width, int d_height,