changeset 7613:ff395fe35161 libavcodec

Add F64BE, F64LE and F64BE PCM codecs.
author pross
date Tue, 19 Aug 2008 10:43:47 +0000
parents 1302ec81afc0
children 1afa1171b7b2
files allcodecs.c avcodec.h pcm.c utils.c
diffstat 4 files changed, 41 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/allcodecs.c	Tue Aug 19 10:36:30 2008 +0000
+++ b/allcodecs.c	Tue Aug 19 10:43:47 2008 +0000
@@ -220,6 +220,9 @@
     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);
--- a/avcodec.h	Tue Aug 19 10:36:30 2008 +0000
+++ b/avcodec.h	Tue Aug 19 10:43:47 2008 +0000
@@ -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 @@
     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,
--- a/pcm.c	Tue Aug 19 10:36:30 2008 +0000
+++ b/pcm.c	Tue Aug 19 10:43:47 2008 +0000
@@ -158,6 +158,7 @@
     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 @@
         }
         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 @@
     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 @@
     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 @@
         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 @@
     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 @@
 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");
--- a/utils.c	Tue Aug 19 10:36:30 2008 +0000
+++ b/utils.c	Tue Aug 19 10:43:47 2008 +0000
@@ -1158,11 +1158,16 @@
 
         /* 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 @@
     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;
     }