Skip to content

Commit 868e1d4

Browse files
osamu620claude
andcommitted
fix(coding): add missing height-parity guard to AVX2 fused-dequant
The NEON and WASM variants gate fused dequant on both (size.x & 3)==0 and (size.y & 1)==0, but the AVX2 path only checked width. With odd-height blocks the last quad-pair's second-row store overflows into the adjacent block's i_samples region, causing a data race under multi-threaded decode_strip_core dispatch (flaky comp_p1_ht_05_11 on CI). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fd72b6d commit 868e1d4

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

source/core/coding/ht_block_decoding_avx2.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,8 @@ bool htj2k_decode(j2k_codeblock *block, const uint8_t ROIshift) {
11301130
// adjacent blocks' column range in the shared output buffer (subband or ring buffer).
11311131
// This is safe in single-threaded decode (sequential order overwrites correctly) but
11321132
// causes a data race in multi-threaded decode. Gate on width % 4 == 0 to avoid this.
1133-
if (num_ht_passes == 1 && ROIshift == 0 && (block->size.x & 3) == 0) {
1133+
if (num_ht_passes == 1 && ROIshift == 0 && (block->size.x & 3) == 0
1134+
&& (block->size.y & 1u) == 0) {
11341135
ht_cleanup_decode<true, true>(block, static_cast<uint8_t>(30 - S_blk), Lcup, Pcup, Scup);
11351136
dequant_done = true;
11361137
} else if (num_ht_passes == 1) {

0 commit comments

Comments
 (0)