summaryrefslogtreecommitdiff
path: root/libavcodec/qdm2.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-04-14 21:49:01 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-04-14 22:37:43 +0200
commit7432bcfe5a36331502c49fe03aefe39b9936247a (patch)
tree398b1874abbd4bcf7c103738ac4548e830af0a43 /libavcodec/qdm2.c
parent01bf2ad7351fdaa2e21b6bdf963d22d6ffccb920 (diff)
parent7bf9e3391fa21d90ff283fc03a12287fe73db9e8 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: vsrc_buffer: fix check from 7ae7c41. libxvid: Reorder functions to avoid forward declarations; make functions static. libxvid: drop some pointless dead code wmal: vertical alignment cosmetics wmal: Warn about missing bitstream splicing feature and ask for sample. wmal: Skip seekable_frame_in_packet. wmal: Drop unused variable num_possible_block_size. avfiltergraph: make the AVFilterInOut alloc/free API public graphparser: allow specifying sws flags in the graph description. graphparser: fix the order of connecting unlabeled links. graphparser: add avfilter_graph_parse2(). vsrc_buffer: allow using a NULL buffer to signal EOF. swscale: handle last pixel if lines have an odd width. qdm2: fix a dubious pointer cast WMAL: Do not try to read rawpcm coefficients if bits is invalid mov: Fix detecting there is no sync sample. tiffdec: K&R cosmetics avf: has_duration does not check the global one dsputil: fix optimized emu_edge function on Win64. Conflicts: doc/APIchanges libavcodec/libxvid_rc.c libavcodec/libxvidff.c libavcodec/tiff.c libavcodec/wmalosslessdec.c libavfilter/avfiltergraph.h libavfilter/graphparser.c libavfilter/version.h libavfilter/vsrc_buffer.c libswscale/output.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/qdm2.c')
-rw-r--r--libavcodec/qdm2.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index bfac583973..74a138bc70 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -140,7 +140,6 @@ typedef struct {
/// Parameters built from header parameters, do not change during playback
int group_order; ///< order of frame group
int fft_order; ///< order of FFT (actually fftorder+1)
- int fft_frame_size; ///< size of fft frame, in components (1 comples = re + im)
int frame_size; ///< size of data frame
int frequency_range;
int sub_sampling; ///< subsampling: 0=25%, 1=50%, 2=100% */
@@ -1607,13 +1606,17 @@ static void qdm2_fft_tone_synthesizer (QDM2Context *q, int sub_packet)
static void qdm2_calculate_fft (QDM2Context *q, int channel, int sub_packet)
{
const float gain = (q->channels == 1 && q->nb_channels == 2) ? 0.5f : 1.0f;
+ float *out = q->output_buffer + channel;
int i;
q->fft.complex[channel][0].re *= 2.0f;
q->fft.complex[channel][0].im = 0.0f;
q->rdft_ctx.rdft_calc(&q->rdft_ctx, (FFTSample *)q->fft.complex[channel]);
/* add samples to output buffer */
- for (i = 0; i < ((q->fft_frame_size + 15) & ~15); i++)
- q->output_buffer[q->channels * i + channel] += ((float *) q->fft.complex[channel])[i] * gain;
+ for (i = 0; i < FFALIGN(q->fft_size, 8); i++) {
+ out[0] += q->fft.complex[channel][i].re * gain;
+ out[q->channels] += q->fft.complex[channel][i].im * gain;
+ out += 2 * q->channels;
+ }
}
@@ -1688,7 +1691,6 @@ static void dump_context(QDM2Context *q)
PRINT("checksum_size",q->checksum_size);
PRINT("channels",q->channels);
PRINT("nb_channels",q->nb_channels);
- PRINT("fft_frame_size",q->fft_frame_size);
PRINT("fft_size",q->fft_size);
PRINT("sub_sampling",q->sub_sampling);
PRINT("fft_order",q->fft_order);
@@ -1843,7 +1845,6 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
}
s->fft_order = av_log2(s->fft_size) + 1;
- s->fft_frame_size = 2 * s->fft_size; // complex has two floats
// something like max decodable tones
s->group_order = av_log2(s->group_size) + 1;