Commit 7cc54b91 authored by Ronald S. Bultje's avatar Ronald S. Bultje

Move Av1FrameHeader and Av1SequenceHeader into public headers

Add DAV1D_/Dav1d prefix to everything.
parent 03d4ede0
This diff is collapsed.
......@@ -32,99 +32,7 @@
#include <stdint.h>
#include "common.h"
enum Dav1dPixelLayout {
DAV1D_PIXEL_LAYOUT_I400, ///< monochrome
DAV1D_PIXEL_LAYOUT_I420, ///< 4:2:0 planar
DAV1D_PIXEL_LAYOUT_I422, ///< 4:2:2 planar
DAV1D_PIXEL_LAYOUT_I444, ///< 4:4:4 planar
};
enum Dav1dFrameType {
DAV1D_FRAME_TYPE_KEY = 0, ///< Key Intra frame
DAV1D_FRAME_TYPE_INTER = 1, ///< Inter frame
DAV1D_FRAME_TYPE_INTRA = 2, ///< Non key Intra frame
DAV1D_FRAME_TYPE_SWITCH = 3, ///< Switch Inter frame
};
enum Dav1dColorPrimaries {
DAV1D_COLOR_PRI_BT709 = 1,
DAV1D_COLOR_PRI_UNKNOWN = 2,
DAV1D_COLOR_PRI_BT470M = 4,
DAV1D_COLOR_PRI_BT470BG = 5,
DAV1D_COLOR_PRI_BT601 = 6,
DAV1D_COLOR_PRI_SMPTE240 = 7,
DAV1D_COLOR_PRI_FILM = 8,
DAV1D_COLOR_PRI_BT2020 = 9,
DAV1D_COLOR_PRI_XYZ = 10,
DAV1D_COLOR_PRI_SMPTE431 = 11,
DAV1D_COLOR_PRI_SMPTE432 = 12,
DAV1D_COLOR_PRI_EBU3213 = 22,
};
enum Dav1dTransferCharacteristics {
DAV1D_TRC_BT709 = 1,
DAV1D_TRC_UNKNOWN = 2,
DAV1D_TRC_BT470M = 4,
DAV1D_TRC_BT470BG = 5,
DAV1D_TRC_BT601 = 6,
DAV1D_TRC_SMPTE240 = 7,
DAV1D_TRC_LINEAR = 8,
DAV1D_TRC_LOG100 = 9, ///< logarithmic (100:1 range)
DAV1D_TRC_LOG100_SQRT10 = 10, ///< lograithmic (100*sqrt(10):1 range)
DAV1D_TRC_IEC61966 = 11,
DAV1D_TRC_BT1361 = 12,
DAV1D_TRC_SRGB = 13,
DAV1D_TRC_BT2020_10BIT = 14,
DAV1D_TRC_BT2020_12BIT = 15,
DAV1D_TRC_SMPTE2084 = 16, ///< PQ
DAV1D_TRC_SMPTE428 = 17,
DAV1D_TRC_HLG = 18, ///< hybrid log/gamma (BT.2100 / ARIB STD-B67)
};
enum Dav1dMatrixCoefficients {
DAV1D_MC_IDENTITY = 0,
DAV1D_MC_BT709 = 1,
DAV1D_MC_UNKNOWN = 2,
DAV1D_MC_FCC = 4,
DAV1D_MC_BT470BG = 5,
DAV1D_MC_BT601 = 6,
DAV1D_MC_SMPTE240 = 7,
DAV1D_MC_SMPTE_YCGCO = 8,
DAV1D_MC_BT2020_NCL = 9,
DAV1D_MC_BT2020_CL = 10,
DAV1D_MC_SMPTE2085 = 11,
DAV1D_MC_CHROMAT_NCL = 12, ///< Chromaticity-derived
DAV1D_MC_CHROMAT_CL = 13,
DAV1D_MC_ICTCP = 14,
};
enum Dav1dChromaSamplePosition {
DAV1D_CHR_UNKNOWN = 0,
DAV1D_CHR_VERTICAL = 1, ///< Horizontally co-located with luma(0, 0)
///< sample, between two vertical samples
DAV1D_CHR_COLOCATED = 2, ///< Co-located with luma(0, 0) sample
};
typedef struct Dav1dFilmGrainData {
uint16_t seed;
int num_y_points;
uint8_t y_points[14][2 /* value, scaling */];
int chroma_scaling_from_luma;
int num_uv_points[2];
uint8_t uv_points[2][10][2 /* value, scaling */];
int scaling_shift;
int ar_coeff_lag;
int8_t ar_coeffs_y[24];
int8_t ar_coeffs_uv[2][25];
int ar_coeff_shift;
int grain_scale_shift;
int8_t uv_mult[2];
int8_t uv_luma_mult[2];
int16_t uv_offset[2];
int overlap_flag;
int clip_to_restricted_range;
} Dav1dFilmGrainData;
#include "headers.h"
typedef struct Dav1dPictureParameters {
int w; ///< width (in pixels)
......
......@@ -4072,7 +4072,7 @@ void dav1d_init_states(CdfThreadContext *const cdf, const int qidx) {
dav1d_cdf_thread_ref(cdf, &cdf_init[qcat]);
}
void dav1d_update_tile_cdf(const Av1FrameHeader *const hdr,
void dav1d_update_tile_cdf(const Dav1dFrameHeader *const hdr,
CdfContext *const dst,
const CdfContext *const src)
{
......@@ -4138,7 +4138,7 @@ void dav1d_update_tile_cdf(const Av1FrameHeader *const hdr,
update_cdf_4d(N_TX_SIZES, 2, 41 /*42*/, 4, coef.base_tok);
update_bit_2d(2, 3, coef.dc_sign);
update_cdf_4d(4, 2, 21, 4, coef.br_tok);
update_cdf_2d(3, NUM_SEGMENTS, m.seg_id);
update_cdf_2d(3, DAV1D_NUM_SEGMENTS, m.seg_id);
update_cdf_1d(8, m.cfl_sign);
update_cdf_2d(6, 16, m.cfl_alpha);
update_bit_0d(m.restore_wiener);
......@@ -4171,7 +4171,7 @@ void dav1d_update_tile_cdf(const Av1FrameHeader *const hdr,
update_bit_1d(3, m.skip_mode);
update_cdf_2d(4, N_INTRA_PRED_MODES, m.y_mode);
update_cdf_3d(2, 8, N_SWITCHABLE_FILTERS, m.filter);
update_cdf_3d(2, 8, DAV1D_N_SWITCHABLE_FILTERS, m.filter);
update_bit_1d(6, m.newmv_mode);
update_bit_1d(2, m.globalmv_mode);
update_bit_1d(6, m.refmv_mode);
......
......@@ -40,7 +40,7 @@ typedef struct CdfModeContext {
uint16_t filter_intra[5 + 1];
uint16_t uv_mode[2][N_INTRA_PRED_MODES][N_UV_INTRA_PRED_MODES + 1];
uint16_t angle_delta[8][8];
uint16_t filter[2][8][N_SWITCHABLE_FILTERS + 1];
uint16_t filter[2][8][DAV1D_N_SWITCHABLE_FILTERS + 1];
uint16_t newmv_mode[6][2];
uint16_t globalmv_mode[2][2];
uint16_t refmv_mode[6][2];
......@@ -68,7 +68,7 @@ typedef struct CdfModeContext {
uint16_t skip_mode[3][2];
uint16_t partition[N_BL_LEVELS][4][N_PARTITIONS + 1];
uint16_t seg_pred[3][2];
uint16_t seg_id[3][NUM_SEGMENTS + 1];
uint16_t seg_id[3][DAV1D_NUM_SEGMENTS + 1];
uint16_t cfl_sign[8 + 1];
uint16_t cfl_alpha[6][16 + 1];
uint16_t restore_wiener[2];
......@@ -132,7 +132,7 @@ typedef struct CdfThreadContext {
} CdfThreadContext;
void dav1d_init_states(CdfThreadContext *cdf, int qidx);
void dav1d_update_tile_cdf(const Av1FrameHeader *hdr, CdfContext *dst,
void dav1d_update_tile_cdf(const Dav1dFrameHeader *hdr, CdfContext *dst,
const CdfContext *src);
void dav1d_cdf_thread_alloc(CdfThreadContext *cdf, struct thread_data *t);
......
This diff is collapsed.
......@@ -123,7 +123,7 @@ static inline unsigned gather_top_partition_prob(const uint16_t *const in,
static inline enum TxfmTypeSet get_ext_txtp_set(const enum RectTxfmSize tx,
const int inter,
const Av1FrameHeader *const hdr,
const Dav1dFrameHeader *const hdr,
const int seg_id)
{
if (!hdr->segmentation.qidx[seg_id]) {
......@@ -156,7 +156,7 @@ static inline enum TxfmTypeSet get_ext_txtp_set(const enum RectTxfmSize tx,
static inline enum TxfmType get_uv_intra_txtp(const enum IntraPredMode uv_mode,
const enum RectTxfmSize tx,
const Av1FrameHeader *const hdr,
const Dav1dFrameHeader *const hdr,
const int seg_id)
{
if (hdr->segmentation.lossless[seg_id]) {
......@@ -171,7 +171,7 @@ static inline enum TxfmType get_uv_intra_txtp(const enum IntraPredMode uv_mode,
static inline enum TxfmType get_uv_inter_txtp(const TxfmInfo *const uvt_dim,
const enum TxfmType ytxtp,
const Av1FrameHeader *const hdr,
const Dav1dFrameHeader *const hdr,
const int seg_id)
{
if (hdr->segmentation.lossless[seg_id]) {
......@@ -197,18 +197,18 @@ static inline int get_filter_ctx(const BlockContext *const a,
const int yb4, const int xb4)
{
const int a_filter = (a->ref[0][xb4] == ref || a->ref[1][xb4] == ref) ?
a->filter[dir][xb4] : N_SWITCHABLE_FILTERS;
a->filter[dir][xb4] : DAV1D_N_SWITCHABLE_FILTERS;
const int l_filter = (l->ref[0][yb4] == ref || l->ref[1][yb4] == ref) ?
l->filter[dir][yb4] : N_SWITCHABLE_FILTERS;
l->filter[dir][yb4] : DAV1D_N_SWITCHABLE_FILTERS;
if (a_filter == l_filter) {
return comp * 4 + a_filter;
} else if (a_filter == N_SWITCHABLE_FILTERS) {
} else if (a_filter == DAV1D_N_SWITCHABLE_FILTERS) {
return comp * 4 + l_filter;
} else if (l_filter == N_SWITCHABLE_FILTERS) {
} else if (l_filter == DAV1D_N_SWITCHABLE_FILTERS) {
return comp * 4 + a_filter;
} else {
return comp * 4 + N_SWITCHABLE_FILTERS;
return comp * 4 + DAV1D_N_SWITCHABLE_FILTERS;
}
}
......@@ -719,18 +719,18 @@ static inline int get_br_ctx(const uint8_t *const levels,
return mag + 14;
}
static inline mv get_gmv_2d(const WarpedMotionParams *const gmv,
static inline mv get_gmv_2d(const Dav1dWarpedMotionParams *const gmv,
const int bx4, const int by4,
const int bw4, const int bh4,
const Av1FrameHeader *const hdr)
const Dav1dFrameHeader *const hdr)
{
switch (gmv->type) {
case WM_TYPE_ROT_ZOOM:
case DAV1D_WM_TYPE_ROT_ZOOM:
assert(gmv->matrix[5] == gmv->matrix[2]);
assert(gmv->matrix[4] == -gmv->matrix[3]);
// fall-through
default:
case WM_TYPE_AFFINE: {
case DAV1D_WM_TYPE_AFFINE: {
const int x = bx4 * 4 + bw4 * 2 - 1;
const int y = by4 * 4 + bh4 * 2 - 1;
const int xc = (gmv->matrix[2] - (1 << 16)) * x +
......@@ -744,12 +744,12 @@ static inline mv get_gmv_2d(const WarpedMotionParams *const gmv,
.x = apply_sign(((abs(xc) + round) >> shift) << !hdr->hp, xc),
};
}
case WM_TYPE_TRANSLATION:
case DAV1D_WM_TYPE_TRANSLATION:
return (mv) {
.y = gmv->matrix[0] >> 13,
.x = gmv->matrix[1] >> 13,
};
case WM_TYPE_IDENTITY:
case DAV1D_WM_TYPE_IDENTITY:
return (mv) { .x = 0, .y = 0 };
}
}
......
......@@ -78,9 +78,9 @@ struct Dav1dContext {
int n_tile_data;
int n_tiles;
Dav1dRef *seq_hdr_ref;
Av1SequenceHeader *seq_hdr;
Dav1dSequenceHeader *seq_hdr;
Dav1dRef *frame_hdr_ref;
Av1FrameHeader *frame_hdr;
Dav1dFrameHeader *frame_hdr;
// decoded output picture queue
Dav1dData in;
......@@ -94,11 +94,11 @@ struct Dav1dContext {
struct {
Dav1dThreadPicture p;
Dav1dRef *segmap;
Av1SegmentationDataSet seg_data;
Dav1dSegmentationDataSet seg_data;
Dav1dRef *refmvs;
unsigned refpoc[7];
WarpedMotionParams gmv[7];
Av1LoopfilterModeRefDeltas lf_mode_ref_deltas;
Dav1dWarpedMotionParams gmv[7];
Dav1dLoopfilterModeRefDeltas lf_mode_ref_deltas;
Dav1dFilmGrainData film_grain;
uint8_t qidx;
unsigned coded_width;
......@@ -125,9 +125,9 @@ struct Dav1dContext {
struct Dav1dFrameContext {
Dav1dRef *seq_hdr_ref;
Av1SequenceHeader *seq_hdr;
Dav1dSequenceHeader *seq_hdr;
Dav1dRef *frame_hdr_ref;
Av1FrameHeader *frame_hdr;
Dav1dFrameHeader *frame_hdr;
Dav1dThreadPicture refp[7];
Dav1dPicture cur; // during block coding / reconstruction
Dav1dThreadPicture sr_cur; // after super-resolution upscaling
......@@ -172,7 +172,7 @@ struct Dav1dFrameContext {
pixel *ipred_edge[3];
ptrdiff_t b4_stride;
int w4, h4, bw, bh, sb128w, sb128h, sbh, sb_shift, sb_step, sr_sb128w;
uint16_t dq[NUM_SEGMENTS][3 /* plane */][2 /* dc/ac */];
uint16_t dq[DAV1D_NUM_SEGMENTS][3 /* plane */][2 /* dc/ac */];
const uint8_t *qm[2 /* is_1d */][N_RECT_TX_SIZES][3 /* plane */];
BlockContext *a;
int a_sz /* w*tile_rows */;
......@@ -250,7 +250,7 @@ struct Dav1dTileState {
coef *cf;
} frame_thread;
uint16_t dqmem[NUM_SEGMENTS][3 /* plane */][2 /* dc/ac */];
uint16_t dqmem[DAV1D_NUM_SEGMENTS][3 /* plane */][2 /* dc/ac */];
const uint16_t (*dq)[3][2];
int last_qidx;
......@@ -274,7 +274,7 @@ struct Dav1dTileContext {
uint16_t pal[3 /* plane */][8 /* palette_idx */];
uint8_t pal_sz_uv[2 /* a/l */][32 /* bx4/by4 */];
uint8_t txtp_map[32 * 32]; // inter-only
WarpedMotionParams warpmv;
Dav1dWarpedMotionParams warpmv;
union {
void *mem;
uint8_t *pal_idx;
......
......@@ -28,6 +28,7 @@
#include "config.h"
#include <assert.h>
#include <stdlib.h>
#include "src/intra_edge.h"
#include "src/levels.h"
......
......@@ -28,6 +28,8 @@
#ifndef __DAV1D_SRC_IPRED_H__
#define __DAV1D_SRC_IPRED_H__
#include <stddef.h>
#include "common/bitdepth.h"
#include "src/levels.h"
......
......@@ -28,6 +28,8 @@
#ifndef __DAV1D_SRC_ITX_H__
#define __DAV1D_SRC_ITX_H__
#include <stddef.h>
#include "common/bitdepth.h"
#include "src/levels.h"
......
......@@ -28,7 +28,9 @@
#ifndef __DAV1D_SRC_LEVELS_H__
#define __DAV1D_SRC_LEVELS_H__
#include "dav1d/picture.h"
#include <stdint.h>
#include "dav1d/headers.h"
enum ObuType {
OBU_SEQ_HDR = 1,
......@@ -41,10 +43,6 @@ enum ObuType {
OBU_PADDING = 15,
};
// Constants from Section 3. "Symbols and abbreviated terms"
#define MAX_TILE_COLS 64
#define MAX_TILE_ROWS 64
enum TxfmSize {
TX_4X4,
TX_8X8,
......@@ -63,13 +61,6 @@ enum BlockLevel {
N_BL_LEVELS,
};
enum TxfmMode {
TX_4X4_ONLY,
TX_LARGEST,
TX_SWITCHABLE,
N_TX_MODES,
};
enum RectTxfmSize {
RTX_4X8 = N_TX_SIZES,
RTX_8X4,
......@@ -203,16 +194,6 @@ enum BlockSize {
N_BS_SIZES,
};
enum FilterMode {
FILTER_8TAP_REGULAR,
FILTER_8TAP_SMOOTH,
FILTER_8TAP_SHARP,
N_SWITCHABLE_FILTERS,
FILTER_BILINEAR = N_SWITCHABLE_FILTERS,
N_FILTERS,
FILTER_SWITCHABLE = N_FILTERS,
};
enum Filter2d { // order is horizontal, vertical
FILTER_2D_8TAP_REGULAR,
FILTER_2D_8TAP_REGULAR_SMOOTH,
......@@ -269,227 +250,16 @@ enum InterIntraType {
INTER_INTRA_WEDGE,
};
enum AdaptiveBoolean {
OFF = 0,
ON = 1,
ADAPTIVE = 2,
};
enum RestorationType {
RESTORATION_NONE,
RESTORATION_SWITCHABLE,
RESTORATION_WIENER,
RESTORATION_SGRPROJ,
};
typedef struct mv {
int16_t y, x;
} mv;
enum WarpedMotionType {
WM_TYPE_IDENTITY,
WM_TYPE_TRANSLATION,
WM_TYPE_ROT_ZOOM,
WM_TYPE_AFFINE,
};
typedef struct WarpedMotionParams {
enum WarpedMotionType type;
int32_t matrix[6];
union {
struct {
int16_t alpha, beta, gamma, delta;
};
int16_t abcd[4];
};
} WarpedMotionParams;
enum MotionMode {
MM_TRANSLATION,
MM_OBMC,
MM_WARP,
};
typedef struct Av1SequenceHeader {
int profile;
int still_picture;
int reduced_still_picture_header;
int timing_info_present;
int num_units_in_tick;
int time_scale;
int equal_picture_interval;
int num_ticks_per_picture;
int decoder_model_info_present;
int encoder_decoder_buffer_delay_length;
int num_units_in_decoding_tick;
int buffer_removal_delay_length;
int frame_presentation_delay_length;
int display_model_info_present;
int num_operating_points;
struct Av1SequenceHeaderOperatingPoint {
int idc;
int major_level, minor_level;
int tier;
int decoder_model_param_present;
int decoder_buffer_delay;
int encoder_buffer_delay;
int low_delay_mode;
int display_model_param_present;
int initial_display_delay;
} operating_points[32];
int max_width, max_height, width_n_bits, height_n_bits;
int frame_id_numbers_present;
int delta_frame_id_n_bits;
int frame_id_n_bits;
int sb128;
int filter_intra;
int intra_edge_filter;
int inter_intra;
int masked_compound;
int warped_motion;
int dual_filter;
int order_hint;
int jnt_comp;
int ref_frame_mvs;
enum AdaptiveBoolean screen_content_tools;
enum AdaptiveBoolean force_integer_mv;
int order_hint_n_bits;
int super_res;
int cdef;
int restoration;
int bpc;
int hbd;
int color_description_present;
enum Dav1dPixelLayout layout;
enum Dav1dColorPrimaries pri;
enum Dav1dTransferCharacteristics trc;
enum Dav1dMatrixCoefficients mtrx;
enum Dav1dChromaSamplePosition chr;
int color_range;
int separate_uv_delta_q;
int film_grain_present;
} Av1SequenceHeader;
#define NUM_SEGMENTS 8
typedef struct Av1SegmentationData {
int delta_q;
int delta_lf_y_v, delta_lf_y_h, delta_lf_u, delta_lf_v;
int ref;
int skip;
int globalmv;
} Av1SegmentationData;
typedef struct Av1SegmentationDataSet {
Av1SegmentationData d[NUM_SEGMENTS];
int preskip;
int last_active_segid;
} Av1SegmentationDataSet;
typedef struct Av1LoopfilterModeRefDeltas {
int mode_delta[2];
int ref_delta[8];
} Av1LoopfilterModeRefDeltas;
typedef struct Av1FrameHeader {
int show_existing_frame;
int existing_frame_idx;
int frame_id;
int frame_presentation_delay;
enum Dav1dFrameType frame_type;
int show_frame;
int showable_frame;
int error_resilient_mode;
int disable_cdf_update;
int allow_screen_content_tools;
int force_integer_mv;
int frame_size_override;
#define PRIMARY_REF_NONE 7
int primary_ref_frame;
int buffer_removal_time_present;
struct Av1FrameHeaderOperatingPoint {
int buffer_removal_time;
} operating_points[32];
int frame_offset;
int refresh_frame_flags;
int width[2 /* { coded_width, superresolution_upscaled_width } */], height;
int render_width, render_height;
struct {
int width_scale_denominator;
int enabled;
} super_res;
int have_render_size;
int allow_intrabc;
int frame_ref_short_signaling;
int refidx[7];
int hp;
enum FilterMode subpel_filter_mode;
int switchable_motion_mode;
int use_ref_frame_mvs;
int refresh_context;
struct {
int uniform;
unsigned n_bytes;
int min_log2_cols, max_log2_cols, log2_cols, cols;
int min_log2_rows, max_log2_rows, log2_rows, rows;
uint16_t col_start_sb[MAX_TILE_COLS + 1];
uint16_t row_start_sb[MAX_TILE_ROWS + 1];
int update;
} tiling;
struct {
int yac;
int ydc_delta;
int udc_delta, uac_delta, vdc_delta, vac_delta;
int qm, qm_y, qm_u, qm_v;
} quant;
struct {
int enabled, update_map, temporal, update_data;
Av1SegmentationDataSet seg_data;
int lossless[NUM_SEGMENTS], qidx[NUM_SEGMENTS];
} segmentation;
struct {
struct {
int present;
int res_log2;
} q;
struct {
int present;
int res_log2;
int multi;
} lf;
} delta;
int all_lossless;
struct {
int level_y[2];
int level_u, level_v;
int mode_ref_delta_enabled;
int mode_ref_delta_update;
Av1LoopfilterModeRefDeltas mode_ref_deltas;
int sharpness;
} loopfilter;
struct {
int damping;
int n_bits;
int y_strength[8];
int uv_strength[8];
} cdef;
struct {
enum RestorationType type[3];
int unit_size[2];
} restoration;
enum TxfmMode txfm_mode;
int switchable_comp_refs;
int skip_mode_allowed, skip_mode_enabled, skip_mode_refs[2];
int warp_motion;
int reduced_txtp_set;
WarpedMotionParams gmv[7];
struct {
int present, update;
Dav1dFilmGrainData data;
} film_grain;
int temporal_id, spatial_id;
} Av1FrameHeader;
#define QINDEX_RANGE 256
typedef struct Av1Block {
......
......@@ -287,7 +287,7 @@ static inline void mask_edges_chroma(uint16_t (*const masks)[32][2][2],
void dav1d_create_lf_mask_intra(Av1Filter *const lflvl,
uint8_t (*const level_cache)[4],
const ptrdiff_t b4_stride,
const Av1FrameHeader *const hdr,
const Dav1dFrameHeader *const hdr,
const uint8_t (*filter_level)[8][2],
const int bx, const int by,
const int iw, const int ih,
......@@ -351,7 +351,7 @@ void dav1d_create_lf_mask_intra(Av1Filter *const lflvl,
void dav1d_create_lf_mask_inter(Av1Filter *const lflvl,
uint8_t (*const level_cache)[4],
const ptrdiff_t b4_stride,
const Av1FrameHeader *const hdr,
const Dav1dFrameHeader *const hdr,
const uint8_t (*filter_level)[8][2],
const int bx, const int by,
const int iw, const int ih,
......@@ -435,7 +435,7 @@ void dav1d_calc_eih(Av1FilterLUT *const lim_lut, const int filter_sharpness) {
static inline void calc_lf_value(uint8_t (*const lflvl_values)[2],
const int is_chroma, const int base_lvl,
const int lf_delta, const int seg_delta,
const Av1LoopfilterModeRefDeltas *const mr_delta)
const Dav1dLoopfilterModeRefDeltas *const mr_delta)
{
const int base = iclip(iclip(base_lvl + lf_delta, 0, 63) + seg_delta, 0, 63);
......@@ -458,7 +458,7 @@ static inline void calc_lf_value(uint8_t (*const lflvl_values)[2],
}
void dav1d_calc_lf_values(uint8_t (*const lflvl_values)[4][8][2],
const Av1FrameHeader *const hdr,
const Dav1dFrameHeader *const hdr,
const int8_t lf_delta[4])
{
const int n_seg = hdr->segmentation.enabled ? 8 : 1;
......@@ -468,11 +468,11 @@ void dav1d_calc_lf_values(uint8_t (*const lflvl_values)[4][8][2],
return;
}
const Av1LoopfilterModeRefDeltas *const mr_deltas =
const Dav1dLoopfilterModeRefDeltas *const mr_deltas =
hdr->loopfilter.mode_ref_delta_enabled ?
&hdr->loopfilter.mode_ref_deltas : NULL;
for (int s = 0; s < n_seg; s++) {
const Av1SegmentationData *const segd =
const Dav1dSegmentationData *const segd =
hdr->segmentation.enabled ? &hdr->segmentation.seg_data.d[s] : NULL;
calc_lf_value(lflvl_values[s][0], 0, hdr->loopfilter.level_y[0],
......
......@@ -40,7 +40,7 @@ typedef struct Av1FilterLUT {
} Av1FilterLUT;
typedef struct Av1RestorationUnit {
enum RestorationType type;
enum Dav1dRestorationType type;
int16_t filter_h[3];
int16_t filter_v[3];
uint8_t sgr_idx;
......@@ -63,7 +63,7 @@ typedef struct Av1Restoration {
void dav1d_create_lf_mask_intra(Av1Filter *lflvl, uint8_t (*level_cache)[4],
const ptrdiff_t b4_stride,
const Av1FrameHeader *hdr,
const Dav1dFrameHeader *hdr,
const uint8_t (*level)[8][2], int bx, int by,
int iw, int ih, enum BlockSize bs,
enum RectTxfmSize ytx, enum RectTxfmSize uvtx,
......@@ -71,7 +71,7 @@ void dav1d_create_lf_mask_intra(Av1Filter *lflvl, uint8_t (*level_cache)[4],
uint8_t *ly, uint8_t *auv, uint8_t *luv);
void dav1d_create_lf_mask_inter(Av1Filter *lflvl, uint8_t (*level_cache)[4],
const ptrdiff_t b4_stride,
const Av1FrameHeader *hdr,
const Dav1dFrameHeader *hdr,
const uint8_t (*level)[8][2], int bx, int by,
int iw, int ih, int skip_inter,
enum BlockSize bs, const uint16_t *tx_mask,
......@@ -79,7 +79,7 @@ void dav1d_create_lf_mask_inter(Av1Filter *lflvl, uint8_t (*level_cache)[4],
enum Dav1dPixelLayout layout, uint8_t *ay,
uint8_t *ly, uint8_t *auv, uint8_t *luv);
void dav1d_calc_eih(Av1FilterLUT *lim_lut, int filter_sharpness);
void dav1d_calc_lf_values(uint8_t (*values)[4][8][2], const Av1FrameHeader *hdr,
void dav1d_calc_lf_values(uint8_t (*values)[4][8][2], const Dav1dFrameHeader *hdr,
const int8_t lf_delta[4]);
#endif /* __DAV1D_SRC_LF_MASK_H__ */
......@@ -103,9 +103,9 @@ void bytefn(dav1d_lr_copy_lpf)(Dav1dFrameContext *const f,
// TODO Also check block level restore type to reduce copying.
const int restore_planes =
((f->frame_hdr->restoration.type[0] != RESTORATION_NONE) << 0) +
((f->frame_hdr->restoration.type[1] != RESTORATION_NONE) << 1) +
((f->frame_hdr->restoration.type[2] != RESTORATION_NONE) << 2);
((f->frame_hdr->restoration.type[0] != DAV1D_RESTORATION_NONE) << 0) +
((f->frame_hdr->restoration.type[1] != DAV1D_RESTORATION_NONE) << 1) +
((f->frame_hdr->restoration.type[2] != DAV1D_RESTORATION_NONE) << 2);
if (restore_planes & LR_RESTORE_Y) {
const int h = f->bh << 2;
......@@ -157,7 +157,7 @@ static void lr_stripe(const Dav1dFrameContext *const f, pixel *p,
// FIXME [8] might be easier for SIMD
int16_t filterh[7], filterv[7];
if (lr->type == RESTORATION_WIENER) {
if (lr->type == DAV1D_RESTORATION_WIENER) {
filterh[0] = filterh[6] = lr->filter_h[0];
filterh[1] = filterh[5] = lr->filter_h[1];
filterh[2] = filterh[4] = lr->filter_h[2];
......@@ -176,11 +176,11 @@ static void lr_stripe(const Dav1dFrameContext *const f, pixel *p,
} else {
edges |= LR_HAVE_BOTTOM;
}
if (lr->type == RESTORATION_WIENER) {
if (lr->type == DAV1D_RESTORATION_WIENER) {
dsp->lr.wiener(p, p_stride, left, lpf, lpf_stride, unit_w, stripe_h,
filterh, filterv, edges);
} else {
assert(lr->type == RESTORATION_SGRPROJ);
assert(lr->type == DAV1D_RESTORATION_SGRPROJ);
dsp->lr.selfguided(p, p_stride, left, lpf, lpf_stride, unit_w, stripe_h,
lr->sgr_idx, lr->sgr_weights, edges);
}
......@@ -257,7 +257,7 @@ static void lr_sbrow(const Dav1dFrameContext *const f, pixel *p, const int y,
if (edges & LR_HAVE_RIGHT) {
backup4xU(pre_lr_border[bit], p + unit_w - 4, p_stride, row_h - y);
}
if (lr->type != RESTORATION_NONE) {
if (lr->type != DAV1D_RESTORATION_NONE) {
lr_stripe(f, p, pre_lr_border[!bit], x, y, plane, unit_w, row_h, lr, edges);