aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2008-11-15 14:15:24 +0000
committerKostya Shishkov <kostya.shishkov@gmail.com>2008-11-15 14:15:24 +0000
commit70f42303e7a20aa3e9c9de4837732b29d1c0a06f (patch)
treebf3795ead6ccc592adb5d1b41eb0a9ba7f74a9de
parent536cd1db7116c662adebee52709731cc272db970 (diff)
downloadffmpeg-70f42303e7a20aa3e9c9de4837732b29d1c0a06f.tar.gz
Weak deblock filter function for future RV40 loop filter
Originally committed as revision 15827 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/rv40.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/libavcodec/rv40.c b/libavcodec/rv40.c
index 2d529677a6..a760bd3abf 100644
--- a/libavcodec/rv40.c
+++ b/libavcodec/rv40.c
@@ -247,6 +247,44 @@ static int rv40_decode_mb_info(RV34DecContext *r)
return 0;
}
+#define CLIP_SYMM(a, b) av_clip(a, -(b), b)
+/**
+ * weaker deblocking very similar to the one described in 4.4.2 of JVT-A003r1
+ */
+static inline void rv40_weak_loop_filter(uint8_t *src, const int step,
+ const int filter_p1, const int filter_q1,
+ const int alpha, const int beta,
+ const int lim_p0q0,
+ const int lim_q1, const int lim_p1,
+ const int diff_p1p0, const int diff_q1q0,
+ const int diff_p1p2, const int diff_q1q2)
+{
+ uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
+ int t, u, diff;
+
+ t = src[0*step] - src[-1*step];
+ if(!t)
+ return;
+ u = (alpha * FFABS(t)) >> 7;
+ if(u > 3 - (filter_p1 && filter_q1))
+ return;
+
+ t <<= 2;
+ if(filter_p1 && filter_q1)
+ t += src[-2*step] - src[1*step];
+ diff = CLIP_SYMM((t + 4) >> 3, lim_p0q0);
+ src[-1*step] = cm[src[-1*step] + diff];
+ src[ 0*step] = cm[src[ 0*step] - diff];
+ if(FFABS(diff_p1p2) <= beta && filter_p1){
+ t = (diff_p1p0 + diff_p1p2 - diff) >> 1;
+ src[-2*step] = cm[src[-2*step] - CLIP_SYMM(t, lim_p1)];
+ }
+ if(FFABS(diff_q1q2) <= beta && filter_q1){
+ t = (diff_q1q0 + diff_q1q2 + diff) >> 1;
+ src[ 1*step] = cm[src[ 1*step] - CLIP_SYMM(t, lim_q1)];
+ }
+}
+
/**
* Initialize decoder.
*/