comparison libmpcodecs/vf_spp.c @ 11305:d1585f7d5366

10l
author michael
date Tue, 28 Oct 2003 13:17:11 +0000
parents f89e212dd5b9
children 487bf0179498
comparison
equal deleted inserted replaced
11304:f89e212dd5b9 11305:d1585f7d5366
195 *(uint32_t*)&dst[4 + y*stride]+= *(uint32_t*)&block[4 + y*8]; 195 *(uint32_t*)&dst[4 + y*stride]+= *(uint32_t*)&block[4 + y*8];
196 *(uint32_t*)&dst[6 + y*stride]+= *(uint32_t*)&block[6 + y*8]; 196 *(uint32_t*)&dst[6 + y*stride]+= *(uint32_t*)&block[6 + y*8];
197 } 197 }
198 } 198 }
199 199
200 static void store_slice_c(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int log2_scale){ 200 static void store_slice_c(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale){
201 int y, x; 201 int y, x;
202 202
203 #define STORE(pos) \ 203 #define STORE(pos) \
204 temp= ((src[x + y*src_stride + pos]<<log2_scale) + d[pos])>>6;\ 204 temp= ((src[x + y*src_stride + pos]<<log2_scale) + d[pos])>>6;\
205 if(temp & 0x100) temp= ~(temp>>31);\ 205 if(temp & 0x100) temp= ~(temp>>31);\
206 dst[x + y*dst_stride + pos]= temp; 206 dst[x + y*dst_stride + pos]= temp;
207 207
208 for(y=0; y<8; y++){ 208 for(y=0; y<height; y++){
209 uint8_t *d= dither[y]; 209 uint8_t *d= dither[y];
210 for(x=0; x<width; x+=8){ 210 for(x=0; x<width; x+=8){
211 int temp; 211 int temp;
212 STORE(0); 212 STORE(0);
213 STORE(1); 213 STORE(1);
220 } 220 }
221 } 221 }
222 } 222 }
223 223
224 #ifdef HAVE_MMX 224 #ifdef HAVE_MMX
225 static void store_slice_mmx(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int log2_scale){ 225 static void store_slice_mmx(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale){
226 int y; 226 int y;
227 227
228 for(y=0; y<8; y++){ 228 for(y=0; y<height; y++){
229 uint8_t *dst1= dst; 229 uint8_t *dst1= dst;
230 int16_t *src1= src; 230 int16_t *src1= src;
231 asm volatile( 231 asm volatile(
232 "movq (%3), %%mm3 \n\t" 232 "movq (%3), %%mm3 \n\t"
233 "movq (%3), %%mm4 \n\t" 233 "movq (%3), %%mm4 \n\t"
260 // if(width != mmxw) 260 // if(width != mmxw)
261 // store_slice_c(dst + mmxw, src + mmxw, dst_stride, src_stride, width - mmxw, log2_scale); 261 // store_slice_c(dst + mmxw, src + mmxw, dst_stride, src_stride, width - mmxw, log2_scale);
262 } 262 }
263 #endif 263 #endif
264 264
265 static void (*store_slice)(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int log2_scale)= store_slice_c; 265 static void (*store_slice)(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale)= store_slice_c;
266 266
267 static void (*requantize)(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation)= requantize_c; 267 static void (*requantize)(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation)= requantize_c;
268 268
269 static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, uint8_t *qp_store, int qp_stride, int is_luma){ 269 static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, uint8_t *qp_store, int qp_stride, int is_luma){
270 int x, y, i; 270 int x, y, i;
310 p->dsp.idct(block2); 310 p->dsp.idct(block2);
311 add_block(p->temp + index, stride, block2); 311 add_block(p->temp + index, stride, block2);
312 } 312 }
313 } 313 }
314 if(y) 314 if(y)
315 store_slice(dst + (y-8)*dst_stride, p->temp + 8 + y*stride, dst_stride, stride, width, 6-p->log2_count); 315 store_slice(dst + (y-8)*dst_stride, p->temp + 8 + y*stride, dst_stride, stride, width, XMIN(8, height+8-y), 6-p->log2_count);
316 } 316 }
317 #if 0 317 #if 0
318 for(y=0; y<height; y++){ 318 for(y=0; y<height; y++){
319 for(x=0; x<width; x++){ 319 for(x=0; x<width; x++){
320 if((((x>>6) ^ (y>>6)) & 1) == 0) 320 if((((x>>6) ^ (y>>6)) & 1) == 0)
328 } 328 }
329 329
330 static int config(struct vf_instance_s* vf, 330 static int config(struct vf_instance_s* vf,
331 int width, int height, int d_width, int d_height, 331 int width, int height, int d_width, int d_height,
332 unsigned int flags, unsigned int outfmt){ 332 unsigned int flags, unsigned int outfmt){
333 int h= (height+16+15)&(~15);
333 334
334 vf->priv->temp_stride= (width+16+15)&(~15); 335 vf->priv->temp_stride= (width+16+15)&(~15);
335 vf->priv->temp= malloc(vf->priv->temp_stride*(height+16)*sizeof(int16_t)); 336 vf->priv->temp= malloc(vf->priv->temp_stride*h*sizeof(int16_t));
336 vf->priv->src = malloc(vf->priv->temp_stride*(height+16)*sizeof(uint8_t)); 337 vf->priv->src = malloc(vf->priv->temp_stride*h*sizeof(uint8_t));
337 338
338 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); 339 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
339 } 340 }
340 341
341 static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){ 342 static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){