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 c5842e1769
commit 139e00f064

View file

@ -449,6 +449,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);
@ -471,6 +473,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);
@ -1254,8 +1257,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;