return;
}
if (x > 0) && (y > 0) {
- let a = ((4 - x) * (4 - y)) as u16;
- let b = (( x) * (4 - y)) as u16;
- let c = ((4 - x) * ( y)) as u16;
- let d = (( x) * ( y)) as u16;
+ // 3,3 case is the same as 3,2 for some reason
+ let ymod = if (x == 3) && (y == 3) { 2 } else { y };
+ let a = ((4 - x) * (4 - ymod)) as u16;
+ let b = (( x) * (4 - ymod)) as u16;
+ let c = ((4 - x) * ( ymod)) as u16;
+ let d = (( x) * ( ymod)) as u16;
for _ in 0..h {
for x in 0..w {
dst[didx + x] = ((a * (src[sidx + x] as u16)
)
}
macro_rules! strength{
- ($el: expr, $lim: expr) => (if $el < $lim { 3 } else { 1 })
+ ($el: expr, $lim: expr) => (if $el.abs() < $lim { 3 } else { 1 })
}
fn clip_symm(val: i16, lim: i16) -> i16 { val.max(-lim).min(lim) }
};
dst[offset - step] = clip8((dst[offset - step] as i16) + delta);
dst[offset] = clip8((dst[offset] as i16) - delta);
- if (str_q != 1) && (diff_q1q2.abs() <= (lim1 >> 2)) {
+ if (str_q != 1) && (diff_q1q2.abs() <= (lim2 >> 2)) {
let diff = (diff_q1q0[y] + diff_q1q2 - delta) >> 1;
let delta_q1 = if weak {
clip_symm(diff, (mode1 >> 1) as i16)
};
dst[offset - 2 * step] = clip8((dst[offset - 2 * step] as i16) - delta_q1);
}
- if (str_p != 1) && (diff_p1p2.abs() <= (lim1 >> 2)) {
+ if (str_p != 1) && (diff_p1p2.abs() <= (lim2 >> 2)) {
let diff = (diff_p1p0[y] + diff_p1p2 + delta) >> 1;
let delta_p1 = if weak {
clip_symm(diff, (mode2 >> 1) as i16)
blk[off + 0 * step] = ((tm0 + tt0 + 64) >> 7) as i16;
blk[off + 1 * step] = ((tm4 + tt1 + 64) >> 7) as i16;
blk[off + 2 * step] = ((tm6 + tt2 + 64) >> 7) as i16;
- blk[off + 3 * step] = ((tm4 + tt3 + 64) >> 7) as i16;
+ blk[off + 3 * step] = ((tm2 + tt3 + 64) >> 7) as i16;
blk[off + 4 * step] = ((tm3 + tt4 + 64) >> 7) as i16;
blk[off + 5 * step] = ((tm7 + tt5 + 64) >> 7) as i16;
blk[off + 6 * step] = ((tm5 + tt6 + 64) >> 7) as i16;
luma_mc(dst, doffset, dstride, src, soffset, sstride, w, h, cx, cy);
} else {
let mut ebuf: [u8; 70*70] = [0; 70*70];
- edge_emu(prev_frame, (x as isize) + (dx as isize) - 2, (y as isize) + (dy as isize) - 2, w+5, h+5, &mut ebuf, 70, 0, 0);
+ edge_emu(prev_frame, (x as isize) + (dx as isize) - 2, (y as isize) + (dy as isize) - 2, w+5, h+5, &mut ebuf, 70, 0, 4);
luma_mc(dst, doffset, dstride, &ebuf, 70*2 + 2, 70, w, h, cx, cy);
}
}
chroma_mc(frame.data, doffset, dstride, src, soffset, sstride, cw, ch, cx, cy);
} else {
let mut ebuf: [u8; 40*40] = [0; 40*40];
- edge_emu(prev_frame, ((x >> 1) as isize) + (dx as isize), ((y >> 1) as isize) + (dy as isize), cw+1, ch+1, &mut ebuf, 40, comp, 0);
+ edge_emu(prev_frame, ((x >> 1) as isize) + (dx as isize), ((y >> 1) as isize) + (dy as isize), cw+1, ch+1, &mut ebuf, 40, comp, 3);
chroma_mc(frame.data, doffset, dstride, &ebuf, 0, 40, cw, ch, cx, cy);
}
}
filter_luma_edge(frame.data, offset, 1, stride, mode_l, mode_r, lim1, lim2);
}
if ((str_l | str_r) >= 2) && deblock_chroma {
- for comp in 1..2 {
+ for comp in 1..3 {
let stride = frame.stride[comp];
let offset = frame.offset[comp] + (xpos >> 1) + (ypos >> 1) * stride;
filter_chroma_edge(frame.data, offset, 1, stride, mode_l, mode_r, lim1, lim2);
filter_luma_edge(frame.data, offset, stride, 1, mode_t, mode_d, lim1, lim2);
}
if ((str_t | str_d) >= 2) && deblock_chroma {
- for comp in 1..2 {
+ for comp in 1..3 {
let stride = frame.stride[comp];
let offset = frame.offset[comp] + (xpos >> 1) + (ypos >> 1) * stride;
filter_chroma_edge(frame.data, offset, stride, 1, mode_t, mode_d, lim1, lim2);