static inline unsigned gather_left_partition_prob(const uint16_t *const in, const enum BlockLevel bl)
{ unsigned out = in[PARTITION_H - 1] - in[PARTITION_H]; // Exploit the fact that cdfs for PARTITION_SPLIT, PARTITION_T_TOP_SPLIT, // PARTITION_T_BOTTOM_SPLIT and PARTITION_T_LEFT_SPLIT are neighbors.
out += in[PARTITION_SPLIT - 1] - in[PARTITION_T_LEFT_SPLIT];
if (bl != BL_128X128)
out += in[PARTITION_H4 - 1] - in[PARTITION_H4]; return out;
}
static inline unsigned gather_top_partition_prob(const uint16_t *const in, const enum BlockLevel bl)
{ // Exploit the fact that cdfs for PARTITION_V, PARTITION_SPLIT and // PARTITION_T_TOP_SPLIT are neighbors. unsigned out = in[PARTITION_V - 1] - in[PARTITION_T_TOP_SPLIT]; // Exploit the facts that cdfs for PARTITION_T_LEFT_SPLIT and // PARTITION_T_RIGHT_SPLIT are neighbors, the probability for // PARTITION_V4 is always zero, and the probability for // PARTITION_T_RIGHT_SPLIT is zero in 128x128 blocks.
out += in[PARTITION_T_LEFT_SPLIT - 1];
if (bl != BL_128X128)
out += in[PARTITION_V4 - 1] - in[PARTITION_T_RIGHT_SPLIT]; return out;
}
static inline int av1_get_ref_ctx(const BlockContext *const a, const BlockContext *const l, const int yb4, const int xb4,
int have_top, int have_left)
{
int cnt[2] = { 0 };
if (have_top && !a->intra[xb4]) {
cnt[a->ref[0][xb4] >= 4]++;
if (a->comp_type[xb4]) cnt[a->ref[1][xb4] >= 4]++;
}
if (have_left && !l->intra[yb4]) {
cnt[l->ref[0][yb4] >= 4]++;
if (l->comp_type[yb4]) cnt[l->ref[1][yb4] >= 4]++;
}
static inline int av1_get_fwd_ref_ctx(const BlockContext *const a, const BlockContext *const l, const int yb4, const int xb4, const int have_top, const int have_left)
{
int cnt[4] = { 0 };
if (have_top && !a->intra[xb4]) {
if (a->ref[0][xb4] < 4) cnt[a->ref[0][xb4]]++;
if (a->comp_type[xb4] && a->ref[1][xb4] < 4) cnt[a->ref[1][xb4]]++;
}
if (have_left && !l->intra[yb4]) {
if (l->ref[0][yb4] < 4) cnt[l->ref[0][yb4]]++;
if (l->comp_type[yb4] && l->ref[1][yb4] < 4) cnt[l->ref[1][yb4]]++;
}
static inline int av1_get_fwd_ref_1_ctx(const BlockContext *const a, const BlockContext *const l, const int yb4, const int xb4, const int have_top, const int have_left)
{
int cnt[2] = { 0 };
if (have_top && !a->intra[xb4]) {
if (a->ref[0][xb4] < 2) cnt[a->ref[0][xb4]]++;
if (a->comp_type[xb4] && a->ref[1][xb4] < 2) cnt[a->ref[1][xb4]]++;
}
if (have_left && !l->intra[yb4]) {
if (l->ref[0][yb4] < 2) cnt[l->ref[0][yb4]]++;
if (l->comp_type[yb4] && l->ref[1][yb4] < 2) cnt[l->ref[1][yb4]]++;
}
static inline int av1_get_fwd_ref_2_ctx(const BlockContext *const a, const BlockContext *const l, const int yb4, const int xb4, const int have_top, const int have_left)
{
int cnt[2] = { 0 };
if (have_top && !a->intra[xb4]) {
if ((a->ref[0][xb4] ^ 2U) < 2) cnt[a->ref[0][xb4] - 2]++;
if (a->comp_type[xb4] && (a->ref[1][xb4] ^ 2U) < 2) cnt[a->ref[1][xb4] - 2]++;
}
if (have_left && !l->intra[yb4]) {
if ((l->ref[0][yb4] ^ 2U) < 2) cnt[l->ref[0][yb4] - 2]++;
if (l->comp_type[yb4] && (l->ref[1][yb4] ^ 2U) < 2) cnt[l->ref[1][yb4] - 2]++;
}
static inline int av1_get_bwd_ref_ctx(const BlockContext *const a, const BlockContext *const l, const int yb4, const int xb4, const int have_top, const int have_left)
{
int cnt[3] = { 0 };
if (have_top && !a->intra[xb4]) {
if (a->ref[0][xb4] >= 4) cnt[a->ref[0][xb4] - 4]++;
if (a->comp_type[xb4] && a->ref[1][xb4] >= 4) cnt[a->ref[1][xb4] - 4]++;
}
if (have_left && !l->intra[yb4]) {
if (l->ref[0][yb4] >= 4) cnt[l->ref[0][yb4] - 4]++;
if (l->comp_type[yb4] && l->ref[1][yb4] >= 4) cnt[l->ref[1][yb4] - 4]++;
}
static inline int av1_get_bwd_ref_1_ctx(const BlockContext *const a, const BlockContext *const l, const int yb4, const int xb4, const int have_top, const int have_left)
{
int cnt[3] = { 0 };
if (have_top && !a->intra[xb4]) {
if (a->ref[0][xb4] >= 4) cnt[a->ref[0][xb4] - 4]++;
if (a->comp_type[xb4] && a->ref[1][xb4] >= 4) cnt[a->ref[1][xb4] - 4]++;
}
if (have_left && !l->intra[yb4]) {
if (l->ref[0][yb4] >= 4) cnt[l->ref[0][yb4] - 4]++;
if (l->comp_type[yb4] && l->ref[1][yb4] >= 4) cnt[l->ref[1][yb4] - 4]++;
}
static inline int av1_get_uni_p1_ctx(const BlockContext *const a, const BlockContext *const l, const int yb4, const int xb4, const int have_top, const int have_left)
{
int cnt[3] = { 0 };
if (have_top && !a->intra[xb4]) {
if (a->ref[0][xb4] - 1U < 3) cnt[a->ref[0][xb4] - 1]++;
if (a->comp_type[xb4] && a->ref[1][xb4] - 1U < 3) cnt[a->ref[1][xb4] - 1]++;
}
if (have_left && !l->intra[yb4]) {
if (l->ref[0][yb4] - 1U < 3) cnt[l->ref[0][yb4] - 1]++;
if (l->comp_type[yb4] && l->ref[1][yb4] - 1U < 3) cnt[l->ref[1][yb4] - 1]++;
}
static inline unsigned get_cur_frame_segid(const int by, const int bx, const int have_top, const int have_left,
int *const seg_ctx, const uint8_t *cur_seg_map, const ptrdiff_t stride)
{
cur_seg_map += bx + by * stride;
if (have_left && have_top) { const int l = cur_seg_map[-1]; const int a = cur_seg_map[-stride]; const int al = cur_seg_map[-(stride + 1)];
if (l == a && al == l) *seg_ctx = 2; else if (l == a || al == l || a == al) *seg_ctx = 1; else *seg_ctx = 0; return a == al ? a : l;
} else {
*seg_ctx = 0; return have_left ? cur_seg_map[-1] : have_top ? cur_seg_map[-stride] : 0;
}
}
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.