[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
diff --git a/av1/common/cfl.c b/av1/common/cfl.c
index e997379..92ef2c6 100644
--- a/av1/common/cfl.c
+++ b/av1/common/cfl.c
@@ -87,17 +87,6 @@
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,
diff --git a/av1/common/cfl.h b/av1/common/cfl.h
index d6d437e..5ee6fe9 100644
--- a/av1/common/cfl.h
+++ b/av1/common/cfl.h
@@ -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 @@
// 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_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,
diff --git a/av1/common/reconintra.c b/av1/common/reconintra.c
index a129a0a..a1ac4dd 100644
--- a/av1/common/reconintra.c
+++ b/av1/common/reconintra.c
@@ -2327,9 +2327,11 @@
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
}