From cf8c93ada4a7643425636ab5c3914c777fc1120f Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Mon, 27 Aug 2012 12:01:16 -0400 Subject: 8svx: use planar sample format --- libavcodec/8svx.c | 51 +++++++++++++++++++++++---------------------------- 1 file changed, 23 insertions(+), 28 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c index 328fc65b41..1839617b96 100644 --- a/libavcodec/8svx.c +++ b/libavcodec/8svx.c @@ -58,30 +58,25 @@ static const int8_t exponential[16] = { -128, -64, -32, -16, -8, -4, -2, -1, * @param[in,out] state starting value. it is saved for use in the next call. */ static void delta_decode(uint8_t *dst, const uint8_t *src, int src_size, - uint8_t *state, const int8_t *table, int channels) + uint8_t *state, const int8_t *table) { uint8_t val = *state; while (src_size--) { uint8_t d = *src++; val = av_clip_uint8(val + table[d & 0xF]); - *dst = val; - dst += channels; + *dst++ = val; val = av_clip_uint8(val + table[d >> 4]); - *dst = val; - dst += channels; + *dst++ = val; } *state = val; } -static void raw_decode(uint8_t *dst, const int8_t *src, int src_size, - int channels) +static void raw_decode(uint8_t *dst, const int8_t *src, int src_size) { - while (src_size--) { - *dst = *src++ + 128; - dst += channels; - } + while (src_size--) + *dst++ = *src++ + 128; } /** decode a frame */ @@ -90,8 +85,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, { EightSvxContext *esc = avctx->priv_data; int buf_size; - uint8_t *out_data; - int ret; + int ch, ret; int is_compr = (avctx->codec_id != AV_CODEC_ID_PCM_S8_PLANAR); /* for the first packet, copy data to buffer */ @@ -146,22 +140,17 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } - out_data = esc->frame.data[0]; - - if (is_compr) { - delta_decode(out_data, &esc->data[0][esc->data_idx], buf_size, - &esc->fib_acc[0], esc->table, avctx->channels); - if (avctx->channels == 2) { - delta_decode(&out_data[1], &esc->data[1][esc->data_idx], buf_size, - &esc->fib_acc[1], esc->table, avctx->channels); - } - } else { - int ch; - for (ch = 0; ch < avctx->channels; ch++) { - raw_decode((int8_t *)&out_data[ch], &esc->data[ch][esc->data_idx], - buf_size, avctx->channels); + + for (ch = 0; ch < avctx->channels; ch++) { + if (is_compr) { + delta_decode(esc->frame.data[ch], &esc->data[ch][esc->data_idx], + buf_size, &esc->fib_acc[ch], esc->table); + } else { + raw_decode(esc->frame.data[ch], &esc->data[ch][esc->data_idx], + buf_size); } } + esc->data_idx += buf_size; *got_frame_ptr = 1; @@ -192,7 +181,7 @@ static av_cold int eightsvx_decode_init(AVCodecContext *avctx) default: return -1; } - avctx->sample_fmt = AV_SAMPLE_FMT_U8; + avctx->sample_fmt = AV_SAMPLE_FMT_U8P; avcodec_get_frame_defaults(&esc->frame); avctx->coded_frame = &esc->frame; @@ -220,6 +209,8 @@ AVCodec ff_eightsvx_fib_decoder = { .decode = eightsvx_decode_frame, .capabilities = CODEC_CAP_DELAY | CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("8SVX fibonacci"), + .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P, + AV_SAMPLE_FMT_NONE }, }; AVCodec ff_eightsvx_exp_decoder = { @@ -232,6 +223,8 @@ AVCodec ff_eightsvx_exp_decoder = { .decode = eightsvx_decode_frame, .capabilities = CODEC_CAP_DELAY | CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("8SVX exponential"), + .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P, + AV_SAMPLE_FMT_NONE }, }; AVCodec ff_pcm_s8_planar_decoder = { @@ -244,4 +237,6 @@ AVCodec ff_pcm_s8_planar_decoder = { .decode = eightsvx_decode_frame, .capabilities = CODEC_CAP_DELAY | CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("PCM signed 8-bit planar"), + .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P, + AV_SAMPLE_FMT_NONE }, }; -- cgit v1.2.3 From 461ba7e97a89ab3e553b0690ce8f87f9f484bf90 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sat, 25 Aug 2012 19:23:55 -0400 Subject: apedec: output in planar sample format --- libavcodec/apedec.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index 59179032cb..9d2941ce15 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -196,13 +196,13 @@ static av_cold int ape_decode_init(AVCodecContext *avctx) s->bps = avctx->bits_per_coded_sample; switch (s->bps) { case 8: - avctx->sample_fmt = AV_SAMPLE_FMT_U8; + avctx->sample_fmt = AV_SAMPLE_FMT_U8P; break; case 16: - avctx->sample_fmt = AV_SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16P; break; case 24: - avctx->sample_fmt = AV_SAMPLE_FMT_S32; + avctx->sample_fmt = AV_SAMPLE_FMT_S32P; break; default: av_log_ask_for_sample(avctx, "Unsupported bits per coded sample %d\n", @@ -830,7 +830,7 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data, uint8_t *sample8; int16_t *sample16; int32_t *sample24; - int i, ret; + int i, ch, ret; int blockstodecode; int bytes_used = 0; @@ -930,27 +930,24 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data, switch (s->bps) { case 8: - sample8 = (uint8_t *)s->frame.data[0]; - for (i = 0; i < blockstodecode; i++) { - *sample8++ = (s->decoded[0][i] + 0x80) & 0xff; - if (s->channels == 2) - *sample8++ = (s->decoded[1][i] + 0x80) & 0xff; + for (ch = 0; ch < s->channels; ch++) { + sample8 = (uint8_t *)s->frame.data[ch]; + for (i = 0; i < blockstodecode; i++) + *sample8++ = (s->decoded[ch][i] + 0x80) & 0xff; } break; case 16: - sample16 = (int16_t *)s->frame.data[0]; - for (i = 0; i < blockstodecode; i++) { - *sample16++ = s->decoded[0][i]; - if (s->channels == 2) - *sample16++ = s->decoded[1][i]; + for (ch = 0; ch < s->channels; ch++) { + sample16 = (int16_t *)s->frame.data[ch]; + for (i = 0; i < blockstodecode; i++) + *sample16++ = s->decoded[ch][i]; } break; case 24: - sample24 = (int32_t *)s->frame.data[0]; - for (i = 0; i < blockstodecode; i++) { - *sample24++ = s->decoded[0][i] << 8; - if (s->channels == 2) - *sample24++ = s->decoded[1][i] << 8; + for (ch = 0; ch < s->channels; ch++) { + sample24 = (int32_t *)s->frame.data[ch]; + for (i = 0; i < blockstodecode; i++) + *sample24++ = s->decoded[ch][i] << 8; } break; } @@ -995,5 +992,9 @@ AVCodec ff_ape_decoder = { .capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DELAY | CODEC_CAP_DR1, .flush = ape_flush, .long_name = NULL_IF_CONFIG_SMALL("Monkey's Audio"), + .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P, + AV_SAMPLE_FMT_S16P, + AV_SAMPLE_FMT_S32P, + AV_SAMPLE_FMT_NONE }, .priv_class = &ape_decoder_class, }; -- cgit v1.2.3 From 9af4eaa8ea03ee8474ec4ad5cf94bfccc954641a Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sun, 26 Aug 2012 12:48:07 -0400 Subject: atrac3: use float planar sample format --- libavcodec/atrac3.c | 44 +++++++------------------------------------- 1 file changed, 7 insertions(+), 37 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index a09007c20f..94b355a362 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -111,7 +111,6 @@ typedef struct { //@} //@{ /** data buffers */ - float *outSamples[2]; uint8_t* decoded_bytes_buffer; float tempBuf[1070]; //@} @@ -197,7 +196,7 @@ static int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes){ } -static av_cold int init_atrac3_transforms(ATRAC3Context *q, int is_float) { +static av_cold int init_atrac3_transforms(ATRAC3Context *q) { float enc_window[256]; int i; @@ -213,7 +212,7 @@ static av_cold int init_atrac3_transforms(ATRAC3Context *q, int is_float) { } /* Initialize the MDCT transform. */ - return ff_mdct_init(&q->mdct_ctx, 9, 1, is_float ? 1.0 / 32768 : 1.0); + return ff_mdct_init(&q->mdct_ctx, 9, 1, 1.0 / 32768); } /** @@ -226,7 +225,6 @@ static av_cold int atrac3_decode_close(AVCodecContext *avctx) av_free(q->pUnits); av_free(q->decoded_bytes_buffer); - av_freep(&q->outSamples[0]); ff_mdct_end(&q->mdct_ctx); @@ -837,8 +835,6 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void *data, ATRAC3Context *q = avctx->priv_data; int result; const uint8_t* databuf; - float *samples_flt; - int16_t *samples_s16; if (buf_size < avctx->block_align) { av_log(avctx, AV_LOG_ERROR, @@ -852,8 +848,6 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void *data, av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return result; } - samples_flt = (float *)q->frame.data[0]; - samples_s16 = (int16_t *)q->frame.data[0]; /* Check if we need to descramble and what buffer to pass on. */ if (q->scrambled_stream) { @@ -863,27 +857,13 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void *data, databuf = buf; } - if (q->channels == 1 && avctx->sample_fmt == AV_SAMPLE_FMT_FLT) - result = decodeFrame(q, databuf, &samples_flt); - else - result = decodeFrame(q, databuf, q->outSamples); + result = decodeFrame(q, databuf, (float **)q->frame.extended_data); if (result != 0) { av_log(NULL,AV_LOG_ERROR,"Frame decoding error!\n"); return result; } - /* interleave */ - if (q->channels == 2 && avctx->sample_fmt == AV_SAMPLE_FMT_FLT) { - q->fmt_conv.float_interleave(samples_flt, - (const float **)q->outSamples, - SAMPLES_PER_FRAME, 2); - } else if (avctx->sample_fmt == AV_SAMPLE_FMT_S16) { - q->fmt_conv.float_to_int16_interleave(samples_s16, - (const float **)q->outSamples, - SAMPLES_PER_FRAME, q->channels); - } - *got_frame_ptr = 1; *(AVFrame *)data = q->frame; @@ -1005,12 +985,9 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) vlcs_initialized = 1; } - if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT) - avctx->sample_fmt = AV_SAMPLE_FMT_FLT; - else - avctx->sample_fmt = AV_SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; - if ((ret = init_atrac3_transforms(q, avctx->sample_fmt == AV_SAMPLE_FMT_FLT))) { + if ((ret = init_atrac3_transforms(q))) { av_log(avctx, AV_LOG_ERROR, "Error initializing MDCT\n"); av_freep(&q->decoded_bytes_buffer); return ret; @@ -1048,15 +1025,6 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); } - if (avctx->channels > 1 || avctx->sample_fmt == AV_SAMPLE_FMT_S16) { - q->outSamples[0] = av_mallocz(SAMPLES_PER_FRAME * avctx->channels * sizeof(*q->outSamples[0])); - q->outSamples[1] = q->outSamples[0] + SAMPLES_PER_FRAME; - if (!q->outSamples[0]) { - atrac3_decode_close(avctx); - return AVERROR(ENOMEM); - } - } - avcodec_get_frame_defaults(&q->frame); avctx->coded_frame = &q->frame; @@ -1075,4 +1043,6 @@ AVCodec ff_atrac3_decoder = .decode = atrac3_decode_frame, .capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Atrac 3 (Adaptive TRansform Acoustic Coding 3)"), + .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, + AV_SAMPLE_FMT_NONE }, }; -- cgit v1.2.3 From cbf6ee78236659e2ef2c7b0d0b17c270dddfb37c Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Mon, 27 Aug 2012 10:38:36 -0400 Subject: cook: use planar sample format --- libavcodec/cook.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 1dec398748..c5b17f98da 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -119,9 +119,10 @@ typedef struct cook { void (*interpolate)(struct cook *q, float *buffer, int gain_index, int gain_index_next); - void (*saturate_output)(struct cook *q, int chan, float *out); + void (*saturate_output)(struct cook *q, float *out); AVCodecContext* avctx; + DSPContext dsp; AVFrame frame; GetBitContext gb; /* stream data */ @@ -876,18 +877,15 @@ static inline void decode_bytes_and_gain(COOKContext *q, COOKSubpacket *p, * Saturate the output signal and interleave. * * @param q pointer to the COOKContext - * @param chan channel to saturate * @param out pointer to the output vector */ -static void saturate_output_float(COOKContext *q, int chan, float *out) +static void saturate_output_float(COOKContext *q, float *out) { - int j; - float *output = q->mono_mdct_output + q->samples_per_channel; - for (j = 0; j < q->samples_per_channel; j++) { - out[chan + q->nb_channels * j] = av_clipf(output[j], -1.0, 1.0); - } + q->dsp.vector_clipf(out, q->mono_mdct_output + q->samples_per_channel, + -1.0f, 1.0f, FFALIGN(q->samples_per_channel, 8)); } + /** * Final part of subpacket decoding: * Apply modulated lapped transform, gain compensation, @@ -898,15 +896,14 @@ static void saturate_output_float(COOKContext *q, int chan, float *out) * @param gains_ptr array of current/prev gain pointers * @param previous_buffer pointer to the previous buffer to be used for overlapping * @param out pointer to the output buffer - * @param chan 0: left or single channel, 1: right channel */ static inline void mlt_compensate_output(COOKContext *q, float *decode_buffer, cook_gains *gains_ptr, float *previous_buffer, - float *out, int chan) + float *out) { imlt_gain(q, decode_buffer, gains_ptr, previous_buffer); if (out) - q->saturate_output(q, chan, out); + q->saturate_output(q, out); } @@ -919,7 +916,7 @@ static inline void mlt_compensate_output(COOKContext *q, float *decode_buffer, * @param outbuffer pointer to the outbuffer */ static int decode_subpacket(COOKContext *q, COOKSubpacket *p, - const uint8_t *inbuffer, float *outbuffer) + const uint8_t *inbuffer, float **outbuffer) { int sub_packet_size = p->size; int res; @@ -942,15 +939,18 @@ static int decode_subpacket(COOKContext *q, COOKSubpacket *p, } mlt_compensate_output(q, q->decode_buffer_1, &p->gains1, - p->mono_previous_buffer1, outbuffer, p->ch_idx); + p->mono_previous_buffer1, + outbuffer ? outbuffer[p->ch_idx] : NULL); if (p->num_channels == 2) if (p->joint_stereo) mlt_compensate_output(q, q->decode_buffer_2, &p->gains1, - p->mono_previous_buffer2, outbuffer, p->ch_idx + 1); + p->mono_previous_buffer2, + outbuffer ? outbuffer[p->ch_idx + 1] : NULL); else mlt_compensate_output(q, q->decode_buffer_2, &p->gains2, - p->mono_previous_buffer2, outbuffer, p->ch_idx + 1); + p->mono_previous_buffer2, + outbuffer ? outbuffer[p->ch_idx + 1] : NULL); return 0; } @@ -967,7 +967,7 @@ static int cook_decode_frame(AVCodecContext *avctx, void *data, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; COOKContext *q = avctx->priv_data; - float *samples = NULL; + float **samples = NULL; int i, ret; int offset = 0; int chidx = 0; @@ -982,7 +982,7 @@ static int cook_decode_frame(AVCodecContext *avctx, void *data, av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } - samples = (float *) q->frame.data[0]; + samples = (float **)q->frame.extended_data; } /* estimate subpacket sizes */ @@ -1099,6 +1099,8 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) /* Initialize RNG. */ av_lfg_init(&q->random_state, 0); + ff_dsputil_init(&q->dsp, avctx); + while (edata_ptr < edata_ptr_end) { /* 8 for mono, 16 for stereo, ? for multichannel Swap to right endianness so we don't need to care later on. */ @@ -1274,7 +1276,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) return AVERROR_PATCHWELCOME; } - avctx->sample_fmt = AV_SAMPLE_FMT_FLT; + avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; if (channel_mask) avctx->channel_layout = channel_mask; else @@ -1299,4 +1301,6 @@ AVCodec ff_cook_decoder = { .decode = cook_decode_frame, .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Cook / Cooker / Gecko (RealAudio G2)"), + .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, + AV_SAMPLE_FMT_NONE }, }; -- cgit v1.2.3 From 64c312aa297b40bccee607574cfdfa8d14abe9ba Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Mon, 27 Aug 2012 11:43:34 -0400 Subject: dcadec: use float planar sample format --- libavcodec/dcadec.c | 119 ++++++++++++++++++++++------------------------------ 1 file changed, 49 insertions(+), 70 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c index a0a5ea948d..d38dff81b3 100644 --- a/libavcodec/dcadec.c +++ b/libavcodec/dcadec.c @@ -354,11 +354,9 @@ typedef struct { DECLARE_ALIGNED(32, float, raXin)[32]; int output; ///< type of output - float scale_bias; ///< output scale DECLARE_ALIGNED(32, float, subband_samples)[DCA_BLOCKS_MAX][DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][8]; - DECLARE_ALIGNED(32, float, samples)[(DCA_PRIM_CHANNELS_MAX + 1) * 256]; - const float *samples_chanptr[DCA_PRIM_CHANNELS_MAX + 1]; + float *samples_chanptr[DCA_PRIM_CHANNELS_MAX + 1]; uint8_t dca_buffer[DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE + DCA_BUFFER_PADDING_SIZE]; int dca_buffer_size; ///< how much data is in the dca_buffer @@ -1007,20 +1005,20 @@ static void lfe_interpolation_fir(DCAContext *s, int decimation_select, } /* downmixing routines */ -#define MIX_REAR1(samples, si1, rs, coef) \ - samples[i] += samples[si1] * coef[rs][0]; \ - samples[i+256] += samples[si1] * coef[rs][1]; +#define MIX_REAR1(samples, s1, rs, coef) \ + samples[0][i] += samples[s1][i] * coef[rs][0]; \ + samples[1][i] += samples[s1][i] * coef[rs][1]; -#define MIX_REAR2(samples, si1, si2, rs, coef) \ - samples[i] += samples[si1] * coef[rs][0] + samples[si2] * coef[rs + 1][0]; \ - samples[i+256] += samples[si1] * coef[rs][1] + samples[si2] * coef[rs + 1][1]; +#define MIX_REAR2(samples, s1, s2, rs, coef) \ + samples[0][i] += samples[s1][i] * coef[rs][0] + samples[s2][i] * coef[rs + 1][0]; \ + samples[1][i] += samples[s1][i] * coef[rs][1] + samples[s2][i] * coef[rs + 1][1]; #define MIX_FRONT3(samples, coef) \ - t = samples[i + c]; \ - u = samples[i + l]; \ - v = samples[i + r]; \ - samples[i] = t * coef[0][0] + u * coef[1][0] + v * coef[2][0]; \ - samples[i+256] = t * coef[0][1] + u * coef[1][1] + v * coef[2][1]; + t = samples[c][i]; \ + u = samples[l][i]; \ + v = samples[r][i]; \ + samples[0][i] = t * coef[0][0] + u * coef[1][0] + v * coef[2][0]; \ + samples[1][i] = t * coef[0][1] + u * coef[1][1] + v * coef[2][1]; #define DOWNMIX_TO_STEREO(op1, op2) \ for (i = 0; i < 256; i++) { \ @@ -1028,7 +1026,7 @@ static void lfe_interpolation_fir(DCAContext *s, int decimation_select, op2 \ } -static void dca_downmix(float *samples, int srcfmt, +static void dca_downmix(float **samples, int srcfmt, int downmix_coef[DCA_PRIM_CHANNELS_MAX][2], const int8_t *channel_mapping) { @@ -1053,36 +1051,36 @@ static void dca_downmix(float *samples, int srcfmt, case DCA_STEREO: break; case DCA_3F: - c = channel_mapping[0] * 256; - l = channel_mapping[1] * 256; - r = channel_mapping[2] * 256; + c = channel_mapping[0]; + l = channel_mapping[1]; + r = channel_mapping[2]; DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef), ); break; case DCA_2F1R: - s = channel_mapping[2] * 256; - DOWNMIX_TO_STEREO(MIX_REAR1(samples, i + s, 2, coef), ); + s = channel_mapping[2]; + DOWNMIX_TO_STEREO(MIX_REAR1(samples, s, 2, coef), ); break; case DCA_3F1R: - c = channel_mapping[0] * 256; - l = channel_mapping[1] * 256; - r = channel_mapping[2] * 256; - s = channel_mapping[3] * 256; + c = channel_mapping[0]; + l = channel_mapping[1]; + r = channel_mapping[2]; + s = channel_mapping[3]; DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef), - MIX_REAR1(samples, i + s, 3, coef)); + MIX_REAR1(samples, s, 3, coef)); break; case DCA_2F2R: - sl = channel_mapping[2] * 256; - sr = channel_mapping[3] * 256; - DOWNMIX_TO_STEREO(MIX_REAR2(samples, i + sl, i + sr, 2, coef), ); + sl = channel_mapping[2]; + sr = channel_mapping[3]; + DOWNMIX_TO_STEREO(MIX_REAR2(samples, sl, sr, 2, coef), ); break; case DCA_3F2R: - c = channel_mapping[0] * 256; - l = channel_mapping[1] * 256; - r = channel_mapping[2] * 256; - sl = channel_mapping[3] * 256; - sr = channel_mapping[4] * 256; + c = channel_mapping[0]; + l = channel_mapping[1]; + r = channel_mapping[2]; + sl = channel_mapping[3]; + sr = channel_mapping[4]; DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef), - MIX_REAR2(samples, i + sl, i + sr, 3, coef)); + MIX_REAR2(samples, sl, sr, 3, coef)); break; } } @@ -1279,21 +1277,21 @@ static int dca_filter_channels(DCAContext *s, int block_index) /* static float pcm_to_double[8] = { 32768.0, 32768.0, 524288.0, 524288.0, 0, 8388608.0, 8388608.0 };*/ qmf_32_subbands(s, k, subband_samples[k], - &s->samples[256 * s->channel_order_tab[k]], - M_SQRT1_2 * s->scale_bias /* pcm_to_double[s->source_pcm_res] */); + s->samples_chanptr[s->channel_order_tab[k]], + M_SQRT1_2 / 32768.0 /* pcm_to_double[s->source_pcm_res] */); } /* Down mixing */ if (s->avctx->request_channels == 2 && s->prim_channels > 2) { - dca_downmix(s->samples, s->amode, s->downmix_coef, s->channel_order_tab); + dca_downmix(s->samples_chanptr, s->amode, s->downmix_coef, s->channel_order_tab); } /* Generate LFE samples for this subsubframe FIXME!!! */ if (s->output & DCA_LFE) { lfe_interpolation_fir(s, s->lfe, 2 * s->lfe, s->lfe_data + 2 * s->lfe * (block_index + 4), - &s->samples[256 * dca_lfe_index[s->amode]], - (1.0 / 256.0) * s->scale_bias); + s->samples_chanptr[dca_lfe_index[s->amode]], + 1.0 / (256.0 * 32768.0)); /* Outputs 20bits pcm samples */ } @@ -1656,8 +1654,7 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data, int lfe_samples; int num_core_channels = 0; int i, ret; - float *samples_flt; - int16_t *samples_s16; + float **samples_flt; DCAContext *s = avctx->priv_data; int channels; int core_ss_end; @@ -1853,33 +1850,26 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data, av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } - samples_flt = (float *) s->frame.data[0]; - samples_s16 = (int16_t *) s->frame.data[0]; + samples_flt = (float **) s->frame.extended_data; /* filter to get final output */ for (i = 0; i < (s->sample_blocks / 8); i++) { + int ch; + + for (ch = 0; ch < channels; ch++) + s->samples_chanptr[ch] = samples_flt[ch] + i * 256; + dca_filter_channels(s, i); /* If this was marked as a DTS-ES stream we need to subtract back- */ /* channel from SL & SR to remove matrixed back-channel signal */ if ((s->source_pcm_res & 1) && s->xch_present) { - float *back_chan = s->samples + s->channel_order_tab[s->xch_base_channel] * 256; - float *lt_chan = s->samples + s->channel_order_tab[s->xch_base_channel - 2] * 256; - float *rt_chan = s->samples + s->channel_order_tab[s->xch_base_channel - 1] * 256; + float *back_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel]]; + float *lt_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel - 2]]; + float *rt_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel - 1]]; s->fdsp.vector_fmac_scalar(lt_chan, back_chan, -M_SQRT1_2, 256); s->fdsp.vector_fmac_scalar(rt_chan, back_chan, -M_SQRT1_2, 256); } - - if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT) { - s->fmt_conv.float_interleave(samples_flt, s->samples_chanptr, 256, - channels); - samples_flt += 256 * channels; - } else { - s->fmt_conv.float_to_int16_interleave(samples_s16, - s->samples_chanptr, 256, - channels); - samples_s16 += 256 * channels; - } } /* update lfe history */ @@ -1904,7 +1894,6 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data, static av_cold int dca_decode_init(AVCodecContext *avctx) { DCAContext *s = avctx->priv_data; - int i; s->avctx = avctx; dca_init_vlcs(); @@ -1915,16 +1904,7 @@ static av_cold int dca_decode_init(AVCodecContext *avctx) ff_dcadsp_init(&s->dcadsp); ff_fmt_convert_init(&s->fmt_conv, avctx); - for (i = 0; i < DCA_PRIM_CHANNELS_MAX + 1; i++) - s->samples_chanptr[i] = s->samples + i * 256; - - if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT) { - avctx->sample_fmt = AV_SAMPLE_FMT_FLT; - s->scale_bias = 1.0 / 32768.0; - } else { - avctx->sample_fmt = AV_SAMPLE_FMT_S16; - s->scale_bias = 1.0; - } + avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; /* allow downmixing to stereo */ if (avctx->channels > 0 && avctx->request_channels < avctx->channels && @@ -1964,8 +1944,7 @@ AVCodec ff_dca_decoder = { .close = dca_decode_end, .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"), .capabilities = CODEC_CAP_CHANNEL_CONF | CODEC_CAP_DR1, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT, - AV_SAMPLE_FMT_S16, + .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }, .profiles = NULL_IF_CONFIG_SMALL(profiles), }; -- cgit v1.2.3 From 3fca0d72105a607926adea702065b1a00adb0b5d Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Mon, 27 Aug 2012 12:58:25 -0400 Subject: iac/imc: use planar sample format --- libavcodec/imc.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/imc.c b/libavcodec/imc.c index 8e6b5bfb31..1156e8aac2 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -241,7 +241,7 @@ static av_cold int imc_decode_init(AVCodecContext *avctx) return ret; } ff_dsputil_init(&q->dsp, avctx); - avctx->sample_fmt = AV_SAMPLE_FMT_FLT; + avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; @@ -661,7 +661,7 @@ static void imc_imdct256(IMCContext *q, IMCChannel *chctx, int channels) int i; float re, im; float *dst1 = q->out_samples; - float *dst2 = q->out_samples + (COEFFS - 1) * channels; + float *dst2 = q->out_samples + (COEFFS - 1); /* prerotation */ for (i = 0; i < COEFFS / 2; i++) { @@ -683,8 +683,8 @@ static void imc_imdct256(IMCContext *q, IMCChannel *chctx, int channels) + (q->mdct_sine_window[i * 2] * re); *dst2 = (q->mdct_sine_window[i * 2] * chctx->last_fft_im[i]) - (q->mdct_sine_window[COEFFS - 1 - i * 2] * re); - dst1 += channels * 2; - dst2 -= channels * 2; + dst1 += 2; + dst2 -= 2; chctx->last_fft_im[i] = im; } } @@ -785,7 +785,6 @@ static int imc_decode_block(AVCodecContext *avctx, IMCContext *q, int ch) chctx->decoder_reset = 1; if (chctx->decoder_reset) { - memset(q->out_samples, 0, COEFFS * sizeof(*q->out_samples)); for (i = 0; i < BANDS; i++) chctx->old_floor[i] = 1.0; for (i = 0; i < COEFFS; i++) @@ -944,7 +943,7 @@ static int imc_decode_frame(AVCodecContext *avctx, void *data, } for (i = 0; i < avctx->channels; i++) { - q->out_samples = (float*)q->frame.data[0] + i; + q->out_samples = (float *)q->frame.extended_data[i]; q->dsp.bswap16_buf(buf16, (const uint16_t*)buf, IMC_BLOCK_SIZE / 2); @@ -957,15 +956,8 @@ static int imc_decode_frame(AVCodecContext *avctx, void *data, } if (avctx->channels == 2) { - float *src = (float*)q->frame.data[0], t1, t2; - - for (i = 0; i < COEFFS; i++) { - t1 = src[0]; - t2 = src[1]; - src[0] = t1 + t2; - src[1] = t1 - t2; - src += 2; - } + q->dsp.butterflies_float((float *)q->frame.extended_data[0], + (float *)q->frame.extended_data[1], COEFFS); } *got_frame_ptr = 1; @@ -995,6 +987,8 @@ AVCodec ff_imc_decoder = { .decode = imc_decode_frame, .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("IMC (Intel Music Coder)"), + .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, + AV_SAMPLE_FMT_NONE }, }; AVCodec ff_iac_decoder = { @@ -1007,4 +1001,6 @@ AVCodec ff_iac_decoder = { .decode = imc_decode_frame, .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("IAC (Indeo Audio Coder)"), + .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, + AV_SAMPLE_FMT_NONE }, }; -- cgit v1.2.3 From 1a3459033dc94d3f6e1b7e7c4de227fda369f2bf Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 28 Aug 2012 09:11:45 -0400 Subject: mpc7/8: use planar sample format --- libavcodec/mpc.c | 14 +++++--------- libavcodec/mpc.h | 2 +- libavcodec/mpc7.c | 6 ++++-- libavcodec/mpc8.c | 7 +++++-- 4 files changed, 15 insertions(+), 14 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/mpc.c b/libavcodec/mpc.c index 6b15a33e5a..5a54a9bad9 100644 --- a/libavcodec/mpc.c +++ b/libavcodec/mpc.c @@ -43,28 +43,24 @@ void ff_mpc_init(void) /** * Process decoded Musepack data and produce PCM */ -static void mpc_synth(MPCContext *c, int16_t *out, int channels) +static void mpc_synth(MPCContext *c, int16_t **out, int channels) { int dither_state = 0; int i, ch; - OUT_INT samples[MPA_MAX_CHANNELS * MPA_FRAME_SIZE], *samples_ptr; for(ch = 0; ch < channels; ch++){ - samples_ptr = samples + ch; for(i = 0; i < SAMPLES_PER_BAND; i++) { ff_mpa_synth_filter_fixed(&c->mpadsp, c->synth_buf[ch], &(c->synth_buf_offset[ch]), ff_mpa_synth_window_fixed, &dither_state, - samples_ptr, channels, + out[ch] + 32 * i, 1, c->sb_samples[ch][i]); - samples_ptr += 32 * channels; } } - for(i = 0; i < MPC_FRAME_SIZE*channels; i++) - *out++=samples[i]; } -void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data, int channels) +void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, int16_t **out, + int channels) { int i, j, ch; Band *bands = c->bands; @@ -100,5 +96,5 @@ void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data, int ch } } - mpc_synth(c, data, channels); + mpc_synth(c, out, channels); } diff --git a/libavcodec/mpc.h b/libavcodec/mpc.h index 1a6e7943af..2ee3c6d416 100644 --- a/libavcodec/mpc.h +++ b/libavcodec/mpc.h @@ -73,6 +73,6 @@ typedef struct { } MPCContext; void ff_mpc_init(void); -void ff_mpc_dequantize_and_synth(MPCContext *c, int maxband, void *dst, int channels); +void ff_mpc_dequantize_and_synth(MPCContext *c, int maxband, int16_t **out, int channels); #endif /* AVCODEC_MPC_H */ diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c index 0d7e9dfc28..b013eeb3d5 100644 --- a/libavcodec/mpc7.c +++ b/libavcodec/mpc7.c @@ -94,7 +94,7 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx) c->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands); c->frames_to_skip = 0; - avctx->sample_fmt = AV_SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16P; avctx->channel_layout = AV_CH_LAYOUT_STEREO; if(vlc_initialized) return 0; @@ -293,7 +293,7 @@ static int mpc7_decode_frame(AVCodecContext * avctx, void *data, for(ch = 0; ch < 2; ch++) idx_to_quant(c, &gb, bands[i].res[ch], c->Q[ch] + off); - ff_mpc_dequantize_and_synth(c, mb, c->frame.data[0], 2); + ff_mpc_dequantize_and_synth(c, mb, (int16_t **)c->frame.extended_data, 2); bits_used = get_bits_count(&gb); bits_avail = buf_size * 8; @@ -340,4 +340,6 @@ AVCodec ff_mpc7_decoder = { .flush = mpc7_decode_flush, .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Musepack SV7"), + .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P, + AV_SAMPLE_FMT_NONE }, }; diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c index 79225c4275..91e228b07c 100644 --- a/libavcodec/mpc8.c +++ b/libavcodec/mpc8.c @@ -135,7 +135,7 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx) c->MSS = get_bits1(&gb); c->frames = 1 << (get_bits(&gb, 3) * 2); - avctx->sample_fmt = AV_SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16P; avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; if(vlc_initialized) return 0; @@ -405,7 +405,8 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data, } } - ff_mpc_dequantize_and_synth(c, maxband - 1, c->frame.data[0], + ff_mpc_dequantize_and_synth(c, maxband - 1, + (int16_t **)c->frame.extended_data, avctx->channels); c->cur_frame++; @@ -438,4 +439,6 @@ AVCodec ff_mpc8_decoder = { .flush = mpc8_decode_flush, .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Musepack SV8"), + .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P, + AV_SAMPLE_FMT_NONE }, }; -- cgit v1.2.3 From a34be78546d23e3dda05ef2e04d8f2345bc6eb94 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 28 Aug 2012 13:04:49 -0400 Subject: ralf: use planar sample format --- libavcodec/ralf.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/ralf.c b/libavcodec/ralf.c index 6866f79609..3244424f74 100644 --- a/libavcodec/ralf.c +++ b/libavcodec/ralf.c @@ -149,7 +149,7 @@ static av_cold int decode_init(AVCodecContext *avctx) avctx->sample_rate, avctx->channels); return AVERROR_INVALIDDATA; } - avctx->sample_fmt = AV_SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16P; avctx->channel_layout = (avctx->channels == 2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; @@ -338,7 +338,8 @@ static void apply_lpc(RALFContext *ctx, int ch, int length, int bits) } } -static int decode_block(AVCodecContext *avctx, GetBitContext *gb, int16_t *dst) +static int decode_block(AVCodecContext *avctx, GetBitContext *gb, + int16_t *dst0, int16_t *dst1) { RALFContext *ctx = avctx->priv_data; int len, ch, ret; @@ -382,35 +383,35 @@ static int decode_block(AVCodecContext *avctx, GetBitContext *gb, int16_t *dst) switch (dmode) { case 0: for (i = 0; i < len; i++) - *dst++ = ch0[i] + ctx->bias[0]; + dst0[i] = ch0[i] + ctx->bias[0]; break; case 1: for (i = 0; i < len; i++) { - *dst++ = ch0[i] + ctx->bias[0]; - *dst++ = ch1[i] + ctx->bias[1]; + dst0[i] = ch0[i] + ctx->bias[0]; + dst1[i] = ch1[i] + ctx->bias[1]; } break; case 2: for (i = 0; i < len; i++) { ch0[i] += ctx->bias[0]; - *dst++ = ch0[i]; - *dst++ = ch0[i] - (ch1[i] + ctx->bias[1]); + dst0[i] = ch0[i]; + dst1[i] = ch0[i] - (ch1[i] + ctx->bias[1]); } break; case 3: for (i = 0; i < len; i++) { t = ch0[i] + ctx->bias[0]; t2 = ch1[i] + ctx->bias[1]; - *dst++ = t + t2; - *dst++ = t; + dst0[i] = t + t2; + dst1[i] = t; } break; case 4: for (i = 0; i < len; i++) { t = ch1[i] + ctx->bias[1]; t2 = ((ch0[i] + ctx->bias[0]) << 1) | (t & 1); - *dst++ = (t2 + t) / 2; - *dst++ = (t2 - t) / 2; + dst0[i] = (t2 + t) / 2; + dst1[i] = (t2 - t) / 2; } break; } @@ -424,7 +425,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { RALFContext *ctx = avctx->priv_data; - int16_t *samples; + int16_t *samples0; + int16_t *samples1; int ret; GetBitContext gb; int table_size, table_bytes, i; @@ -465,7 +467,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, av_log(avctx, AV_LOG_ERROR, "Me fail get_buffer()? That's unpossible!\n"); return ret; } - samples = (int16_t*)ctx->frame.data[0]; + samples0 = (int16_t *)ctx->frame.data[0]; + samples1 = (int16_t *)ctx->frame.data[1]; if (src_size < 5) { av_log(avctx, AV_LOG_ERROR, "too short packets are too short!\n"); @@ -498,8 +501,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, break; } init_get_bits(&gb, block_pointer, ctx->block_size[i] * 8); - if (decode_block(avctx, &gb, samples + ctx->sample_offset - * avctx->channels) < 0) { + if (decode_block(avctx, &gb, samples0 + ctx->sample_offset, + samples1 + ctx->sample_offset) < 0) { av_log(avctx, AV_LOG_ERROR, "Sir, I got carsick in your office. Not decoding the rest of packet.\n"); break; } @@ -533,4 +536,6 @@ AVCodec ff_ralf_decoder = { .flush = decode_flush, .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("RealAudio Lossless"), + .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P, + AV_SAMPLE_FMT_NONE }, }; -- cgit v1.2.3 From 1478a3601e450f2044103e6e3449105957b25eac Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 28 Aug 2012 15:29:40 -0400 Subject: twinvq: use planar sample format --- libavcodec/twinvq.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c index ab22f64734..d009196445 100644 --- a/libavcodec/twinvq.c +++ b/libavcodec/twinvq.c @@ -666,7 +666,7 @@ static void imdct_and_window(TwinContext *tctx, enum FrameType ftype, int wtype, } static void imdct_output(TwinContext *tctx, enum FrameType ftype, int wtype, - float *out) + float **out) { const ModeTab *mtab = tctx->mtab; int size1, size2; @@ -685,24 +685,15 @@ static void imdct_output(TwinContext *tctx, enum FrameType ftype, int wtype, size2 = tctx->last_block_pos[0]; size1 = mtab->size - size2; - if (tctx->avctx->channels == 2) { - tctx->dsp.butterflies_float_interleave(out, prev_buf, - &prev_buf[2*mtab->size], - size1); - - out += 2 * size1; - - tctx->dsp.butterflies_float_interleave(out, tctx->curr_frame, - &tctx->curr_frame[2*mtab->size], - size2); - } else { - memcpy(out, prev_buf, size1 * sizeof(*out)); - out += size1; + memcpy(&out[0][0 ], prev_buf, size1 * sizeof(out[0][0])); + memcpy(&out[0][size1], tctx->curr_frame, size2 * sizeof(out[0][0])); - memcpy(out, tctx->curr_frame, size2 * sizeof(*out)); + if (tctx->avctx->channels == 2) { + memcpy(&out[1][0], &prev_buf[2*mtab->size], size1 * sizeof(out[1][0])); + memcpy(&out[1][size1], &tctx->curr_frame[2*mtab->size], size2 * sizeof(out[1][0])); + tctx->dsp.butterflies_float(out[0], out[1], mtab->size); } - } static void dec_bark_env(TwinContext *tctx, const uint8_t *in, int use_hist, @@ -825,7 +816,7 @@ static int twin_decode_frame(AVCodecContext * avctx, void *data, TwinContext *tctx = avctx->priv_data; GetBitContext gb; const ModeTab *mtab = tctx->mtab; - float *out = NULL; + float **out = NULL; enum FrameType ftype; int window_type, ret; static const enum FrameType wtype_to_ftype_table[] = { @@ -846,7 +837,7 @@ static int twin_decode_frame(AVCodecContext * avctx, void *data, av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } - out = (float *)tctx->frame.data[0]; + out = (float **)tctx->frame.extended_data; } init_get_bits(&gb, buf, buf_size * 8); @@ -1119,7 +1110,7 @@ static av_cold int twin_decode_init(AVCodecContext *avctx) int isampf, ibps; tctx->avctx = avctx; - avctx->sample_fmt = AV_SAMPLE_FMT_FLT; + avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; if (!avctx->extradata || avctx->extradata_size < 12) { av_log(avctx, AV_LOG_ERROR, "Missing or incomplete extradata\n"); @@ -1184,4 +1175,6 @@ AVCodec ff_twinvq_decoder = { .decode = twin_decode_frame, .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("VQF TwinVQ"), + .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, + AV_SAMPLE_FMT_NONE }, }; -- cgit v1.2.3 From bfcd4b6a1691d20aebc6d2308424c2a88334a9f0 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Fri, 21 Sep 2012 10:33:56 -0400 Subject: adpcmdec: set AVCodec.sample_fmts --- libavcodec/adpcm.c | 60 +++++++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 28 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index a48cee2f9b..f11b899dd3 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -1265,7 +1265,10 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, } -#define ADPCM_DECODER(id_, name_, long_name_) \ +static const enum AVSampleFormat sample_fmts_s16[] = { AV_SAMPLE_FMT_S16, + AV_SAMPLE_FMT_NONE }; + +#define ADPCM_DECODER(id_, sample_fmts_, name_, long_name_) \ AVCodec ff_ ## name_ ## _decoder = { \ .name = #name_, \ .type = AVMEDIA_TYPE_AUDIO, \ @@ -1275,33 +1278,34 @@ AVCodec ff_ ## name_ ## _decoder = { \ .decode = adpcm_decode_frame, \ .capabilities = CODEC_CAP_DR1, \ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ + .sample_fmts = sample_fmts_, \ } /* Note: Do not forget to add new entries to the Makefile as well. */ -ADPCM_DECODER(AV_CODEC_ID_ADPCM_4XM, adpcm_4xm, "ADPCM 4X Movie"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_CT, adpcm_ct, "ADPCM Creative Technology"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA, adpcm_ea, "ADPCM Electronic Arts"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_MAXIS_XA, adpcm_ea_maxis_xa, "ADPCM Electronic Arts Maxis CDROM XA"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_R1, adpcm_ea_r1, "ADPCM Electronic Arts R1"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_R2, adpcm_ea_r2, "ADPCM Electronic Arts R2"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_R3, adpcm_ea_r3, "ADPCM Electronic Arts R3"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_XAS, adpcm_ea_xas, "ADPCM Electronic Arts XAS"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_AMV, adpcm_ima_amv, "ADPCM IMA AMV"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_APC, adpcm_ima_apc, "ADPCM IMA CRYO APC"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3, "ADPCM IMA Duck DK3"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4, "ADPCM IMA Duck DK4"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs, "ADPCM IMA Electronic Arts EACS"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead, "ADPCM IMA Electronic Arts SEAD"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_ISS, adpcm_ima_iss, "ADPCM IMA Funcom ISS"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt, "ADPCM IMA QuickTime"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg, "ADPCM IMA Loki SDL MJPEG"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav, "ADPCM IMA WAV"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_WS, adpcm_ima_ws, "ADPCM IMA Westwood"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_MS, adpcm_ms, "ADPCM Microsoft"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_SBPRO_2, adpcm_sbpro_2, "ADPCM Sound Blaster Pro 2-bit"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_SBPRO_3, adpcm_sbpro_3, "ADPCM Sound Blaster Pro 2.6-bit"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_SBPRO_4, adpcm_sbpro_4, "ADPCM Sound Blaster Pro 4-bit"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_SWF, adpcm_swf, "ADPCM Shockwave Flash"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_THP, adpcm_thp, "ADPCM Nintendo Gamecube THP"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_XA, adpcm_xa, "ADPCM CDROM XA"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_YAMAHA, adpcm_yamaha, "ADPCM Yamaha"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_4XM, sample_fmts_s16, adpcm_4xm, "ADPCM 4X Movie"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_CT, sample_fmts_s16, adpcm_ct, "ADPCM Creative Technology"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA, sample_fmts_s16, adpcm_ea, "ADPCM Electronic Arts"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_MAXIS_XA, sample_fmts_s16, adpcm_ea_maxis_xa, "ADPCM Electronic Arts Maxis CDROM XA"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_R1, sample_fmts_s16, adpcm_ea_r1, "ADPCM Electronic Arts R1"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_R2, sample_fmts_s16, adpcm_ea_r2, "ADPCM Electronic Arts R2"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_R3, sample_fmts_s16, adpcm_ea_r3, "ADPCM Electronic Arts R3"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_XAS, sample_fmts_s16, adpcm_ea_xas, "ADPCM Electronic Arts XAS"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_AMV, sample_fmts_s16, adpcm_ima_amv, "ADPCM IMA AMV"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_APC, sample_fmts_s16, adpcm_ima_apc, "ADPCM IMA CRYO APC"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_DK3, sample_fmts_s16, adpcm_ima_dk3, "ADPCM IMA Duck DK3"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_DK4, sample_fmts_s16, adpcm_ima_dk4, "ADPCM IMA Duck DK4"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_EA_EACS, sample_fmts_s16, adpcm_ima_ea_eacs, "ADPCM IMA Electronic Arts EACS"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_EA_SEAD, sample_fmts_s16, adpcm_ima_ea_sead, "ADPCM IMA Electronic Arts SEAD"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_ISS, sample_fmts_s16, adpcm_ima_iss, "ADPCM IMA Funcom ISS"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_QT, sample_fmts_s16, adpcm_ima_qt, "ADPCM IMA QuickTime"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_SMJPEG, sample_fmts_s16, adpcm_ima_smjpeg, "ADPCM IMA Loki SDL MJPEG"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_WAV, sample_fmts_s16, adpcm_ima_wav, "ADPCM IMA WAV"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_WS, sample_fmts_s16, adpcm_ima_ws, "ADPCM IMA Westwood"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_MS, sample_fmts_s16, adpcm_ms, "ADPCM Microsoft"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_SBPRO_2, sample_fmts_s16, adpcm_sbpro_2, "ADPCM Sound Blaster Pro 2-bit"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_SBPRO_3, sample_fmts_s16, adpcm_sbpro_3, "ADPCM Sound Blaster Pro 2.6-bit"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_SBPRO_4, sample_fmts_s16, adpcm_sbpro_4, "ADPCM Sound Blaster Pro 4-bit"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_SWF, sample_fmts_s16, adpcm_swf, "ADPCM Shockwave Flash"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_THP, sample_fmts_s16, adpcm_thp, "ADPCM Nintendo Gamecube THP"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_XA, sample_fmts_s16, adpcm_xa, "ADPCM CDROM XA"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_YAMAHA, sample_fmts_s16, adpcm_yamaha, "ADPCM Yamaha"); -- cgit v1.2.3