Fix referring over IDR boundary when using --gop

This problem resulted in an illegal bitstream with --gop=lp, because it
uses IDR's. The --gop=8 would not code IDR pictures, even when told to
with -p, which masked this problem.

This fix solves the problem with --gop=lp and also prevents references
across the intra picture in --gop=8. The intra pictures should be set
to IDR in a later fix, or an alternate method of differentiating
between IDR and non-IDR intra should be made.
This commit is contained in:
Ari Koivula 2016-05-27 13:01:55 +03:00
parent a77dc1610e
commit 67acead4bc

View file

@ -729,12 +729,12 @@ static void encoder_state_remove_refs(encoder_state_t *state) {
target_ref_num = neg_refs + pos_refs;
} else {
target_ref_num = encoder->cfg->ref_frames;
if (state->global->slicetype == KVZ_SLICE_I) {
target_ref_num = 0; // TODO: do the same with GOP
}
}
if (state->global->slicetype == KVZ_SLICE_I) {
target_ref_num = 0;
}
if (encoder->cfg->gop_len) {
if (encoder->cfg->gop_len && target_ref_num > 0) {
// With GOP in use, go through all the existing reference pictures and
// remove any picture that is not referenced by the current picture.