Skip to content

Refactor Decoder#501

Merged
argilo merged 3 commits into
theori-io:masterfrom
TheDaChicken:blocks-decode
Apr 20, 2026
Merged

Refactor Decoder#501
argilo merged 3 commits into
theori-io:masterfrom
TheDaChicken:blocks-decode

Conversation

@TheDaChicken
Copy link
Copy Markdown
Contributor

@TheDaChicken TheDaChicken commented Apr 19, 2026

Fixes an issue raised in #457 (to be moved in a different pr)

While working on the API for the local_time SIS parameter, I wanted to try out decoding the ALFN to experiment with what stations are sending out. That requires the current block count to construct ALFN.
The current block count isn't directly associated with each PIDS. To make this easier, I decided to refactor the decoder to make the current block count more accessible.

This is the improvements:

  • decode_set_block is removed since block count is now provided with each call.
  • For any decoding changes based on PSMI can be changed through decode_set_psmi now. decode_set_px1_length is not needed.
  • Each deinterleaver is now into their own individual functions. This can make deinterleaving a lot easier for advanced service modes. This can also the possibly to deinterleave per block instead of by a complete frame a bit easier.
  • Constants for the convolutional decoder of P, E1, E2
  • The convolutional decoder's path and trellis is now separated. The possibly for stack allocation is easier. (to be moved in a different pr)
  • The convolutional decoder's path and trellis is now allocated upfront before decoding and freed after decoding is finished. This does make memory usage (~18.7 MB) from convolutional decoder noticeable. For example, Task Manager on Windows now shows the memory usage from the convolutional decoder. (to be moved in a different pr)

There is still some code duplication but good enough for what it is at the moment.

I did learn a lot by asking @argilo many questions to make sure this was refactored properly.

Comment thread src/defines.h Outdated
Comment thread src/decode.h Outdated
Comment thread src/sync.c Outdated
Comment thread src/decode.c Outdated
Comment thread src/decode.c Outdated
Comment thread src/decode.c Outdated
@TheDaChicken TheDaChicken force-pushed the blocks-decode branch 2 times, most recently from 01c75c0 to c2577c3 Compare April 19, 2026 04:57
Comment thread src/defines.h
Comment thread src/defines.h Outdated
Comment thread src/defines.h Outdated
Comment thread src/defines.h Outdated
Comment thread src/decode.c Outdated
Comment thread src/decode.c Outdated
Comment thread src/decode.c Outdated
Comment thread src/decode.c Outdated
Comment thread src/decode.c Outdated
Comment thread src/decode.c Outdated
Comment thread src/decode.c Outdated
Comment thread src/decode.c Outdated
Comment thread src/decode.c Outdated
Comment thread src/decode.c Outdated
Comment thread src/decode.c Outdated
Comment thread src/decode.c Outdated
Comment thread src/decode.c Outdated
Comment thread src/decode.c Outdated
Comment thread src/decode.c Outdated
@argilo argilo merged commit a5c0972 into theori-io:master Apr 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants