DCA core decoder no longer uses fixed tables for channel reordering. Move them into private encoder header (and drop ff_dca_ prefix).
Unified · Split
| @@ -8730,48 +8730,6 @@ const int32_t ff_dca_sampling_freqs[16] = { · 8729 unmodified lines | ||
| 8730 | 8730 | 176400, 352800, 12000, 24000, 48000, 96000, 192000, 384000, |
| 8731 | 8731 | }; |
| 8732 | 8732 | |
| 8733 | −const int8_t ff_dca_lfe_index[16] = { | |
| 8734 | − 1, 2, 2, 2, 2, 3, 2, 3, 2, 3, 2, 3, 1, 3, 2, 3 | |
| 8735 | −}; | |
| 8736 | − | |
| 8737 | −const int8_t ff_dca_channel_reorder_lfe[16][9] = { | |
| 8738 | − { 0, -1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 8739 | − { 0, 1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 8740 | − { 0, 1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 8741 | − { 0, 1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 8742 | − { 0, 1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 8743 | − { 2, 0, 1, -1, -1, -1, -1, -1, -1 }, | |
| 8744 | − { 0, 1, 3, -1, -1, -1, -1, -1, -1 }, | |
| 8745 | − { 2, 0, 1, 4, -1, -1, -1, -1, -1 }, | |
| 8746 | − { 0, 1, 3, 4, -1, -1, -1, -1, -1 }, | |
| 8747 | − { 2, 0, 1, 4, 5, -1, -1, -1, -1 }, | |
| 8748 | − { 3, 4, 0, 1, 5, 6, -1, -1, -1 }, | |
| 8749 | − { 2, 0, 1, 4, 5, 6, -1, -1, -1 }, | |
| 8750 | − { 0, 6, 4, 5, 2, 3, -1, -1, -1 }, | |
| 8751 | − { 4, 2, 5, 0, 1, 6, 7, -1, -1 }, | |
| 8752 | − { 5, 6, 0, 1, 7, 3, 8, 4, -1 }, | |
| 8753 | − { 4, 2, 5, 0, 1, 6, 8, 7, -1 }, | |
| 8754 | −}; | |
| 8755 | − | |
| 8756 | −const int8_t ff_dca_channel_reorder_nolfe[16][9] = { | |
| 8757 | − { 0, -1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 8758 | − { 0, 1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 8759 | − { 0, 1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 8760 | − { 0, 1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 8761 | − { 0, 1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 8762 | − { 2, 0, 1, -1, -1, -1, -1, -1, -1 }, | |
| 8763 | − { 0, 1, 2, -1, -1, -1, -1, -1, -1 }, | |
| 8764 | − { 2, 0, 1, 3, -1, -1, -1, -1, -1 }, | |
| 8765 | − { 0, 1, 2, 3, -1, -1, -1, -1, -1 }, | |
| 8766 | − { 2, 0, 1, 3, 4, -1, -1, -1, -1 }, | |
| 8767 | − { 2, 3, 0, 1, 4, 5, -1, -1, -1 }, | |
| 8768 | − { 2, 0, 1, 3, 4, 5, -1, -1, -1 }, | |
| 8769 | − { 0, 5, 3, 4, 1, 2, -1, -1, -1 }, | |
| 8770 | − { 3, 2, 4, 0, 1, 5, 6, -1, -1 }, | |
| 8771 | − { 4, 5, 0, 1, 6, 2, 7, 3, -1 }, | |
| 8772 | − { 3, 2, 4, 0, 1, 5, 7, 6, -1 }, | |
| 8773 | −}; | |
| 8774 | − | |
| 8775 | 8733 | const uint16_t ff_dca_vlc_offs[63] = { |
| 8776 | 8734 | 0, 512, 640, 768, 1282, 1794, 2436, 3080, 3770, 4454, 5364, |
| 8777 | 8735 | 5372, 5380, 5388, 5392, 5396, 5412, 5420, 5428, 5460, 5492, 5508, |
| @@ -73,11 +73,6 @@ extern const int32_t ff_dca_xll_band_coeff[20]; · 72 unmodified lines | ||
| 73 | 73 | |
| 74 | 74 | extern const int32_t ff_dca_sampling_freqs[16]; |
| 75 | 75 | |
| 76 | −extern const int8_t ff_dca_lfe_index[16]; | |
| 77 | − | |
| 78 | −extern const int8_t ff_dca_channel_reorder_lfe[16][9]; | |
| 79 | −extern const int8_t ff_dca_channel_reorder_nolfe[16][9]; | |
| 80 | − | |
| 81 | 76 | extern const uint16_t ff_dca_vlc_offs[63]; |
| 82 | 77 | |
| 83 | 78 | #endif /* AVCODEC_DCADATA_H */ |
| @@ -137,9 +137,9 @@ static int encode_init(AVCodecContext *avctx) · 136 unmodified lines | ||
| 137 | 137 | |
| 138 | 138 | if (c->lfe_channel) { |
| 139 | 139 | c->fullband_channels--; |
| 140 | − c->channel_order_tab = ff_dca_channel_reorder_lfe[c->channel_config]; | |
| 140 | + c->channel_order_tab = channel_reorder_lfe[c->channel_config]; | |
| 141 | 141 | } else { |
| 142 | − c->channel_order_tab = ff_dca_channel_reorder_nolfe[c->channel_config]; | |
| 142 | + c->channel_order_tab = channel_reorder_nolfe[c->channel_config]; | |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | for (i = 0; i < 9; i++) { |
| @@ -303,7 +303,7 @@ static void subband_transform(DCAEncContext *c, const int32_t *input) · 157 unmodified lines | ||
| 303 | 303 | static void lfe_downsample(DCAEncContext *c, const int32_t *input) |
| 304 | 304 | { |
| 305 | 305 | /* FIXME: make 128x LFE downsampling possible */ |
| 306 | − const int lfech = ff_dca_lfe_index[c->channel_config]; | |
| 306 | + const int lfech = lfe_index[c->channel_config]; | |
| 307 | 307 | int i, j, lfes; |
| 308 | 308 | int32_t hist[512]; |
| 309 | 309 | int32_t accum; |
| @@ -103,4 +103,46 @@ static const int bit_consumption[27] = { · 102 unmodified lines | ||
| 103 | 103 | 272, 288, 304, 320, 336, 352, 368, |
| 104 | 104 | }; |
| 105 | 105 | |
| 106 | +static const int8_t lfe_index[16] = { | |
| 107 | + 1, 2, 2, 2, 2, 3, 2, 3, 2, 3, 2, 3, 1, 3, 2, 3 | |
| 108 | +}; | |
| 109 | + | |
| 110 | +static const int8_t channel_reorder_lfe[16][9] = { | |
| 111 | + { 0, -1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 112 | + { 0, 1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 113 | + { 0, 1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 114 | + { 0, 1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 115 | + { 0, 1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 116 | + { 2, 0, 1, -1, -1, -1, -1, -1, -1 }, | |
| 117 | + { 0, 1, 3, -1, -1, -1, -1, -1, -1 }, | |
| 118 | + { 2, 0, 1, 4, -1, -1, -1, -1, -1 }, | |
| 119 | + { 0, 1, 3, 4, -1, -1, -1, -1, -1 }, | |
| 120 | + { 2, 0, 1, 4, 5, -1, -1, -1, -1 }, | |
| 121 | + { 3, 4, 0, 1, 5, 6, -1, -1, -1 }, | |
| 122 | + { 2, 0, 1, 4, 5, 6, -1, -1, -1 }, | |
| 123 | + { 0, 6, 4, 5, 2, 3, -1, -1, -1 }, | |
| 124 | + { 4, 2, 5, 0, 1, 6, 7, -1, -1 }, | |
| 125 | + { 5, 6, 0, 1, 7, 3, 8, 4, -1 }, | |
| 126 | + { 4, 2, 5, 0, 1, 6, 8, 7, -1 }, | |
| 127 | +}; | |
| 128 | + | |
| 129 | +static const int8_t channel_reorder_nolfe[16][9] = { | |
| 130 | + { 0, -1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 131 | + { 0, 1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 132 | + { 0, 1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 133 | + { 0, 1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 134 | + { 0, 1, -1, -1, -1, -1, -1, -1, -1 }, | |
| 135 | + { 2, 0, 1, -1, -1, -1, -1, -1, -1 }, | |
| 136 | + { 0, 1, 2, -1, -1, -1, -1, -1, -1 }, | |
| 137 | + { 2, 0, 1, 3, -1, -1, -1, -1, -1 }, | |
| 138 | + { 0, 1, 2, 3, -1, -1, -1, -1, -1 }, | |
| 139 | + { 2, 0, 1, 3, 4, -1, -1, -1, -1 }, | |
| 140 | + { 2, 3, 0, 1, 4, 5, -1, -1, -1 }, | |
| 141 | + { 2, 0, 1, 3, 4, 5, -1, -1, -1 }, | |
| 142 | + { 0, 5, 3, 4, 1, 2, -1, -1, -1 }, | |
| 143 | + { 3, 2, 4, 0, 1, 5, 6, -1, -1 }, | |
| 144 | + { 4, 5, 0, 1, 6, 2, 7, 3, -1 }, | |
| 145 | + { 3, 2, 4, 0, 1, 5, 7, 6, -1 }, | |
| 146 | +}; | |
| 147 | + | |
| 106 | 148 | #endif /* AVCODEC_DCAENC_H */ |