- let top_is_strong = is_strong || (row > 0 && mbinfo[mb_pos - mb_w].mbtype.is_intra_or_16());
- let left_is_strong = is_strong || (mb_x > 0 && mbinfo[mb_pos - 1].mbtype.is_intra_or_16());
+ let top_is_strong = row > 0 && mbinfo[mb_pos - mb_w].mbtype.is_intra_or_16();
+ let left_is_strong = mb_x > 0 && mbinfo[mb_pos - 1].mbtype.is_intra_or_16();
+ let bot_is_strong = !is_last_row && mbinfo[mb_pos + mb_w].mbtype.is_intra_or_16();
+
+ let cur_dbk = mbinfo[mb_pos].deblock;
+ let cur_cbp = if is_strong { 0xFFFFFF } else { mbinfo[mb_pos].cbp };
+
+ let (top_cbp, top_dbk) = if row > 0 {
+ (if top_is_strong { 0xFFFFFF } else { mbinfo[mb_pos - mb_w].cbp }, mbinfo[mb_pos - mb_w].deblock)
+ } else {
+ (0, 0)
+ };
+ let (bot_cbp, bot_dbk) = if !is_last_row {
+ (mbinfo[mb_pos + mb_w].cbp, mbinfo[mb_pos + mb_w].deblock)
+ } else {
+ (0, 0)
+ };
+
+ let y_cbp = cur_cbp & 0xFFFF;
+ let y_to_deblock = (cur_dbk as u32) | ((bot_dbk as u32) << 16);
+ let mut y_h_deblock = y_to_deblock | ((y_cbp << 4) & !Y_TOP_ROW_MASK) | ((top_cbp & Y_BOT_ROW_MASK) >> 12);
+ let mut y_v_deblock = y_to_deblock | ((y_cbp << 1) & !Y_LEFT_COL_MASK) | ((left_cbp & Y_RIGHT_COL_MASK) >> 3);
+
+ if mb_x == 0 {
+ y_v_deblock &= !Y_LEFT_COL_MASK;
+ }
+ if row == 0 {
+ y_h_deblock &= !Y_TOP_ROW_MASK;
+ }
+ if is_last_row || is_strong || bot_is_strong {
+ y_h_deblock &= !(Y_TOP_ROW_MASK << 16);
+ }