Mercurial > libavcodec.hg
comparison vp3.c @ 2699:1b4a3c083f9d libavcodec
some optimizations gcc should have done (10% faster loop filter)
author | michael |
---|---|
date | Tue, 17 May 2005 20:50:47 +0000 |
parents | fae7fce1a202 |
children | 5a4e5225cbb6 |
comparison
equal
deleted
inserted
replaced
2698:fae7fce1a202 | 2699:1b4a3c083f9d |
---|---|
2246 } | 2246 } |
2247 | 2247 |
2248 static void horizontal_filter(unsigned char *first_pixel, int stride, | 2248 static void horizontal_filter(unsigned char *first_pixel, int stride, |
2249 int *bounding_values) | 2249 int *bounding_values) |
2250 { | 2250 { |
2251 int i; | 2251 unsigned char *end; |
2252 int filter_value; | 2252 int filter_value; |
2253 | 2253 |
2254 for (i = 0; i < 8; i++, first_pixel += stride) { | 2254 for (end= first_pixel + 8*stride; first_pixel < end; first_pixel += stride) { |
2255 filter_value = | 2255 filter_value = |
2256 (first_pixel[-2] * 1) - | 2256 (first_pixel[-2] - first_pixel[ 1]) |
2257 (first_pixel[-1] * 3) + | 2257 +3*(first_pixel[ 0] - first_pixel[-1]); |
2258 (first_pixel[ 0] * 3) - | |
2259 (first_pixel[ 1] * 1); | |
2260 filter_value = bounding_values[(filter_value + 4) >> 3]; | 2258 filter_value = bounding_values[(filter_value + 4) >> 3]; |
2261 first_pixel[-1] = clip_uint8(first_pixel[-1] + filter_value); | 2259 first_pixel[-1] = clip_uint8(first_pixel[-1] + filter_value); |
2262 first_pixel[ 0] = clip_uint8(first_pixel[ 0] - filter_value); | 2260 first_pixel[ 0] = clip_uint8(first_pixel[ 0] - filter_value); |
2263 } | 2261 } |
2264 } | 2262 } |
2265 | 2263 |
2266 static void vertical_filter(unsigned char *first_pixel, int stride, | 2264 static void vertical_filter(unsigned char *first_pixel, int stride, |
2267 int *bounding_values) | 2265 int *bounding_values) |
2268 { | 2266 { |
2269 int i; | 2267 unsigned char *end; |
2270 int filter_value; | 2268 int filter_value; |
2271 | 2269 const int nstride= -stride; |
2272 for (i = 0; i < 8; i++, first_pixel++) { | 2270 |
2271 for (end= first_pixel + 8; first_pixel < end; first_pixel++) { | |
2273 filter_value = | 2272 filter_value = |
2274 (first_pixel[-(2 * stride)] * 1) - | 2273 (first_pixel[2 * nstride] - first_pixel[ stride]) |
2275 (first_pixel[-(1 * stride)] * 3) + | 2274 +3*(first_pixel[0 ] - first_pixel[nstride]); |
2276 (first_pixel[ (0 )] * 3) - | |
2277 (first_pixel[ (1 * stride)] * 1); | |
2278 filter_value = bounding_values[(filter_value + 4) >> 3]; | 2275 filter_value = bounding_values[(filter_value + 4) >> 3]; |
2279 first_pixel[-(1 * stride)] = clip_uint8(first_pixel[-(1 * stride)] + filter_value); | 2276 first_pixel[nstride] = clip_uint8(first_pixel[nstride] + filter_value); |
2280 first_pixel[0] = clip_uint8(first_pixel[0] - filter_value); | 2277 first_pixel[0] = clip_uint8(first_pixel[0] - filter_value); |
2281 } | 2278 } |
2282 } | 2279 } |
2283 | 2280 |
2284 static void apply_loop_filter(Vp3DecodeContext *s) | 2281 static void apply_loop_filter(Vp3DecodeContext *s) |