summaryrefslogtreecommitdiff
path: root/contrib/ffmpeg/libavcodec/qdm2.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ffmpeg/libavcodec/qdm2.c')
-rw-r--r--contrib/ffmpeg/libavcodec/qdm2.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/contrib/ffmpeg/libavcodec/qdm2.c b/contrib/ffmpeg/libavcodec/qdm2.c
index a2630fe7f..55ddbef45 100644
--- a/contrib/ffmpeg/libavcodec/qdm2.c
+++ b/contrib/ffmpeg/libavcodec/qdm2.c
@@ -20,7 +20,6 @@
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
*/
/**
@@ -98,16 +97,16 @@ typedef struct {
/**
* A node in the subpacket list
*/
-typedef struct _QDM2SubPNode {
+typedef struct QDM2SubPNode {
QDM2SubPacket *packet; ///< packet
- struct _QDM2SubPNode *next; ///< pointer to next packet in the list, NULL if leaf node
+ struct QDM2SubPNode *next; ///< pointer to next packet in the list, NULL if leaf node
} QDM2SubPNode;
typedef struct {
float level;
float *samples_im;
float *samples_re;
- float *table;
+ const float *table;
int phase;
int phase_shift;
int duration;
@@ -129,7 +128,7 @@ typedef struct {
} QDM2Complex;
typedef struct {
- QDM2Complex complex[256 + 1] __attribute__((aligned(16)));
+ DECLARE_ALIGNED_16(QDM2Complex, complex[256 + 1]);
float samples_im[MPA_MAX_CHANNELS][256];
float samples_re[MPA_MAX_CHANNELS][256];
} QDM2FFT;
@@ -177,14 +176,14 @@ typedef struct {
QDM2FFT fft;
/// I/O data
- uint8_t *compressed_data;
+ const uint8_t *compressed_data;
int compressed_size;
float output_buffer[1024];
/// Synthesis filter
- MPA_INT synth_buf[MPA_MAX_CHANNELS][512*2] __attribute__((aligned(16)));
+ DECLARE_ALIGNED_16(MPA_INT, synth_buf[MPA_MAX_CHANNELS][512*2]);
int synth_buf_offset[MPA_MAX_CHANNELS];
- int32_t sb_samples[MPA_MAX_CHANNELS][128][SBLIMIT] __attribute__((aligned(16)));
+ DECLARE_ALIGNED_16(int32_t, sb_samples[MPA_MAX_CHANNELS][128][SBLIMIT]);
/// Mixed temporary data used in decoding
float tone_level[MPA_MAX_CHANNELS][30][64];
@@ -229,7 +228,7 @@ static uint8_t random_dequant_index[256][5];
static uint8_t random_dequant_type24[128][3];
static float noise_samples[128];
-static MPA_INT mpa_window[512] __attribute__((aligned(16)));
+static DECLARE_ALIGNED_16(MPA_INT, mpa_window[512]);
static void softclip_table_init(void) {
@@ -405,7 +404,7 @@ static int qdm2_get_se_vlc (VLC *vlc, GetBitContext *gb, int depth)
*
* @return 0 if checksum is OK
*/
-static uint16_t qdm2_packet_checksum (uint8_t *data, int length, int value) {
+static uint16_t qdm2_packet_checksum (const uint8_t *data, int length, int value) {
int i;
for (i=0; i < length; i++)
@@ -1599,7 +1598,7 @@ static void qdm2_fft_tone_synthesizer (QDM2Context *q, int sub_packet)
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];
tone.samples_im = &q->fft.samples_im[ch][offset];
tone.samples_re = &q->fft.samples_re[ch][offset];
- tone.table = (float*)fft_tone_sample_table[i][q->fft_coefs[j].offset - (offset << four_i)];
+ tone.table = fft_tone_sample_table[i][q->fft_coefs[j].offset - (offset << four_i)];
tone.phase = 64 * q->fft_coefs[j].phase - (offset << 8) - 128;
tone.phase_shift = (2 * q->fft_coefs[j].offset + 1) << (7 - four_i);
tone.duration = i;
@@ -1693,11 +1692,11 @@ static void qdm2_synthesis_filter (QDM2Context *q, int index)
* @param q context
*/
static void qdm2_init(QDM2Context *q) {
- static int inited = 0;
+ static int initialized = 0;
- if (inited != 0)
+ if (initialized != 0)
return;
- inited = 1;
+ initialized = 1;
qdm2_init_vlc();
ff_mpa_synth_init(mpa_window);
@@ -1944,7 +1943,7 @@ static int qdm2_decode_close(AVCodecContext *avctx)
}
-static void qdm2_decode (QDM2Context *q, uint8_t *in, int16_t *out)
+static void qdm2_decode (QDM2Context *q, const uint8_t *in, int16_t *out)
{
int ch, i;
const int frame_size = (q->frame_size * q->channels);
@@ -2006,7 +2005,7 @@ static void qdm2_decode (QDM2Context *q, uint8_t *in, int16_t *out)
static int qdm2_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
QDM2Context *s = avctx->priv_data;