summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2005-05-17 20:50:47 +0000
committerMichael Niedermayer <michaelni@gmx.at>2005-05-17 20:50:47 +0000
commit6f7aa5891d310a8d114431efe3b5179c4bac0e68 (patch)
tree3f3b057ffba8246cb7ba310b6b1f89650de8296b /libavcodec
parentee408eadbadbc629c9ef06f62ddf63643defe541 (diff)
some optimizations gcc should have done (10% faster loop filter)
Originally committed as revision 4263 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/vp3.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 7d4b9e8bec..75877860c0 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2248,15 +2248,13 @@ av_log(s->avctx, AV_LOG_ERROR, " help! got beefy vector! (%X, %X)\n", motion_x,
static void horizontal_filter(unsigned char *first_pixel, int stride,
int *bounding_values)
{
- int i;
+ unsigned char *end;
int filter_value;
- for (i = 0; i < 8; i++, first_pixel += stride) {
+ for (end= first_pixel + 8*stride; first_pixel < end; first_pixel += stride) {
filter_value =
- (first_pixel[-2] * 1) -
- (first_pixel[-1] * 3) +
- (first_pixel[ 0] * 3) -
- (first_pixel[ 1] * 1);
+ (first_pixel[-2] - first_pixel[ 1])
+ +3*(first_pixel[ 0] - first_pixel[-1]);
filter_value = bounding_values[(filter_value + 4) >> 3];
first_pixel[-1] = clip_uint8(first_pixel[-1] + filter_value);
first_pixel[ 0] = clip_uint8(first_pixel[ 0] - filter_value);
@@ -2266,17 +2264,16 @@ static void horizontal_filter(unsigned char *first_pixel, int stride,
static void vertical_filter(unsigned char *first_pixel, int stride,
int *bounding_values)
{
- int i;
+ unsigned char *end;
int filter_value;
+ const int nstride= -stride;
- for (i = 0; i < 8; i++, first_pixel++) {
+ for (end= first_pixel + 8; first_pixel < end; first_pixel++) {
filter_value =
- (first_pixel[-(2 * stride)] * 1) -
- (first_pixel[-(1 * stride)] * 3) +
- (first_pixel[ (0 )] * 3) -
- (first_pixel[ (1 * stride)] * 1);
+ (first_pixel[2 * nstride] - first_pixel[ stride])
+ +3*(first_pixel[0 ] - first_pixel[nstride]);
filter_value = bounding_values[(filter_value + 4) >> 3];
- first_pixel[-(1 * stride)] = clip_uint8(first_pixel[-(1 * stride)] + filter_value);
+ first_pixel[nstride] = clip_uint8(first_pixel[nstride] + filter_value);
first_pixel[0] = clip_uint8(first_pixel[0] - filter_value);
}
}