Mercurial > libavcodec.hg
comparison dsputil.c @ 2045:9447bbd8a7e9 libavcodec
rewrite h261 loop filter
no malloc(64) memcpy free stuff
no filter1 A->B then filter2 A->B (yes not B->A)
no incorrect rouding after the 1d filter
author | michael |
---|---|
date | Sun, 30 May 2004 21:21:13 +0000 |
parents | b6f2add2511e |
children | 9e4bebc39ade |
comparison
equal
deleted
inserted
replaced
2044:b6f2add2511e | 2045:9447bbd8a7e9 |
---|---|
2358 src[y*stride-2] = p0 - d2; | 2358 src[y*stride-2] = p0 - d2; |
2359 src[y*stride+1] = p3 + d2; | 2359 src[y*stride+1] = p3 + d2; |
2360 } | 2360 } |
2361 } | 2361 } |
2362 | 2362 |
2363 static void h261_v_loop_filter_c(uint8_t *dest,uint8_t *src, int stride){ | 2363 static void h261_loop_filter_c(uint8_t *src, int stride){ |
2364 int i,j,xy,yz; | 2364 int x,y,xy,yz; |
2365 int res; | 2365 int temp[64]; |
2366 for(i=0; i<8; i++){ | 2366 |
2367 for(j=1; j<7; j++){ | 2367 for(x=0; x<8; x++){ |
2368 xy = j * stride + i; | 2368 temp[x ] = 4*src[x ]; |
2369 yz = j * 8 + i; | 2369 temp[x + 7*8] = 4*src[x + 7*stride]; |
2370 res = (int)src[yz-1*8] + ((int)(src[yz+0*8]) * 2) + (int)src[yz+1*8]; | 2370 } |
2371 res +=2; | 2371 for(y=1; y<7; y++){ |
2372 res >>=2; | 2372 for(x=0; x<8; x++){ |
2373 dest[xy] = (uint8_t)res; | 2373 xy = y * stride + x; |
2374 yz = y * 8 + x; | |
2375 temp[yz] = src[xy - stride] + 2*src[xy] + src[xy + stride]; | |
2374 } | 2376 } |
2375 } | 2377 } |
2376 } | 2378 |
2377 | 2379 for(y=0; y<8; y++){ |
2378 static void h261_h_loop_filter_c(uint8_t *dest,uint8_t *src, int stride){ | 2380 src[ y*stride] = (temp[ y*8] + 2)>>2; |
2379 int i,j,xy,yz; | 2381 src[7+y*stride] = (temp[7+y*8] + 2)>>2; |
2380 int res; | 2382 for(x=1; x<7; x++){ |
2381 for(i=1; i<7; i++){ | 2383 xy = y * stride + x; |
2382 for(j=0; j<8; j++){ | 2384 yz = y * 8 + x; |
2383 xy = j * stride + i; | 2385 src[xy] = (temp[yz-1] + 2*temp[yz] + temp[yz+1] + 8)>>4; |
2384 yz = j * 8 + i; | |
2385 res = (int)src[yz-1] + ((int)(src[yz]) *2) + (int)src[yz+1]; | |
2386 res+=2; | |
2387 res>>=2; | |
2388 dest[xy] = (uint8_t)res; | |
2389 } | 2386 } |
2390 } | 2387 } |
2391 } | 2388 } |
2392 | 2389 |
2393 static inline int pix_abs16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) | 2390 static inline int pix_abs16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) |
3323 c->bswap_buf= bswap_buf; | 3320 c->bswap_buf= bswap_buf; |
3324 | 3321 |
3325 c->h263_h_loop_filter= h263_h_loop_filter_c; | 3322 c->h263_h_loop_filter= h263_h_loop_filter_c; |
3326 c->h263_v_loop_filter= h263_v_loop_filter_c; | 3323 c->h263_v_loop_filter= h263_v_loop_filter_c; |
3327 | 3324 |
3328 c->h261_h_loop_filter= h261_h_loop_filter_c; | 3325 c->h261_loop_filter= h261_loop_filter_c; |
3329 c->h261_v_loop_filter= h261_v_loop_filter_c; | |
3330 | 3326 |
3331 c->try_8x8basis= try_8x8basis_c; | 3327 c->try_8x8basis= try_8x8basis_c; |
3332 c->add_8x8basis= add_8x8basis_c; | 3328 c->add_8x8basis= add_8x8basis_c; |
3333 | 3329 |
3334 #ifdef HAVE_MMX | 3330 #ifdef HAVE_MMX |