diff vp3dsp.c @ 7995:1fbfce20cb79 libavcodec

Move VP3 loop filter to DSPContext
author conrad
date Sat, 04 Oct 2008 10:26:17 +0000
parents 25914f8a9bb3
children e9d9d946f213
line wrap: on
line diff
--- a/vp3dsp.c	Sat Oct 04 09:43:11 2008 +0000
+++ b/vp3dsp.c	Sat Oct 04 10:26:17 2008 +0000
@@ -222,3 +222,34 @@
 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);
+    }
+}