mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-30 20:54:07 +00:00
Fix error in frame variance calculation. Chroma channels were not added to variance
This commit is contained in:
parent
5986e71535
commit
be7d9ddec5
|
@ -1268,7 +1268,12 @@ static void encoder_state_init_new_frame(encoder_state_t * const state, kvz_pict
|
||||||
|
|
||||||
// Calculate frame pixel variance
|
// Calculate frame pixel variance
|
||||||
uint32_t len = state->tile->frame->width * state->tile->frame->height;
|
uint32_t len = state->tile->frame->width * state->tile->frame->height;
|
||||||
|
uint32_t c_len = len / 4;
|
||||||
double frame_var = pixel_var(state->tile->frame->source->y, len);
|
double frame_var = pixel_var(state->tile->frame->source->y, len);
|
||||||
|
if (has_chroma) {
|
||||||
|
frame_var += pixel_var(state->tile->frame->source->u, c_len);
|
||||||
|
frame_var += pixel_var(state->tile->frame->source->v, c_len);
|
||||||
|
}
|
||||||
|
|
||||||
// Loop through LCUs
|
// Loop through LCUs
|
||||||
// For each LCU calculate: D * (log(LCU pixel variance) - log(frame pixel variance))
|
// For each LCU calculate: D * (log(LCU pixel variance) - log(frame pixel variance))
|
||||||
|
|
Loading…
Reference in a new issue