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

| AOMedia AV1 Codec

intra_mode_search.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020, 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
15#ifndef AOM_AV1_ENCODER_INTRA_MODE_SEARCH_H_
16#define AOM_AV1_ENCODER_INTRA_MODE_SEARCH_H_
17
18#include "av1/encoder/encoder.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
31 typedef struct IntraModeSearchState {
35 PREDICTION_MODE best_intra_mode;
36
45 int skip_intra_modes;
49 uint8_t directional_mode_skip_mask[INTRA_MODES];
53 int dir_mode_skip_mask_ready;
55
62 int rate_uv_intra;
63 int rate_uv_tokenonly;
64 int64_t dist_uvs;
65 uint8_t skip_uvs;
66 UV_PREDICTION_MODE mode_uv;
67 PALETTE_MODE_INFO pmi_uv;
68 int8_t uv_angle_delta;
70} IntraModeSearchState;
71
108int av1_handle_intra_y_mode(IntraModeSearchState *intra_search_state,
109 const AV1_COMP *cpi, MACROBLOCK *x,
110 BLOCK_SIZE bsize, unsigned int ref_frame_cost,
111 const PICK_MODE_CONTEXT *ctx, RD_STATS *rd_stats_y,
112 int64_t best_rd, int *mode_cost_y, int64_t *rd_y,
113 int64_t *best_model_rd,
114 int64_t top_intra_model_rd[]);
115
143int av1_search_intra_uv_modes_in_interframe(
144 IntraModeSearchState *intra_search_state, const AV1_COMP *cpi,
145 MACROBLOCK *x, BLOCK_SIZE bsize, RD_STATS *rd_stats,
146 const RD_STATS *rd_stats_y, RD_STATS *rd_stats_uv, int64_t best_rd);
147
174int av1_search_palette_mode(IntraModeSearchState *intra_search_state,
175 const AV1_COMP *cpi, MACROBLOCK *x,
176 BLOCK_SIZE bsize, unsigned int ref_frame_cost,
177 PICK_MODE_CONTEXT *ctx, RD_STATS *this_rd_cost,
178 int64_t best_rd);
179
200void av1_search_palette_mode_luma(const AV1_COMP *cpi, MACROBLOCK *x,
201 BLOCK_SIZE bsize, unsigned int ref_frame_cost,
202 PICK_MODE_CONTEXT *ctx,
203 RD_STATS *this_rd_cost, int64_t best_rd);
204
235int64_t av1_rd_pick_intra_sby_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
236 int *rate, int *rate_tokenonly,
237 int64_t *distortion, uint8_t *skippable,
238 BLOCK_SIZE bsize, int64_t best_rd,
239 PICK_MODE_CONTEXT *ctx);
240
270int64_t av1_rd_pick_intra_sbuv_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
271 int *rate, int *rate_tokenonly,
272 int64_t *distortion, uint8_t *skippable,
273 BLOCK_SIZE bsize, TX_SIZE max_tx_size);
274
277void av1_count_colors(const uint8_t *src, int stride, int rows, int cols,
278 int *val_count, int *num_colors);
279
282void av1_count_colors_highbd(const uint8_t *src8, int stride, int rows,
283 int cols, int bit_depth, int *val_count,
284 int *val_count_8bit, int *num_color_bins,
285 int *num_colors);
286
289 static inline void init_intra_mode_search_state(
290 IntraModeSearchState *intra_search_state) {
291 memset(intra_search_state, 0, sizeof(*intra_search_state));
292 intra_search_state->rate_uv_intra = INT_MAX;
293}
294
307void set_y_mode_and_delta_angle(const int mode_idx, MB_MODE_INFO *const mbmi,
308 int reorder_delta_angle_eval);
309#ifdef __cplusplus
310} // extern "C"
311#endif
312
313#endif // AOM_AV1_ENCODER_INTRA_MODE_SEARCH_H_
MACROBLOCK
struct macroblock MACROBLOCK
Encoder's parameters related to the current coding block.
encoder.h
Declares top-level encoder structures and functions.
av1_search_intra_uv_modes_in_interframe
int av1_search_intra_uv_modes_in_interframe(IntraModeSearchState *intra_search_state, const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, RD_STATS *rd_stats, const RD_STATS *rd_stats_y, RD_STATS *rd_stats_uv, int64_t best_rd)
Search through all chroma intra-modes for inter frames.
Definition intra_mode_search.c:1388
av1_search_palette_mode
int av1_search_palette_mode(IntraModeSearchState *intra_search_state, const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, unsigned int ref_frame_cost, PICK_MODE_CONTEXT *ctx, RD_STATS *this_rd_cost, int64_t best_rd)
Evaluate luma palette mode for inter frames.
Definition intra_mode_search.c:1010
av1_rd_pick_intra_sby_mode
int64_t av1_rd_pick_intra_sby_mode(const AV1_COMP *const cpi, MACROBLOCK *x, int *rate, int *rate_tokenonly, int64_t *distortion, uint8_t *skippable, BLOCK_SIZE bsize, int64_t best_rd, PICK_MODE_CONTEXT *ctx)
Perform intra-mode search on luma channels for intra frames.
Definition intra_mode_search.c:1474
av1_rd_pick_intra_sbuv_mode
int64_t av1_rd_pick_intra_sbuv_mode(const AV1_COMP *const cpi, MACROBLOCK *x, int *rate, int *rate_tokenonly, int64_t *distortion, uint8_t *skippable, BLOCK_SIZE bsize, TX_SIZE max_tx_size)
Perform intra-mode search on chroma channels.
Definition intra_mode_search.c:842
av1_search_palette_mode_luma
void av1_search_palette_mode_luma(const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, unsigned int ref_frame_cost, PICK_MODE_CONTEXT *ctx, RD_STATS *this_rd_cost, int64_t best_rd)
Evaluate luma palette mode for inter frames.
Definition intra_mode_search.c:1104
av1_handle_intra_y_mode
int av1_handle_intra_y_mode(IntraModeSearchState *intra_search_state, const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, unsigned int ref_frame_cost, const PICK_MODE_CONTEXT *ctx, RD_STATS *rd_stats_y, int64_t best_rd, int *mode_cost_y, int64_t *rd_y, int64_t *best_model_rd, int64_t top_intra_model_rd[])
Evaluate a given luma intra-mode for inter frames.
Definition intra_mode_search.c:1287
av1_count_colors
void av1_count_colors(const uint8_t *src, int stride, int rows, int cols, int *val_count, int *num_colors)
Return the number of colors in src. Used by palette mode.
Definition intra_mode_search.c:320
set_y_mode_and_delta_angle
void set_y_mode_and_delta_angle(const int mode_idx, MB_MODE_INFO *const mbmi, int reorder_delta_angle_eval)
set the luma intra mode and delta angles for a given mode index. The total number of luma intra mode ...
Definition intra_mode_search.c:381
av1_count_colors_highbd
void av1_count_colors_highbd(const uint8_t *src8, int stride, int rows, int cols, int bit_depth, int *val_count, int *val_count_8bit, int *num_color_bins, int *num_colors)
See av1_count_colors(), but for highbd.
Definition intra_mode_search.c:338
init_intra_mode_search_state
static void init_intra_mode_search_state(IntraModeSearchState *intra_search_state)
Initializes the IntraModeSearchState struct.
Definition intra_mode_search.h:289
AV1_COMP
Top level encoder structure.
Definition encoder.h:2878
IntraModeSearchState
Variables related to intra-mode search during inter frame coding.
Definition intra_mode_search.h:31
IntraModeSearchState::best_intra_mode
PREDICTION_MODE best_intra_mode
The best luma intra-mode found so far.
Definition intra_mode_search.h:35
IntraModeSearchState::dir_mode_skip_mask_ready
int dir_mode_skip_mask_ready
Whether directional_mode_skip_mask is valid for pruning.
Definition intra_mode_search.h:53
IntraModeSearchState::skip_intra_modes
int skip_intra_modes
Whether to terminate all intra mode search.
Definition intra_mode_search.h:45
IntraModeSearchState::dist_uvs
int64_t dist_uvs
Distortion of the uv_mode's recon.
Definition intra_mode_search.h:64
IntraModeSearchState::rate_uv_intra
int rate_uv_intra
Total rate to transmit uv_mode.
Definition intra_mode_search.h:62
IntraModeSearchState::skip_uvs
uint8_t skip_uvs
Whether the uv txfm is skippable.
Definition intra_mode_search.h:65
IntraModeSearchState::pmi_uv
PALETTE_MODE_INFO pmi_uv
Color map if mode_uv is palette.
Definition intra_mode_search.h:67
IntraModeSearchState::directional_mode_skip_mask
uint8_t directional_mode_skip_mask[INTRA_MODES]
Whether a directional mode is pruned.
Definition intra_mode_search.h:49
IntraModeSearchState::mode_uv
UV_PREDICTION_MODE mode_uv
The best uv mode.
Definition intra_mode_search.h:66
IntraModeSearchState::rate_uv_tokenonly
int rate_uv_tokenonly
Rate transmit txfm tokens.
Definition intra_mode_search.h:63
IntraModeSearchState::uv_angle_delta
int8_t uv_angle_delta
Angle delta if mode_uv directional.
Definition intra_mode_search.h:68
MB_MODE_INFO
Stores the prediction/txfm mode of the current coding block.
Definition blockd.h:222