// Set the upper limit of the motion vector component magnitude. // This would make a motion vector fit in 26 bits. Plus 3 bits for the // reference frame index. A tuple of motion vector can hence be stored within // 32 bit range for efficient load/store operations. #define REFMVS_LIMIT ((1 << 12) - 1)
typedefstruct position {
int row;
int col;
} POSITION;
// clamp_mv_ref #define MV_BORDER (16 << 3) // Allow 16 pels in 1/8th pel units
static inline int get_relative_dist(const OrderHintInfo *oh, int a, int b) {
if (!oh->enable_order_hint) return0;
// Checks that the given mi_row, mi_col and search point // are inside the borders of the tile. static inline int is_inside(const TileInfo *const tile, int mi_col, int mi_row, const POSITION *mi_pos) { return !(mi_row + mi_pos->row < tile->mi_row_start ||
mi_col + mi_pos->col < tile->mi_col_start ||
mi_row + mi_pos->row >= tile->mi_row_end ||
mi_col + mi_pos->col >= tile->mi_col_end);
}
static inline int find_valid_row_offset(const TileInfo *const tile, int mi_row,
int row_offset) { return clamp(row_offset, tile->mi_row_start - mi_row,
tile->mi_row_end - mi_row - 1);
}
static inline int find_valid_col_offset(const TileInfo *const tile, int mi_col,
int col_offset) { return clamp(col_offset, tile->mi_col_start - mi_col,
tile->mi_col_end - mi_col - 1);
}
static inline void lower_mv_precision(MV *mv, int allow_hp, int is_integer) {
if (is_integer) {
integer_mv_precision(mv);
} else {
if (!allow_hp) {
if (mv->row & 1) mv->row += (mv->row > 0 ? -1 : 1);
if (mv->col & 1) mv->col += (mv->col > 0 ? -1 : 1);
}
}
}
static inline int8_t get_uni_comp_ref_idx(const MV_REFERENCE_FRAME *const rf) { // Single ref pred
if (rf[1] <= INTRA_FRAME) return -1;
// Bi-directional comp ref pred
if ((rf[0] < BWDREF_FRAME) && (rf[1] >= BWDREF_FRAME)) return -1;
// NOTE: Following reference frame pairs are not supported to be explicitly // signalled, but they are possibly chosen by the use of skip_mode, // which may use the most recent one-sided reference frame pair.
{ LAST2_FRAME, LAST3_FRAME }, { LAST2_FRAME, GOLDEN_FRAME },
{ LAST3_FRAME, GOLDEN_FRAME }, {BWDREF_FRAME, ALTREF2_FRAME},
{ ALTREF2_FRAME, ALTREF_FRAME }
}; // clang-format on
// Above neighbor
if (above_in_image && is_inter_block(above_mbmi)) {
ref_counts[above_mbmi->ref_frame[0]]++;
if (has_second_ref(above_mbmi)) {
ref_counts[above_mbmi->ref_frame[1]]++;
}
}
// Left neighbor
if (left_in_image && is_inter_block(left_mbmi)) {
ref_counts[left_mbmi->ref_frame[0]]++;
if (has_second_ref(left_mbmi)) {
ref_counts[left_mbmi->ref_frame[1]]++;
}
}
}
void av1_get_mv_projection(MV *output, MV ref, int num, int den);
void av1_copy_frame_mvs(const AV1_COMMON *const cm, const MB_MODE_INFO *const mi, int mi_row, int mi_col,
int x_mis, int y_mis);
// The global_mvs output parameter points to an array of REF_FRAMES elements. // The caller may pass a null global_mvs if it does not need the global_mvs // output. void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
MB_MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame,
uint8_t ref_mv_count[MODE_CTX_REF_FRAMES],
CANDIDATE_MV ref_mv_stack[][MAX_REF_MV_STACK_SIZE],
uint16_t ref_mv_weight[][MAX_REF_MV_STACK_SIZE],
int_mv mv_ref_list[][MAX_MV_REF_CANDIDATES],
int_mv *global_mvs, int16_t *mode_context);
// check a list of motion vectors by sad score using a number rows of pixels // above and a number cols of pixels in the left to select the one with best // score to use as ref motion vector void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv,
int_mv *near_mv, int is_integer);
uint8_t av1_selectSamples(MV *mv, int *pts, int *pts_inref, int len,
BLOCK_SIZE bsize);
uint8_t av1_findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int *pts,
int *pts_inref);
static inline int av1_is_dv_valid(const MV dv, const AV1_COMMON *cm, const MACROBLOCKD *xd, int mi_row, int mi_col,
BLOCK_SIZE bsize, int mib_size_log2) { const int bw = block_size_wide[bsize]; const int bh = block_size_high[bsize]; const int SCALE_PX_TO_MV = 8; // Disallow subpixel for now // SUBPEL_MASK is not the correct scale
if (((dv.row & (SCALE_PX_TO_MV - 1)) || (dv.col & (SCALE_PX_TO_MV - 1)))) return0;
const TileInfo *const tile = &xd->tile; // Is the source top-left inside the current tile? const int src_top_edge = mi_row * MI_SIZE * SCALE_PX_TO_MV + dv.row; const int tile_top_edge = tile->mi_row_start * MI_SIZE * SCALE_PX_TO_MV;
if (src_top_edge < tile_top_edge) return0; const int src_left_edge = mi_col * MI_SIZE * SCALE_PX_TO_MV + dv.col; const int tile_left_edge = tile->mi_col_start * MI_SIZE * SCALE_PX_TO_MV;
if (src_left_edge < tile_left_edge) return0; // Is the bottom right inside the current tile? const int src_bottom_edge = (mi_row * MI_SIZE + bh) * SCALE_PX_TO_MV + dv.row; const int tile_bottom_edge = tile->mi_row_end * MI_SIZE * SCALE_PX_TO_MV;
if (src_bottom_edge > tile_bottom_edge) return0; const int src_right_edge = (mi_col * MI_SIZE + bw) * SCALE_PX_TO_MV + dv.col; const int tile_right_edge = tile->mi_col_end * MI_SIZE * SCALE_PX_TO_MV;
if (src_right_edge > tile_right_edge) return0;
// Special case for sub 8x8 chroma cases, to prevent referring to chroma // pixels outside current tile.
if (xd->is_chroma_ref && av1_num_planes(cm) > 1) { conststruct macroblockd_plane *const pd = &xd->plane[1];
if (bw < 8 && pd->subsampling_x)
if (src_left_edge < tile_left_edge + 4 * SCALE_PX_TO_MV) return0;
if (bh < 8 && pd->subsampling_y)
if (src_top_edge < tile_top_edge + 4 * SCALE_PX_TO_MV) return0;
}
// Is the bottom right within an already coded SB? Also consider additional // constraints to facilitate HW decoder. const int max_mib_size = 1 << mib_size_log2; const int active_sb_row = mi_row >> mib_size_log2; const int active_sb64_col = (mi_col * MI_SIZE) >> 6; const int sb_size = max_mib_size * MI_SIZE; const int src_sb_row = ((src_bottom_edge >> 3) - 1) / sb_size; const int src_sb64_col = ((src_right_edge >> 3) - 1) >> 6; const int total_sb64_per_row =
((tile->mi_col_end - tile->mi_col_start - 1) >> 4) + 1; const int active_sb64 = active_sb_row * total_sb64_per_row + active_sb64_col; const int src_sb64 = src_sb_row * total_sb64_per_row + src_sb64_col;
if (src_sb64 >= active_sb64 - INTRABC_DELAY_SB64) return0;
// Wavefront constraint: use only top left area of frame for reference. const int gradient = 1 + INTRABC_DELAY_SB64 + (sb_size > 64); const int wf_offset = gradient * (active_sb_row - src_sb_row);
if (src_sb_row > active_sb_row ||
src_sb64_col >= active_sb64_col - INTRABC_DELAY_SB64 + wf_offset) return0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.