Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assertion failed: sbo.0.x % (1 << sb_shift) == 0 since earlier this week #1611

Closed
sdroege opened this issue Aug 29, 2019 · 5 comments
Closed
Assignees
Labels
Projects

Comments

@sdroege
Copy link
Contributor

sdroege commented Aug 29, 2019

If you run cargo test in
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/tree/master/gst-plugin-rav1e
it will fail with panics

thread 'test_encode_y444' panicked at 'assertion failed: sbo.0.x % (1 << sb_shift) == 0', /home/slomo/.cargo/git/checkouts/rav1e-14e16d25dd5cd9c0/aa4271e/src/tiling/tile_restoration_state.rs:369:1
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:200
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:211
   6: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:477
   7: std::panicking::begin_panic
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/libstd/panicking.rs:411
   8: rav1e::tiling::tile_restoration_state::TileRestorationStateMut::new
             at /home/slomo/.cargo/git/checkouts/rav1e-14e16d25dd5cd9c0/aa4271e/src/tiling/tile_state.rs:0
   9: rav1e::tiling::tile_state::TileStateMut<T>::new
             at /home/slomo/.cargo/git/checkouts/rav1e-14e16d25dd5cd9c0/aa4271e/src/tiling/tile_state.rs:110
  10: <rav1e::tiling::tiler::TileContextIterMut<T> as core::iter::traits::iterator::Iterator>::next
             at /home/slomo/.cargo/git/checkouts/rav1e-14e16d25dd5cd9c0/aa4271e/src/tiling/tiler.rs:187
  11: alloc::vec::Vec<T>::extend_desugared
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/liballoc/vec.rs:2003
  12: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::spec_extend
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/liballoc/vec.rs:1900
  13: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/liballoc/vec.rs:1895
  14: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/liballoc/vec.rs:1796
  15: core::iter::traits::iterator::Iterator::collect
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/libcore/iter/traits/iterator.rs:1466
  16: rav1e::api::ContextInner<T>::compute_lookahead_motion_vectors
             at /home/slomo/.cargo/git/checkouts/rav1e-14e16d25dd5cd9c0/aa4271e/src/api/mod.rs:1464
  17: rav1e::api::ContextInner<T>::compute_lookahead_data
             at /home/slomo/.cargo/git/checkouts/rav1e-14e16d25dd5cd9c0/aa4271e/src/api/mod.rs:1681
  18: rav1e::api::ContextInner<T>::send_frame
             at /home/slomo/.cargo/git/checkouts/rav1e-14e16d25dd5cd9c0/aa4271e/src/api/mod.rs:1181

This was working fine with the version of rav1e on Tuesday.

@shssoichiro
Copy link
Collaborator

I think the test that was disabled here was catching this.

@sdroege
Copy link
Contributor Author

sdroege commented Aug 30, 2019

This only happens when setting tile rows/cols to some value, at least setting both to 2 makes it happen.

gstreamer-github pushed a commit to sdroege/gst-plugin-rs that referenced this issue Aug 30, 2019
And also add support for forcing keyframes.

Disable tiles in the test for now because of xiph/rav1e#1611
@shssoichiro shssoichiro added the bug label Sep 1, 2019
@lu-zero lu-zero added this to To do in Release 0.1 Sep 3, 2019
@YaLTeR
Copy link
Collaborator

YaLTeR commented Sep 3, 2019

Reproducible with one tile with the following test:

#[test]
fn get_units_region_assert() {
  let config = Config {
    enc: EncoderConfig {
      width: 65,
      height: 158,
      bit_depth: 8,
      chroma_sampling: ChromaSampling::Cs420,
      chroma_sample_position: ChromaSamplePosition::Unknown,
      pixel_range: PixelRange::Limited,
      color_description: None,
      mastering_display: None,
      content_light: None,
      still_picture: true,
      time_base: Rational { num: 4294977800, den: 6004234345560342528 },
      min_key_frame_interval: 12,
      max_key_frame_interval: 240,
      reservoir_frame_delay: None,
      low_latency: true,
      quantizer: 100,
      min_quantizer: 0,
      bitrate: 0,
      tune: Tune::Psychovisual,
      tile_cols: 0,
      tile_rows: 0,
      tiles: 0,
      rdo_lookahead_frames: 0,
      speed_settings: SpeedSettings {
        min_block_size: BlockSize::BLOCK_64X64,
        multiref: false,
        fast_deblock: true,
        reduced_tx_set: true,
        tx_domain_distortion: true,
        tx_domain_rate: false,
        encode_bottomup: false,
        rdo_tx_decision: false,
        prediction_modes: PredictionModesSetting::Simple,
        include_near_mvs: false,
        no_scene_detection: true,
        diamond_me: true,
        cdef: true,
        quantizer_rdo: false,
        use_satd_subpel: false,
      },
      show_psnr: false,
      train_rdo: false,
    },
    threads: 1,
  };

  let mut ctx: Context<u8> = config.new_context().unwrap();
  ctx.send_frame(ctx.new_frame()).unwrap();
  ctx.flush();

  ctx.receive_packet().unwrap();
}

