Commit 84dff83
ropus: move the frame-decode buffers off the decode stack
ropus_decode_frame_f carried pcm_silk (11,520 bytes), bl/br (3,840)
and the redundancy buffer (1,920) as locals -- a 15,680-byte frame by
-fstack-usage, nested directly above ropus_celt_decode's own (still
larger) frame on the audio/task thread. The s16 twin carried bl/br
and its redundancy buffer the same way, inlined into ropus_decode_s16
for a 4,832-byte frame.
Move them into a ropus_frame_scratch embedded in ropus_t, one per
decoder context, passed into both decode-frame functions. Per
context and not static for the reason the sub_q/sub_f comment in the
struct already gives: the mixer runs several voices at once. One
scratch per context is enough for any stream count because the
substream loop decodes sequentially, so multistream contexts do not
multiply the cost. ropus_t is heap-allocated (calloc in ropus_open),
so the storage moves from a thread stack to the heap where it
belongs; ropus_dec_f/ropus_dec_q themselves are unchanged.
Frame sizes after: ropus_decode_f32 992 bytes, ropus_decode_s16 976
(the decode-frame layer now inlines into them entirely). Worst-case
decode stack depth drops from ~20.5 KB + the CELT frame to ~1 KB +
the CELT frame; ropus_celt_decode's 28,256/18,688-byte frames remain
and are the larger half of the problem, left for a dedicated change.
Decoded output verified bit-identical against the previous code over
both pipelines for three stream shapes: a CELT-mode music encode, a
pure-SILK 8 kb/s speech encode (151 SILK packets -- the mode that
actually exercises pcm_silk/bl/br), and a hybrid-mode 24 kb/s encode
(151 hybrid packets, covering the SILK+CELT redundancy path). FNV-1a
over all decoded PCM, six checksum pairs, all exact matches.1 parent a52f6c7 commit 84dff83
1 file changed
Lines changed: 34 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10056 | 10056 | | |
10057 | 10057 | | |
10058 | 10058 | | |
10059 | | - | |
| 10059 | + | |
| 10060 | + | |
| 10061 | + | |
| 10062 | + | |
| 10063 | + | |
| 10064 | + | |
| 10065 | + | |
| 10066 | + | |
| 10067 | + | |
| 10068 | + | |
| 10069 | + | |
| 10070 | + | |
| 10071 | + | |
| 10072 | + | |
| 10073 | + | |
| 10074 | + | |
| 10075 | + | |
| 10076 | + | |
| 10077 | + | |
| 10078 | + | |
| 10079 | + | |
| 10080 | + | |
10060 | 10081 | | |
10061 | 10082 | | |
10062 | 10083 | | |
| |||
10066 | 10087 | | |
10067 | 10088 | | |
10068 | 10089 | | |
10069 | | - | |
| 10090 | + | |
10070 | 10091 | | |
10071 | 10092 | | |
10072 | 10093 | | |
| |||
10090 | 10111 | | |
10091 | 10112 | | |
10092 | 10113 | | |
10093 | | - | |
| 10114 | + | |
| 10115 | + | |
10094 | 10116 | | |
10095 | 10117 | | |
10096 | 10118 | | |
| |||
10275 | 10297 | | |
10276 | 10298 | | |
10277 | 10299 | | |
10278 | | - | |
| 10300 | + | |
| 10301 | + | |
10279 | 10302 | | |
10280 | 10303 | | |
10281 | 10304 | | |
| |||
10284 | 10307 | | |
10285 | 10308 | | |
10286 | 10309 | | |
10287 | | - | |
10288 | | - | |
| 10310 | + | |
| 10311 | + | |
10289 | 10312 | | |
10290 | 10313 | | |
10291 | 10314 | | |
| |||
10295 | 10318 | | |
10296 | 10319 | | |
10297 | 10320 | | |
10298 | | - | |
| 10321 | + | |
| 10322 | + | |
10299 | 10323 | | |
10300 | 10324 | | |
10301 | 10325 | | |
| |||
10470 | 10494 | | |
10471 | 10495 | | |
10472 | 10496 | | |
| 10497 | + | |
10473 | 10498 | | |
10474 | 10499 | | |
10475 | 10500 | | |
| |||
10671 | 10696 | | |
10672 | 10697 | | |
10673 | 10698 | | |
10674 | | - | |
| 10699 | + | |
10675 | 10700 | | |
10676 | 10701 | | |
10677 | 10702 | | |
| |||
10751 | 10776 | | |
10752 | 10777 | | |
10753 | 10778 | | |
10754 | | - | |
| 10779 | + | |
10755 | 10780 | | |
10756 | 10781 | | |
10757 | 10782 | | |
| |||
0 commit comments