Use the actual transform block size for loop filter selection Parse the recursive transform block partition to fetch the actual transform size. Use this correct transform size to select the corresponding loop filter kernel. This slightly improves the coding performance of recursive transform partition for hdres to 0.14%. Change-Id: Ibe8bc3fdd0d222a4f1fb8156c56a407bec052b9b
diff --git a/av1/common/loopfilter.c b/av1/common/loopfilter.c index 15d4947..25ce24a 100644 --- a/av1/common/loopfilter.c +++ b/av1/common/loopfilter.c
@@ -1241,26 +1241,37 @@ const int skip_this_r = skip_this && !block_edge_above; #if CONFIG_VAR_TX +#if CONFIG_EXT_TX && CONFIG_RECT_TX + TX_SIZE mb_tx_size = is_rect_tx(mbmi->tx_size) + ? mbmi->tx_size + : mbmi->inter_tx_size[blk_row][blk_col]; +#else + const TX_SIZE mb_tx_size = mbmi->inter_tx_size[blk_row][blk_col]; +#endif +#endif + TX_SIZE tx_size = (plane->plane_type == PLANE_TYPE_UV) ? get_uv_tx_size(mbmi, plane) : mbmi->tx_size; -#else - const TX_SIZE tx_size = (plane->plane_type == PLANE_TYPE_UV) - ? get_uv_tx_size(mbmi, plane) - : mbmi->tx_size; -#endif const int skip_border_4x4_c = ss_x && mi_col + c == cm->mi_cols - 1; const int skip_border_4x4_r = ss_y && mi_row + r == cm->mi_rows - 1; - TX_SIZE tx_size_c = num_4x4_blocks_wide_txsize_log2_lookup[tx_size]; - TX_SIZE tx_size_r = num_4x4_blocks_high_txsize_log2_lookup[tx_size]; + TX_SIZE tx_size_c = tx_size_wide_unit[tx_size]; + TX_SIZE tx_size_r = tx_size_high_unit[tx_size]; int tx_size_mask = 0; const int c_step = (c >> ss_x); const int r_step = (r >> ss_y); const int col_mask = 1 << c_step; +#if CONFIG_VAR_TX + if (is_inter_block(mbmi) && !mbmi->skip) + tx_size = (plane->plane_type == PLANE_TYPE_UV) + ? uv_txsize_lookup[sb_type][mb_tx_size][ss_x][ss_y] + : mb_tx_size; +#endif + // Filter level can vary per MI if (!(lfl[r][c_step] = get_filter_level(&cm->lf_info, mbmi))) continue; @@ -1272,19 +1283,6 @@ tx_size_mask = 0; #if CONFIG_VAR_TX - if (is_inter_block(mbmi) && !mbmi->skip) { -#if CONFIG_EXT_TX && CONFIG_RECT_TX - TX_SIZE mb_tx_size = is_rect_tx(mbmi->tx_size) - ? mbmi->tx_size - : mbmi->inter_tx_size[blk_row][blk_col]; -#else - TX_SIZE mb_tx_size = mbmi->inter_tx_size[blk_row][blk_col]; -#endif - tx_size = (plane->plane_type == PLANE_TYPE_UV) - ? uv_txsize_lookup[sb_type][mb_tx_size][ss_x][ss_y] - : mb_tx_size; - } - #if CONFIG_EXT_TX && CONFIG_RECT_TX tx_size_r = AOMMIN(txsize_horz_map[tx_size], cm->above_txfm_context[mi_col + c]); @@ -1433,27 +1431,37 @@ (num_4x4_blocks_high_lookup[sb_type] > 1) ? !blk_row : 1; const int skip_this_r = skip_this && !block_edge_above; -#if CONFIG_VAR_TX TX_SIZE tx_size = (plane->plane_type == PLANE_TYPE_UV) ? get_uv_tx_size(mbmi, plane) : mbmi->tx_size; +#if CONFIG_VAR_TX +#if CONFIG_EXT_TX && CONFIG_RECT_TX + TX_SIZE mb_tx_size = is_rect_tx(mbmi->tx_size) + ? mbmi->tx_size + : mbmi->inter_tx_size[blk_row][blk_col]; #else - const TX_SIZE tx_size = (plane->plane_type == PLANE_TYPE_UV) - ? get_uv_tx_size(mbmi, plane) - : mbmi->tx_size; + TX_SIZE mb_tx_size = mbmi->inter_tx_size[blk_row][blk_col]; #endif - +#endif const int skip_border_4x4_c = ss_x && mi_col + c == cm->mi_cols - 1; const int skip_border_4x4_r = ss_y && mi_row + r == cm->mi_rows - 1; - TX_SIZE tx_size_c = num_4x4_blocks_wide_txsize_log2_lookup[tx_size]; - TX_SIZE tx_size_r = num_4x4_blocks_high_txsize_log2_lookup[tx_size]; + TX_SIZE tx_size_c = tx_size_wide_unit[tx_size]; + TX_SIZE tx_size_r = tx_size_high_unit[tx_size]; int tx_size_mask = 0; const int c_step = (c >> ss_x); const int r_step = (r >> ss_y); const int col_mask = 1 << c_step; +#if CONFIG_VAR_TX + if (is_inter_block(mbmi) && !mbmi->skip) { + tx_size = (plane->plane_type == PLANE_TYPE_UV) + ? uv_txsize_lookup[sb_type][mb_tx_size][ss_x][ss_y] + : mb_tx_size; + } +#endif + // Filter level can vary per MI if (!(lfl[r][c_step] = get_filter_level(&cm->lf_info, mbmi))) continue; @@ -1465,19 +1473,6 @@ tx_size_mask = 0; #if CONFIG_VAR_TX - if (is_inter_block(mbmi) && !mbmi->skip) { -#if CONFIG_EXT_TX && CONFIG_RECT_TX - TX_SIZE mb_tx_size = is_rect_tx(mbmi->tx_size) - ? mbmi->tx_size - : mbmi->inter_tx_size[blk_row][blk_col]; -#else - TX_SIZE mb_tx_size = mbmi->inter_tx_size[blk_row][blk_col]; -#endif - tx_size = (plane->plane_type == PLANE_TYPE_UV) - ? uv_txsize_lookup[sb_type][mb_tx_size][ss_x][ss_y] - : mb_tx_size; - } - #if CONFIG_EXT_TX && CONFIG_RECT_TX tx_size_r = AOMMIN(txsize_horz_map[tx_size], cm->above_txfm_context[mi_col + c]);