Mercurial > libavcodec.hg
comparison qdm2.c @ 6273:39cd8d3d5b9e libavcodec
const
author | michael |
---|---|
date | Fri, 01 Feb 2008 15:37:24 +0000 |
parents | 61f95f3a62e0 |
children | 8e63d869a904 |
comparison
equal
deleted
inserted
replaced
6272:ec8c482d17c1 | 6273:39cd8d3d5b9e |
---|---|
104 | 104 |
105 typedef struct { | 105 typedef struct { |
106 float level; | 106 float level; |
107 float *samples_im; | 107 float *samples_im; |
108 float *samples_re; | 108 float *samples_re; |
109 float *table; | 109 const float *table; |
110 int phase; | 110 int phase; |
111 int phase_shift; | 111 int phase_shift; |
112 int duration; | 112 int duration; |
113 short time_index; | 113 short time_index; |
114 short cutoff; | 114 short cutoff; |
174 FFTContext fft_ctx; | 174 FFTContext fft_ctx; |
175 FFTComplex exptab[128]; | 175 FFTComplex exptab[128]; |
176 QDM2FFT fft; | 176 QDM2FFT fft; |
177 | 177 |
178 /// I/O data | 178 /// I/O data |
179 uint8_t *compressed_data; | 179 const uint8_t *compressed_data; |
180 int compressed_size; | 180 int compressed_size; |
181 float output_buffer[1024]; | 181 float output_buffer[1024]; |
182 | 182 |
183 /// Synthesis filter | 183 /// Synthesis filter |
184 DECLARE_ALIGNED_16(MPA_INT, synth_buf[MPA_MAX_CHANNELS][512*2]); | 184 DECLARE_ALIGNED_16(MPA_INT, synth_buf[MPA_MAX_CHANNELS][512*2]); |
402 * @param length data length | 402 * @param length data length |
403 * @param value checksum value | 403 * @param value checksum value |
404 * | 404 * |
405 * @return 0 if checksum is OK | 405 * @return 0 if checksum is OK |
406 */ | 406 */ |
407 static uint16_t qdm2_packet_checksum (uint8_t *data, int length, int value) { | 407 static uint16_t qdm2_packet_checksum (const uint8_t *data, int length, int value) { |
408 int i; | 408 int i; |
409 | 409 |
410 for (i=0; i < length; i++) | 410 for (i=0; i < length; i++) |
411 value -= data[i]; | 411 value -= data[i]; |
412 | 412 |
1596 tone.cutoff = (offset >= 60) ? 3 : 2; | 1596 tone.cutoff = (offset >= 60) ? 3 : 2; |
1597 | 1597 |
1598 tone.level = (q->fft_coefs[j].exp < 0) ? 0.0 : fft_tone_level_table[q->superblocktype_2_3 ? 0 : 1][q->fft_coefs[j].exp & 63]; | 1598 tone.level = (q->fft_coefs[j].exp < 0) ? 0.0 : fft_tone_level_table[q->superblocktype_2_3 ? 0 : 1][q->fft_coefs[j].exp & 63]; |
1599 tone.samples_im = &q->fft.samples_im[ch][offset]; | 1599 tone.samples_im = &q->fft.samples_im[ch][offset]; |
1600 tone.samples_re = &q->fft.samples_re[ch][offset]; | 1600 tone.samples_re = &q->fft.samples_re[ch][offset]; |
1601 tone.table = (float*)fft_tone_sample_table[i][q->fft_coefs[j].offset - (offset << four_i)]; | 1601 tone.table = fft_tone_sample_table[i][q->fft_coefs[j].offset - (offset << four_i)]; |
1602 tone.phase = 64 * q->fft_coefs[j].phase - (offset << 8) - 128; | 1602 tone.phase = 64 * q->fft_coefs[j].phase - (offset << 8) - 128; |
1603 tone.phase_shift = (2 * q->fft_coefs[j].offset + 1) << (7 - four_i); | 1603 tone.phase_shift = (2 * q->fft_coefs[j].offset + 1) << (7 - four_i); |
1604 tone.duration = i; | 1604 tone.duration = i; |
1605 tone.time_index = 0; | 1605 tone.time_index = 0; |
1606 | 1606 |
1941 | 1941 |
1942 return 0; | 1942 return 0; |
1943 } | 1943 } |
1944 | 1944 |
1945 | 1945 |
1946 static void qdm2_decode (QDM2Context *q, uint8_t *in, int16_t *out) | 1946 static void qdm2_decode (QDM2Context *q, const uint8_t *in, int16_t *out) |
1947 { | 1947 { |
1948 int ch, i; | 1948 int ch, i; |
1949 const int frame_size = (q->frame_size * q->channels); | 1949 const int frame_size = (q->frame_size * q->channels); |
1950 | 1950 |
1951 /* select input buffer */ | 1951 /* select input buffer */ |
2003 } | 2003 } |
2004 | 2004 |
2005 | 2005 |
2006 static int qdm2_decode_frame(AVCodecContext *avctx, | 2006 static int qdm2_decode_frame(AVCodecContext *avctx, |
2007 void *data, int *data_size, | 2007 void *data, int *data_size, |
2008 uint8_t *buf, int buf_size) | 2008 const uint8_t *buf, int buf_size) |
2009 { | 2009 { |
2010 QDM2Context *s = avctx->priv_data; | 2010 QDM2Context *s = avctx->priv_data; |
2011 | 2011 |
2012 if(!buf) | 2012 if(!buf) |
2013 return 0; | 2013 return 0; |