Rename SLICE_* enum constants to KVZ_SLICE_*.

This commit is contained in:
Arttu Ylä-Outinen 2015-09-08 13:57:15 +03:00
parent 9051fbf593
commit 173b70b53f
11 changed files with 29 additions and 25 deletions

View file

@ -365,7 +365,7 @@ void print_frame_info(encoder_state_t *state, double frame_psnr[3])
frame_psnr[0], frame_psnr[1], frame_psnr[2]);
// Print reference picture lists
if (state->global->slicetype != SLICE_I) {
if (state->global->slicetype != KVZ_SLICE_I) {
int j, ref_list[2] = { 0, 0 }, ref_list_poc[2][16];
// List all pocs of lists
for (j = 0; j < state->global->ref->used_size; j++) {

View file

@ -33,8 +33,8 @@ static void encoder_state_write_bitstream_aud(encoder_state_t * const state)
bitstream_t * const stream = &state->stream;
kvz_nal_write(stream, AUD_NUT, 0, 1);
uint8_t pic_type = state->global->slicetype == SLICE_I ? 0
: state->global->slicetype == SLICE_P ? 1
uint8_t pic_type = state->global->slicetype == KVZ_SLICE_I ? 0
: state->global->slicetype == KVZ_SLICE_P ? 1
: 2;
WRITE_U(stream, pic_type, 3, "pic_type");
@ -745,10 +745,10 @@ void kvz_encoder_state_write_bitstream_slice_header(encoder_state_t * const stat
WRITE_U(stream, 1, 1, "slice_sao_chroma_flag");
}
if (state->global->slicetype != SLICE_I) {
if (state->global->slicetype != KVZ_SLICE_I) {
WRITE_U(stream, 1, 1, "num_ref_idx_active_override_flag");
WRITE_UE(stream, ref_negative != 0 ? ref_negative - 1: 0, "num_ref_idx_l0_active_minus1");
if (state->global->slicetype == SLICE_B) {
if (state->global->slicetype == KVZ_SLICE_B) {
WRITE_UE(stream, ref_positive != 0 ? ref_positive - 1 : 0, "num_ref_idx_l1_active_minus1");
WRITE_U(stream, 0, 1, "mvd_l1_zero_flag");
}

View file

@ -369,7 +369,7 @@ static void encoder_state_encode_leaf(encoder_state_t * const state) {
// once. The added dependancy is for the first LCU of each wavefront
// row to depend on the reconstruction status of the row below in the
// previous frame.
if (state->previous_encoder_state != state && state->previous_encoder_state->tqj_recon_done && state->global->slicetype != SLICE_I) {
if (state->previous_encoder_state != state && state->previous_encoder_state->tqj_recon_done && state->global->slicetype != KVZ_SLICE_I) {
if (!lcu->left) {
if (lcu->below) {
kvz_threadqueue_job_dep_add(state->tile->wf_jobs[lcu->id], lcu->below->encoder_state->previous_encoder_state->tqj_recon_done);
@ -688,7 +688,7 @@ static void encoder_state_remove_refs(encoder_state_t *state) {
if (encoder->cfg->gop_len) {
refnumber = encoder->cfg->gop[state->global->gop_offset].ref_neg_count + encoder->cfg->gop[state->global->gop_offset].ref_pos_count;
check_refs = 1;
} else if (state->global->slicetype == SLICE_I) {
} else if (state->global->slicetype == KVZ_SLICE_I) {
refnumber = 0;
}
// Remove the ref pic (if present)
@ -758,14 +758,14 @@ static void encoder_state_new_frame(encoder_state_t * const state) {
if (state->global->is_idr_frame) {
encoder_state_reset_poc(state);
state->global->slicetype = SLICE_I;
state->global->slicetype = KVZ_SLICE_I;
state->global->pictype = NAL_IDR_W_RADL;
} else {
state->global->slicetype = encoder->cfg->intra_period==1 ? SLICE_I : (state->encoder_control->cfg->gop_len?SLICE_B:SLICE_P);
state->global->slicetype = encoder->cfg->intra_period==1 ? KVZ_SLICE_I : (state->encoder_control->cfg->gop_len?KVZ_SLICE_B:KVZ_SLICE_P);
state->global->pictype = NAL_TRAIL_R;
if (state->encoder_control->cfg->gop_len) {
if (encoder->cfg->intra_period > 1 && (state->global->poc % encoder->cfg->intra_period) == 0) {
state->global->slicetype = SLICE_I;
state->global->slicetype = KVZ_SLICE_I;
}
}
@ -779,7 +779,7 @@ static void encoder_state_new_frame(encoder_state_t * const state) {
lambda = kvz_select_picture_lambda(state);
state->global->QP = kvz_lambda_to_QP(lambda);
} else {
if (encoder->cfg->gop_len > 0 && state->global->slicetype != SLICE_I) {
if (encoder->cfg->gop_len > 0 && state->global->slicetype != KVZ_SLICE_I) {
kvz_gop_config const * const gop =
encoder->cfg->gop + state->global->gop_offset;
state->global->QP = encoder->cfg->qp + gop->qp_offset;
@ -1011,7 +1011,7 @@ void kvz_encode_coding_tree(encoder_state_t * const state,
// Encode skip flag
if (state->global->slicetype != SLICE_I) {
if (state->global->slicetype != KVZ_SLICE_I) {
int8_t ctx_skip = 0; // uiCtxSkip = aboveskipped + leftskipped;
int ui;
int16_t num_cand = MRG_MAX_NUM_CANDS;
@ -1050,7 +1050,7 @@ void kvz_encode_coding_tree(encoder_state_t * const state,
// ENDIF SKIP
// Prediction mode
if (state->global->slicetype != SLICE_I) {
if (state->global->slicetype != KVZ_SLICE_I) {
cabac->cur_ctx = &(cabac->ctx.cu_pred_mode_model);
CABAC_BIN(cabac, (cur_cu->type == CU_INTRA), "PredMode");
}
@ -1106,7 +1106,7 @@ void kvz_encode_coding_tree(encoder_state_t * const state,
}
// Void TEncSbac::codeInterDir( TComDataCU* pcCU, UInt uiAbsPartIdx )
if (state->global->slicetype == SLICE_B)
if (state->global->slicetype == KVZ_SLICE_B)
{
// Code Inter Dir
uint8_t inter_dir = cur_cu->inter.mv_dir-1;

View file

@ -81,7 +81,7 @@ typedef struct {
bool is_idr_frame;
uint8_t pictype;
uint8_t slicetype;
enum kvz_slice_type slicetype;
//! Total number of bits written.
uint64_t total_bits_coded;

View file

@ -246,7 +246,7 @@ void kvz_filter_deblock_edge_luma(encoder_state_t * const state,
}
// B-slice related checks
if(!strength && state->global->slicetype == SLICE_B) {
if(!strength && state->global->slicetype == KVZ_SLICE_B) {
// Zero all undefined motion vectors for easier usage
if(!(cu_q->inter.mv_dir & 1)) {

View file

@ -216,6 +216,10 @@ typedef int16_t coeff_t;
//Constants
typedef enum { COLOR_Y = 0, COLOR_U, COLOR_V, NUM_COLORS } color_t;
enum { SLICE_B = 0, SLICE_P = 1, SLICE_I = 2 };
enum kvz_slice_type {
KVZ_SLICE_B = 0,
KVZ_SLICE_P = 1,
KVZ_SLICE_I = 2,
};
#endif

View file

@ -763,7 +763,7 @@ uint8_t kvz_inter_get_merge_cand(const encoder_state_t * const state, int32_t x,
}
#endif
if (candidates < MRG_MAX_NUM_CANDS && state->global->slicetype == SLICE_B) {
if (candidates < MRG_MAX_NUM_CANDS && state->global->slicetype == KVZ_SLICE_B) {
#define NUM_PRIORITY_LIST 12;
static const uint8_t priorityList0[] = { 0, 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3 };
static const uint8_t priorityList1[] = { 1, 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2 };
@ -798,7 +798,7 @@ uint8_t kvz_inter_get_merge_cand(const encoder_state_t * const state, int32_t x,
int num_ref = state->global->ref->used_size;
if (candidates < MRG_MAX_NUM_CANDS && state->global->slicetype == SLICE_B) {
if (candidates < MRG_MAX_NUM_CANDS && state->global->slicetype == KVZ_SLICE_B) {
int j;
int ref_negative = 0;
int ref_positive = 0;
@ -819,7 +819,7 @@ uint8_t kvz_inter_get_merge_cand(const encoder_state_t * const state, int32_t x,
mv_cand[candidates].ref[0] = (zero_idx>=num_ref-1)?0:zero_idx;
mv_cand[candidates].ref[1] = mv_cand[candidates].ref[0];
mv_cand[candidates].dir = 1;
if (state->global->slicetype == SLICE_B) {
if (state->global->slicetype == KVZ_SLICE_B) {
mv_cand[candidates].mv[1][0] = 0;
mv_cand[candidates].mv[1][1] = 0;
mv_cand[candidates].dir = 3;

View file

@ -160,7 +160,7 @@ double kvz_select_picture_lambda_from_qp(encoder_state_t const * const state)
const double qp_temp = state->global->QP - 12;
double qp_factor;
if (state->global->slicetype == SLICE_I) {
if (state->global->slicetype == KVZ_SLICE_I) {
const double lambda_scale = 1.0 - CLIP(0.0, 0.5, 0.05 * gop_len);
qp_factor = 0.57 * lambda_scale;
} else if (gop_len > 0) {

View file

@ -517,7 +517,7 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
y + cu_width <= frame->height)
{
if (state->global->slicetype != SLICE_I &&
if (state->global->slicetype != KVZ_SLICE_I &&
WITHIN(depth, ctrl->pu_depth_inter.min, ctrl->pu_depth_inter.max))
{
int mode_cost = kvz_search_cu_inter(state, x, y, depth, &work_tree[depth]);
@ -606,7 +606,7 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
}
// Recursively split all the way to max search depth.
if (depth < ctrl->pu_depth_intra.max || (depth < ctrl->pu_depth_inter.max && state->global->slicetype != SLICE_I)) {
if (depth < ctrl->pu_depth_intra.max || (depth < ctrl->pu_depth_inter.max && state->global->slicetype != KVZ_SLICE_I)) {
int half_cu = cu_width / 2;
// Using Cost = lambda * 9 to compensate on the price of the split
double split_cost = state->global->cur_lambda_cost * CU_COST;

View file

@ -1052,7 +1052,7 @@ int kvz_search_cu_inter(const encoder_state_t * const state, int x, int y, int d
}
// Search bi-pred positions
if (state->global->slicetype == SLICE_B && state->encoder_control->cfg->bipred) {
if (state->global->slicetype == KVZ_SLICE_B && state->encoder_control->cfg->bipred) {
lcu_t *templcu = MALLOC(lcu_t, 1);
cost_pixel_nxn_func *satd = kvz_pixels_get_satd_func(LCU_WIDTH >> depth);
#define NUM_PRIORITY_LIST 12;

View file

@ -147,7 +147,7 @@ void kvz_quant(const encoder_state_t * const state, coeff_t *coef, coeff_t *q_co
const int32_t *quant_coeff = encoder->scaling_list.quant_coeff[log2_tr_size-2][scalinglist_type][qp_scaled%6];
const int32_t transform_shift = MAX_TR_DYNAMIC_RANGE - encoder->bitdepth - log2_tr_size; //!< Represents scaling through forward transform
const int32_t q_bits = QUANT_SHIFT + qp_scaled/6 + transform_shift;
const int32_t add = ((state->global->slicetype == SLICE_I) ? 171 : 85) << (q_bits - 9);
const int32_t add = ((state->global->slicetype == KVZ_SLICE_I) ? 171 : 85) << (q_bits - 9);
const int32_t q_bits8 = q_bits - 8;
uint32_t ac_sum = 0;