From 9971331dfb6f4ef499b17f156bc0befc98b504b1 Mon Sep 17 00:00:00 2001 From: David Conrad Date: Sat, 4 Oct 2008 10:26:17 +0000 Subject: Move VP3 loop filter to DSPContext Originally committed as revision 15551 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/vp3dsp.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'libavcodec/vp3dsp.c') diff --git a/libavcodec/vp3dsp.c b/libavcodec/vp3dsp.c index d374a85f6e..da5b108bdc 100644 --- a/libavcodec/vp3dsp.c +++ b/libavcodec/vp3dsp.c @@ -222,3 +222,34 @@ void ff_vp3_idct_put_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/* void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/){ idct(dest, line_size, block, 2); } + +void ff_vp3_v_loop_filter_c(uint8_t *first_pixel, int stride, int *bounding_values) +{ + unsigned char *end; + int filter_value; + const int nstride= -stride; + + for (end= first_pixel + 8; first_pixel < end; first_pixel++) { + filter_value = + (first_pixel[2 * nstride] - first_pixel[ stride]) + +3*(first_pixel[0 ] - first_pixel[nstride]); + filter_value = bounding_values[(filter_value + 4) >> 3]; + first_pixel[nstride] = av_clip_uint8(first_pixel[nstride] + filter_value); + first_pixel[0] = av_clip_uint8(first_pixel[0] - filter_value); + } +} + +void ff_vp3_h_loop_filter_c(uint8_t *first_pixel, int stride, int *bounding_values) +{ + unsigned char *end; + int filter_value; + + for (end= first_pixel + 8*stride; first_pixel != end; first_pixel += stride) { + filter_value = + (first_pixel[-2] - first_pixel[ 1]) + +3*(first_pixel[ 0] - first_pixel[-1]); + filter_value = bounding_values[(filter_value + 4) >> 3]; + first_pixel[-1] = av_clip_uint8(first_pixel[-1] + filter_value); + first_pixel[ 0] = av_clip_uint8(first_pixel[ 0] - filter_value); + } +} -- cgit v1.2.3