intra_mode_search.h
Go to the documentation of this file.
/*
* Copyright (c) 2020, 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.
*/
#ifndef AOM_AV1_ENCODER_INTRA_MODE_SEARCH_H_
#define AOM_AV1_ENCODER_INTRA_MODE_SEARCH_H_
#include <stdbool.h>
#include "av1/encoder/encoder.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct IntraModeSearchState {
PREDICTION_MODE best_intra_mode;
int skip_intra_modes;
uint8_t directional_mode_skip_mask[INTRA_MODES];
int dir_mode_skip_mask_ready;
int rate_uv_intra;
int rate_uv_tokenonly;
int64_t dist_uvs;
uint8_t skip_uvs;
UV_PREDICTION_MODE mode_uv;
PALETTE_MODE_INFO pmi_uv;
int8_t uv_angle_delta;
} IntraModeSearchState;
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[]);
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);
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);
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);
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);
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);
void av1_count_colors(const uint8_t *src, int stride, int rows, int cols,
int *val_count, int *num_colors);
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);
bool av1_count_colors_with_threshold(const uint8_t *src, int stride, int rows,
int cols, int num_colors_threshold,
int *num_colors);
static inline void init_intra_mode_search_state(
IntraModeSearchState *intra_search_state) {
memset(intra_search_state, 0, sizeof(*intra_search_state));
intra_search_state->rate_uv_intra = INT_MAX;
}
void set_y_mode_and_delta_angle(const int mode_idx, MB_MODE_INFO *const mbmi,
int reorder_delta_angle_eval);
#ifdef __cplusplus
} // extern "C"
#endif
#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:1385
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:1468
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:2897
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