Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Side by Side Diff: patched-ffmpeg-mt/libavcodec/qdm2.c

Issue 789004: ffmpeg roll of source to mar 9 version... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * QDM2 compatible decoder 2 * QDM2 compatible decoder
3 * Copyright (c) 2003 Ewald Snel 3 * Copyright (c) 2003 Ewald Snel
4 * Copyright (c) 2005 Benjamin Larsson 4 * Copyright (c) 2005 Benjamin Larsson
5 * Copyright (c) 2005 Alex Beregszaszi 5 * Copyright (c) 2005 Alex Beregszaszi
6 * Copyright (c) 2005 Roberto Togni 6 * Copyright (c) 2005 Roberto Togni
7 * 7 *
8 * This file is part of FFmpeg. 8 * This file is part of FFmpeg.
9 * 9 *
10 * FFmpeg is free software; you can redistribute it and/or 10 * FFmpeg is free software; you can redistribute it and/or
(...skipping 20 matching lines...) Expand all
31 */ 31 */
32 32
33 #include <math.h> 33 #include <math.h>
34 #include <stddef.h> 34 #include <stddef.h>
35 #include <stdio.h> 35 #include <stdio.h>
36 36
37 #define ALT_BITSTREAM_READER_LE 37 #define ALT_BITSTREAM_READER_LE
38 #include "avcodec.h" 38 #include "avcodec.h"
39 #include "get_bits.h" 39 #include "get_bits.h"
40 #include "dsputil.h" 40 #include "dsputil.h"
41 #include "fft.h"
41 #include "mpegaudio.h" 42 #include "mpegaudio.h"
42 43
43 #include "qdm2data.h" 44 #include "qdm2data.h"
44 45
45 #undef NDEBUG 46 #undef NDEBUG
46 #include <assert.h> 47 #include <assert.h>
47 48
48 49
49 #define SOFTCLIP_THRESHOLD 27600 50 #define SOFTCLIP_THRESHOLD 27600
50 #define HARDCLIP_THRESHOLD 35716 51 #define HARDCLIP_THRESHOLD 35716
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 116
116 typedef struct { 117 typedef struct {
117 int16_t sub_packet; 118 int16_t sub_packet;
118 uint8_t channel; 119 uint8_t channel;
119 int16_t offset; 120 int16_t offset;
120 int16_t exp; 121 int16_t exp;
121 uint8_t phase; 122 uint8_t phase;
122 } FFTCoefficient; 123 } FFTCoefficient;
123 124
124 typedef struct { 125 typedef struct {
125 DECLARE_ALIGNED_16(QDM2Complex, complex)[MPA_MAX_CHANNELS][256]; 126 DECLARE_ALIGNED(16, QDM2Complex, complex)[MPA_MAX_CHANNELS][256];
126 } QDM2FFT; 127 } QDM2FFT;
127 128
128 /** 129 /**
129 * QDM2 decoder context 130 * QDM2 decoder context
130 */ 131 */
131 typedef struct { 132 typedef struct {
132 /// Parameters from codec header, do not change during playback 133 /// Parameters from codec header, do not change during playback
133 int nb_channels; ///< number of channels 134 int nb_channels; ///< number of channels
134 int channels; ///< number of channels 135 int channels; ///< number of channels
135 int group_size; ///< size of frame group (16 frames per group) 136 int group_size; ///< size of frame group (16 frames per group)
(...skipping 29 matching lines...) Expand all
165 int fft_level_exp[6]; 166 int fft_level_exp[6];
166 RDFTContext rdft_ctx; 167 RDFTContext rdft_ctx;
167 QDM2FFT fft; 168 QDM2FFT fft;
168 169
169 /// I/O data 170 /// I/O data
170 const uint8_t *compressed_data; 171 const uint8_t *compressed_data;
171 int compressed_size; 172 int compressed_size;
172 float output_buffer[1024]; 173 float output_buffer[1024];
173 174
174 /// Synthesis filter 175 /// Synthesis filter
175 DECLARE_ALIGNED_16(MPA_INT, synth_buf)[MPA_MAX_CHANNELS][512*2]; 176 DECLARE_ALIGNED(16, MPA_INT, synth_buf)[MPA_MAX_CHANNELS][512*2];
176 int synth_buf_offset[MPA_MAX_CHANNELS]; 177 int synth_buf_offset[MPA_MAX_CHANNELS];
177 DECLARE_ALIGNED_16(int32_t, sb_samples)[MPA_MAX_CHANNELS][128][SBLIMIT]; 178 DECLARE_ALIGNED(16, int32_t, sb_samples)[MPA_MAX_CHANNELS][128][SBLIMIT];
178 179
179 /// Mixed temporary data used in decoding 180 /// Mixed temporary data used in decoding
180 float tone_level[MPA_MAX_CHANNELS][30][64]; 181 float tone_level[MPA_MAX_CHANNELS][30][64];
181 int8_t coding_method[MPA_MAX_CHANNELS][30][64]; 182 int8_t coding_method[MPA_MAX_CHANNELS][30][64];
182 int8_t quantized_coeffs[MPA_MAX_CHANNELS][10][8]; 183 int8_t quantized_coeffs[MPA_MAX_CHANNELS][10][8];
183 int8_t tone_level_idx_base[MPA_MAX_CHANNELS][30][8]; 184 int8_t tone_level_idx_base[MPA_MAX_CHANNELS][30][8];
184 int8_t tone_level_idx_hi1[MPA_MAX_CHANNELS][3][8][8]; 185 int8_t tone_level_idx_hi1[MPA_MAX_CHANNELS][3][8][8];
185 int8_t tone_level_idx_mid[MPA_MAX_CHANNELS][26][8]; 186 int8_t tone_level_idx_mid[MPA_MAX_CHANNELS][26][8];
186 int8_t tone_level_idx_hi2[MPA_MAX_CHANNELS][26]; 187 int8_t tone_level_idx_hi2[MPA_MAX_CHANNELS][26];
187 int8_t tone_level_idx[MPA_MAX_CHANNELS][30][64]; 188 int8_t tone_level_idx[MPA_MAX_CHANNELS][30][64];
(...skipping 1732 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 s->coeff_per_sb_select = 1; 1921 s->coeff_per_sb_select = 1;
1921 else 1922 else
1922 s->coeff_per_sb_select = 2; 1923 s->coeff_per_sb_select = 2;
1923 1924
1924 // Fail on unknown fft order 1925 // Fail on unknown fft order
1925 if ((s->fft_order < 7) || (s->fft_order > 9)) { 1926 if ((s->fft_order < 7) || (s->fft_order > 9)) {
1926 av_log(avctx, AV_LOG_ERROR, "Unknown FFT order (%d), contact the develop ers!\n", s->fft_order); 1927 av_log(avctx, AV_LOG_ERROR, "Unknown FFT order (%d), contact the develop ers!\n", s->fft_order);
1927 return -1; 1928 return -1;
1928 } 1929 }
1929 1930
1930 ff_rdft_init(&s->rdft_ctx, s->fft_order, IRDFT); 1931 ff_rdft_init(&s->rdft_ctx, s->fft_order, IDFT_C2R);
1931 1932
1932 qdm2_init(s); 1933 qdm2_init(s);
1933 1934
1934 avctx->sample_fmt = SAMPLE_FMT_S16; 1935 avctx->sample_fmt = SAMPLE_FMT_S16;
1935 1936
1936 // dump_context(s); 1937 // dump_context(s);
1937 return 0; 1938 return 0;
1938 } 1939 }
1939 1940
1940 1941
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 { 2041 {
2041 .name = "qdm2", 2042 .name = "qdm2",
2042 .type = CODEC_TYPE_AUDIO, 2043 .type = CODEC_TYPE_AUDIO,
2043 .id = CODEC_ID_QDM2, 2044 .id = CODEC_ID_QDM2,
2044 .priv_data_size = sizeof(QDM2Context), 2045 .priv_data_size = sizeof(QDM2Context),
2045 .init = qdm2_decode_init, 2046 .init = qdm2_decode_init,
2046 .close = qdm2_decode_close, 2047 .close = qdm2_decode_close,
2047 .decode = qdm2_decode_frame, 2048 .decode = qdm2_decode_frame,
2048 .long_name = NULL_IF_CONFIG_SMALL("QDesign Music Codec 2"), 2049 .long_name = NULL_IF_CONFIG_SMALL("QDesign Music Codec 2"),
2049 }; 2050 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698