Merge "Moving loopfilter struct to VP9_COMMON."
This commit is contained in:
commit
ff7df102d9
@ -199,27 +199,6 @@ struct macroblockd_plane {
|
||||
|
||||
#define BLOCK_OFFSET(x, i, n) ((x) + (i) * (n))
|
||||
|
||||
#define MAX_REF_LF_DELTAS 4
|
||||
#define MAX_MODE_LF_DELTAS 2
|
||||
|
||||
struct loopfilter {
|
||||
int filter_level;
|
||||
|
||||
int sharpness_level;
|
||||
int last_sharpness_level;
|
||||
|
||||
uint8_t mode_ref_delta_enabled;
|
||||
uint8_t mode_ref_delta_update;
|
||||
|
||||
// 0 = Intra, Last, GF, ARF
|
||||
signed char ref_deltas[MAX_REF_LF_DELTAS];
|
||||
signed char last_ref_deltas[MAX_REF_LF_DELTAS];
|
||||
|
||||
// 0 = ZERO_MV, MV
|
||||
signed char mode_deltas[MAX_MODE_LF_DELTAS];
|
||||
signed char last_mode_deltas[MAX_MODE_LF_DELTAS];
|
||||
};
|
||||
|
||||
typedef struct macroblockd {
|
||||
struct macroblockd_plane plane[MAX_MB_PLANE];
|
||||
|
||||
@ -234,7 +213,6 @@ typedef struct macroblockd {
|
||||
int right_available;
|
||||
|
||||
struct segmentation seg;
|
||||
struct loopfilter lf;
|
||||
|
||||
// partition contexts
|
||||
PARTITION_CONTEXT *above_seg_context;
|
||||
|
@ -473,7 +473,7 @@ static void set_default_lf_deltas(struct loopfilter *lf) {
|
||||
void vp9_setup_past_independence(VP9_COMMON *cm, MACROBLOCKD *xd) {
|
||||
// Reset the segment feature data to the default stats:
|
||||
// Features disabled, 0, with delta coding (Default state).
|
||||
struct loopfilter *const lf = &xd->lf;
|
||||
struct loopfilter *const lf = &cm->lf;
|
||||
|
||||
int i;
|
||||
vp9_clearall_segfeatures(&xd->seg);
|
||||
|
@ -85,7 +85,7 @@ void vp9_loop_filter_frame_init(VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
||||
// 2 when filter_lvl is between 32 and 63
|
||||
const int n_shift = default_filt_lvl >> 5;
|
||||
loop_filter_info_n *const lfi = &cm->lf_info;
|
||||
struct loopfilter *const lf = &xd->lf;
|
||||
struct loopfilter *const lf = &cm->lf;
|
||||
struct segmentation *const seg = &xd->seg;
|
||||
|
||||
// update limits if sharpness has changed
|
||||
|
@ -22,6 +22,27 @@
|
||||
|
||||
#define SIMD_WIDTH 16
|
||||
|
||||
#define MAX_REF_LF_DELTAS 4
|
||||
#define MAX_MODE_LF_DELTAS 2
|
||||
|
||||
struct loopfilter {
|
||||
int filter_level;
|
||||
|
||||
int sharpness_level;
|
||||
int last_sharpness_level;
|
||||
|
||||
uint8_t mode_ref_delta_enabled;
|
||||
uint8_t mode_ref_delta_update;
|
||||
|
||||
// 0 = Intra, Last, GF, ARF
|
||||
signed char ref_deltas[MAX_REF_LF_DELTAS];
|
||||
signed char last_ref_deltas[MAX_REF_LF_DELTAS];
|
||||
|
||||
// 0 = ZERO_MV, MV
|
||||
signed char mode_deltas[MAX_MODE_LF_DELTAS];
|
||||
signed char last_mode_deltas[MAX_MODE_LF_DELTAS];
|
||||
};
|
||||
|
||||
// Need to align this structure so when it is declared and
|
||||
// passed it can be loaded into vector registers.
|
||||
typedef struct {
|
||||
|
@ -176,6 +176,8 @@ typedef struct VP9Common {
|
||||
|
||||
int ref_frame_sign_bias[MAX_REF_FRAMES]; /* Two state 0, 1 */
|
||||
|
||||
struct loopfilter lf;
|
||||
|
||||
/* Y,U,V */
|
||||
ENTROPY_CONTEXT *above_context[MAX_MB_PLANE];
|
||||
ENTROPY_CONTEXT left_context[MAX_MB_PLANE][16];
|
||||
|
@ -599,7 +599,7 @@ static void decode_tile(VP9D_COMP *pbi, vp9_reader *r) {
|
||||
lf_data->xd = pbi->mb;
|
||||
lf_data->y_only = 0;
|
||||
}
|
||||
vp9_loop_filter_frame_init(pc, &pbi->mb, pbi->mb.lf.filter_level);
|
||||
vp9_loop_filter_frame_init(pc, &pbi->mb, pc->lf.filter_level);
|
||||
}
|
||||
|
||||
for (mi_row = pc->cur_tile_mi_row_start; mi_row < pc->cur_tile_mi_row_end;
|
||||
@ -813,7 +813,7 @@ static size_t read_uncompressed_header(VP9D_COMP *pbi,
|
||||
int frame_to_show = cm->ref_frame_map[vp9_rb_read_literal(rb, 3)];
|
||||
ref_cnt_fb(cm->fb_idx_ref_cnt, &cm->new_fb_idx, frame_to_show);
|
||||
pbi->refresh_frame_flags = 0;
|
||||
xd->lf.filter_level = 0;
|
||||
cm->lf.filter_level = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -897,7 +897,7 @@ static size_t read_uncompressed_header(VP9D_COMP *pbi,
|
||||
if (cm->frame_type == KEY_FRAME || cm->error_resilient_mode || cm->intra_only)
|
||||
vp9_setup_past_independence(cm, xd);
|
||||
|
||||
setup_loopfilter(&xd->lf, rb);
|
||||
setup_loopfilter(&cm->lf, rb);
|
||||
setup_quantization(pbi, rb);
|
||||
setup_segmentation(&xd->seg, rb);
|
||||
|
||||
@ -961,7 +961,7 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
|
||||
xd->corrupted = 0;
|
||||
new_fb->corrupted = 0;
|
||||
pbi->do_loopfilter_inline =
|
||||
(pc->log2_tile_rows | pc->log2_tile_cols) == 0 && pbi->mb.lf.filter_level;
|
||||
(pc->log2_tile_rows | pc->log2_tile_cols) == 0 && pc->lf.filter_level;
|
||||
|
||||
if (!pbi->decoded_key_frame && !keyframe)
|
||||
return -1;
|
||||
|
@ -136,7 +136,7 @@ VP9D_PTR vp9_create_decompressor(VP9D_CONFIG *oxcf) {
|
||||
// vp9_init_dequantizer() for every frame.
|
||||
vp9_init_dequantizer(&pbi->common);
|
||||
|
||||
vp9_loop_filter_init(&pbi->common, &pbi->mb.lf);
|
||||
vp9_loop_filter_init(&pbi->common, &pbi->common.lf);
|
||||
|
||||
pbi->common.error.setjmp = 0;
|
||||
pbi->decoded_key_frame = 0;
|
||||
@ -359,7 +359,7 @@ int vp9_receive_compressed_data(VP9D_PTR ptr,
|
||||
|
||||
if (!pbi->do_loopfilter_inline) {
|
||||
/* Apply the loop filter if appropriate. */
|
||||
vp9_loop_filter_frame(cm, &pbi->mb, pbi->mb.lf.filter_level, 0, 0);
|
||||
vp9_loop_filter_frame(cm, &pbi->mb, pbi->common.lf.filter_level, 0, 0);
|
||||
}
|
||||
|
||||
#if WRITE_RECON_BUFFER == 2
|
||||
@ -424,7 +424,7 @@ int vp9_get_raw_frame(VP9D_PTR ptr, YV12_BUFFER_CONFIG *sd,
|
||||
*time_end_stamp = 0;
|
||||
|
||||
#if CONFIG_POSTPROC
|
||||
ret = vp9_post_proc_frame(&pbi->common, &pbi->mb.lf, sd, flags);
|
||||
ret = vp9_post_proc_frame(&pbi->common, &pbi->common.lf, sd, flags);
|
||||
#else
|
||||
|
||||
if (pbi->common.frame_to_show) {
|
||||
|
@ -1342,7 +1342,7 @@ static void write_uncompressed_header(VP9_COMP *cpi,
|
||||
|
||||
vp9_wb_write_literal(wb, cm->frame_context_idx, NUM_FRAME_CONTEXTS_LOG2);
|
||||
|
||||
encode_loopfilter(&xd->lf, wb);
|
||||
encode_loopfilter(&cm->lf, wb);
|
||||
encode_quantization(cm, wb);
|
||||
encode_segmentation(cpi, wb);
|
||||
|
||||
|
@ -2023,7 +2023,7 @@ static void switch_lossless_mode(VP9_COMP *cpi, int lossless) {
|
||||
cpi->mb.e_mbd.inv_txm4x4_1_add = vp9_short_iwalsh4x4_1_add;
|
||||
cpi->mb.e_mbd.inv_txm4x4_add = vp9_short_iwalsh4x4_add;
|
||||
cpi->mb.optimize = 0;
|
||||
cpi->mb.e_mbd.lf.filter_level = 0;
|
||||
cpi->common.lf.filter_level = 0;
|
||||
cpi->zbin_mode_boost_enabled = 0;
|
||||
cpi->common.tx_mode = ONLY_4X4;
|
||||
} else {
|
||||
|
@ -239,7 +239,7 @@ void vp9_initialize_enc() {
|
||||
|
||||
static void setup_features(VP9_COMP *cpi) {
|
||||
MACROBLOCKD *xd = &cpi->mb.e_mbd;
|
||||
struct loopfilter *const lf = &xd->lf;
|
||||
struct loopfilter *const lf = &cpi->common.lf;
|
||||
struct segmentation *const seg = &xd->seg;
|
||||
|
||||
// Set up default state for MB feature flags
|
||||
@ -543,7 +543,7 @@ static void update_reference_segmentation_map(VP9_COMP *cpi) {
|
||||
}
|
||||
|
||||
static void set_default_lf_deltas(VP9_COMP *cpi) {
|
||||
struct loopfilter *lf = &cpi->mb.e_mbd.lf;
|
||||
struct loopfilter *lf = &cpi->common.lf;
|
||||
|
||||
lf->mode_ref_delta_enabled = 1;
|
||||
lf->mode_ref_delta_update = 1;
|
||||
@ -1305,7 +1305,7 @@ void vp9_change_config(VP9_PTR ptr, VP9_CONFIG *oxcf) {
|
||||
// VP8 sharpness level mapping 0-7 (vs 0-10 in general VPx dialogs)
|
||||
cpi->oxcf.Sharpness = MIN(7, cpi->oxcf.Sharpness);
|
||||
|
||||
cpi->mb.e_mbd.lf.sharpness_level = cpi->oxcf.Sharpness;
|
||||
cpi->common.lf.sharpness_level = cpi->oxcf.Sharpness;
|
||||
|
||||
if (cpi->initial_width) {
|
||||
// Increasing the size of the frame beyond the first seen frame, or some
|
||||
@ -1705,7 +1705,7 @@ VP9_PTR vp9_create_compressor(VP9_CONFIG *oxcf) {
|
||||
*/
|
||||
vp9_init_quantizer(cpi);
|
||||
|
||||
vp9_loop_filter_init(cm, &cpi->mb.e_mbd.lf);
|
||||
vp9_loop_filter_init(cm, &cpi->common.lf);
|
||||
|
||||
cpi->common.error.setjmp = 0;
|
||||
|
||||
@ -2426,7 +2426,7 @@ static void update_reference_frames(VP9_COMP * const cpi) {
|
||||
|
||||
static void loopfilter_frame(VP9_COMP *cpi, VP9_COMMON *cm) {
|
||||
MACROBLOCKD *xd = &cpi->mb.e_mbd;
|
||||
struct loopfilter *lf = &xd->lf;
|
||||
struct loopfilter *lf = &cm->lf;
|
||||
if (xd->lossless) {
|
||||
lf->filter_level = 0;
|
||||
} else {
|
||||
@ -2605,7 +2605,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
|
||||
}
|
||||
|
||||
// Set default state for segment based loop filter update flags
|
||||
xd->lf.mode_ref_delta_update = 0;
|
||||
cm->lf.mode_ref_delta_update = 0;
|
||||
|
||||
// Initialize cpi->mv_step_param to default based on max resolution
|
||||
cpi->mv_step_param = vp9_init_search_range(cpi, max_mv_def);
|
||||
@ -3477,7 +3477,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
|
||||
// Clear the one shot update flags for segmentation map and mode/ref loop filter deltas.
|
||||
xd->seg.update_map = 0;
|
||||
xd->seg.update_data = 0;
|
||||
xd->lf.mode_ref_delta_update = 0;
|
||||
cm->lf.mode_ref_delta_update = 0;
|
||||
|
||||
// keep track of the last coded dimensions
|
||||
cm->last_width = cm->width;
|
||||
@ -3584,7 +3584,7 @@ static int frame_is_reference(const VP9_COMP *cpi) {
|
||||
cpi->refresh_golden_frame ||
|
||||
cpi->refresh_alt_ref_frame ||
|
||||
cm->refresh_frame_context ||
|
||||
mb->lf.mode_ref_delta_update ||
|
||||
cm->lf.mode_ref_delta_update ||
|
||||
mb->seg.update_map ||
|
||||
mb->seg.update_data;
|
||||
}
|
||||
@ -3990,7 +3990,7 @@ int vp9_get_preview_raw_frame(VP9_PTR comp, YV12_BUFFER_CONFIG *dest,
|
||||
else {
|
||||
int ret;
|
||||
#if CONFIG_POSTPROC
|
||||
ret = vp9_post_proc_frame(&cpi->common, &cpi->mb.e_mbd.lf, dest, flags);
|
||||
ret = vp9_post_proc_frame(&cpi->common, &cpi->common.lf, dest, flags);
|
||||
#else
|
||||
|
||||
if (cpi->common.frame_to_show) {
|
||||
|
@ -127,7 +127,7 @@ void vp9_set_alt_lf_level(VP9_COMP *cpi, int filt_val) {
|
||||
|
||||
void vp9_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi, int partial) {
|
||||
VP9_COMMON *cm = &cpi->common;
|
||||
struct loopfilter *lf = &cpi->mb.e_mbd.lf;
|
||||
struct loopfilter *lf = &cpi->common.lf;
|
||||
|
||||
int best_err = 0;
|
||||
int filt_err = 0;
|
||||
|
@ -99,8 +99,8 @@ void vp9_save_coding_context(VP9_COMP *cpi) {
|
||||
vpx_memcpy(cpi->coding_context.last_frame_seg_map_copy,
|
||||
cm->last_frame_seg_map, (cm->mi_rows * cm->mi_cols));
|
||||
|
||||
vp9_copy(cc->last_ref_lf_deltas, xd->lf.last_ref_deltas);
|
||||
vp9_copy(cc->last_mode_lf_deltas, xd->lf.last_mode_deltas);
|
||||
vp9_copy(cc->last_ref_lf_deltas, cm->lf.last_ref_deltas);
|
||||
vp9_copy(cc->last_mode_lf_deltas, cm->lf.last_mode_deltas);
|
||||
|
||||
vp9_copy(cc->coef_probs, cm->fc.coef_probs);
|
||||
vp9_copy(cc->switchable_interp_prob, cm->fc.switchable_interp_prob);
|
||||
@ -138,8 +138,8 @@ void vp9_restore_coding_context(VP9_COMP *cpi) {
|
||||
cpi->coding_context.last_frame_seg_map_copy,
|
||||
(cm->mi_rows * cm->mi_cols));
|
||||
|
||||
vp9_copy(xd->lf.last_ref_deltas, cc->last_ref_lf_deltas);
|
||||
vp9_copy(xd->lf.last_mode_deltas, cc->last_mode_lf_deltas);
|
||||
vp9_copy(cm->lf.last_ref_deltas, cc->last_ref_lf_deltas);
|
||||
vp9_copy(cm->lf.last_mode_deltas, cc->last_mode_lf_deltas);
|
||||
|
||||
vp9_copy(cm->fc.coef_probs, cc->coef_probs);
|
||||
vp9_copy(cm->fc.switchable_interp_prob, cc->switchable_interp_prob);
|
||||
|
Loading…
x
Reference in New Issue
Block a user