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
/*
* Copyright © 2018, VideoLAN and dav1d authors
* Copyright © 2018, Two Orioles, LLC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __DAV1D_HEADERS_H__
#define __DAV1D_HEADERS_H__
// Constants from Section 3. "Symbols and abbreviated terms"
#define DAV1D_MAX_TILE_COLS 64
#define DAV1D_MAX_TILE_ROWS 64
enum Dav1dTxfmMode {
DAV1D_TX_4X4_ONLY,
DAV1D_TX_LARGEST,
DAV1D_TX_SWITCHABLE,
DAV1D_N_TX_MODES,
};
enum Dav1dFilterMode {
DAV1D_FILTER_8TAP_REGULAR,
DAV1D_FILTER_8TAP_SMOOTH,
DAV1D_FILTER_8TAP_SHARP,
DAV1D_N_SWITCHABLE_FILTERS,
DAV1D_FILTER_BILINEAR = DAV1D_N_SWITCHABLE_FILTERS,
DAV1D_N_FILTERS,
DAV1D_FILTER_SWITCHABLE = DAV1D_N_FILTERS,
};
enum Dav1dAdaptiveBoolean {
DAV1D_OFF = 0,
DAV1D_ON = 1,
DAV1D_ADAPTIVE = 2,
};
enum Dav1dRestorationType {
DAV1D_RESTORATION_NONE,
DAV1D_RESTORATION_SWITCHABLE,
DAV1D_RESTORATION_WIENER,
DAV1D_RESTORATION_SGRPROJ,
};
enum Dav1dWarpedMotionType {
DAV1D_WM_TYPE_IDENTITY,
DAV1D_WM_TYPE_TRANSLATION,
DAV1D_WM_TYPE_ROT_ZOOM,
DAV1D_WM_TYPE_AFFINE,
};
typedef struct Dav1dWarpedMotionParams {
enum Dav1dWarpedMotionType type;
int32_t matrix[6];
union {
struct {
int16_t alpha, beta, gamma, delta;
};
int16_t abcd[4];
};
} Dav1dWarpedMotionParams;
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 Dav1dSequenceHeader {
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 Dav1dSequenceHeaderOperatingPoint {
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 Dav1dAdaptiveBoolean screen_content_tools;
enum Dav1dAdaptiveBoolean 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;
} Dav1dSequenceHeader;
#define DAV1D_NUM_SEGMENTS 8
typedef struct Dav1dSegmentationData {
int delta_q;
int delta_lf_y_v, delta_lf_y_h, delta_lf_u, delta_lf_v;
int ref;
int skip;
int globalmv;
} Dav1dSegmentationData;
typedef struct Dav1dSegmentationDataSet {
Dav1dSegmentationData d[DAV1D_NUM_SEGMENTS];
int preskip;
int last_active_segid;
} Dav1dSegmentationDataSet;
typedef struct Dav1dLoopfilterModeRefDeltas {
int mode_delta[2];
int ref_delta[8];
} Dav1dLoopfilterModeRefDeltas;
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;
int uv_mult[2];
int uv_luma_mult[2];
int uv_offset[2];
int overlap_flag;
int clip_to_restricted_range;
} Dav1dFilmGrainData;
typedef struct Dav1dFrameHeader {
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 DAV1D_PRIMARY_REF_NONE 7
int primary_ref_frame;
int buffer_removal_time_present;
struct Dav1dFrameHeaderOperatingPoint {
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 Dav1dFilterMode 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[DAV1D_MAX_TILE_COLS + 1];
uint16_t row_start_sb[DAV1D_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;
Dav1dSegmentationDataSet seg_data;
int lossless[DAV1D_NUM_SEGMENTS], qidx[DAV1D_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;
Dav1dLoopfilterModeRefDeltas mode_ref_deltas;
int sharpness;
} loopfilter;
struct {
int damping;
int n_bits;
int y_strength[8];
int uv_strength[8];
} cdef;
struct {
enum Dav1dRestorationType type[3];
int unit_size[2];
} restoration;
enum Dav1dTxfmMode txfm_mode;
int switchable_comp_refs;
int skip_mode_allowed, skip_mode_enabled, skip_mode_refs[2];
int warp_motion;
int reduced_txtp_set;
Dav1dWarpedMotionParams gmv[7];
struct {
int present, update;
Dav1dFilmGrainData data;
} film_grain;
int temporal_id, spatial_id;
} Dav1dFrameHeader;
#endif /* __DAV1D_HEADERS_H__ */
......@@ -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);
......
......@@ -49,8 +49,8 @@
#include "src/thread_task.h"
#include "src/warpmv.h"
static void init_quant_tables(const Av1SequenceHeader *const seq_hdr,
const Av1FrameHeader *const frame_hdr,
static void init_quant_tables(const Dav1dSequenceHeader *const seq_hdr,
const Dav1dFrameHeader *const frame_hdr,
const int qidx, uint16_t (*dq)[3][2])
{
for (int i = 0; i < (frame_hdr->segmentation.enabled ? 8 : 1); i++) {
......@@ -283,7 +283,7 @@ static void find_matching_ref(const Dav1dTileContext *const t,
static void derive_warpmv(const Dav1dTileContext *const t,
const int bw4, const int bh4,
const uint64_t masks[2], const struct mv mv,
WarpedMotionParams *const wmp)
Dav1dWarpedMotionParams *const wmp)
{
int pts[8][2 /* in, out */][2 /* x, y */], np = 0;
const Dav1dFrameContext *const f = t->f;
......@@ -352,9 +352,9 @@ static void derive_warpmv(const Dav1dTileContext *const t,
if (!dav1d_find_affine_int(pts, ret, bw4, bh4, mv, wmp, t->bx, t->by) &&
!dav1d_get_shear_params(wmp))
{
wmp->type = WM_TYPE_AFFINE;
wmp->type = DAV1D_WM_TYPE_AFFINE;
} else
wmp->type = WM_TYPE_IDENTITY;
wmp->type = DAV1D_WM_TYPE_IDENTITY;
}
static inline int findoddzero(const uint8_t *buf, int len) {
......@@ -617,22 +617,22 @@ static void read_vartx_tree(Dav1dTileContext *const t,
b->max_ytx == TX_4X4)
{
b->max_ytx = b->uvtx = TX_4X4;
if (f->frame_hdr->txfm_mode == TX_SWITCHABLE) {
if (f->frame_hdr->txfm_mode == DAV1D_TX_SWITCHABLE) {
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, t->dir tx, off, TX_4X4)
case_set(bh4, l., 1, by4);
case_set(bw4, a->, 0, bx4);
#undef set_ctx
}
} else if (f->frame_hdr->txfm_mode != TX_SWITCHABLE || b->skip) {
if (f->frame_hdr->txfm_mode == TX_SWITCHABLE) {
} else if (f->frame_hdr->txfm_mode != DAV1D_TX_SWITCHABLE || b->skip) {
if (f->frame_hdr->txfm_mode == DAV1D_TX_SWITCHABLE) {
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, t->dir tx, off, mul * b_dim[2 + diridx])
case_set(bh4, l., 1, by4);
case_set(bw4, a->, 0, bx4);
#undef set_ctx
} else {
assert(f->frame_hdr->txfm_mode == TX_LARGEST);
assert(f->frame_hdr->txfm_mode == DAV1D_TX_LARGEST);
}
b->uvtx = dav1d_max_txfm_size_for_bs[bs][f->cur.p.layout];
} else {
......@@ -664,7 +664,7 @@ static inline unsigned get_prev_frame_segid(const Dav1dFrameContext *const f,
{
unsigned seg_id = 8;
assert(f->frame_hdr->primary_ref_frame != PRIMARY_REF_NONE);
assert(f->frame_hdr->primary_ref_frame != DAV1D_PRIMARY_REF_NONE);
if (dav1d_thread_picture_wait(&f->refp[f->frame_hdr->primary_ref_frame],
(by + h4) * 4, PLANE_TYPE_BLOCK))
{
......@@ -763,7 +763,7 @@ static int decode_b(Dav1dTileContext *const t,
b->bp = bp;
b->bs = bs;
const Av1SegmentationData *seg = NULL;
const Dav1dSegmentationData *seg = NULL;
// segment_id (if seg_feature for skip/ref/gmv is enabled)
int seg_pred = 0;
......@@ -803,13 +803,13 @@ static int decode_b(Dav1dTileContext *const t,
&seg_ctx, f->cur_segmap, f->b4_stride);
const unsigned diff = msac_decode_symbol_adapt(&ts->msac,
ts->cdf.m.seg_id[seg_ctx],
NUM_SEGMENTS);
DAV1D_NUM_SEGMENTS);
const unsigned last_active_seg_id =
f->frame_hdr->segmentation.seg_data.last_active_segid;
b->seg_id = neg_deinterleave(diff, pred_seg_id,
last_active_seg_id + 1);
if (b->seg_id > last_active_seg_id) b->seg_id = 0; // error?
if (b->seg_id >= NUM_SEGMENTS) b->seg_id = 0; // error?
if (b->seg_id >= DAV1D_NUM_SEGMENTS) b->seg_id = 0; // error?
}
if (DEBUG_BLOCK_INFO)
......@@ -875,14 +875,14 @@ static int decode_b(Dav1dTileContext *const t,
} else {
const unsigned diff = msac_decode_symbol_adapt(&ts->msac,
ts->cdf.m.seg_id[seg_ctx],
NUM_SEGMENTS);
DAV1D_NUM_SEGMENTS);
const unsigned last_active_seg_id =
f->frame_hdr->segmentation.seg_data.last_active_segid;
b->seg_id = neg_deinterleave(diff, pred_seg_id,
last_active_seg_id + 1);
if (b->seg_id > last_active_seg_id) b->seg_id = 0; // error?
}
if (b->seg_id >= NUM_SEGMENTS) b->seg_id = 0; // error?
if (b->seg_id >= DAV1D_NUM_SEGMENTS) b->seg_id = 0; // error?
}
seg = &f->frame_hdr->segmentation.seg_data.d[b->seg_id];
......@@ -1140,7 +1140,7 @@ static int decode_b(Dav1dTileContext *const t,
b->tx = dav1d_max_txfm_size_for_bs[bs][0];
b->uvtx = dav1d_max_txfm_size_for_bs[bs][f->cur.p.layout];
t_dim = &dav1d_txfm_dimensions[b->tx];
if (f->frame_hdr->txfm_mode == TX_SWITCHABLE && t_dim->max > TX_4X4) {
if (f->frame_hdr->txfm_mode == DAV1D_TX_SWITCHABLE && t_dim->max > TX_4X4) {
const int tctx = get_tx_ctx(t->a, &t->l, t_dim, by4, bx4);
uint16_t *const tx_cdf = ts->cdf.m.txsz[t_dim->max - 1][tctx];
int depth = msac_decode_symbol_adapt(&ts->msac, tx_cdf,
......@@ -1187,8 +1187,8 @@ static int decode_b(Dav1dTileContext *const t,
rep_macro(type, t->dir comp_type, off, mul * COMP_INTER_NONE); \
rep_macro(type, t->dir ref[0], off, mul * ((uint8_t) -1)); \
rep_macro(type, t->dir ref[1], off, mul * ((uint8_t) -1)); \
rep_macro(type, t->dir filter[0], off, mul * N_SWITCHABLE_FILTERS); \
rep_macro(type, t->dir filter[1], off, mul * N_SWITCHABLE_FILTERS); \
rep_macro(type, t->dir filter[0], off, mul * DAV1D_N_SWITCHABLE_FILTERS); \
rep_macro(type, t->dir filter[1], off, mul * DAV1D_N_SWITCHABLE_FILTERS); \
}
const enum IntraPredMode y_mode_nofilt =
b->y_mode == FILTER_PRED ? DC_PRED : b->y_mode;
......@@ -1506,7 +1506,7 @@ static int decode_b(Dav1dTileContext *const t,
break; \
case GLOBALMV: \
has_subpel_filter |= \
f->frame_hdr->gmv[b->ref[idx]].type == WM_TYPE_TRANSLATION; \
f->frame_hdr->gmv[b->ref[idx]].type == DAV1D_WM_TYPE_TRANSLATION; \
b->mv[idx] = get_gmv_2d(&f->frame_hdr->gmv[b->ref[idx]], \
t->bx, t->by, bw4, bh4, f->frame_hdr); \
fix_mv_precision(f->frame_hdr, &b->mv[idx]); \
......@@ -1640,7 +1640,7 @@ static int decode_b(Dav1dTileContext *const t,
t->bx, t->by, bw4, bh4, f->frame_hdr);
fix_mv_precision(f->frame_hdr, &b->mv[0]);
has_subpel_filter = imin(bw4, bh4) == 1 ||
f->frame_hdr->gmv[b->ref[0]].type == WM_TYPE_TRANSLATION;
f->frame_hdr->gmv[b->ref[0]].type == DAV1D_WM_TYPE_TRANSLATION;
} else {
has_subpel_filter = 1;
if (msac_decode_bool_adapt(&ts->msac,
......@@ -1737,7 +1737,7 @@ static int decode_b(Dav1dTileContext *const t,
b->interintra_type == INTER_INTRA_NONE && imin(bw4, bh4) >= 2 &&
// is not warped global motion
!(!f->frame_hdr->force_integer_mv && b->inter_mode == GLOBALMV &&
f->frame_hdr->gmv[b->ref[0]].type > WM_TYPE_TRANSLATION) &&
f->frame_hdr->gmv[b->ref[0]].type > DAV1D_WM_TYPE_TRANSLATION) &&
// has overlappable neighbours
((have_left && findoddzero(&t->l.intra[by4 + 1], h4 >> 1)) ||
(have_top && findoddzero(&t->a->intra[bx4 + 1], w4 >> 1))))
......@@ -1784,14 +1784,14 @@ static int decode_b(Dav1dTileContext *const t,
}
// subpel filter
enum FilterMode filter[2];
if (f->frame_hdr->subpel_filter_mode == FILTER_SWITCHABLE) {
enum Dav1dFilterMode filter[2];
if (f->frame_hdr->subpel_filter_mode == DAV1D_FILTER_SWITCHABLE) {
if (has_subpel_filter) {
const int comp = b->comp_type != COMP_INTER_NONE;
const int ctx1 = get_filter_ctx(t->a, &t->l, comp, 0, b->ref[0],
by4, bx4);
filter[0] = msac_decode_symbol_adapt(&ts->msac,
ts->cdf.m.filter[0][ctx1], N_SWITCHABLE_FILTERS);
ts->cdf.m.filter[0][ctx1], DAV1D_N_SWITCHABLE_FILTERS);
if (f->seq_hdr->dual_filter) {
const int ctx2 = get_filter_ctx(t->a, &t->l, comp, 1,
b->ref[0], by4, bx4);
......@@ -1799,7 +1799,7 @@ static int decode_b(Dav1dTileContext *const t,
printf("Post-subpel_filter1[%d,ctx=%d]: r=%d\n",
filter[0], ctx1, ts->msac.rng);
filter[1] = msac_decode_symbol_adapt(&ts->msac,
ts->cdf.m.filter[1][ctx2], N_SWITCHABLE_FILTERS);
ts->cdf.m.filter[1][ctx2], DAV1D_N_SWITCHABLE_FILTERS);
if (DEBUG_BLOCK_INFO)
printf("Post-subpel_filter2[%d,ctx=%d]: r=%d\n",
filter[1], ctx2, ts->msac.rng);
......@@ -1810,7 +1810,7 @@ static int decode_b(Dav1dTileContext *const t,
filter[0], ctx1, ts->msac.rng);
}
} else {
filter[0] = filter[1] = FILTER_8TAP_REGULAR;
filter[0] = filter[1] = DAV1D_FILTER_8TAP_REGULAR;
}
} else {
filter[0] = filter[1] = f->frame_hdr->subpel_filter_mode;
......@@ -2194,7 +2194,7 @@ static void reset_context(BlockContext *const ctx, const int keyframe, const int
}
memset(ctx->lcoef, 0x40, sizeof(ctx->lcoef));
memset(ctx->ccoef, 0x40, sizeof(ctx->ccoef));
memset(ctx->filter, N_SWITCHABLE_FILTERS, sizeof(ctx->filter));
memset(ctx->filter, DAV1D_N_SWITCHABLE_FILTERS, sizeof(ctx->filter));
memset(ctx->seg_pred, 0, sizeof(ctx->seg_pred));
memset(ctx->pal_sz, 0, sizeof(ctx->pal_sz));
}
......@@ -2239,7 +2239,7 @@ static void setup_tile(Dav1dTileState *const ts,
((ts->tiling.col_start & 16) >> 4);
}
for (int p = 0; p < 3; p++) {
if (f->frame_hdr->restoration.type[p] == RESTORATION_NONE)
if (f->frame_hdr->restoration.type[p] == DAV1D_RESTORATION_NONE)
continue;
if (f->frame_hdr->super_res.enabled) {
......@@ -2273,28 +2273,28 @@ static void setup_tile(Dav1dTileState *const ts,
static void read_restoration_info(Dav1dTileContext *const t,
Av1RestorationUnit *const lr, const int p,
const enum RestorationType frame_type)
const enum Dav1dRestorationType frame_type)
{
const Dav1dFrameContext *const f = t->f;
Dav1dTileState *const ts = t->ts;
if (frame_type == RESTORATION_SWITCHABLE) {
if (frame_type == DAV1D_RESTORATION_SWITCHABLE) {
const int filter =
msac_decode_symbol_adapt(&ts->msac,
ts->cdf.m.restore_switchable, 3);
lr->type = filter ? filter == 2 ? RESTORATION_SGRPROJ :
RESTORATION_WIENER :