Skip to content

# main does not build: the two ADPCM encoders landed on top of each other - #127

Merged
Hawkynt merged 1 commit into
mainfrom
fix/adpcm-partial-collision
Aug 29, 2026
Merged

# main does not build: the two ADPCM encoders landed on top of each other#127
Hawkynt merged 1 commit into
mainfrom
fix/adpcm-partial-collision

Conversation

@Hawkynt

@Hawkynt Hawkynt commented Aug 29, 2026

Copy link
Copy Markdown
Owner

main has not built since #105 merged. #105 and #106 were each green on their own branch and collided on the squash commit no run ever saw — 7 compiler errors in Codec.ImaAdpcm and Codec.MsAdpcm.

#106 added the span-based encoders in {Ima,Ms}AdpcmCodec.Encode.cs; #105 then rewrote {Ima,Ms}AdpcmCodec.cs to carry its own list-based encoders, re-declaring helpers the partial already had.

Both public surfaces stay — AdpcmEncodeTests covers the list-based pair, AdpcmEncoderTests the span-based pair, so neither is dead.

  • IMA — the two EncodeNibble bodies were the same quantizer, so the partial's copy goes and every caller uses the one in the main file (short widens to int). Its copies of QuickTimePacketBytes, QuickTimeSamplesPerPacket and StartIndexFor go for the same reason.
  • MS — these two are genuinely different: the main file quantizes the residual directly, the partial searches all sixteen nibbles for the smallest error. The partial keeps its body under the name SearchNibble; sharing the name was what let a short argument silently pick the search over the quantizer. DecodeNibble takes the predictor index by value now that it is no longer mutated per nibble.

Verified locally: dotnet build -c Release clean, and 122 ADPCM tests pass.

… building

#105 and #106 were each green on their own branch and collided on the squash
commit no run ever saw. #106 added the span-based encoders in
{Ima,Ms}AdpcmCodec.Encode.cs; #105 then rewrote {Ima,Ms}AdpcmCodec.cs to carry
its own list-based encoders, re-declaring helpers the partial already had.

Both public surfaces stay - AdpcmEncodeTests covers the list-based pair and
AdpcmEncoderTests the span-based pair, so neither is dead.

IMA: the two EncodeNibble bodies were the same quantizer, so the partial's copy
goes and every caller uses the one in the main file; short widens to int. Its
copies of QuickTimePacketBytes, QuickTimeSamplesPerPacket and StartIndexFor go
for the same reason.

MS: the two are genuinely different - the main file quantizes the residual
directly, the partial searches all sixteen nibbles for the smallest error - so
the partial's keeps its body and takes the name SearchNibble. Sharing the name
was what made a short argument silently pick the search over the quantizer.
DecodeNibble takes the predictor index by value now that it is no longer
mutated per nibble, which is what the rewrite in #105 established.
@Hawkynt
Hawkynt merged commit 539d915 into main Aug 29, 2026
@Hawkynt
Hawkynt deleted the fix/adpcm-partial-collision branch August 29, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant