| 753 | // Process modes part |
| 754 | |
| 755 | static void create_map(vorbis_context *vc, uint_fast8_t floor_number) |
| 756 | { |
| 757 | vorbis_floor *floors = vc->floors; |
| 758 | vorbis_floor0 *vf; |
| 759 | int idx; |
| 760 | int_fast8_t blockflag; |
| 761 | int_fast32_t *map; |
| 762 | int_fast32_t n; //TODO: could theoretically be smaller? |
| 763 | |
| 764 | for (blockflag = 0; blockflag < 2; ++blockflag) { |
| 765 | n = vc->blocksize[blockflag] / 2; |
| 766 | floors[floor_number].data.t0.map[blockflag] = |
| 767 | av_malloc((n+1) * sizeof(int_fast32_t)); // n + sentinel |
| 768 | |
| 769 | map = floors[floor_number].data.t0.map[blockflag]; |
| 770 | vf = &floors[floor_number].data.t0; |
| 771 | |
| 772 | for (idx = 0; idx < n; ++idx) { |
| 773 | map[idx] = floor(BARK((vf->rate * idx) / (2.0f * n)) * |
| 774 | ((vf->bark_map_size) / |
| 775 | BARK(vf->rate / 2.0f))); |
| 776 | if (vf->bark_map_size-1 < map[idx]) |
| 777 | map[idx] = vf->bark_map_size - 1; |
| 778 | } |
| 779 | map[n] = -1; |
| 780 | vf->map_size[blockflag] = n; |
| 781 | } |
| 782 | |
| 783 | # ifdef V_DEBUG |
| 784 | for (idx = 0; idx <= n; ++idx) { |
| 785 | AV_DEBUG("floor0 map: map at pos %d is %d\n", |
| 786 | idx, map[idx]); |
| 787 | } |
| 788 | # endif |
| 789 | } |
| 790 | |
| 791 | static int vorbis_parse_setup_hdr_modes(vorbis_context *vc) |
| 792 | { |
no test coverage detected