Commit bb100e27 authored by Angie Chiang's avatar Angie Chiang

Add av1_adapt_txb_probs()

This is for backward updating probability model of lv_map

Change-Id: I0e943e271e3cb8a90c33263b4d62db90bf2e89b0
parent fe2ad262
......@@ -9,14 +9,17 @@
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include "av1/common/entropy.h"
#include "./aom_config.h"
#include "aom/aom_integer.h"
#include "aom_mem/aom_mem.h"
#include "av1/common/blockd.h"
#include "av1/common/entropy.h"
#include "av1/common/entropymode.h"
#include "av1/common/onyxc_int.h"
#include "av1/common/scan.h"
#if CONFIG_LV_MAP
#include "av1/common/txb_common.h"
#endif
// Unconstrained Node Tree
/* clang-format off */
......@@ -5507,6 +5510,7 @@ void av1_default_coef_probs(AV1_COMMON *cm) {
#endif // CONFIG_EC_MULTISYMBOL
}
#if !CONFIG_LV_MAP
static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size,
unsigned int count_sat,
unsigned int update_factor) {
......@@ -5568,9 +5572,9 @@ static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size,
}
#endif
}
#endif // !CONFIG_LV_MAP
void av1_adapt_coef_probs(AV1_COMMON *cm) {
TX_SIZE tx_size;
unsigned int count_sat, update_factor;
if (!frame_is_intra_only(cm) && cm->last_frame_type == KEY_FRAME) {
......@@ -5584,8 +5588,13 @@ void av1_adapt_coef_probs(AV1_COMMON *cm) {
if (cm->partial_prob_update == 1) update_factor = COEF_MAX_UPDATE_FACTOR;
#endif // CONFIG_SUBFRAME_PROB_UPDATE
#if CONFIG_LV_MAP
av1_adapt_txb_probs(cm, count_sat, update_factor);
#else
TX_SIZE tx_size;
for (tx_size = 0; tx_size < TX_SIZES; tx_size++)
adapt_coef_probs(cm, tx_size, count_sat, update_factor);
#endif
}
#if CONFIG_SUBFRAME_PROB_UPDATE
......
......@@ -9,6 +9,7 @@
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include "aom/aom_integer.h"
#include "av1/common/onyxc_int.h"
const int16_t av1_coeff_band_4x4[16] = { 0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15 };
......@@ -93,3 +94,56 @@ const int16_t av1_coeff_band_32x32[1024] = {
24, 24, 24, 24, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22,
22, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24,
};
void av1_adapt_txb_probs(AV1_COMMON *cm, unsigned int count_sat,
unsigned int update_factor) {
FRAME_CONTEXT *fc = cm->fc;
const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx];
const FRAME_COUNTS *counts = &cm->counts;
TX_SIZE tx_size;
int plane, ctx, level;
// Update probability models for transform block skip flag
for (tx_size = 0; tx_size < TX_SIZES; ++tx_size)
for (ctx = 0; ctx < TXB_SKIP_CONTEXTS; ++ctx)
fc->txb_skip[tx_size][ctx] = mode_mv_merge_probs(
pre_fc->txb_skip[tx_size][ctx], counts->txb_skip[tx_size][ctx]);
for (plane = 0; plane < PLANE_TYPES; ++plane)
for (ctx = 0; ctx < DC_SIGN_CONTEXTS; ++ctx)
fc->dc_sign[plane][ctx] = mode_mv_merge_probs(
pre_fc->dc_sign[plane][ctx], counts->dc_sign[plane][ctx]);
// Update probability models for non-zero coefficient map and eob flag.
for (level = 0; level < NUM_BASE_LEVELS; ++level)
for (tx_size = 0; tx_size < TX_SIZES; ++tx_size)
for (plane = 0; plane < PLANE_TYPES; ++plane)
for (ctx = 0; ctx < COEFF_BASE_CONTEXTS; ++ctx)
fc->coeff_base[tx_size][plane][level][ctx] =
merge_probs(pre_fc->coeff_base[tx_size][plane][level][ctx],
counts->coeff_base[tx_size][plane][level][ctx],
count_sat, update_factor);
for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) {
for (plane = 0; plane < PLANE_TYPES; ++plane) {
for (ctx = 0; ctx < SIG_COEF_CONTEXTS; ++ctx) {
fc->nz_map[tx_size][plane][ctx] = merge_probs(
pre_fc->nz_map[tx_size][plane][ctx],
counts->nz_map[tx_size][plane][ctx], count_sat, update_factor);
}
for (ctx = 0; ctx < EOB_COEF_CONTEXTS; ++ctx) {
fc->eob_flag[tx_size][plane][ctx] = merge_probs(
pre_fc->eob_flag[tx_size][plane][ctx],
counts->eob_flag[tx_size][plane][ctx], count_sat, update_factor);
}
}
}
for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) {
for (plane = 0; plane < PLANE_TYPES; ++plane)
for (ctx = 0; ctx < LEVEL_CONTEXTS; ++ctx)
fc->coeff_lps[tx_size][plane][ctx] = merge_probs(
pre_fc->coeff_lps[tx_size][plane][ctx],
counts->coeff_lps[tx_size][plane][ctx], count_sat, update_factor);
}
}
......@@ -298,4 +298,7 @@ static INLINE void get_txb_ctx(BLOCK_SIZE bsize, TX_SIZE tx_size, int plane,
txb_ctx->txb_skip_ctx = ctx_offset + ctx_base;
}
}
void av1_adapt_txb_probs(AV1_COMMON *cm, unsigned int count_sat,
unsigned int update_factor);
#endif // AV1_COMMON_TXB_COMMON_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment