Inter frames' intra blocks inherited a stale enable_intra_edge_filter
Browse files at this commitd1585d00bff858538a919b803b25f557524eb35cParent: 62aad8f- fix
- inter frames' intra blocks inherited a stale enable_intra_edge_filter
3 changed files +32 -0
- crates/ec-av1/src/decode.rs +14 -0
- crates/ec-av1/src/stream.rs +5 -0
- scripts/build-aom-oracle.sh +13 -0
crates/ec-av1/src/decode.rsmodified+14 -0
| @@ -391,6 +391,20 @@ thread_local! { | ||
| 391 | 391 | static ENABLE_EDGE_FILTER: std::cell::Cell<bool> = const { std::cell::Cell::new(false) }; |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | +/// Set [`ENABLE_EDGE_FILTER`] for this thread. | |
| 395 | +/// | |
| 396 | +/// `decode_key_frame_tile_with_cdfs` sets it, but `decode_inter_frame_tile` | |
| 397 | +/// never did -- so an inter frame's intra blocks read whatever value the last | |
| 398 | +/// key frame decoded ON THIS THREAD left behind. Inside one stream that is | |
| 399 | +/// harmless (its own key frame sets it first), but a caller that decodes an | |
| 400 | +/// inter frame directly, or a test harness running several streams on one | |
| 401 | +/// thread, inherits a foreign sequence's bit: decode stops being a pure | |
| 402 | +/// function of the bitstream. `decode_stream` now calls this once per stream | |
| 403 | +/// from the sequence header, which covers every frame including inter ones. | |
| 404 | +pub(crate) fn set_enable_edge_filter(value: bool) { | |
| 405 | + ENABLE_EDGE_FILTER.with(|f| f.set(value)); | |
| 406 | +} | |
| 407 | + | |
| 394 | 408 | /// Current value of [`ANGLE_DELTA_HITS`]. |
| 395 | 409 | pub(crate) fn angle_delta_hits() -> usize { |
| 396 | 410 | ANGLE_DELTA_HITS.load(std::sync::atomic::Ordering::Relaxed) |
crates/ec-av1/src/stream.rsmodified+5 -0
| @@ -249,6 +249,11 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> { | ||
| 249 | 249 | let enable_edge_filter = parser |
| 250 | 250 | .sequence_header() |
| 251 | 251 | .is_some_and(|seq| seq.enable_intra_edge_filter); |
| 252 | + // Inter frames' intra blocks read this through a thread-local that only | |
| 253 | + // the key-frame tile path used to set; without this call a stream whose | |
| 254 | + // inter frames are decoded on a thread that previously decoded a | |
| 255 | + // different sequence would inherit that sequence's bit. | |
| 256 | + crate::decode::set_enable_edge_filter(enable_edge_filter); | |
| 252 | 257 | // lane-av1comp: `comp_group_idx`/`compound_idx`'s own gating bits. |
| 253 | 258 | let enable_masked_compound = parser |
| 254 | 259 | .sequence_header() |
scripts/build-aom-oracle.shmodified+13 -0
| @@ -22,6 +22,19 @@ if [ ! -d "$SRC/.git" ]; then | ||
| 22 | 22 | git clone --depth 1 --branch "$VERSION" https://aomedia.googlesource.com/aom "$SRC" |
| 23 | 23 | fi |
| 24 | 24 | |
| 25 | +# A cmake build tree bakes in its own absolute path and its source's, so a | |
| 26 | +# build dir that was produced elsewhere and then moved cannot regenerate | |
| 27 | +# (`ninja: error: rebuilding build.ninja`) -- which silently costs you the | |
| 28 | +# ability to re-instrument aomdec later. Never stage a build under one name | |
| 29 | +# and rename it; configure it where it will live. If the cache disagrees with | |
| 30 | +# where we are now, drop it and reconfigure in place. | |
| 31 | +if [ -f "$BUILD/CMakeCache.txt" ] && | |
| 32 | + ! grep -q "^CMAKE_HOME_DIRECTORY:INTERNAL=$SRC$" "$BUILD/CMakeCache.txt"; then | |
| 33 | + echo "build tree was configured for a different path -- reconfiguring in place" >&2 | |
| 34 | + rm -f "$BUILD/CMakeCache.txt" | |
| 35 | + rm -rf "$BUILD/CMakeFiles" | |
| 36 | +fi | |
| 37 | + | |
| 25 | 38 | CPU_ARGS=() |
| 26 | 39 | if [ -n "${AOM_TARGET_CPU:-}" ]; then |
| 27 | 40 | CPU_ARGS=(-DAOM_TARGET_CPU="$AOM_TARGET_CPU") |