Mercurial > libavcodec.hg
comparison rv40.c @ 8146:4a92ea42a8bc libavcodec
Weak deblock filter function for future RV40 loop filter
author | kostya |
---|---|
date | Sat, 15 Nov 2008 14:15:24 +0000 |
parents | e943e1409077 |
children | de344498875e |
comparison
equal
deleted
inserted
replaced
8145:f27d01aff4af | 8146:4a92ea42a8bc |
---|---|
245 av_log(s->avctx, AV_LOG_ERROR, "Dquant for B-frame\n"); | 245 av_log(s->avctx, AV_LOG_ERROR, "Dquant for B-frame\n"); |
246 } | 246 } |
247 return 0; | 247 return 0; |
248 } | 248 } |
249 | 249 |
250 #define CLIP_SYMM(a, b) av_clip(a, -(b), b) | |
251 /** | |
252 * weaker deblocking very similar to the one described in 4.4.2 of JVT-A003r1 | |
253 */ | |
254 static inline void rv40_weak_loop_filter(uint8_t *src, const int step, | |
255 const int filter_p1, const int filter_q1, | |
256 const int alpha, const int beta, | |
257 const int lim_p0q0, | |
258 const int lim_q1, const int lim_p1, | |
259 const int diff_p1p0, const int diff_q1q0, | |
260 const int diff_p1p2, const int diff_q1q2) | |
261 { | |
262 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; | |
263 int t, u, diff; | |
264 | |
265 t = src[0*step] - src[-1*step]; | |
266 if(!t) | |
267 return; | |
268 u = (alpha * FFABS(t)) >> 7; | |
269 if(u > 3 - (filter_p1 && filter_q1)) | |
270 return; | |
271 | |
272 t <<= 2; | |
273 if(filter_p1 && filter_q1) | |
274 t += src[-2*step] - src[1*step]; | |
275 diff = CLIP_SYMM((t + 4) >> 3, lim_p0q0); | |
276 src[-1*step] = cm[src[-1*step] + diff]; | |
277 src[ 0*step] = cm[src[ 0*step] - diff]; | |
278 if(FFABS(diff_p1p2) <= beta && filter_p1){ | |
279 t = (diff_p1p0 + diff_p1p2 - diff) >> 1; | |
280 src[-2*step] = cm[src[-2*step] - CLIP_SYMM(t, lim_p1)]; | |
281 } | |
282 if(FFABS(diff_q1q2) <= beta && filter_q1){ | |
283 t = (diff_q1q0 + diff_q1q2 + diff) >> 1; | |
284 src[ 1*step] = cm[src[ 1*step] - CLIP_SYMM(t, lim_q1)]; | |
285 } | |
286 } | |
287 | |
250 /** | 288 /** |
251 * Initialize decoder. | 289 * Initialize decoder. |
252 */ | 290 */ |
253 static av_cold int rv40_decode_init(AVCodecContext *avctx) | 291 static av_cold int rv40_decode_init(AVCodecContext *avctx) |
254 { | 292 { |