Add F64BE, F64LE and F64BE PCM codecs.

Originally committed as revision 14833 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Peter Ross 17 years ago
parent e06b00f3b6
commit 143a5d6f1f
  1. 3
      libavcodec/allcodecs.c
  2. 5
      libavcodec/avcodec.h
  3. 25
      libavcodec/pcm.c
  4. 9
      libavcodec/utils.c

@ -220,6 +220,9 @@ void avcodec_register_all(void)
REGISTER_ENCDEC (PCM_ALAW, pcm_alaw);
REGISTER_DECODER (PCM_DVD, pcm_dvd);
REGISTER_ENCDEC (PCM_F32BE, pcm_f32be);
REGISTER_ENCDEC (PCM_F32LE, pcm_f32le);
REGISTER_ENCDEC (PCM_F64BE, pcm_f64be);
REGISTER_ENCDEC (PCM_F64LE, pcm_f64le);
REGISTER_ENCDEC (PCM_MULAW, pcm_mulaw);
REGISTER_ENCDEC (PCM_S8, pcm_s8);
REGISTER_ENCDEC (PCM_S16BE, pcm_s16be);

@ -30,7 +30,7 @@
#include "libavutil/avutil.h"
#define LIBAVCODEC_VERSION_MAJOR 51
#define LIBAVCODEC_VERSION_MINOR 65
#define LIBAVCODEC_VERSION_MINOR 66
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@ -212,6 +212,9 @@ enum CodecID {
CODEC_ID_PCM_S16LE_PLANAR,
CODEC_ID_PCM_DVD,
CODEC_ID_PCM_F32BE,
CODEC_ID_PCM_F32LE,
CODEC_ID_PCM_F64BE,
CODEC_ID_PCM_F64LE,
/* various ADPCM codecs */
CODEC_ID_ADPCM_IMA_QT= 0x11000,

@ -158,6 +158,7 @@ static int pcm_encode_frame(AVCodecContext *avctx,
uint8_t *srcu8;
int16_t *samples_int16_t;
int32_t *samples_int32_t;
int64_t *samples_int64_t;
uint16_t *samples_uint16_t;
uint32_t *samples_uint32_t;
@ -213,16 +214,24 @@ static int pcm_encode_frame(AVCodecContext *avctx,
}
break;
#if WORDS_BIGENDIAN
case CODEC_ID_PCM_F64LE:
ENCODE(int64_t, le64, samples, dst, n, 0, 0)
break;
case CODEC_ID_PCM_S32LE:
case CODEC_ID_PCM_F32LE:
ENCODE(int32_t, le32, samples, dst, n, 0, 0)
break;
case CODEC_ID_PCM_S16LE:
ENCODE(int16_t, le16, samples, dst, n, 0, 0)
break;
case CODEC_ID_PCM_F64BE:
case CODEC_ID_PCM_F32BE:
case CODEC_ID_PCM_S32BE:
case CODEC_ID_PCM_S16BE:
#else
case CODEC_ID_PCM_F64BE:
ENCODE(int64_t, be64, samples, dst, n, 0, 0)
break;
case CODEC_ID_PCM_F32BE:
case CODEC_ID_PCM_S32BE:
ENCODE(int32_t, be32, samples, dst, n, 0, 0)
@ -230,6 +239,8 @@ static int pcm_encode_frame(AVCodecContext *avctx,
case CODEC_ID_PCM_S16BE:
ENCODE(int16_t, be16, samples, dst, n, 0, 0)
break;
case CODEC_ID_PCM_F64LE:
case CODEC_ID_PCM_F32LE:
case CODEC_ID_PCM_S32LE:
case CODEC_ID_PCM_S16LE:
#endif /* WORDS_BIGENDIAN */
@ -320,6 +331,7 @@ static int pcm_decode_frame(AVCodecContext *avctx,
uint8_t *dstu8;
int16_t *dst_int16_t;
int32_t *dst_int32_t;
int64_t *dst_int64_t;
uint16_t *dst_uint16_t;
uint32_t *dst_uint32_t;
@ -404,16 +416,24 @@ static int pcm_decode_frame(AVCodecContext *avctx,
samples= (short*)dstu8;
break;
#if WORDS_BIGENDIAN
case CODEC_ID_PCM_F64LE:
DECODE(int64_t, le64, src, samples, n, 0, 0)
break;
case CODEC_ID_PCM_S32LE:
case CODEC_ID_PCM_F32LE:
DECODE(int32_t, le32, src, samples, n, 0, 0)
break;
case CODEC_ID_PCM_S16LE:
DECODE(int16_t, le16, src, samples, n, 0, 0)
break;
case CODEC_ID_PCM_F64BE:
case CODEC_ID_PCM_F32BE:
case CODEC_ID_PCM_S32BE:
case CODEC_ID_PCM_S16BE:
#else
case CODEC_ID_PCM_F64BE:
DECODE(int64_t, be64, src, samples, n, 0, 0)
break;
case CODEC_ID_PCM_F32BE:
case CODEC_ID_PCM_S32BE:
DECODE(int32_t, be32, src, samples, n, 0, 0)
@ -421,6 +441,8 @@ static int pcm_decode_frame(AVCodecContext *avctx,
case CODEC_ID_PCM_S16BE:
DECODE(int16_t, be16, src, samples, n, 0, 0)
break;
case CODEC_ID_PCM_F64LE:
case CODEC_ID_PCM_F32LE:
case CODEC_ID_PCM_S32LE:
case CODEC_ID_PCM_S16LE:
#endif /* WORDS_BIGENDIAN */
@ -507,6 +529,9 @@ AVCodec name ## _decoder = { \
PCM_CODEC (CODEC_ID_PCM_ALAW, SAMPLE_FMT_S16, pcm_alaw, "A-law PCM");
PCM_CODEC (CODEC_ID_PCM_DVD, SAMPLE_FMT_S16, pcm_dvd, "signed 16|20|24-bit big-endian PCM");
PCM_CODEC (CODEC_ID_PCM_F32BE, SAMPLE_FMT_FLT, pcm_f32be, "32-bit floating point big-endian PCM");
PCM_CODEC (CODEC_ID_PCM_F32LE, SAMPLE_FMT_FLT, pcm_f32le, "32-bit floating point little-endian PCM");
PCM_CODEC (CODEC_ID_PCM_F64BE, SAMPLE_FMT_DBL, pcm_f64be, "64-bit floating point big-endian PCM");
PCM_CODEC (CODEC_ID_PCM_F64LE, SAMPLE_FMT_DBL, pcm_f64le, "64-bit floating point little-endian PCM");
PCM_CODEC (CODEC_ID_PCM_MULAW, SAMPLE_FMT_S16, pcm_mulaw, "mu-law PCM");
PCM_CODEC (CODEC_ID_PCM_S8, SAMPLE_FMT_U8, pcm_s8, "signed 8-bit PCM");
PCM_CODEC (CODEC_ID_PCM_S16BE, SAMPLE_FMT_S16, pcm_s16be, "signed 16-bit big-endian PCM");

@ -1158,11 +1158,16 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
/* for PCM codecs, compute bitrate directly */
switch(enc->codec_id) {
case CODEC_ID_PCM_F64BE:
case CODEC_ID_PCM_F64LE:
bitrate = enc->sample_rate * enc->channels * 64;
break;
case CODEC_ID_PCM_S32LE:
case CODEC_ID_PCM_S32BE:
case CODEC_ID_PCM_U32LE:
case CODEC_ID_PCM_U32BE:
case CODEC_ID_PCM_F32BE:
case CODEC_ID_PCM_F32LE:
bitrate = enc->sample_rate * enc->channels * 32;
break;
case CODEC_ID_PCM_S24LE:
@ -1312,7 +1317,11 @@ int av_get_bits_per_sample(enum CodecID codec_id){
case CODEC_ID_PCM_U32BE:
case CODEC_ID_PCM_U32LE:
case CODEC_ID_PCM_F32BE:
case CODEC_ID_PCM_F32LE:
return 32;
case CODEC_ID_PCM_F64BE:
case CODEC_ID_PCM_F64LE:
return 64;
default:
return 0;
}

Loading…
Cancel
Save