Merge "Remove unnecessary ternary constructs"
This commit is contained in:
commit
03fadc4b20
@ -60,10 +60,10 @@ static unsigned int vp8_check_mv_bounds(int_mv *mv, int mb_to_left_edge,
|
|||||||
int mb_to_bottom_edge)
|
int mb_to_bottom_edge)
|
||||||
{
|
{
|
||||||
unsigned int need_to_clamp;
|
unsigned int need_to_clamp;
|
||||||
need_to_clamp = (mv->as_mv.col < mb_to_left_edge) ? 1 : 0;
|
need_to_clamp = (mv->as_mv.col < mb_to_left_edge);
|
||||||
need_to_clamp |= (mv->as_mv.col > mb_to_right_edge) ? 1 : 0;
|
need_to_clamp |= (mv->as_mv.col > mb_to_right_edge);
|
||||||
need_to_clamp |= (mv->as_mv.row < mb_to_top_edge) ? 1 : 0;
|
need_to_clamp |= (mv->as_mv.row < mb_to_top_edge);
|
||||||
need_to_clamp |= (mv->as_mv.row > mb_to_bottom_edge) ? 1 : 0;
|
need_to_clamp |= (mv->as_mv.row > mb_to_bottom_edge);
|
||||||
return need_to_clamp;
|
return need_to_clamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1644,20 +1644,20 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned char * dest
|
|||||||
|
|
||||||
|
|
||||||
// Signal whether or not Segmentation is enabled
|
// Signal whether or not Segmentation is enabled
|
||||||
vp8_write_bit(bc, (xd->segmentation_enabled) ? 1 : 0);
|
vp8_write_bit(bc, xd->segmentation_enabled);
|
||||||
|
|
||||||
// Indicate which features are enabled
|
// Indicate which features are enabled
|
||||||
if (xd->segmentation_enabled)
|
if (xd->segmentation_enabled)
|
||||||
{
|
{
|
||||||
// Signal whether or not the segmentation map is being updated.
|
// Signal whether or not the segmentation map is being updated.
|
||||||
vp8_write_bit(bc, (xd->update_mb_segmentation_map) ? 1 : 0);
|
vp8_write_bit(bc, xd->update_mb_segmentation_map);
|
||||||
vp8_write_bit(bc, (xd->update_mb_segmentation_data) ? 1 : 0);
|
vp8_write_bit(bc, xd->update_mb_segmentation_data);
|
||||||
|
|
||||||
if (xd->update_mb_segmentation_data)
|
if (xd->update_mb_segmentation_data)
|
||||||
{
|
{
|
||||||
signed char Data;
|
signed char Data;
|
||||||
|
|
||||||
vp8_write_bit(bc, (xd->mb_segement_abs_delta) ? 1 : 0);
|
vp8_write_bit(bc, xd->mb_segement_abs_delta);
|
||||||
|
|
||||||
// For each segmentation feature (Quant and loop filter level)
|
// For each segmentation feature (Quant and loop filter level)
|
||||||
for (i = 0; i < MB_LVL_MAX; i++)
|
for (i = 0; i < MB_LVL_MAX; i++)
|
||||||
@ -1714,7 +1714,7 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned char * dest
|
|||||||
vp8_write_literal(bc, pc->sharpness_level, 3);
|
vp8_write_literal(bc, pc->sharpness_level, 3);
|
||||||
|
|
||||||
// Write out loop filter deltas applied at the MB level based on mode or ref frame (if they are enabled).
|
// Write out loop filter deltas applied at the MB level based on mode or ref frame (if they are enabled).
|
||||||
vp8_write_bit(bc, (xd->mode_ref_lf_delta_enabled) ? 1 : 0);
|
vp8_write_bit(bc, xd->mode_ref_lf_delta_enabled);
|
||||||
|
|
||||||
if (xd->mode_ref_lf_delta_enabled)
|
if (xd->mode_ref_lf_delta_enabled)
|
||||||
{
|
{
|
||||||
|
@ -1540,7 +1540,7 @@ void vp8_change_config(VP8_COMP *cpi, VP8_CONFIG *oxcf)
|
|||||||
cpi->active_best_quality = cpi->oxcf.worst_allowed_q;
|
cpi->active_best_quality = cpi->oxcf.worst_allowed_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
cpi->buffered_mode = (cpi->oxcf.optimal_buffer_level > 0) ? 1 : 0;
|
cpi->buffered_mode = cpi->oxcf.optimal_buffer_level > 0;
|
||||||
|
|
||||||
cpi->cq_target_quality = cpi->oxcf.cq_level;
|
cpi->cq_target_quality = cpi->oxcf.cq_level;
|
||||||
|
|
||||||
@ -3800,7 +3800,7 @@ static void encode_frame_to_data_rate
|
|||||||
else if (Q < q_low)
|
else if (Q < q_low)
|
||||||
Q = q_low;
|
Q = q_low;
|
||||||
|
|
||||||
Loop = ((Q != last_q)) ? 1 : 0;
|
Loop = Q != last_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is the projected frame size out of range and are we allowed to attempt to recode.
|
// Is the projected frame size out of range and are we allowed to attempt to recode.
|
||||||
@ -3919,8 +3919,8 @@ static void encode_frame_to_data_rate
|
|||||||
// Clamp cpi->zbin_over_quant
|
// Clamp cpi->zbin_over_quant
|
||||||
cpi->zbin_over_quant = (cpi->zbin_over_quant < zbin_oq_low) ? zbin_oq_low : (cpi->zbin_over_quant > zbin_oq_high) ? zbin_oq_high : cpi->zbin_over_quant;
|
cpi->zbin_over_quant = (cpi->zbin_over_quant < zbin_oq_low) ? zbin_oq_low : (cpi->zbin_over_quant > zbin_oq_high) ? zbin_oq_high : cpi->zbin_over_quant;
|
||||||
|
|
||||||
//Loop = ((Q != last_q) || (last_zbin_oq != cpi->zbin_over_quant)) ? 1 : 0;
|
//Loop = (Q != last_q) || (last_zbin_oq != cpi->zbin_over_quant);
|
||||||
Loop = ((Q != last_q)) ? 1 : 0;
|
Loop = Q != last_q;
|
||||||
last_zbin_oq = cpi->zbin_over_quant;
|
last_zbin_oq = cpi->zbin_over_quant;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -760,10 +760,8 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
|
|||||||
int sadpb = x->sadperbit16;
|
int sadpb = x->sadperbit16;
|
||||||
int_mv mvp_full;
|
int_mv mvp_full;
|
||||||
|
|
||||||
int col_min = (best_ref_mv.as_mv.col>>3)
|
int col_min = ((best_ref_mv.as_mv.col+7)>>3) - MAX_FULL_PEL_VAL;
|
||||||
- MAX_FULL_PEL_VAL + ((best_ref_mv.as_mv.col & 7)?1:0);
|
int row_min = ((best_ref_mv.as_mv.row+7)>>3) - MAX_FULL_PEL_VAL;
|
||||||
int row_min = (best_ref_mv.as_mv.row>>3)
|
|
||||||
- MAX_FULL_PEL_VAL + ((best_ref_mv.as_mv.row & 7)?1:0);
|
|
||||||
int col_max = (best_ref_mv.as_mv.col>>3)
|
int col_max = (best_ref_mv.as_mv.col>>3)
|
||||||
+ MAX_FULL_PEL_VAL;
|
+ MAX_FULL_PEL_VAL;
|
||||||
int row_max = (best_ref_mv.as_mv.row>>3)
|
int row_max = (best_ref_mv.as_mv.row>>3)
|
||||||
@ -1067,7 +1065,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
|
|||||||
x->e_mbd.mode_info_context->mbmi.mv.as_int = 0;
|
x->e_mbd.mode_info_context->mbmi.mv.as_int = 0;
|
||||||
x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
|
x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
|
||||||
x->e_mbd.mode_info_context->mbmi.mb_skip_coeff =
|
x->e_mbd.mode_info_context->mbmi.mb_skip_coeff =
|
||||||
(cpi->common.mb_no_coeff_skip) ? 1 : 0;
|
(cpi->common.mb_no_coeff_skip);
|
||||||
x->e_mbd.mode_info_context->mbmi.partitioning = 0;
|
x->e_mbd.mode_info_context->mbmi.partitioning = 0;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -186,7 +186,7 @@ void vp8cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi)
|
|||||||
best_err = calc_partial_ssl_err(sd, cm->frame_to_show,
|
best_err = calc_partial_ssl_err(sd, cm->frame_to_show,
|
||||||
IF_RTCD(&cpi->rtcd.variance));
|
IF_RTCD(&cpi->rtcd.variance));
|
||||||
|
|
||||||
filt_val -= (1 + ((filt_val > 10) ? 1 : 0));
|
filt_val -= 1 + (filt_val > 10);
|
||||||
|
|
||||||
// Search lower filter levels
|
// Search lower filter levels
|
||||||
while (filt_val >= min_filter_level)
|
while (filt_val >= min_filter_level)
|
||||||
@ -209,11 +209,11 @@ void vp8cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
// Adjust filter level
|
// Adjust filter level
|
||||||
filt_val -= (1 + ((filt_val > 10) ? 1 : 0));
|
filt_val -= 1 + (filt_val > 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search up (note that we have already done filt_val = cm->filter_level)
|
// Search up (note that we have already done filt_val = cm->filter_level)
|
||||||
filt_val = cm->filter_level + (1 + ((filt_val > 10) ? 1 : 0));
|
filt_val = cm->filter_level + 1 + (filt_val > 10);
|
||||||
|
|
||||||
if (best_filt_val == cm->filter_level)
|
if (best_filt_val == cm->filter_level)
|
||||||
{
|
{
|
||||||
@ -243,7 +243,7 @@ void vp8cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
// Adjust filter level
|
// Adjust filter level
|
||||||
filt_val += (1 + ((filt_val > 10) ? 1 : 0));
|
filt_val += 1 + (filt_val > 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1385,8 +1385,8 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x,
|
|||||||
|
|
||||||
if (bsi.segment_rd < best_rd)
|
if (bsi.segment_rd < best_rd)
|
||||||
{
|
{
|
||||||
int col_min = (best_ref_mv->as_mv.col>>3) - MAX_FULL_PEL_VAL + ((best_ref_mv->as_mv.col & 7)?1:0);
|
int col_min = ((best_ref_mv->as_mv.col+7)>>3) - MAX_FULL_PEL_VAL;
|
||||||
int row_min = (best_ref_mv->as_mv.row>>3) - MAX_FULL_PEL_VAL + ((best_ref_mv->as_mv.row & 7)?1:0);
|
int row_min = ((best_ref_mv->as_mv.row+7)>>3) - MAX_FULL_PEL_VAL;
|
||||||
int col_max = (best_ref_mv->as_mv.col>>3) + MAX_FULL_PEL_VAL;
|
int col_max = (best_ref_mv->as_mv.col>>3) + MAX_FULL_PEL_VAL;
|
||||||
int row_max = (best_ref_mv->as_mv.row>>3) + MAX_FULL_PEL_VAL;
|
int row_max = (best_ref_mv->as_mv.row>>3) + MAX_FULL_PEL_VAL;
|
||||||
|
|
||||||
@ -2016,8 +2016,8 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
|
|||||||
int sadpb = x->sadperbit16;
|
int sadpb = x->sadperbit16;
|
||||||
int_mv mvp_full;
|
int_mv mvp_full;
|
||||||
|
|
||||||
int col_min = (best_ref_mv.as_mv.col>>3) - MAX_FULL_PEL_VAL + ((best_ref_mv.as_mv.col & 7)?1:0);
|
int col_min = ((best_ref_mv.as_mv.col+7)>>3) - MAX_FULL_PEL_VAL;
|
||||||
int row_min = (best_ref_mv.as_mv.row>>3) - MAX_FULL_PEL_VAL + ((best_ref_mv.as_mv.row & 7)?1:0);
|
int row_min = ((best_ref_mv.as_mv.row+7)>>3) - MAX_FULL_PEL_VAL;
|
||||||
int col_max = (best_ref_mv.as_mv.col>>3) + MAX_FULL_PEL_VAL;
|
int col_max = (best_ref_mv.as_mv.col>>3) + MAX_FULL_PEL_VAL;
|
||||||
int row_max = (best_ref_mv.as_mv.row>>3) + MAX_FULL_PEL_VAL;
|
int row_max = (best_ref_mv.as_mv.row>>3) + MAX_FULL_PEL_VAL;
|
||||||
|
|
||||||
@ -2386,7 +2386,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
|
|||||||
x->e_mbd.mode_info_context->mbmi.mv.as_int = 0;
|
x->e_mbd.mode_info_context->mbmi.mv.as_int = 0;
|
||||||
x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
|
x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
|
||||||
x->e_mbd.mode_info_context->mbmi.mb_skip_coeff =
|
x->e_mbd.mode_info_context->mbmi.mb_skip_coeff =
|
||||||
(cpi->common.mb_no_coeff_skip) ? 1 : 0;
|
(cpi->common.mb_no_coeff_skip);
|
||||||
x->e_mbd.mode_info_context->mbmi.partitioning = 0;
|
x->e_mbd.mode_info_context->mbmi.partitioning = 0;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -186,7 +186,7 @@ static int vp8_temporal_filter_find_matching_mb_c
|
|||||||
if (cpi->Speed < 8)
|
if (cpi->Speed < 8)
|
||||||
{
|
{
|
||||||
step_param = cpi->sf.first_step +
|
step_param = cpi->sf.first_step +
|
||||||
((cpi->Speed > 5) ? 1 : 0);
|
(cpi->Speed > 5);
|
||||||
further_steps =
|
further_steps =
|
||||||
(cpi->sf.max_step_search_steps - 1)-step_param;
|
(cpi->sf.max_step_search_steps - 1)-step_param;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user