Mercurial > libavcodec.hg
comparison dsputil.c @ 1644:835cf346975e libavcodec
h263 loop filter
fixed h263 modified quantization
CODEC_FLAG_OBMC
author | michael |
---|---|
date | Mon, 01 Dec 2003 15:23:14 +0000 |
parents | 932d306bf1dc |
children | 901f928ec1f6 |
comparison
equal
deleted
inserted
replaced
1643:9bb07bd315d9 | 1644:835cf346975e |
---|---|
2259 uint8_t halfH[88]; | 2259 uint8_t halfH[88]; |
2260 wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11); | 2260 wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11); |
2261 wmv2_mspel8_v_lowpass(dst, halfH+8, stride, 8, 8); | 2261 wmv2_mspel8_v_lowpass(dst, halfH+8, stride, 8, 8); |
2262 } | 2262 } |
2263 | 2263 |
2264 static void h263_v_loop_filter_c(uint8_t *src, int stride, int qscale){ | |
2265 int x; | |
2266 const int strength= ff_h263_loop_filter_strength[qscale]; | |
2267 | |
2268 for(x=0; x<8; x++){ | |
2269 int d1, d2, ad1; | |
2270 int p0= src[x-2*stride]; | |
2271 int p1= src[x-1*stride]; | |
2272 int p2= src[x+0*stride]; | |
2273 int p3= src[x+1*stride]; | |
2274 int d = (p0 - p3 + 4*(p2 - p1)) / 8; | |
2275 | |
2276 if (d<-2*strength) d1= 0; | |
2277 else if(d<- strength) d1=-2*strength - d; | |
2278 else if(d< strength) d1= d; | |
2279 else if(d< 2*strength) d1= 2*strength - d; | |
2280 else d1= 0; | |
2281 | |
2282 p1 += d1; | |
2283 p2 -= d1; | |
2284 if(p1&256) p1= ~(p1>>31); | |
2285 if(p2&256) p2= ~(p2>>31); | |
2286 | |
2287 src[x-1*stride] = p1; | |
2288 src[x+0*stride] = p2; | |
2289 | |
2290 ad1= ABS(d1); | |
2291 | |
2292 d2= clip((p0-p3)/4, -ad1, ad1); | |
2293 | |
2294 src[x-2*stride] = p0 - d2; | |
2295 src[x+ stride] = p3 + d2; | |
2296 } | |
2297 } | |
2298 | |
2299 static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale){ | |
2300 int y; | |
2301 const int strength= ff_h263_loop_filter_strength[qscale]; | |
2302 | |
2303 for(y=0; y<8; y++){ | |
2304 int d1, d2, ad1; | |
2305 int p0= src[y*stride-2]; | |
2306 int p1= src[y*stride-1]; | |
2307 int p2= src[y*stride+0]; | |
2308 int p3= src[y*stride+1]; | |
2309 int d = (p0 - p3 + 4*(p2 - p1)) / 8; | |
2310 | |
2311 if (d<-2*strength) d1= 0; | |
2312 else if(d<- strength) d1=-2*strength - d; | |
2313 else if(d< strength) d1= d; | |
2314 else if(d< 2*strength) d1= 2*strength - d; | |
2315 else d1= 0; | |
2316 | |
2317 p1 += d1; | |
2318 p2 -= d1; | |
2319 if(p1&256) p1= ~(p1>>31); | |
2320 if(p2&256) p2= ~(p2>>31); | |
2321 | |
2322 src[y*stride-1] = p1; | |
2323 src[y*stride+0] = p2; | |
2324 | |
2325 ad1= ABS(d1)>>1; | |
2326 | |
2327 d2= clip((p0-p3)/4, -ad1, ad1); | |
2328 | |
2329 src[y*stride-2] = p0 - d2; | |
2330 src[y*stride+1] = p3 + d2; | |
2331 } | |
2332 } | |
2264 | 2333 |
2265 static inline int pix_abs16x16_c(uint8_t *pix1, uint8_t *pix2, int line_size) | 2334 static inline int pix_abs16x16_c(uint8_t *pix1, uint8_t *pix2, int line_size) |
2266 { | 2335 { |
2267 int s, i; | 2336 int s, i; |
2268 | 2337 |
3046 | 3115 |
3047 c->add_bytes= add_bytes_c; | 3116 c->add_bytes= add_bytes_c; |
3048 c->diff_bytes= diff_bytes_c; | 3117 c->diff_bytes= diff_bytes_c; |
3049 c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c; | 3118 c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c; |
3050 c->bswap_buf= bswap_buf; | 3119 c->bswap_buf= bswap_buf; |
3120 | |
3121 c->h263_h_loop_filter= h263_h_loop_filter_c; | |
3122 c->h263_v_loop_filter= h263_v_loop_filter_c; | |
3051 | 3123 |
3052 #ifdef HAVE_MMX | 3124 #ifdef HAVE_MMX |
3053 dsputil_init_mmx(c, avctx); | 3125 dsputil_init_mmx(c, avctx); |
3054 #endif | 3126 #endif |
3055 #ifdef ARCH_ARMV4L | 3127 #ifdef ARCH_ARMV4L |