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 <stdbool.h>
19
20#include "av1/encoder/encoder.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
33 typedef struct IntraModeSearchState {
37 PREDICTION_MODE best_intra_mode;
38
47 int skip_intra_modes;
51 uint8_t directional_mode_skip_mask[INTRA_MODES];
55 int dir_mode_skip_mask_ready;
57
64 int rate_uv_intra;
65 int rate_uv_tokenonly;
66 int64_t dist_uvs;
67 uint8_t skip_uvs;
68 UV_PREDICTION_MODE mode_uv;
69 PALETTE_MODE_INFO pmi_uv;
70 int8_t uv_angle_delta;
72} IntraModeSearchState;
73
110int av1_handle_intra_y_mode(IntraModeSearchState *intra_search_state,
111 const AV1_COMP *cpi, MACROBLOCK *x,
112 BLOCK_SIZE bsize, unsigned int ref_frame_cost,
113 const PICK_MODE_CONTEXT *ctx, RD_STATS *rd_stats_y,
114 int64_t best_rd, int *mode_cost_y, int64_t *rd_y,
115 int64_t *best_model_rd,
116 int64_t top_intra_model_rd[]);
117
145int av1_search_intra_uv_modes_in_interframe(
146 IntraModeSearchState *intra_search_state, const AV1_COMP *cpi,
147 MACROBLOCK *x, BLOCK_SIZE bsize, RD_STATS *rd_stats,
148 const RD_STATS *rd_stats_y, RD_STATS *rd_stats_uv, int64_t best_rd);
149
176int av1_search_palette_mode(IntraModeSearchState *intra_search_state,
177 const AV1_COMP *cpi, MACROBLOCK *x,
178 BLOCK_SIZE bsize, unsigned int ref_frame_cost,
179 PICK_MODE_CONTEXT *ctx, RD_STATS *this_rd_cost,
180 int64_t best_rd);
181
202void av1_search_palette_mode_luma(const AV1_COMP *cpi, MACROBLOCK *x,
203 BLOCK_SIZE bsize, unsigned int ref_frame_cost,
204 PICK_MODE_CONTEXT *ctx,
205 RD_STATS *this_rd_cost, int64_t best_rd);
206
237int64_t av1_rd_pick_intra_sby_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
238 int *rate, int *rate_tokenonly,
239 int64_t *distortion, uint8_t *skippable,
240 BLOCK_SIZE bsize, int64_t best_rd,
241 PICK_MODE_CONTEXT *ctx);
242
272int64_t av1_rd_pick_intra_sbuv_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
273 int *rate, int *rate_tokenonly,
274 int64_t *distortion, uint8_t *skippable,
275 BLOCK_SIZE bsize, TX_SIZE max_tx_size);
276
279void av1_count_colors(const uint8_t *src, int stride, int rows, int cols,
280 int *val_count, int *num_colors);
281
284void av1_count_colors_highbd(const uint8_t *src8, int stride, int rows,
285 int cols, int bit_depth, int *val_count,
286 int *val_count_8bit, int *num_color_bins,
287 int *num_colors);
288
299bool av1_count_colors_with_threshold(const uint8_t *src, int stride, int rows,
300 int cols, int num_colors_threshold,
301 int *num_colors);
302
305 static inline void init_intra_mode_search_state(
306 IntraModeSearchState *intra_search_state) {
307 memset(intra_search_state, 0, sizeof(*intra_search_state));
308 intra_search_state->rate_uv_intra = INT_MAX;
309}
310
324void set_y_mode_and_delta_angle(const int mode_idx, MB_MODE_INFO *const mbmi,
325 int reorder_delta_angle_eval);
326#ifdef __cplusplus
327} // extern "C"
328#endif
329
330#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:1386
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:1032
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:1469
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:864
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:1122
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:1292
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.
Definition intra_mode_search.c:403
av1_count_colors_with_threshold
bool av1_count_colors_with_threshold(const uint8_t *src, int stride, int rows, int cols, int num_colors_threshold, int *num_colors)
Set *num_colors to the number of colors in src.
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:305
AV1_COMP
Top level encoder structure.
Definition encoder.h:2907
IntraModeSearchState
Variables related to intra-mode search during inter frame coding.
Definition intra_mode_search.h:33
IntraModeSearchState::best_intra_mode
PREDICTION_MODE best_intra_mode
The best luma intra-mode found so far.
Definition intra_mode_search.h:37
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:55
IntraModeSearchState::skip_intra_modes
int skip_intra_modes
Whether to terminate all intra mode search.
Definition intra_mode_search.h:47
IntraModeSearchState::dist_uvs
int64_t dist_uvs
Distortion of the uv_mode's recon.
Definition intra_mode_search.h:66
IntraModeSearchState::rate_uv_intra
int rate_uv_intra
Total rate to transmit uv_mode.
Definition intra_mode_search.h:64
IntraModeSearchState::skip_uvs
uint8_t skip_uvs
Whether the uv txfm is skippable.
Definition intra_mode_search.h:67
IntraModeSearchState::pmi_uv
PALETTE_MODE_INFO pmi_uv
Color map if mode_uv is palette.
Definition intra_mode_search.h:69
IntraModeSearchState::directional_mode_skip_mask
uint8_t directional_mode_skip_mask[INTRA_MODES]
Whether a directional mode is pruned.
Definition intra_mode_search.h:51
IntraModeSearchState::mode_uv
UV_PREDICTION_MODE mode_uv
The best uv mode.
Definition intra_mode_search.h:68
IntraModeSearchState::rate_uv_tokenonly
int rate_uv_tokenonly
Rate transmit txfm tokens.
Definition intra_mode_search.h:65
IntraModeSearchState::uv_angle_delta
int8_t uv_angle_delta
Angle delta if mode_uv directional.
Definition intra_mode_search.h:70
MB_MODE_INFO
Stores the prediction/txfm mode of the current coding block.
Definition blockd.h:222