* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* @file qdm2.c
* QDM2 decoder
* @author Ewald Snel, Benjamin Larsson, Alex Beregszaszi, Roberto Togni
* @file qdm2.c
* QDM2 decoder
* @author Ewald Snel, Benjamin Larsson, Alex Beregszaszi, Roberto Togni
- * The decoder is not perfect yet, there are still some distorions expecially
- * on files encoded with 16 or 8 subbands
+ * The decoder is not perfect yet, there are still some distortions
+ * especially on files encoded with 16 or 8 subbands.
int superblocktype_2_3; ///< select fft tables and some algorithm based on superblock type
int do_synth_filter; ///< used to perform or skip synthesis filter
int sub_packet;
int superblocktype_2_3; ///< select fft tables and some algorithm based on superblock type
int do_synth_filter; ///< used to perform or skip synthesis filter
int sub_packet;
{
init_vlc (&vlc_tab_level, 8, 24,
vlc_tab_level_huffbits, 1, 1,
{
init_vlc (&vlc_tab_level, 8, 24,
vlc_tab_level_huffbits, 1, 1,
- av_log(NULL,AV_LOG_DEBUG,"Sub packet: type=%d size=%d start_offs=%x\n",
+ av_log(NULL,AV_LOG_DEBUG,"Subpacket: type=%d size=%d start_offs=%x\n",
* @param type type of searched subpacket
* @return node pointer for subpacket if found, else NULL
*/
* @param type type of searched subpacket
* @return node pointer for subpacket if found, else NULL
*/
- * Replaces 8 elements with their average value
- * Called by qdm2_decode_superblock before starting subblocks decoding
+ * Replaces 8 elements with their average value.
+ * Called by qdm2_decode_superblock before starting subblock decoding.
- * Build subband samples with noise weighted by q->tone_level
- * Called by synthfilt_build_sb_samples
+ * Build subband samples with noise weighted by q->tone_level.
+ * Called by synthfilt_build_sb_samples.
- * Called while processing data from subpackets 11 and 12
- * Used after making changes to coding_method array
+ * Called while processing data from subpackets 11 and 12.
+ * Used after making changes to coding_method array.
*
* @param sb subband index
* @param channels number of channels
* @param coding_method q->coding_method[0][0][0]
*/
*
* @param sb subband index
* @param channels number of channels
* @param coding_method q->coding_method[0][0][0]
*/
case 0: run = 10; case_val = 10; break;
case 1: run = 1; case_val = 16; break;
case 2: run = 5; case_val = 24; break;
case 0: run = 10; case_val = 10; break;
case 1: run = 1; case_val = 16; break;
case 2: run = 5; case_val = 24; break;
* 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
*
* 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_temp
* @param coding_method q->coding_method[0][0][0]
* @param nb_channels number of channels
* @param tone_level_idx_temp
* @param coding_method q->coding_method[0][0][0]
* @param nb_channels number of channels
* @param sb_min lower subband processed (sb_min included)
* @param sb_max higher subband processed (sb_max excluded)
*/
* @param sb_min lower subband processed (sb_min included)
* @param sb_max higher subband processed (sb_max excluded)
*/
samples[0] = type30_dequant[qdm2_get_vlc(gb, &vlc_tab_type30, 0, 1)];
else
samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
samples[0] = type30_dequant[qdm2_get_vlc(gb, &vlc_tab_type30, 0, 1)];
else
samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
if (BITS_LEFT(length,gb) < 16)
break;
diff = qdm2_get_se_vlc(&vlc_tab_diff, gb, 2);
if (BITS_LEFT(length,gb) < 16)
break;
diff = qdm2_get_se_vlc(&vlc_tab_diff, gb, 2);
packet = &q->sub_packets[i];
qdm2_decode_sub_packet_header(&gb, packet);
next_index = packet->size + get_bits_count(&gb) / 8;
packet = &q->sub_packets[i];
qdm2_decode_sub_packet_header(&gb, packet);
next_index = packet->size + get_bits_count(&gb) / 8;
for (j = 0, min = 0, packet = NULL; j < q->sub_packets_B; j++) {
value = q->sub_packet_list_B[j].packet->type;
if (value > min && value < max) {
for (j = 0, min = 0, packet = NULL; j < q->sub_packets_B; j++) {
value = q->sub_packet_list_B[j].packet->type;
if (value > min && value < max) {
if (duration >= 0 && duration < 4)
qdm2_fft_decode_tones(q, duration, &gb, unknown_flag);
} else if (type == 31) {
if (duration >= 0 && duration < 4)
qdm2_fft_decode_tones(q, duration, &gb, unknown_flag);
} else if (type == 31) {
- for (i=0; i < 4; i++)
- qdm2_fft_decode_tones(q, i, &gb, unknown_flag);
+ for (j=0; j < 4; j++)
+ qdm2_fft_decode_tones(q, j, &gb, unknown_flag);
- for (i=0; i < 6; i++)
- q->fft_level_exp[i] = get_bits(&gb, 6);
- for (i=0; i < 4; i++)
- qdm2_fft_decode_tones(q, i, &gb, unknown_flag);
+ for (j=0; j < 6; j++)
+ q->fft_level_exp[j] = get_bits(&gb, 6);
+ for (j=0; j < 4; j++)
+ qdm2_fft_decode_tones(q, j, &gb, unknown_flag);
float c, s, f0, f1, f2, f3;
int i, j;
float c, s, f0, f1, f2, f3;
int i, j;
av_log(NULL,AV_LOG_DEBUG,"Tone (%d) dump:\n", i);
av_log(NULL,AV_LOG_DEBUG," level = %f\n", t->level);
// PRINT(" level", t->level);
av_log(NULL,AV_LOG_DEBUG,"Tone (%d) dump:\n", i);
av_log(NULL,AV_LOG_DEBUG," level = %f\n", t->level);
// PRINT(" level", t->level);
32 size (including this field, in bytes)
32 tag (=QDCA) // maybe mandatory parameters
32 unknown (=1)
32 size (including this field, in bytes)
32 tag (=QDCA) // maybe mandatory parameters
32 unknown (=1)
32 size (including this field, in bytes)
32 tag (=QDCP) // maybe some tuneable parameters
32 float1 (=1.0)
32 size (including this field, in bytes)
32 tag (=QDCP) // maybe some tuneable parameters
32 float1 (=1.0)
if(size > extradata_size){
av_log(avctx, AV_LOG_ERROR, "extradata size too small, %i < %i\n",
if(size > extradata_size){
av_log(avctx, AV_LOG_ERROR, "extradata size too small, %i < %i\n",
extradata += 4;
av_log(avctx, AV_LOG_DEBUG, "size: %d\n", size);
extradata += 4;
av_log(avctx, AV_LOG_DEBUG, "size: %d\n", size);
- if (BE_32(extradata) != MKBETAG('Q','D','C','A')) {
+ if (AV_RB32(extradata) != MKBETAG('Q','D','C','A')) {
av_log(avctx, AV_LOG_ERROR, "invalid extradata, expecting QDCA\n");
return -1;
}
extradata += 8;
av_log(avctx, AV_LOG_ERROR, "invalid extradata, expecting QDCA\n");
return -1;
}
extradata += 8;
/* decode block of QDM2 compressed data */
if (q->sub_packet == 0) {
q->has_errors = 0; // zero it for a new super block
/* decode block of QDM2 compressed data */
if (q->sub_packet == 0) {
q->has_errors = 0; // zero it for a new super block