| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Windows Media Audio Voice decoder. | 2 * Windows Media Audio Voice decoder. |
| 3 * Copyright (c) 2009 Ronald S. Bultje | 3 * Copyright (c) 2009 Ronald S. Bultje |
| 4 * | 4 * |
| 5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
| 6 * | 6 * |
| 7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
| (...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 /** | 1026 /** |
| 1027 * Apply second set of pitch-adaptive window pulses. | 1027 * Apply second set of pitch-adaptive window pulses. |
| 1028 * @param s WMA Voice decoding context private data | 1028 * @param s WMA Voice decoding context private data |
| 1029 * @param gb bit I/O context | 1029 * @param gb bit I/O context |
| 1030 * @param block_idx block index in frame [0, 1] | 1030 * @param block_idx block index in frame [0, 1] |
| 1031 * @param fcb structure containing fixed codebook vector info | 1031 * @param fcb structure containing fixed codebook vector info |
| 1032 */ | 1032 */ |
| 1033 static void aw_pulse_set2(WMAVoiceContext *s, GetBitContext *gb, | 1033 static void aw_pulse_set2(WMAVoiceContext *s, GetBitContext *gb, |
| 1034 int block_idx, AMRFixed *fcb) | 1034 int block_idx, AMRFixed *fcb) |
| 1035 { | 1035 { |
| 1036 uint16_t use_mask[7]; // only 5 are used, rest is padding | 1036 uint16_t use_mask_mem[9]; // only 5 are used, rest is padding |
| 1037 uint16_t *use_mask = use_mask_mem + 2; |
| 1037 /* in this function, idx is the index in the 80-bit (+ padding) use_mask | 1038 /* in this function, idx is the index in the 80-bit (+ padding) use_mask |
| 1038 * bit-array. Since use_mask consists of 16-bit values, the lower 4 bits | 1039 * bit-array. Since use_mask consists of 16-bit values, the lower 4 bits |
| 1039 * of idx are the position of the bit within a particular item in the | 1040 * of idx are the position of the bit within a particular item in the |
| 1040 * array (0 being the most significant bit, and 15 being the least | 1041 * array (0 being the most significant bit, and 15 being the least |
| 1041 * significant bit), and the remainder (>> 4) is the index in the | 1042 * significant bit), and the remainder (>> 4) is the index in the |
| 1042 * use_mask[]-array. This is faster and uses less memory than using a | 1043 * use_mask[]-array. This is faster and uses less memory than using a |
| 1043 * 80-byte/80-int array. */ | 1044 * 80-byte/80-int array. */ |
| 1044 int pulse_off = s->aw_first_pulse_off[block_idx], | 1045 int pulse_off = s->aw_first_pulse_off[block_idx], |
| 1045 pulse_start, n, idx, range, aidx, start_off = 0; | 1046 pulse_start, n, idx, range, aidx, start_off = 0; |
| 1046 | 1047 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1058 if (s->aw_n_pulses[block_idx] > 0) | 1059 if (s->aw_n_pulses[block_idx] > 0) |
| 1059 pulse_off = s->aw_next_pulse_off_cache; | 1060 pulse_off = s->aw_next_pulse_off_cache; |
| 1060 } | 1061 } |
| 1061 } else | 1062 } else |
| 1062 range = 16; | 1063 range = 16; |
| 1063 pulse_start = s->aw_n_pulses[block_idx] > 0 ? pulse_off - range / 2 : 0; | 1064 pulse_start = s->aw_n_pulses[block_idx] > 0 ? pulse_off - range / 2 : 0; |
| 1064 | 1065 |
| 1065 /* aw_pulse_set1() already applies pulses around pulse_off (to be exactly, | 1066 /* aw_pulse_set1() already applies pulses around pulse_off (to be exactly, |
| 1066 * in the range of [pulse_off, pulse_off + s->aw_pulse_range], and thus | 1067 * in the range of [pulse_off, pulse_off + s->aw_pulse_range], and thus |
| 1067 * we exclude that range from being pulsed again in this function. */ | 1068 * we exclude that range from being pulsed again in this function. */ |
| 1069 memset(&use_mask[-2], 0, 2 * sizeof(use_mask[0])); |
| 1068 memset( use_mask, -1, 5 * sizeof(use_mask[0])); | 1070 memset( use_mask, -1, 5 * sizeof(use_mask[0])); |
| 1069 memset(&use_mask[5], 0, 2 * sizeof(use_mask[0])); | 1071 memset(&use_mask[5], 0, 2 * sizeof(use_mask[0])); |
| 1070 if (s->aw_n_pulses[block_idx] > 0) | 1072 if (s->aw_n_pulses[block_idx] > 0) |
| 1071 for (idx = pulse_off; idx < MAX_FRAMESIZE / 2; idx += fcb->pitch_lag) { | 1073 for (idx = pulse_off; idx < MAX_FRAMESIZE / 2; idx += fcb->pitch_lag) { |
| 1072 int excl_range = s->aw_pulse_range; // always 16 or 24 | 1074 int excl_range = s->aw_pulse_range; // always 16 or 24 |
| 1073 uint16_t *use_mask_ptr = &use_mask[idx >> 4]; | 1075 uint16_t *use_mask_ptr = &use_mask[idx >> 4]; |
| 1074 int first_sh = 16 - (idx & 15); | 1076 int first_sh = 16 - (idx & 15); |
| 1075 *use_mask_ptr++ &= 0xFFFF << first_sh; | 1077 *use_mask_ptr++ &= 0xFFFF << first_sh; |
| 1076 excl_range -= first_sh; | 1078 excl_range -= first_sh; |
| 1077 if (excl_range >= 16) { | 1079 if (excl_range >= 16) { |
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2022 CODEC_ID_WMAVOICE, | 2024 CODEC_ID_WMAVOICE, |
| 2023 sizeof(WMAVoiceContext), | 2025 sizeof(WMAVoiceContext), |
| 2024 wmavoice_decode_init, | 2026 wmavoice_decode_init, |
| 2025 NULL, | 2027 NULL, |
| 2026 wmavoice_decode_end, | 2028 wmavoice_decode_end, |
| 2027 wmavoice_decode_packet, | 2029 wmavoice_decode_packet, |
| 2028 CODEC_CAP_SUBFRAMES, | 2030 CODEC_CAP_SUBFRAMES, |
| 2029 .flush = wmavoice_flush, | 2031 .flush = wmavoice_flush, |
| 2030 .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Voice"), | 2032 .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Voice"), |
| 2031 }; | 2033 }; |
| OLD | NEW |