Fix fluctuation of coefficients on identical frames when RDOQ is on.

Moves CABAC context initialization to take place before search. This fixes
an issue with RDOQ returning different coefficients for identical adjacent
frames.

- This actually probably worsens BD-rate a little for all frames except the
  first one because we were using last frames final CABAC context for every
  LCU and now we are using initialized CABAC contexts. The fix is to encode
  the LCU before we start compressing the next LCU so we can update CABAC
  contexts.
This commit is contained in:
Ari Koivula 2014-03-05 16:18:47 +02:00
parent d2b8f50351
commit ca51f660d5

View file

@ -450,6 +450,8 @@ void encode_one_frame(encoder_control* encoder)
// First slice is IDR
cabac_start(&cabac);
init_contexts(encoder, encoder->in.cur_pic->slicetype);
scalinglist_process();
search_slice_data(encoder);
@ -472,6 +474,7 @@ void encode_one_frame(encoder_control* encoder)
write_aud(encoder);
cabac_start(&cabac);
init_contexts(encoder, encoder->in.cur_pic->slicetype);
scalinglist_process();
search_slice_data(encoder);
@ -1255,8 +1258,6 @@ void encode_slice_data(encoder_control* encoder)
free(new_v_data);
}
init_contexts(encoder,encoder->in.cur_pic->slicetype);
// Loop through every LCU in the slice
for (y_ctb = 0; y_ctb < encoder->in.height_in_lcu; y_ctb++) {
uint8_t last_cu_y = (y_ctb == (encoder->in.height_in_lcu - 1)) ? 1 : 0;