Commit 85e3b960 authored by Angie Chiang's avatar Angie Chiang

Add symbol rate accounting code for lv_map

Change-Id: I03adc36f5e5f839d23c4f50a864d317d008e30a6
parent dff57e0a
......@@ -89,7 +89,8 @@ set(AOM_AV1_DECODER_SOURCES
"${AOM_ROOT}/av1/decoder/dsubexp.c"
"${AOM_ROOT}/av1/decoder/dsubexp.h"
"${AOM_ROOT}/av1/decoder/dthread.c"
"${AOM_ROOT}/av1/decoder/dthread.h")
"${AOM_ROOT}/av1/decoder/dthread.h"
"${AOM_ROOT}/av1/decoder/symbolrate.h")
set(AOM_AV1_ENCODER_SOURCES
"${AOM_ROOT}/av1/av1_cx_iface.c"
......
......@@ -32,6 +32,7 @@ AV1_DX_SRCS-yes += decoder/decoder.c
AV1_DX_SRCS-yes += decoder/decoder.h
AV1_DX_SRCS-yes += decoder/dsubexp.c
AV1_DX_SRCS-yes += decoder/dsubexp.h
AV1_DX_SRCS-yes += decoder/symbolrate.h
ifeq ($(CONFIG_ACCOUNTING),yes)
AV1_DX_SRCS-yes += decoder/accounting.h
......
......@@ -441,6 +441,10 @@ typedef struct FRAME_COUNTS {
#endif // CONFIG_CTX1D
#endif // CONFIG_LV_MAP
#if CONFIG_SYMBOLRATE
unsigned int symbol_num[2]; // 0: entropy symbol 1: non-entropy symbol
#endif
unsigned int newmv_mode[NEWMV_MODE_CONTEXTS][2];
unsigned int zeromv_mode[ZEROMV_MODE_CONTEXTS][2];
unsigned int refmv_mode[REFMV_MODE_CONTEXTS][2];
......
......@@ -64,6 +64,7 @@
#endif
#include "av1/decoder/detokenize.h"
#include "av1/decoder/dsubexp.h"
#include "av1/decoder/symbolrate.h"
#if CONFIG_WARPED_MOTION || CONFIG_GLOBAL_MOTION
#include "av1/common/warped_motion.h"
......@@ -5199,7 +5200,7 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
#endif
#if CONFIG_LV_MAP
av1_read_txb_probs(fc, cm->tx_mode, &r);
av1_read_txb_probs(fc, cm->tx_mode, &r, &cm->counts);
#endif // CONFIG_LV_MAP
#if !CONFIG_NEW_MULTISYMBOL
......@@ -5704,6 +5705,9 @@ void av1_decode_tg_tiles_and_wrapup(AV1Decoder *pbi, const uint8_t *data,
#if CONFIG_LV_MAP
av1_adapt_coef_probs(cm);
#endif // CONFIG_LV_MAP
#if CONFIG_SYMBOLRATE
av1_dump_symbol_rate(cm);
#endif
av1_adapt_intra_frame_probs(cm);
av1_average_tile_coef_cdfs(pbi->common.fc, tile_ctxs, cdf_ptrs,
cm->tile_rows * cm->tile_cols);
......
This diff is collapsed.
......@@ -28,5 +28,6 @@ uint8_t av1_read_coeffs_txb_facade(AV1_COMMON *cm, MACROBLOCKD *xd,
int plane, tran_low_t *tcoeffs,
TX_SIZE tx_size, int16_t *max_scan_line,
int *eob);
void av1_read_txb_probs(FRAME_CONTEXT *fc, TX_MODE tx_mode, aom_reader *r);
void av1_read_txb_probs(FRAME_CONTEXT *fc, TX_MODE tx_mode, aom_reader *r,
FRAME_COUNTS *counts);
#endif // DECODETXB_H_
/*
* Copyright (c) 2017, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include "aom_dsp/bitreader.h"
#ifndef AV1_DECODER_SYMBOLRATE_H_
#define AV1_DECODER_SYMBOLRATE_H_
#if CONFIG_SYMBOLRATE
static INLINE void av1_dump_symbol_rate(struct AV1Common *cm) {
const FRAME_COUNTS *counts = &cm->counts;
printf("%d %d\n", counts->symbol_num[0], counts->symbol_num[1]);
}
static INLINE int av1_read_record_symbol(FRAME_COUNTS *counts, aom_reader *r,
aom_cdf_prob *cdf, int nsymbs,
const char *str) {
(void)str;
if (counts) ++counts->symbol_num[0];
return aom_read_symbol(r, cdf, nsymbs, str);
}
static INLINE int av1_read_record_bit(FRAME_COUNTS *counts, aom_reader *r,
const char *str) {
(void)str;
if (counts) ++counts->symbol_num[1];
return aom_read_bit(r, str);
}
#else // CONFIG_SYMBOLRATE
#define av1_read_record_symbol(counts, r, cdf, nsymbs, ACCT_STR_NAME) \
aom_read_symbol(r, cdf, nsymbs, ACCT_STR_NAME)
#define av1_read_record_bit(counts, r, ACCT_STR_NAME) \
aom_read_bit(r, ACCT_STR_NAME)
#endif // CONFIG_SYMBOLRATE
#endif // AV1_DECODER_SYMBOLRATE_H_
......@@ -102,6 +102,7 @@ set(CONFIG_LOWBITDEPTH 1 CACHE NUMBER "Enables low bit depth support.")
set(CONFIG_REALTIME_ONLY 0 CACHE NUMBER "Support only realtime encodes.")
set(CONFIG_SIZE_LIMIT 0 CACHE NUMBER "Limit max decode width/height.")
set(CONFIG_SPATIAL_RESAMPLING 1 CACHE NUMBER "Spatial resampling.")
set(CONFIG_SYMBOLRATE 0 CACHE NUMBER "Enables symbol rate accounting.")
# AV1 experiment flags.
set(CONFIG_ADAPT_SCAN 0 CACHE NUMBER "AV1 experiment flag.")
......
......@@ -394,6 +394,7 @@ CONFIG_LIST="
decode_perf_tests
encode_perf_tests
bitstream_debug
symbolrate
coefficient_range_checking
lowbitdepth
highbitdepth
......@@ -452,6 +453,7 @@ CMDLINE_SELECT="
encode_perf_tests
coefficient_range_checking
bitstream_debug
symbolrate
lowbitdepth
highbitdepth
experimental
......
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