Weird time base seems essential (1/25 doesn't trigger the assertion).

EDIT: this triggers sbo.0.y % (1 << sb_shift) == 0 (rather than x).

@xiphmont
Copy link
Contributor

xiphmont commented Sep 3, 2019 via email

@xiphmont
Copy link
Contributor

xiphmont commented Sep 4, 2019

The above example isn't one tile. There's three tiles stacked vertically. The framerate is causing the tiler to... overpartition.
In any case, still fits evidence of bug as understood, testing the fix against it too.

xiphmont added a commit to xiphmont/rav1e that referenced this issue Sep 5, 2019
This patch set attempts to both improve cooperation between LRF and
tiling setup, but also eliminate several illegal configurations.

The patch strategy is to consistently eliminate evaluation of
'stretch' superblocks in RDO of LRUs for the loop restoration filter.
This primarily affects the case where a tile consists of
primarily/exclusively SBs that belong to an LRU stretched from some
other tile.
xiphmont added a commit to xiphmont/rav1e that referenced this issue Sep 5, 2019
This patch set attempts to both improve cooperation between LRF and
tiling setup, but also eliminate several illegal configurations.

The patch strategy is to consistently eliminate evaluation of
'stretch' superblocks in RDO of LRUs for the loop restoration filter.
This primarily affects the case where a tile consists of
primarily/exclusively SBs that belong to an LRU stretched from some
other tile.
xiphmont added a commit to xiphmont/rav1e that referenced this issue Sep 5, 2019
This patch set attempts to both improve cooperation between LRF and
tiling setup, but also eliminate several illegal configurations.

The patch strategy is to consistently eliminate evaluation of
'stretch' superblocks in RDO of LRUs for the loop restoration filter.
This primarily affects the case where a tile consists of
primarily/exclusively SBs that belong to an LRU stretched from some
other tile.
xiphmont added a commit to xiphmont/rav1e that referenced this issue Sep 5, 2019
This patch set attempts to both improve cooperation between LRF and
tiling setup, but also eliminate several illegal configurations.

The patch strategy is to consistently eliminate evaluation of
'stretch' superblocks in RDO of LRUs for the loop restoration filter.
This primarily affects the case where a tile consists of
primarily/exclusively SBs that belong to an LRU stretched from some
other tile.
xiphmont added a commit to xiphmont/rav1e that referenced this issue Sep 5, 2019
This patch set attempts to both improve cooperation between LRF and
tiling setup, but also eliminate several illegal configurations.

The patch strategy is to consistently eliminate evaluation of
'stretch' superblocks in RDO of LRUs for the loop restoration filter.
This primarily affects the case where a tile consists of
primarily/exclusively SBs that belong to an LRU stretched from some
other tile.
xiphmont added a commit to xiphmont/rav1e that referenced this issue Sep 5, 2019
This patch set attempts to both improve cooperation between LRF and
tiling setup, but also eliminate several illegal configurations.

The patch strategy is to consistently eliminate evaluation of
'stretch' superblocks in RDO of LRUs for the loop restoration filter.
This primarily affects the case where a tile consists of
primarily/exclusively SBs that belong to an LRU stretched from some
other tile.
@YaLTeR YaLTeR moved this from To do to In progress in Release 0.1 Sep 5, 2019
xiphmont added a commit that referenced this issue Sep 5, 2019
This patch set attempts to both improve cooperation between LRF and
tiling setup, but also eliminate several illegal configurations.

The patch strategy is to consistently eliminate evaluation of
'stretch' superblocks in RDO of LRUs for the loop restoration filter.
This primarily affects the case where a tile consists of
primarily/exclusively SBs that belong to an LRU stretched from some
other tile.
@xiphmont xiphmont closed this as completed Sep 5, 2019
Release 0.1 automation moved this from In progress to Done Sep 5, 2019
lu-zero pushed a commit to rust-av/rav1e that referenced this issue Nov 27, 2019
This patch set attempts to both improve cooperation between LRF and
tiling setup, but also eliminate several illegal configurations.

The patch strategy is to consistently eliminate evaluation of
'stretch' superblocks in RDO of LRUs for the loop restoration filter.
This primarily affects the case where a tile consists of
primarily/exclusively SBs that belong to an LRU stretched from some
other tile.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Release 0.1
  
Done
Development

No branches or pull requests

4 participants