static void count_segs_sb(VP9_COMP *cpi, MODE_INFO *mi, int *no_pred_segcounts, int (*temporal_predictor_count)[2], int *t_unpred_seg_counts, int mi_row, int mi_col, BLOCK_SIZE_TYPE bsize) { VP9_COMMON *const cm = &cpi->common; const int mis = cm->mode_info_stride; int bwl, bhl; const int bsl = mi_width_log2(bsize), bs = 1 << (bsl - 1); if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return; bwl = mi_width_log2(mi->mbmi.sb_type); bhl = mi_height_log2(mi->mbmi.sb_type); if (bwl == bsl && bhl == bsl) { count_segs(cpi, mi, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, 1 << bsl, 1 << bsl, mi_row, mi_col); } else if (bwl == bsl && bhl < bsl) { count_segs(cpi, mi, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, 1 << bsl, bs, mi_row, mi_col); count_segs(cpi, mi + bs * mis, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, 1 << bsl, bs, mi_row + bs, mi_col); } else if (bwl < bsl && bhl == bsl) { count_segs(cpi, mi, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, bs, 1 << bsl, mi_row, mi_col); count_segs(cpi, mi + bs, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, bs, 1 << bsl, mi_row, mi_col + bs); } else { BLOCK_SIZE_TYPE subsize; int n; assert(bwl < bsl && bhl < bsl); if (bsize == BLOCK_SIZE_SB64X64) { subsize = BLOCK_SIZE_SB32X32; } else if (bsize == BLOCK_SIZE_SB32X32) { subsize = BLOCK_SIZE_MB16X16; } else { assert(bsize == BLOCK_SIZE_MB16X16); subsize = BLOCK_SIZE_SB8X8; } for (n = 0; n < 4; n++) { const int y_idx = n >> 1, x_idx = n & 0x01; count_segs_sb(cpi, mi + y_idx * bs * mis + x_idx * bs, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, mi_row + y_idx * bs, mi_col + x_idx * bs, subsize); } } }
static void count_segs_sb(const VP9_COMMON *cm, MACROBLOCKD *xd, const TileInfo *tile, MODE_INFO **mi, int *no_pred_segcounts, int (*temporal_predictor_count)[2], int *t_unpred_seg_counts, int mi_row, int mi_col, BLOCK_SIZE bsize) { const int mis = cm->mi_stride; int bw, bh; const int bs = num_8x8_blocks_wide_lookup[bsize], hbs = bs / 2; if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return; bw = num_8x8_blocks_wide_lookup[mi[0]->mbmi.sb_type]; bh = num_8x8_blocks_high_lookup[mi[0]->mbmi.sb_type]; if (bw == bs && bh == bs) { count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, bs, bs, mi_row, mi_col); } else if (bw == bs && bh < bs) { count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, bs, hbs, mi_row, mi_col); count_segs(cm, xd, tile, mi + hbs * mis, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, bs, hbs, mi_row + hbs, mi_col); } else if (bw < bs && bh == bs) { count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, hbs, bs, mi_row, mi_col); count_segs(cm, xd, tile, mi + hbs, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, hbs, bs, mi_row, mi_col + hbs); } else { const BLOCK_SIZE subsize = subsize_lookup[PARTITION_SPLIT][bsize]; int n; assert(bw < bs && bh < bs); for (n = 0; n < 4; n++) { const int mi_dc = hbs * (n & 1); const int mi_dr = hbs * (n >> 1); count_segs_sb(cm, xd, tile, &mi[mi_dr * mis + mi_dc], no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, mi_row + mi_dr, mi_col + mi_dc, subsize); } } }
static void count_segs_sb(const AV1_COMMON *cm, MACROBLOCKD *xd, const TileInfo *tile, MODE_INFO **mi, unsigned *no_pred_segcounts, unsigned (*temporal_predictor_count)[2], unsigned *t_unpred_seg_counts, int mi_row, int mi_col, BLOCK_SIZE bsize) { const int mis = cm->mi_stride; const int bs = mi_size_wide[bsize], hbs = bs / 2; #if CONFIG_EXT_PARTITION_TYPES PARTITION_TYPE partition; #else int bw, bh; #endif // CONFIG_EXT_PARTITION_TYPES if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return; #if CONFIG_EXT_PARTITION_TYPES if (bsize == BLOCK_8X8) partition = PARTITION_NONE; else partition = get_partition(cm, mi_row, mi_col, bsize); switch (partition) { case PARTITION_NONE: count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, bs, bs, mi_row, mi_col); break; case PARTITION_HORZ: count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, bs, hbs, mi_row, mi_col); count_segs(cm, xd, tile, mi + hbs * mis, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, bs, hbs, mi_row + hbs, mi_col); break; case PARTITION_VERT: count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, hbs, bs, mi_row, mi_col); count_segs(cm, xd, tile, mi + hbs, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, hbs, bs, mi_row, mi_col + hbs); break; case PARTITION_HORZ_A: count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, hbs, hbs, mi_row, mi_col); count_segs(cm, xd, tile, mi + hbs, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, hbs, hbs, mi_row, mi_col + hbs); count_segs(cm, xd, tile, mi + hbs * mis, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, bs, hbs, mi_row + hbs, mi_col); break; case PARTITION_HORZ_B: count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, bs, hbs, mi_row, mi_col); count_segs(cm, xd, tile, mi + hbs * mis, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, hbs, hbs, mi_row + hbs, mi_col); count_segs(cm, xd, tile, mi + hbs + hbs * mis, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, hbs, hbs, mi_row + hbs, mi_col + hbs); break; case PARTITION_VERT_A: count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, hbs, hbs, mi_row, mi_col); count_segs(cm, xd, tile, mi + hbs * mis, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, hbs, hbs, mi_row + hbs, mi_col); count_segs(cm, xd, tile, mi + hbs, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, hbs, bs, mi_row, mi_col + hbs); break; case PARTITION_VERT_B: count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, hbs, bs, mi_row, mi_col); count_segs(cm, xd, tile, mi + hbs, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, hbs, hbs, mi_row, mi_col + hbs); count_segs(cm, xd, tile, mi + hbs + hbs * mis, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, hbs, hbs, mi_row + hbs, mi_col + hbs); break; case PARTITION_SPLIT: { const BLOCK_SIZE subsize = subsize_lookup[PARTITION_SPLIT][bsize]; int n; assert(num_8x8_blocks_wide_lookup[mi[0]->mbmi.sb_type] < bs && num_8x8_blocks_high_lookup[mi[0]->mbmi.sb_type] < bs); for (n = 0; n < 4; n++) { const int mi_dc = hbs * (n & 1); const int mi_dr = hbs * (n >> 1); count_segs_sb(cm, xd, tile, &mi[mi_dr * mis + mi_dc], no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, mi_row + mi_dr, mi_col + mi_dc, subsize); } } break; default: assert(0); } #else bw = mi_size_wide[mi[0]->mbmi.sb_type]; bh = mi_size_high[mi[0]->mbmi.sb_type]; if (bw == bs && bh == bs) { count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, bs, bs, mi_row, mi_col); } else if (bw == bs && bh < bs) { count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, bs, hbs, mi_row, mi_col); count_segs(cm, xd, tile, mi + hbs * mis, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, bs, hbs, mi_row + hbs, mi_col); } else if (bw < bs && bh == bs) { count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, hbs, bs, mi_row, mi_col); count_segs(cm, xd, tile, mi + hbs, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, hbs, bs, mi_row, mi_col + hbs); } else { const BLOCK_SIZE subsize = subsize_lookup[PARTITION_SPLIT][bsize]; int n; assert(bw < bs && bh < bs); for (n = 0; n < 4; n++) { const int mi_dc = hbs * (n & 1); const int mi_dr = hbs * (n >> 1); count_segs_sb(cm, xd, tile, &mi[mi_dr * mis + mi_dc], no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, mi_row + mi_dr, mi_col + mi_dc, subsize); } } #endif // CONFIG_EXT_PARTITION_TYPES }