Commit 04120190 authored by Luc Trudeau's avatar Luc Trudeau

[CFL] move cfl_idx_to_alpha to header

Move cfl_idx_to_alpha in the header to facilitate inlining.
Remove the forward MB_MODE_INFO forward declaration

Change-Id: Id33fb0228d88b6285252843e2345a0d3ae875cd2
parent bcfb0e15
......@@ -87,17 +87,6 @@ void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
xd->cfl->dc_pred[CFL_PRED_V] = sum_v / num_pel;
}
double cfl_ind_to_alpha(const MB_MODE_INFO *const mbmi,
CFL_PRED_TYPE pred_type) {
double const abs_alpha = cfl_alpha_codes[mbmi->cfl_alpha_idx][pred_type];
if (mbmi->cfl_alpha_signs[pred_type] == CFL_SIGN_POS) {
return abs_alpha;
} else {
assert(abs_alpha != 0.0);
return -abs_alpha;
}
}
// Predict the current transform block using CfL.
void cfl_predict_block(const CFL_CTX *cfl, uint8_t *dst, int dst_stride,
int row, int col, TX_SIZE tx_size, double dc_pred,
......
......@@ -12,6 +12,8 @@
#ifndef AV1_COMMON_CFL_H_
#define AV1_COMMON_CFL_H_
#include <assert.h>
#include "av1/common/enums.h"
// Forward declaration of AV1_COMMON, in order to avoid creating a cyclic
......@@ -22,10 +24,6 @@ typedef struct AV1Common AV1_COMMON;
// dependency by importing av1/common/blockd.h
typedef struct macroblockd MACROBLOCKD;
// Forward declaration of MB_MODE_INFO, in order to avoid creating a cyclic
// dependency by importing av1/common/blockd.h
typedef struct MB_MODE_INFO MB_MODE_INFO;
typedef struct {
// Pixel buffer containing the luma pixels used as prediction for chroma
uint8_t y_pix[MAX_SB_SQUARE];
......@@ -58,7 +56,16 @@ void cfl_init(CFL_CTX *cfl, AV1_COMMON *cm, int subsampling_x,
void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize, TX_SIZE tx_size);
double cfl_ind_to_alpha(const MB_MODE_INFO *mbmi, CFL_PRED_TYPE pred_type);
static INLINE double cfl_idx_to_alpha(int alpha_idx, CFL_SIGN_TYPE alpha_sign,
CFL_PRED_TYPE pred_type) {
const double abs_alpha = cfl_alpha_codes[alpha_idx][pred_type];
if (alpha_sign == CFL_SIGN_POS) {
return abs_alpha;
} else {
assert(abs_alpha != 0.0);
return -abs_alpha;
}
}
void cfl_predict_block(const CFL_CTX *cfl, uint8_t *dst, int dst_stride,
int row, int col, TX_SIZE tx_size, double dc_pred,
......
......@@ -2327,9 +2327,11 @@ void av1_predict_intra_block_facade(MACROBLOCKD *xd, int plane, int block_idx,
cfl_dc_pred(xd, get_plane_block_size(block_idx, pd), tx_size);
}
cfl_predict_block(xd->cfl, dst, pd->dst.stride, blk_row, blk_col, tx_size,
xd->cfl->dc_pred[plane - 1],
cfl_ind_to_alpha(mbmi, plane - 1));
cfl_predict_block(
xd->cfl, dst, pd->dst.stride, blk_row, blk_col, tx_size,
xd->cfl->dc_pred[plane - 1],
cfl_idx_to_alpha(mbmi->cfl_alpha_idx, mbmi->cfl_alpha_signs[plane - 1],
plane - 1));
}
#endif
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment