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
21 extern "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;
62 int rate_uv_intra;
63 int rate_uv_tokenonly;
64 int64_t dist_uvs;
65 int skip_uvs;
66 UV_PREDICTION_MODE mode_uv;
67 PALETTE_MODE_INFO pmi_uv;
68 int8_t uv_angle_delta;
70 } IntraModeSearchState;
71
105 int av1_handle_intra_y_mode(IntraModeSearchState *intra_search_state,
106 const AV1_COMP *cpi, MACROBLOCK *x,
107 BLOCK_SIZE bsize, unsigned int ref_frame_cost,
108 const PICK_MODE_CONTEXT *ctx, RD_STATS *rd_stats_y,
109 int64_t best_rd, int *mode_cost_y, int64_t *rd_y);
110
138 int av1_search_intra_uv_modes_in_interframe(
139 IntraModeSearchState *intra_search_state, const AV1_COMP *cpi,
140 MACROBLOCK *x, BLOCK_SIZE bsize, RD_STATS *rd_stats,
141 const RD_STATS *rd_stats_y, RD_STATS *rd_stats_uv, int64_t best_rd);
142
169 int av1_search_palette_mode(IntraModeSearchState *intra_search_state,
170 const AV1_COMP *cpi, MACROBLOCK *x,
171 BLOCK_SIZE bsize, unsigned int ref_frame_cost,
172 PICK_MODE_CONTEXT *ctx, RD_STATS *this_rd_cost,
173 int64_t best_rd);
174
205 int64_t av1_rd_pick_intra_sby_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
206 int *rate, int *rate_tokenonly,
207 int64_t *distortion, int *skippable,
208 BLOCK_SIZE bsize, int64_t best_rd,
209 PICK_MODE_CONTEXT *ctx);
210
240 int64_t av1_rd_pick_intra_sbuv_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
241 int *rate, int *rate_tokenonly,
242 int64_t *distortion, int *skippable,
243 BLOCK_SIZE bsize, TX_SIZE max_tx_size);
244
247 void av1_count_colors(const uint8_t *src, int stride, int rows, int cols,
248 int *val_count, int *num_colors);
249
252 void av1_count_colors_highbd(const uint8_t *src8, int stride, int rows,
253 int cols, int bit_depth, int *val_count,
254 int *val_count_8bit, int *num_color_bins,
255 int *num_colors);
256
259 static AOM_INLINE void init_intra_mode_search_state(
260 IntraModeSearchState *intra_search_state) {
261 memset(intra_search_state, 0, sizeof(*intra_search_state));
262 intra_search_state->rate_uv_intra = INT_MAX;
263 }
264
265 #ifdef __cplusplus
266 } // extern "C"
267 #endif
268
269 #endif // AOM_AV1_ENCODER_INTRA_MODE_SEARCH_H_
encoder.h
Declares top-level encoder structures and functions.
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)
Evaluate a given luma intra-mode for inter frames.
Definition: intra_mode_search.c:1005
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:1093
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:718
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, int *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:1153
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, int *skippable, BLOCK_SIZE bsize, TX_SIZE max_tx_size)
Perform intra-mode search on chroma channels.
Definition: intra_mode_search.c:558
IntraModeSearchState
struct IntraModeSearchState IntraModeSearchState
Variables related to intra-mode search during inter frame coding.
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:201
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:219
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:259
AV1_COMP
Top level encoder structure.
Definition: encoder.h:2095
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
int 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
macroblock
Encoder's parameters related to the current coding block.
Definition: block.h:846