Add q-index as context for initial token probs
There are 4 entropy tables to select for initial entropy table, depending on the frame base q-index. The entropy tables are trained with derf, yt, and stdhd sets. About 0.2% gain on the following test sets: derflr 0.227% yt 0.277% stdhd 0.233% hevclr 0.221% hevcmr 0.155% hevchr 0.182% Change-Id: I3fde846c47fc020e80c814897690b4cda1da569c Change-Id: I460408372586c823974f945ed9fd8dcb0360fbaf
This commit is contained in:
parent
3a3fb8d100
commit
5963fd35dd
1
configure
vendored
1
configure
vendored
@ -303,6 +303,7 @@ EXPERIMENT_LIST="
|
||||
misc_entropy
|
||||
wavelets
|
||||
ext_partition
|
||||
qctx_tprobs
|
||||
"
|
||||
CONFIG_LIST="
|
||||
external_build
|
||||
|
@ -14,6 +14,9 @@
|
||||
#include "vp9/common/vp9_entropymode.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#if CONFIG_QCTX_TPROBS
|
||||
#include "vp9/common/vp9_qctx_token_probs.h"
|
||||
#endif // CONFIG_QCTX_TPROBS
|
||||
|
||||
const vp9_prob vp9_cat1_prob[] = { 159 };
|
||||
const vp9_prob vp9_cat2_prob[] = { 165, 145 };
|
||||
@ -1602,6 +1605,21 @@ void vp9_model_to_full_probs(const vp9_prob *model, vp9_prob *full) {
|
||||
extend_to_full_distribution(&full[UNCONSTRAINED_NODES], model[PIVOT_NODE]);
|
||||
}
|
||||
|
||||
#if CONFIG_QCTX_TPROBS
|
||||
static void fill_qctx_probs(int q, int tx_size,
|
||||
vp9_coeff_probs_model *coef_probs) {
|
||||
int i0, i1, i2, i3, i4;
|
||||
|
||||
for (i0 = 0; i0 < PLANE_TYPES; i0++)
|
||||
for (i1 = 0; i1 < REF_TYPES; i1++)
|
||||
for (i2 = 0; i2 < COEF_BANDS; i2++)
|
||||
for (i3 = 0; i3 < COEFF_CONTEXTS; i3++)
|
||||
for (i4 = 0; i4 < UNCONSTRAINED_NODES; i4++)
|
||||
coef_probs[i0][i1][i2][i3][i4] =
|
||||
default_qctx_coef_probs[q][tx_size][i0][i1][i2][i3][i4];
|
||||
}
|
||||
#endif // CONFIG_QCTX_TPROBS
|
||||
|
||||
void vp9_default_coef_probs(VP9_COMMON *cm) {
|
||||
vp9_copy(cm->fc.coef_probs[TX_4X4], default_coef_probs_4x4);
|
||||
vp9_copy(cm->fc.coef_probs[TX_8X8], default_coef_probs_8x8);
|
||||
@ -1614,6 +1632,17 @@ void vp9_default_coef_probs(VP9_COMMON *cm) {
|
||||
#if CONFIG_TX_SKIP
|
||||
vp9_copy(cm->fc.coef_probs_pxd, default_coef_probs_pxd);
|
||||
#endif // CONFIG_TX_SKIP
|
||||
|
||||
#if CONFIG_QCTX_TPROBS
|
||||
fill_qctx_probs(cm->base_qindex >> (8 - QCTX_BINS_BITS), TX_4X4,
|
||||
cm->fc.coef_probs[TX_4X4]);
|
||||
fill_qctx_probs(cm->base_qindex >> (8 - QCTX_BINS_BITS), TX_8X8,
|
||||
cm->fc.coef_probs[TX_8X8]);
|
||||
fill_qctx_probs(cm->base_qindex >> (8 - QCTX_BINS_BITS), TX_16X16,
|
||||
cm->fc.coef_probs[TX_16X16]);
|
||||
fill_qctx_probs(cm->base_qindex >> (8 - QCTX_BINS_BITS), TX_32X32,
|
||||
cm->fc.coef_probs[TX_32X32]);
|
||||
#endif // CONFIG_QCTX_TPROBS
|
||||
}
|
||||
|
||||
#define COEF_COUNT_SAT 24
|
||||
|
2717
vp9/common/vp9_qctx_token_probs.c
Normal file
2717
vp9/common/vp9_qctx_token_probs.c
Normal file
File diff suppressed because it is too large
Load Diff
22
vp9/common/vp9_qctx_token_probs.h
Normal file
22
vp9/common/vp9_qctx_token_probs.h
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2015 The WebM project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef VP9_COMMON_VP9_QCTX_TOKEN_PROBS_H_
|
||||
#define VP9_COMMON_VP9_QCTX_TOKEN_PROBS_H_
|
||||
|
||||
#include "vp9/common/vp9_entropymode.h"
|
||||
|
||||
#if CONFIG_QCTX_TPROBS
|
||||
#define QCTX_BINS_BITS 2
|
||||
extern const vp9_coeff_probs_model
|
||||
default_qctx_coef_probs[1 << QCTX_BINS_BITS][TX_SIZES][PLANE_TYPES];
|
||||
#endif // CONFIG_QCTX_TPROBS
|
||||
|
||||
#endif // VP9_COMMON_VP9_QCTX_TOKEN_PROBS_H_
|
@ -2681,9 +2681,6 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
|
||||
// below, forcing the use of context 0 for those frame types.
|
||||
cm->frame_context_idx = vp9_rb_read_literal(rb, FRAME_CONTEXTS_LOG2);
|
||||
|
||||
if (frame_is_intra_only(cm) || cm->error_resilient_mode)
|
||||
vp9_setup_past_independence(cm);
|
||||
|
||||
setup_loopfilter(cm, rb);
|
||||
setup_quantization(cm, &pbi->mb, rb);
|
||||
setup_segmentation(&cm->seg, rb);
|
||||
@ -2691,6 +2688,9 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
|
||||
setup_tile_info(cm, rb);
|
||||
sz = vp9_rb_read_literal(rb, 16);
|
||||
|
||||
if (frame_is_intra_only(cm) || cm->error_resilient_mode)
|
||||
vp9_setup_past_independence(cm);
|
||||
|
||||
if (sz == 0)
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
|
||||
"Invalid header size");
|
||||
|
@ -2899,7 +2899,9 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
|
||||
|
||||
vp9_set_quantizer(cm, q);
|
||||
|
||||
#if !CONFIG_QCTX_TPROBS
|
||||
if (loop_count == 0)
|
||||
#endif // CONFIG_QCTX_TPROBS
|
||||
setup_frame(cpi);
|
||||
|
||||
#if CONFIG_PALETTE
|
||||
|
@ -35,8 +35,8 @@ VP9_COMMON_SRCS-yes += common/vp9_idct.h
|
||||
VP9_COMMON_SRCS-yes += common/vp9_loopfilter.h
|
||||
VP9_COMMON_SRCS-yes += common/vp9_mv.h
|
||||
VP9_COMMON_SRCS-yes += common/vp9_onyxc_int.h
|
||||
VP9_COMMON_SRCS-$(CONFIG_EXPERIMENTAL) += common/vp9_palette.h
|
||||
VP9_COMMON_SRCS-$(CONFIG_EXPERIMENTAL) += common/vp9_palette.c
|
||||
VP9_COMMON_SRCS-$(CONFIG_PALETTE) += common/vp9_palette.h
|
||||
VP9_COMMON_SRCS-$(CONFIG_PALETTE) += common/vp9_palette.c
|
||||
VP9_COMMON_SRCS-yes += common/vp9_pred_common.h
|
||||
VP9_COMMON_SRCS-yes += common/vp9_pred_common.c
|
||||
VP9_COMMON_SRCS-yes += common/vp9_prob.h
|
||||
@ -72,6 +72,8 @@ VP9_COMMON_SRCS-$(CONFIG_GLOBAL_MOTION) += common/vp9_motion_model.c
|
||||
VP9_COMMON_SRCS-$(CONFIG_GLOBAL_MOTION) += common/vp9_motion_model.h
|
||||
VP9_COMMON_SRCS-$(CONFIG_WAVELETS) += common/vp9_idwt.c
|
||||
VP9_COMMON_SRCS-$(CONFIG_WAVELETS) += common/vp9_idwt.h
|
||||
VP9_COMMON_SRCS-$(CONFIG_QCTX_TPROBS) += common/vp9_qctx_token_probs.h
|
||||
VP9_COMMON_SRCS-$(CONFIG_QCTX_TPROBS) += common/vp9_qctx_token_probs.c
|
||||
|
||||
VP9_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64) += common/x86/vp9_asm_stubs.c
|
||||
VP9_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64) += common/x86/vp9_loopfilter_intrin_sse2.c
|
||||
|
Loading…
x
Reference in New Issue
Block a user