VP8: Move calculation of outer filter limit out of dsp functions for normal

filter to match the simple loop filter

Originally committed as revision 24010 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
David Conrad 2010-07-02 21:04:45 +00:00
parent b67a8f49a4
commit 5245c04da3
2 changed files with 21 additions and 18 deletions

View File

@ -1167,38 +1167,41 @@ static void filter_level_for_mb(VP8Context *s, VP8Macroblock *mb, int *level, in
// TODO: look at backup_mb_border / xchg_mb_border in h264.c
static void filter_mb(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb, int mb_x, int mb_y)
{
int filter_level, inner_limit, hev_thresh;
int filter_level, inner_limit, hev_thresh, mbedge_lim, bedge_lim;
filter_level_for_mb(s, mb, &filter_level, &inner_limit, &hev_thresh);
if (!filter_level)
return;
mbedge_lim = 2*(filter_level+2) + inner_limit;
bedge_lim = 2* filter_level + inner_limit;
if (mb_x) {
s->vp8dsp.vp8_h_loop_filter16(dst[0], s->linesize, filter_level+2, inner_limit, hev_thresh);
s->vp8dsp.vp8_h_loop_filter8 (dst[1], s->uvlinesize, filter_level+2, inner_limit, hev_thresh);
s->vp8dsp.vp8_h_loop_filter8 (dst[2], s->uvlinesize, filter_level+2, inner_limit, hev_thresh);
s->vp8dsp.vp8_h_loop_filter16(dst[0], s->linesize, mbedge_lim, inner_limit, hev_thresh);
s->vp8dsp.vp8_h_loop_filter8 (dst[1], s->uvlinesize, mbedge_lim, inner_limit, hev_thresh);
s->vp8dsp.vp8_h_loop_filter8 (dst[2], s->uvlinesize, mbedge_lim, inner_limit, hev_thresh);
}
if (!mb->skip || mb->mode == MODE_I4x4 || mb->mode == VP8_MVMODE_SPLIT) {
s->vp8dsp.vp8_h_loop_filter16_inner(dst[0]+ 4, s->linesize, filter_level, inner_limit, hev_thresh);
s->vp8dsp.vp8_h_loop_filter16_inner(dst[0]+ 8, s->linesize, filter_level, inner_limit, hev_thresh);
s->vp8dsp.vp8_h_loop_filter16_inner(dst[0]+12, s->linesize, filter_level, inner_limit, hev_thresh);
s->vp8dsp.vp8_h_loop_filter8_inner (dst[1]+ 4, s->uvlinesize, filter_level, inner_limit, hev_thresh);
s->vp8dsp.vp8_h_loop_filter8_inner (dst[2]+ 4, s->uvlinesize, filter_level, inner_limit, hev_thresh);
s->vp8dsp.vp8_h_loop_filter16_inner(dst[0]+ 4, s->linesize, bedge_lim, inner_limit, hev_thresh);
s->vp8dsp.vp8_h_loop_filter16_inner(dst[0]+ 8, s->linesize, bedge_lim, inner_limit, hev_thresh);
s->vp8dsp.vp8_h_loop_filter16_inner(dst[0]+12, s->linesize, bedge_lim, inner_limit, hev_thresh);
s->vp8dsp.vp8_h_loop_filter8_inner (dst[1]+ 4, s->uvlinesize, bedge_lim, inner_limit, hev_thresh);
s->vp8dsp.vp8_h_loop_filter8_inner (dst[2]+ 4, s->uvlinesize, bedge_lim, inner_limit, hev_thresh);
}
if (mb_y) {
s->vp8dsp.vp8_v_loop_filter16(dst[0], s->linesize, filter_level+2, inner_limit, hev_thresh);
s->vp8dsp.vp8_v_loop_filter8 (dst[1], s->uvlinesize, filter_level+2, inner_limit, hev_thresh);
s->vp8dsp.vp8_v_loop_filter8 (dst[2], s->uvlinesize, filter_level+2, inner_limit, hev_thresh);
s->vp8dsp.vp8_v_loop_filter16(dst[0], s->linesize, mbedge_lim, inner_limit, hev_thresh);
s->vp8dsp.vp8_v_loop_filter8 (dst[1], s->uvlinesize, mbedge_lim, inner_limit, hev_thresh);
s->vp8dsp.vp8_v_loop_filter8 (dst[2], s->uvlinesize, mbedge_lim, inner_limit, hev_thresh);
}
if (!mb->skip || mb->mode == MODE_I4x4 || mb->mode == VP8_MVMODE_SPLIT) {
s->vp8dsp.vp8_v_loop_filter16_inner(dst[0]+ 4*s->linesize, s->linesize, filter_level, inner_limit, hev_thresh);
s->vp8dsp.vp8_v_loop_filter16_inner(dst[0]+ 8*s->linesize, s->linesize, filter_level, inner_limit, hev_thresh);
s->vp8dsp.vp8_v_loop_filter16_inner(dst[0]+12*s->linesize, s->linesize, filter_level, inner_limit, hev_thresh);
s->vp8dsp.vp8_v_loop_filter8_inner (dst[1]+ 4*s->uvlinesize, s->uvlinesize, filter_level, inner_limit, hev_thresh);
s->vp8dsp.vp8_v_loop_filter8_inner (dst[2]+ 4*s->uvlinesize, s->uvlinesize, filter_level, inner_limit, hev_thresh);
s->vp8dsp.vp8_v_loop_filter16_inner(dst[0]+ 4*s->linesize, s->linesize, bedge_lim, inner_limit, hev_thresh);
s->vp8dsp.vp8_v_loop_filter16_inner(dst[0]+ 8*s->linesize, s->linesize, bedge_lim, inner_limit, hev_thresh);
s->vp8dsp.vp8_v_loop_filter16_inner(dst[0]+12*s->linesize, s->linesize, bedge_lim, inner_limit, hev_thresh);
s->vp8dsp.vp8_v_loop_filter8_inner (dst[1]+ 4*s->uvlinesize, s->uvlinesize, bedge_lim, inner_limit, hev_thresh);
s->vp8dsp.vp8_v_loop_filter8_inner (dst[2]+ 4*s->uvlinesize, s->uvlinesize, bedge_lim, inner_limit, hev_thresh);
}
}

View File

@ -162,7 +162,7 @@ static av_always_inline int simple_limit(uint8_t *p, int stride, int flim)
static av_always_inline int normal_limit(uint8_t *p, int stride, int E, int I)
{
LOAD_PIXELS
return simple_limit(p, stride, 2*E+I)
return simple_limit(p, stride, E)
&& FFABS(p3-p2) <= I && FFABS(p2-p1) <= I && FFABS(p1-p0) <= I
&& FFABS(q3-q2) <= I && FFABS(q2-q1) <= I && FFABS(q1-q0) <= I;
}