AOMedia AV1 Codec: av1/encoder/encodetxb.h Source File

| AOMedia AV1 Codec

encodetxb.h
1/*
2 * Copyright (c) 2017, Alliance for Open Media. All rights reserved
3 *
4 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10 */
11
12#ifndef AOM_AV1_ENCODER_ENCODETXB_H_
13#define AOM_AV1_ENCODER_ENCODETXB_H_
14
15#include "config/aom_config.h"
16
17#include "av1/common/av1_common_int.h"
18#include "av1/common/blockd.h"
19#include "av1/common/txb_common.h"
20#include "av1/encoder/block.h"
21#include "av1/encoder/encoder.h"
22#include "aom_dsp/bitwriter.h"
23#ifdef __cplusplus
24extern "C" {
25#endif
26
28#define TXB_SKIP_CTX_MASK 15
29#define DC_SIGN_CTX_SHIFT 4
30#define DC_SIGN_CTX_MASK 3
31
32int av1_get_eob_pos_token(const int eob, int *const extra);
33
44 void av1_alloc_txb_buf(AV1_COMP *cpi);
53 void av1_free_txb_buf(AV1_COMP *cpi);
54
89 void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCK *const x,
90 aom_writer *w, int blk_row, int blk_col, int plane,
91 int block, TX_SIZE tx_size);
92
110 void av1_write_intra_coeffs_mb(const AV1_COMMON *const cm, MACROBLOCK *x,
111 aom_writer *w, BLOCK_SIZE bsize);
112
126uint8_t av1_get_txb_entropy_context(const tran_low_t *qcoeff,
127 const SCAN_ORDER *scan_order, int eob);
128
145 void av1_update_intra_mb_txb_context(const AV1_COMP *cpi, ThreadData *td,
146 RUN_TYPE dry_run, BLOCK_SIZE bsize,
147 uint8_t allow_update_cdf);
148
184 void av1_update_and_record_txb_context(int plane, int block, int blk_row,
185 int blk_col, BLOCK_SIZE plane_bsize,
186 TX_SIZE tx_size, void *arg);
187
220 void av1_record_txb_context(int plane, int block, int blk_row, int blk_col,
221 BLOCK_SIZE plane_bsize, TX_SIZE tx_size, void *arg);
222
240 CB_COEFF_BUFFER *av1_get_cb_coeff_buffer(const struct AV1_COMP *cpi, int mi_row,
241 int mi_col);
242
254 static INLINE int av1_cost_skip_txb(const CoeffCosts *coeff_costs,
255 const TXB_CTX *const txb_ctx, int plane,
256 TX_SIZE tx_size) {
257 const TX_SIZE txs_ctx = get_txsize_entropy_ctx(tx_size);
258 const PLANE_TYPE plane_type = get_plane_type(plane);
259 const LV_MAP_COEFF_COST *const coeff_costs_ =
260 &coeff_costs->coeff_costs[txs_ctx][plane_type];
261 return coeff_costs_->txb_skip_cost[txb_ctx->txb_skip_ctx][1];
262}
263
265// These numbers are empirically obtained.
266static const int plane_rd_mult[REF_TYPES][PLANE_TYPES] = {
267 { 17, 13 },
268 { 16, 10 },
269};
272#ifdef __cplusplus
273}
274#endif
275
276#endif // AOM_AV1_ENCODER_ENCODETXB_H_
block.h
encoder.h
Declares top-level encoder structures and functions.
av1_get_txb_entropy_context
uint8_t av1_get_txb_entropy_context(const tran_low_t *qcoeff, const SCAN_ORDER *scan_order, int eob)
Pack the context info of the current transform block into an uint8_t.
av1_alloc_txb_buf
void av1_alloc_txb_buf(AV1_COMP *cpi)
Allocate the memory resources for all the macro blocks in the current coding frame.
av1_write_intra_coeffs_mb
void av1_write_intra_coeffs_mb(const AV1_COMMON *const cm, MACROBLOCK *x, aom_writer *w, BLOCK_SIZE bsize)
Write quantized coefficients of all transform blocks in an intra macroblock into the bitstream using ...
av1_write_coeffs_txb
void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCK *const x, aom_writer *w, int blk_row, int blk_col, int plane, int block, TX_SIZE tx_size)
Write quantized coefficients in a transform block into bitstream using entropy coding.
av1_record_txb_context
void av1_record_txb_context(int plane, int block, int blk_row, int blk_col, BLOCK_SIZE plane_bsize, TX_SIZE tx_size, void *arg)
Update the entropy context related to coefficient coding for a transform block.
av1_update_intra_mb_txb_context
void av1_update_intra_mb_txb_context(const AV1_COMP *cpi, ThreadData *td, RUN_TYPE dry_run, BLOCK_SIZE bsize, uint8_t allow_update_cdf)
Update the probability model (cdf) and the entropy context related to coefficient coding for all tran...
av1_cost_skip_txb
static int av1_cost_skip_txb(const CoeffCosts *coeff_costs, const TXB_CTX *const txb_ctx, int plane, TX_SIZE tx_size)
Returns the entropy cost associated with skipping the current transform block.
Definition encodetxb.h:254
av1_free_txb_buf
void av1_free_txb_buf(AV1_COMP *cpi)
Free the memory resources for all the macro blocks in the current coding frame.
av1_update_and_record_txb_context
void av1_update_and_record_txb_context(int plane, int block, int blk_row, int blk_col, BLOCK_SIZE plane_bsize, TX_SIZE tx_size, void *arg)
Update the probability model (cdf) and the entropy context related to coefficient coding for a transf...
av1_get_cb_coeff_buffer
CB_COEFF_BUFFER * av1_get_cb_coeff_buffer(const struct AV1_COMP *cpi, int mi_row, int mi_col)
Get the corresponding CB_COEFF_BUFFER of the current macro block.
AV1Common
Top level common structure used by both encoder and decoder.
Definition av1_common_int.h:752
AV1_COMP
Top level encoder structure.
Definition encoder.h:2872
CB_COEFF_BUFFER
Stores the transforms coefficients for the whole superblock.
Definition block.h:206
CoeffCosts
Holds the costs needed to encode the coefficients.
Definition block.h:806
CoeffCosts::coeff_costs
LV_MAP_COEFF_COST coeff_costs[TX_SIZES][PLANE_TYPES]
Costs for coding the coefficients.
Definition block.h:808
LV_MAP_COEFF_COST
Costs for encoding the coefficients within a level.
Definition block.h:173
LV_MAP_COEFF_COST::txb_skip_cost
int txb_skip_cost[13][2]
Cost to skip txfm for the current txfm block.
Definition block.h:175
macroblock
Encoder's parameters related to the current coding block.
Definition block.h:878