#include "av1/common/av1_common_int.h"
#include "av1/common/cfl.h"
#include "av1/common/common_data.h"
#include "config/av1_rtcd.h"
void cfl_init(CFL_CTX *cfl, const SequenceHeader *seq_params) { … }
void cfl_store_dc_pred(MACROBLOCKD *const xd, const uint8_t *input,
CFL_PRED_TYPE pred_plane, int width) { … }
static void cfl_load_dc_pred_lbd(const int16_t *dc_pred_cache, uint8_t *dst,
int dst_stride, int width, int height) { … }
static void cfl_load_dc_pred_hbd(const int16_t *dc_pred_cache, uint16_t *dst,
int dst_stride, int width, int height) { … }
void cfl_load_dc_pred(MACROBLOCKD *const xd, uint8_t *dst, int dst_stride,
TX_SIZE tx_size, CFL_PRED_TYPE pred_plane) { … }
static inline void cfl_pad(CFL_CTX *cfl, int width, int height) { … }
static void subtract_average_c(const uint16_t *src, int16_t *dst, int width,
int height, int round_offset, int num_pel_log2) { … }
CFL_SUB_AVG_FN(…)
static inline int cfl_idx_to_alpha(uint8_t alpha_idx, int8_t joint_sign,
CFL_PRED_TYPE pred_type) { … }
static inline void cfl_predict_lbd_c(const int16_t *ac_buf_q3, uint8_t *dst,
int dst_stride, int alpha_q3, int width,
int height) { … }
CFL_PREDICT_FN(…)
#if CONFIG_AV1_HIGHBITDEPTH
static inline void cfl_predict_hbd_c(const int16_t *ac_buf_q3, uint16_t *dst,
int dst_stride, int alpha_q3,
int bit_depth, int width, int height) {
for (int j = 0; j < height; j++) {
for (int i = 0; i < width; i++) {
dst[i] = clip_pixel_highbd(
get_scaled_luma_q0(alpha_q3, ac_buf_q3[i]) + dst[i], bit_depth);
}
dst += dst_stride;
ac_buf_q3 += CFL_BUF_LINE;
}
}
CFL_PREDICT_FN(c, hbd)
#endif
static void cfl_compute_parameters(MACROBLOCKD *const xd, TX_SIZE tx_size) { … }
void av1_cfl_predict_block(MACROBLOCKD *const xd, uint8_t *dst, int dst_stride,
TX_SIZE tx_size, int plane) { … }
static void cfl_luma_subsampling_420_lbd_c(const uint8_t *input,
int input_stride,
uint16_t *output_q3, int width,
int height) { … }
static void cfl_luma_subsampling_422_lbd_c(const uint8_t *input,
int input_stride,
uint16_t *output_q3, int width,
int height) { … }
static void cfl_luma_subsampling_444_lbd_c(const uint8_t *input,
int input_stride,
uint16_t *output_q3, int width,
int height) { … }
#if CONFIG_AV1_HIGHBITDEPTH
static void cfl_luma_subsampling_420_hbd_c(const uint16_t *input,
int input_stride,
uint16_t *output_q3, int width,
int height) {
for (int j = 0; j < height; j += 2) {
for (int i = 0; i < width; i += 2) {
const int bot = i + input_stride;
output_q3[i >> 1] =
(input[i] + input[i + 1] + input[bot] + input[bot + 1]) << 1;
}
input += input_stride << 1;
output_q3 += CFL_BUF_LINE;
}
}
static void cfl_luma_subsampling_422_hbd_c(const uint16_t *input,
int input_stride,
uint16_t *output_q3, int width,
int height) {
assert((height - 1) * CFL_BUF_LINE + width <= CFL_BUF_SQUARE);
for (int j = 0; j < height; j++) {
for (int i = 0; i < width; i += 2) {
output_q3[i >> 1] = (input[i] + input[i + 1]) << 2;
}
input += input_stride;
output_q3 += CFL_BUF_LINE;
}
}
static void cfl_luma_subsampling_444_hbd_c(const uint16_t *input,
int input_stride,
uint16_t *output_q3, int width,
int height) {
assert((height - 1) * CFL_BUF_LINE + width <= CFL_BUF_SQUARE);
for (int j = 0; j < height; j++) {
for (int i = 0; i < width; i++) {
output_q3[i] = input[i] << 3;
}
input += input_stride;
output_q3 += CFL_BUF_LINE;
}
}
#endif
CFL_GET_SUBSAMPLE_FUNCTION(…)
#if CONFIG_AV1_HIGHBITDEPTH
static inline cfl_subsample_hbd_fn cfl_subsampling_hbd(TX_SIZE tx_size,
int sub_x, int sub_y) {
if (sub_x == 1) {
if (sub_y == 1) {
return cfl_get_luma_subsampling_420_hbd(tx_size);
}
return cfl_get_luma_subsampling_422_hbd(tx_size);
}
return cfl_get_luma_subsampling_444_hbd(tx_size);
}
#endif
static inline cfl_subsample_lbd_fn cfl_subsampling_lbd(TX_SIZE tx_size,
int sub_x, int sub_y) { … }
static void cfl_store(CFL_CTX *cfl, const uint8_t *input, int input_stride,
int row, int col, TX_SIZE tx_size, int use_hbd) { … }
static inline void sub8x8_adjust_offset(const CFL_CTX *cfl, int mi_row,
int mi_col, int *row_out,
int *col_out) { … }
void cfl_store_tx(MACROBLOCKD *const xd, int row, int col, TX_SIZE tx_size,
BLOCK_SIZE bsize) { … }
static inline int max_intra_block_width(const MACROBLOCKD *xd,
BLOCK_SIZE plane_bsize, int plane,
TX_SIZE tx_size) { … }
static inline int max_intra_block_height(const MACROBLOCKD *xd,
BLOCK_SIZE plane_bsize, int plane,
TX_SIZE tx_size) { … }
void cfl_store_block(MACROBLOCKD *const xd, BLOCK_SIZE bsize, TX_SIZE tx_size) { … }