Closed gavv closed 11 months ago
Hi @gavv, I would suggest to simplify setup_map_matrix_()
.
The following things complicate the understanding of the code base:
for
loop contains more then one variable:
for (size_t in_index = 0, n_ord = 0; in_order.chans[n_ord] != ChanPos_Max; n_ord++) {}
for (size_t n = 0; !ch_map && n < ROC_ARRAY_SIZE(chan_maps); n++) {}
for
loop exit condition should be calculated somehow:
for (size_t in_index = 0, n_ord = 0; in_order.chans[n_ord] != ChanPos_Max; n_ord++) {}
Repeating code for output and input channels
Nested constructions:
map_matrix_[out_index_map[ch]][in_index_map[ch]] = 1.f;
roc_panic_if_not(out_index_map[ch] < ChanPos_Max
&& in_index_map[ch] < ChanPos_Max);
It can be done after the PR. Suggested patch
I'll add the suggested patch in a separate PR.
For #86.
Before this commit, order of channels in surround layout was defined by ChannelPosition enum values.
After this commit, each ChannelSet (and hence SampleSpec) contains ChannelOrder enum, which defines order of surround channels in memory.
Currently two orders are supported:
ChannelMapper now takes order into account. If input & output orders differ, it automatically performs reordering.
So far surround layouts were not exposed in API and CLI. Thus, changing default order did not break anything, however all tests had to be updated to match new order.