* Related to synthesis filter * Called by process_subpacket_11 * c is built with data from subpacket 11 * Most of this function is used only if superblock_type_2_3 == 0, never seen it in samples * * @param tone_level_idx * @param tone_level_idx_temp * @param coding_method q->coding_method[0][0][0] * @param nb_channels number of channels * @param c coming
| 637 | * @param cm_table_select q->cm_table_select |
| 638 | */ |
| 639 | static void fill_coding_method_array (sb_int8_array tone_level_idx, sb_int8_array tone_level_idx_temp, |
| 640 | sb_int8_array coding_method, int nb_channels, |
| 641 | int c, int superblocktype_2_3, int cm_table_select) |
| 642 | { |
| 643 | int ch, sb, j; |
| 644 | int tmp, acc, esp_40, comp; |
| 645 | int add1, add2, add3, add4; |
| 646 | int64_t multres; |
| 647 | |
| 648 | // This should never happen |
| 649 | if (nb_channels <= 0) |
| 650 | return; |
| 651 | |
| 652 | if (!superblocktype_2_3) { |
| 653 | /* This case is untested, no samples available */ |
| 654 | SAMPLES_NEEDED |
| 655 | for (ch = 0; ch < nb_channels; ch++) |
| 656 | for (sb = 0; sb < 30; sb++) { |
| 657 | for (j = 1; j < 63; j++) { // The loop only iterates to 63 so the code doesn't overflow the buffer |
| 658 | add1 = tone_level_idx[ch][sb][j] - 10; |
| 659 | if (add1 < 0) |
| 660 | add1 = 0; |
| 661 | add2 = add3 = add4 = 0; |
| 662 | if (sb > 1) { |
| 663 | add2 = tone_level_idx[ch][sb - 2][j] + tone_level_idx_offset_table[sb][0] - 6; |
| 664 | if (add2 < 0) |
| 665 | add2 = 0; |
| 666 | } |
| 667 | if (sb > 0) { |
| 668 | add3 = tone_level_idx[ch][sb - 1][j] + tone_level_idx_offset_table[sb][1] - 6; |
| 669 | if (add3 < 0) |
| 670 | add3 = 0; |
| 671 | } |
| 672 | if (sb < 29) { |
| 673 | add4 = tone_level_idx[ch][sb + 1][j] + tone_level_idx_offset_table[sb][3] - 6; |
| 674 | if (add4 < 0) |
| 675 | add4 = 0; |
| 676 | } |
| 677 | tmp = tone_level_idx[ch][sb][j + 1] * 2 - add4 - add3 - add2 - add1; |
| 678 | if (tmp < 0) |
| 679 | tmp = 0; |
| 680 | tone_level_idx_temp[ch][sb][j + 1] = tmp & 0xff; |
| 681 | } |
| 682 | tone_level_idx_temp[ch][sb][0] = tone_level_idx_temp[ch][sb][1]; |
| 683 | } |
| 684 | acc = 0; |
| 685 | for (ch = 0; ch < nb_channels; ch++) |
| 686 | for (sb = 0; sb < 30; sb++) |
| 687 | for (j = 0; j < 64; j++) |
| 688 | acc += tone_level_idx_temp[ch][sb][j]; |
| 689 | |
| 690 | multres = 0x66666667 * (acc * 10); |
| 691 | esp_40 = (multres >> 32) / 8 + ((multres & 0xffffffff) >> 31); |
| 692 | for (ch = 0; ch < nb_channels; ch++) |
| 693 | for (sb = 0; sb < 30; sb++) |
| 694 | for (j = 0; j < 64; j++) { |
| 695 | comp = tone_level_idx_temp[ch][sb][j]* esp_40 * 10; |
| 696 | if (comp < 0) |
no test coverage detected