Skip computing SSD when using lossless coding.

The SSD is always zero since it is lossless.
This commit is contained in:
Arttu Ylä-Outinen 2016-06-07 13:59:40 +09:00
parent fbbe5d1844
commit cd7024b3a5

View file

@ -329,10 +329,13 @@ double kvz_cu_rd_cost_luma(const encoder_state_t *const state,
} }
// SSD between reconstruction and original // SSD between reconstruction and original
int ssd = 0;
if (!state->encoder_control->cfg->lossless) {
int index = y_px * LCU_WIDTH + x_px; int index = y_px * LCU_WIDTH + x_px;
int ssd = kvz_pixels_calc_ssd(&lcu->ref.y[index], &lcu->rec.y[index], ssd = kvz_pixels_calc_ssd(&lcu->ref.y[index], &lcu->rec.y[index],
LCU_WIDTH, LCU_WIDTH, LCU_WIDTH, LCU_WIDTH,
width); width);
}
{ {
coeff_t coeff_temp[32 * 32]; coeff_t coeff_temp[32 * 32];
@ -393,6 +396,8 @@ double kvz_cu_rd_cost_chroma(const encoder_state_t *const state,
} }
// Chroma SSD // Chroma SSD
int ssd = 0;
if (!state->encoder_control->cfg->lossless) {
int index = lcu_px.y * LCU_WIDTH_C + lcu_px.x; int index = lcu_px.y * LCU_WIDTH_C + lcu_px.x;
int ssd_u = kvz_pixels_calc_ssd(&lcu->ref.u[index], &lcu->rec.u[index], int ssd_u = kvz_pixels_calc_ssd(&lcu->ref.u[index], &lcu->rec.u[index],
LCU_WIDTH_C, LCU_WIDTH_C, LCU_WIDTH_C, LCU_WIDTH_C,
@ -400,7 +405,8 @@ double kvz_cu_rd_cost_chroma(const encoder_state_t *const state,
int ssd_v = kvz_pixels_calc_ssd(&lcu->ref.v[index], &lcu->rec.v[index], int ssd_v = kvz_pixels_calc_ssd(&lcu->ref.v[index], &lcu->rec.v[index],
LCU_WIDTH_C, LCU_WIDTH_C, LCU_WIDTH_C, LCU_WIDTH_C,
width); width);
int ssd = ssd_u + ssd_v; ssd = ssd_u + ssd_v;
}
{ {
coeff_t coeff_temp[16 * 16]; coeff_t coeff_temp[16 * 16];