Commit 5b2021ea authored by David Michael Barr's avatar David Michael Barr Committed by Luc Trudeau
Browse files

[CFL] Fix typedef-redefinition compiler warnings

Instead of forward-declaring AV1_COMMON and MACROBLOCKD,
move the dependent struct and function prototype closer
to where they are used and after these types are defined.

Change-Id: I75f005b46ef322a6fcbc01377b8dded1637c5f73
parent a5263757
...@@ -31,9 +31,6 @@ ...@@ -31,9 +31,6 @@
#include "av1/common/pvq_state.h" #include "av1/common/pvq_state.h"
#include "av1/decoder/decint.h" #include "av1/decoder/decint.h"
#endif #endif
#if CONFIG_CFL
#include "av1/common/cfl.h"
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
...@@ -687,6 +684,59 @@ typedef struct { ...@@ -687,6 +684,59 @@ typedef struct {
} SgrprojInfo; } SgrprojInfo;
#endif // CONFIG_LOOP_RESTORATION #endif // CONFIG_LOOP_RESTORATION
#if CONFIG_CFL
typedef struct cfl_ctx {
// Pixel buffer containing the luma pixels used as prediction for chroma
// TODO(ltrudeau) Convert to uint16 for HBD support
uint8_t y_pix[MAX_SB_SQUARE];
// Pixel buffer containing the downsampled luma pixels used as prediction for
// chroma
// TODO(ltrudeau) Convert to uint16 for HBD support
uint8_t y_down_pix[MAX_SB_SQUARE];
// Height and width of the luma prediction block currently in the pixel buffer
int y_height, y_width;
// Height and width of the chroma prediction block currently associated with
// this context
int uv_height, uv_width;
// Transform level averages of the luma reconstructed values over the entire
// prediction unit
// Fixed point y_averages is Q12.3:
// * Worst case division is 1/1024
// * Max error will be 1/16th.
// Note: 3 is chosen so that y_averages fits in 15 bits when 12 bit input is
// used
int y_averages_q3[MAX_NUM_TXB];
int y_averages_stride;
int are_parameters_computed;
// Chroma subsampling
int subsampling_x, subsampling_y;
// Block level DC_PRED for each chromatic plane
int dc_pred[CFL_PRED_PLANES];
int mi_row, mi_col;
// Whether the reconstructed luma pixels need to be stored
int store_y;
#if CONFIG_CB4X4
int is_chroma_reference;
#if CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
// The prediction used for sub8x8 blocks originates from multiple luma blocks,
// this array is used to validate that cfl_store() is called only once for
// each luma block
uint8_t sub8x8_val[4];
#endif // CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
#endif // CONFIG_CB4X4
} CFL_CTX;
#endif // CONFIG_CFL
typedef struct macroblockd { typedef struct macroblockd {
struct macroblockd_plane plane[MAX_MB_PLANE]; struct macroblockd_plane plane[MAX_MB_PLANE];
uint8_t bmode_blocks_wl; uint8_t bmode_blocks_wl;
......
...@@ -16,67 +16,9 @@ ...@@ -16,67 +16,9 @@
#include <string.h> #include <string.h>
#include "av1/common/common.h" #include "av1/common/common.h"
#include "av1/common/blockd.h"
#include "av1/common/enums.h" #include "av1/common/enums.h"
// Forward declaration of AV1_COMMON, in order to avoid creating a cyclic
// dependency by importing av1/common/onyxc_int.h
typedef struct AV1Common AV1_COMMON;
// Forward declaration of MACROBLOCK, in order to avoid creating a cyclic
// dependency by importing av1/common/blockd.h
typedef struct macroblockd MACROBLOCKD;
typedef struct {
// Pixel buffer containing the luma pixels used as prediction for chroma
// TODO(ltrudeau) Convert to uint16 for HBD support
uint8_t y_pix[MAX_SB_SQUARE];
// Pixel buffer containing the downsampled luma pixels used as prediction for
// chroma
// TODO(ltrudeau) Convert to uint16 for HBD support
uint8_t y_down_pix[MAX_SB_SQUARE];
// Height and width of the luma prediction block currently in the pixel buffer
int y_height, y_width;
// Height and width of the chroma prediction block currently associated with
// this context
int uv_height, uv_width;
// Transform level averages of the luma reconstructed values over the entire
// prediction unit
// Fixed point y_averages is Q12.3:
// * Worst case division is 1/1024
// * Max error will be 1/16th.
// Note: 3 is chosen so that y_averages fits in 15 bits when 12 bit input is
// used
int y_averages_q3[MAX_NUM_TXB];
int y_averages_stride;
int are_parameters_computed;
// Chroma subsampling
int subsampling_x, subsampling_y;
// Block level DC_PRED for each chromatic plane
int dc_pred[CFL_PRED_PLANES];
int mi_row, mi_col;
// Whether the reconstructed luma pixels need to be stored
int store_y;
#if CONFIG_CB4X4
int is_chroma_reference;
#if CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
// The prediction used for sub8x8 blocks originates from multiple luma blocks,
// this array is used to validate that cfl_store() is called only once for
// each luma block
uint8_t sub8x8_val[4];
#endif // CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
#endif // CONFIG_CB4X4
} CFL_CTX;
static INLINE int get_scaled_luma_q0(int alpha_q3, int y_pix, int avg_q3) { static INLINE int get_scaled_luma_q0(int alpha_q3, int y_pix, int avg_q3) {
int scaled_luma_q6 = alpha_q3 * ((y_pix << 3) - avg_q3); int scaled_luma_q6 = alpha_q3 * ((y_pix << 3) - avg_q3);
return ROUND_POWER_OF_TWO_SIGNED(scaled_luma_q6, 6); return ROUND_POWER_OF_TWO_SIGNED(scaled_luma_q6, 6);
...@@ -88,8 +30,6 @@ static INLINE void cfl_clear_sub8x8_val(CFL_CTX *cfl) { ...@@ -88,8 +30,6 @@ static INLINE void cfl_clear_sub8x8_val(CFL_CTX *cfl) {
} }
#endif // CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG #endif // CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
void cfl_init(CFL_CTX *cfl, AV1_COMMON *cm);
void cfl_predict_block(MACROBLOCKD *const xd, uint8_t *dst, int dst_stride, void cfl_predict_block(MACROBLOCKD *const xd, uint8_t *dst, int dst_stride,
int row, int col, TX_SIZE tx_size, int plane); int row, int col, TX_SIZE tx_size, int plane);
......
...@@ -35,9 +35,6 @@ ...@@ -35,9 +35,6 @@
#if CONFIG_PVQ #if CONFIG_PVQ
#include "av1/common/pvq.h" #include "av1/common/pvq.h"
#endif #endif
#if CONFIG_CFL
#include "av1/common/cfl.h"
#endif
#if CONFIG_HASH_ME #if CONFIG_HASH_ME
// TODO(youzhou@microsoft.com): Encoder only. Move it out of common // TODO(youzhou@microsoft.com): Encoder only. Move it out of common
#include "av1/encoder/hash_motion.h" #include "av1/encoder/hash_motion.h"
...@@ -640,6 +637,10 @@ static INLINE int frame_is_intra_only(const AV1_COMMON *const cm) { ...@@ -640,6 +637,10 @@ static INLINE int frame_is_intra_only(const AV1_COMMON *const cm) {
return cm->frame_type == KEY_FRAME || cm->intra_only; return cm->frame_type == KEY_FRAME || cm->intra_only;
} }
#if CONFIG_CFL
void cfl_init(CFL_CTX *cfl, AV1_COMMON *cm);
#endif
static INLINE void av1_init_macroblockd(AV1_COMMON *cm, MACROBLOCKD *xd, static INLINE void av1_init_macroblockd(AV1_COMMON *cm, MACROBLOCKD *xd,
#if CONFIG_PVQ #if CONFIG_PVQ
tran_low_t *pvq_ref_coeff, tran_low_t *pvq_ref_coeff,
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
#include "aom_ports/mem.h" #include "aom_ports/mem.h"
#include "aom_ports/system_state.h" #include "aom_ports/system_state.h"
#if CONFIG_CFL
#include "av1/common/cfl.h"
#endif
#include "av1/common/common.h" #include "av1/common/common.h"
#include "av1/common/common_data.h" #include "av1/common/common_data.h"
#include "av1/common/entropy.h" #include "av1/common/entropy.h"
......
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