Renamed to Harmony
authorJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Sun, 10 Oct 2010 01:13:22 +0000 (21:13 -0400)
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Sun, 10 Oct 2010 01:13:22 +0000 (21:13 -0400)
Also a CELT update

README
celt
configure.ac
src/Makefile.am
src/framepack.c
src/harmony.h [moved from src/hybrid.h with 64% similarity]
src/harmony_decoder.c [moved from src/hybrid_decoder.c with 88% similarity]
src/harmony_decoder.h [moved from src/hybrid_decoder.h with 93% similarity]
src/harmony_encoder.c [moved from src/hybrid_encoder.c with 88% similarity]
src/harmony_encoder.h [moved from src/hybrid_encoder.h with 93% similarity]
src/test_harmony.c [moved from src/test_hybrid.c with 85% similarity]

diff --git a/README b/README
index 50df66c..b75ef84 100644 (file)
--- a/README
+++ b/README
@@ -23,10 +23,10 @@ To build from the git repository, the following steps are necessary
 % make
 
 
-Once you have compiled the codec, there will be a test_hybrid executable in
+Once you have compiled the codec, there will be a test_harmony executable in
 the src/ directory. This can be in the following way:
 
-% ./test_hybrid 48000 1 960 80 input.sw output.sw
+% ./test_harmony 48000 1 960 80 input.sw output.sw
 
 The arguments are:
 1) The sampling rate (only 48000 supported for now)
diff --git a/celt b/celt
index 8abc6be..8226ac0 160000 (submodule)
--- a/celt
+++ b/celt
@@ -1 +1 @@
-Subproject commit 8abc6bee40f4df4c346f997f60d07d027bf9d27d
+Subproject commit 8226ac083ea19f57b69e863251fe487228bc2925
index 5035664..dd64488 100644 (file)
@@ -2,8 +2,8 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.59])
-AC_INIT(src/hybrid.h)
-AM_INIT_AUTOMAKE(ietfcodec,20100921)
+AC_INIT(src/harmony.h)
+AM_INIT_AUTOMAKE(harmony,20100921)
 
 # Checks for programs.
 AC_PROG_CC
index 130fc36..f3f0240 100644 (file)
@@ -2,12 +2,12 @@
 INCLUDES = -I$(top_srcdir)/celt/libcelt/ -I$(top_srcdir)/silk/interface 
 
 lib_LTLIBRARIES = libietfcodec.la
-libietfcodec_la_SOURCES = hybrid_decoder.c hybrid_encoder.c
+libietfcodec_la_SOURCES = harmony_decoder.c harmony_encoder.c
 
-noinst_HEADERS = hybrid_decoder.h hybrid_encoder.h
+noinst_HEADERS = harmony_decoder.h harmony_encoder.h
 
-pkginclude_HEADERS = hybrid.h
+pkginclude_HEADERS = harmony.h
 
-noinst_PROGRAMS = test_hybrid
-test_hybrid_SOURCES = test_hybrid.c $(top_srcdir)/silk/test/SKP_debug.c
-test_hybrid_LDADD = libietfcodec.la $(top_builddir)/celt/libcelt/libcelt0.la $(top_builddir)/silk/libSKP_SILK_SDK.la
+noinst_PROGRAMS = test_harmony
+test_harmony_SOURCES = test_harmony.c $(top_srcdir)/silk/test/SKP_debug.c
+test_harmony_LDADD = libietfcodec.la $(top_builddir)/celt/libcelt/libcelt0.la $(top_builddir)/silk/libSKP_SILK_SDK.la
index 9943435..c7a84c0 100644 (file)
@@ -100,7 +100,7 @@ int count_frames(unsigned char *packet, int len)
 }
 
 #define MAX_FRAMES 256
-int hybrid_merge_packets(unsigned char **packets, int *plen, int nb_packets,
+int harmony_merge_packets(unsigned char **packets, int *plen, int nb_packets,
         unsigned *output, int maxlen)
 {
     int i;
similarity index 64%
rename from src/hybrid.h
rename to src/harmony.h
index 541fca1..ed8d1f3 100644 (file)
@@ -29,8 +29,8 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-#ifndef HYBRID_H
-#define HYBRID_H
+#ifndef HARMONY_H
+#define HARMONY_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -59,44 +59,44 @@ extern "C" {
 
 
 
-#define HYBRID_SET_MODE_REQUEST 0
-#define HYBRID_SET_MODE(x) HYBRID_SET_MODE_REQUEST, __check_int(x)
-#define HYBRID_GET_MODE_REQUEST 1
-#define HYBRID_GET_MODE(x) HYBRID_GET_MODE_REQUEST, __check_int_ptr(x)
+#define HARMONY_SET_MODE_REQUEST 0
+#define HARMONY_SET_MODE(x) HARMONY_SET_MODE_REQUEST, __check_int(x)
+#define HARMONY_GET_MODE_REQUEST 1
+#define HARMONY_GET_MODE(x) HARMONY_GET_MODE_REQUEST, __check_int_ptr(x)
 
-#define HYBRID_SET_BANDWIDTH_REQUEST 2
-#define HYBRID_SET_BANDWIDTH(x) HYBRID_SET_BANDWIDTH_REQUEST, __check_int(x)
-#define HYBRID_GET_BANDWIDTH_REQUEST 3
-#define HYBRID_GET_BANDWIDTH(x) HYBRID_GET_BANDWIDTH_REQUEST, __check_int_ptr(x)
+#define HARMONY_SET_BANDWIDTH_REQUEST 2
+#define HARMONY_SET_BANDWIDTH(x) HARMONY_SET_BANDWIDTH_REQUEST, __check_int(x)
+#define HARMONY_GET_BANDWIDTH_REQUEST 3
+#define HARMONY_GET_BANDWIDTH(x) HARMONY_GET_BANDWIDTH_REQUEST, __check_int_ptr(x)
 
-#define HYBRID_SET_VBR_RATE_REQUEST 4
-#define HYBRID_SET_VBR_RATE(x) HYBRID_SET_VBR_RATE_REQUEST, __check_int(x)
-#define HYBRID_GET_VBR_RATE_REQUEST 5
-#define HYBRID_GET_VBR_RATE(x) HYBRID_GET_VBR_RATE_REQUEST, __check_int_ptr(x)
+#define HARMONY_SET_VBR_RATE_REQUEST 4
+#define HARMONY_SET_VBR_RATE(x) HARMONY_SET_VBR_RATE_REQUEST, __check_int(x)
+#define HARMONY_GET_VBR_RATE_REQUEST 5
+#define HARMONY_GET_VBR_RATE(x) HARMONY_GET_VBR_RATE_REQUEST, __check_int_ptr(x)
 
-typedef struct HybridEncoder HybridEncoder;
-typedef struct HybridDecoder HybridDecoder;
+typedef struct HarmonyEncoder HarmonyEncoder;
+typedef struct HarmonyDecoder HarmonyDecoder;
 
-HybridEncoder *hybrid_encoder_create(int Fs);
+HarmonyEncoder *harmony_encoder_create(int Fs);
 
-int hybrid_encode(HybridEncoder *st, const short *pcm, int frame_size,
+int harmony_encode(HarmonyEncoder *st, const short *pcm, int frame_size,
                unsigned char *data, int bytes_per_packet);
 
-void hybrid_encoder_destroy(HybridEncoder *st);
+void harmony_encoder_destroy(HarmonyEncoder *st);
 
-void hybrid_encoder_ctl(HybridEncoder *st, int request, ...);
+void harmony_encoder_ctl(HarmonyEncoder *st, int request, ...);
 
-HybridDecoder *hybrid_decoder_create(int Fs);
+HarmonyDecoder *harmony_decoder_create(int Fs);
 
-int hybrid_decode(HybridDecoder *st, const unsigned char *data, int len,
+int harmony_decode(HarmonyDecoder *st, const unsigned char *data, int len,
                short *pcm, int frame_size);
 
-void hybrid_decoder_ctl(HybridDecoder *st, int request, ...);
+void harmony_decoder_ctl(HarmonyDecoder *st, int request, ...);
 
-void hybrid_decoder_destroy(HybridDecoder *st);
+void harmony_decoder_destroy(HarmonyDecoder *st);
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* HYBRID_H */
+#endif /* HARMONY_H */
similarity index 88%
rename from src/hybrid_decoder.c
rename to src/harmony_decoder.c
index e095701..7177d60 100644 (file)
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdarg.h>
-#include "hybrid_decoder.h"
+#include "harmony_decoder.h"
 #include "entdec.h"
 #include "modes.h"
 #include "SKP_Silk_SDK_API.h"
 
 
-HybridDecoder *hybrid_decoder_create(int Fs)
+HarmonyDecoder *harmony_decoder_create(int Fs)
 {
     char *raw_state;
        int ret, silkDecSizeBytes, celtDecSizeBytes;
        CELTMode *celtMode;
-       HybridDecoder *st;
+       HarmonyDecoder *st;
 
     /* We should not have to create a CELT mode for each encoder state */
     celtMode = celt_mode_create(Fs, Fs/50, NULL);
@@ -58,10 +58,10 @@ HybridDecoder *hybrid_decoder_create(int Fs)
         /* Handle error */
     }
     celtDecSizeBytes = celt_decoder_get_size(celtMode, 1);
-    raw_state = calloc(sizeof(HybridDecoder)+silkDecSizeBytes+celtDecSizeBytes, 1);
-    st = (HybridDecoder*)raw_state;
-    st->silk_dec = (void*)(raw_state+sizeof(HybridDecoder));
-    st->celt_dec = (CELTDecoder*)(raw_state+sizeof(HybridDecoder)+silkDecSizeBytes);
+    raw_state = calloc(sizeof(HarmonyDecoder)+silkDecSizeBytes+celtDecSizeBytes, 1);
+    st = (HarmonyDecoder*)raw_state;
+    st->silk_dec = (void*)(raw_state+sizeof(HarmonyDecoder));
+    st->celt_dec = (CELTDecoder*)(raw_state+sizeof(HarmonyDecoder)+silkDecSizeBytes);
 
     st->Fs = Fs;
     st->celt_mode = celtMode;
@@ -78,7 +78,7 @@ HybridDecoder *hybrid_decoder_create(int Fs)
        return st;
 
 }
-int hybrid_decode(HybridDecoder *st, const unsigned char *data,
+int harmony_decode(HarmonyDecoder *st, const unsigned char *data,
                int len, short *pcm, int frame_size)
 {
        int i, silk_ret=0, celt_ret=0;
@@ -164,7 +164,7 @@ int hybrid_decode(HybridDecoder *st, const unsigned char *data,
 
 }
 
-void hybrid_decoder_ctl(HybridDecoder *st, int request, ...)
+void harmony_decoder_ctl(HarmonyDecoder *st, int request, ...)
 {
     va_list ap;
 
@@ -172,39 +172,39 @@ void hybrid_decoder_ctl(HybridDecoder *st, int request, ...)
 
     switch (request)
     {
-        case HYBRID_SET_MODE_REQUEST:
+        case HARMONY_SET_MODE_REQUEST:
         {
             int value = va_arg(ap, int);
             st->mode = value;
         }
         break;
-        case HYBRID_GET_MODE_REQUEST:
+        case HARMONY_GET_MODE_REQUEST:
         {
             int *value = va_arg(ap, int*);
             *value = st->mode;
         }
         break;
-        case HYBRID_SET_BANDWIDTH_REQUEST:
+        case HARMONY_SET_BANDWIDTH_REQUEST:
         {
             int value = va_arg(ap, int);
             st->bandwidth = value;
         }
         break;
-        case HYBRID_GET_BANDWIDTH_REQUEST:
+        case HARMONY_GET_BANDWIDTH_REQUEST:
         {
             int *value = va_arg(ap, int*);
             *value = st->bandwidth;
         }
         break;
         default:
-            fprintf(stderr, "unknown hybrid_decoder_ctl() request: %d", request);
+            fprintf(stderr, "unknown harmony_decoder_ctl() request: %d", request);
             break;
     }
 
     va_end(ap);
 }
 
-void hybrid_decoder_destroy(HybridDecoder *st)
+void harmony_decoder_destroy(HarmonyDecoder *st)
 {
        celt_mode_destroy(st->celt_mode);
 
similarity index 93%
rename from src/hybrid_decoder.h
rename to src/harmony_decoder.h
index b5a54fb..18f5c9e 100644 (file)
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-#ifndef HYBRID_DECODER_H
-#define HYBRID_DECODER_H
+#ifndef HARMONY_DECODER_H
+#define HARMONY_DECODER_H
 
 #include "celt.h"
-#include "hybrid.h"
+#include "harmony.h"
 
-struct HybridDecoder {
+struct HarmonyDecoder {
        CELTMode    *celt_mode;
        CELTDecoder *celt_dec;
        void        *silk_dec;
@@ -47,5 +47,5 @@ struct HybridDecoder {
 };
 
 
-#endif /* HYBRID_DECODER_H */
+#endif /* HARMONY_DECODER_H */
 
similarity index 88%
rename from src/hybrid_encoder.c
rename to src/harmony_encoder.c
index d931f07..569eb7a 100644 (file)
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdarg.h>
-#include "hybrid_encoder.h"
+#include "harmony_encoder.h"
 #include "entenc.h"
 #include "modes.h"
 #include "SKP_Silk_SDK_API.h"
 
-HybridEncoder *hybrid_encoder_create(int Fs)
+HarmonyEncoder *harmony_encoder_create(int Fs)
 {
     char *raw_state;
     CELTMode *celtMode;
-       HybridEncoder *st;
+       HarmonyEncoder *st;
        int ret, silkEncSizeBytes, celtEncSizeBytes;
     SKP_SILK_SDK_EncControlStruct encControl;
 
@@ -58,10 +58,10 @@ HybridEncoder *hybrid_encoder_create(int Fs)
        /* Handle error */
     }
     celtEncSizeBytes = celt_encoder_get_size(celtMode, 1);
-    raw_state = calloc(sizeof(HybridEncoder)+silkEncSizeBytes+celtEncSizeBytes, 1);
-    st = (HybridEncoder*)raw_state;
-    st->silk_enc = (void*)(raw_state+sizeof(HybridEncoder));
-    st->celt_enc = (CELTEncoder*)(raw_state+sizeof(HybridEncoder)+silkEncSizeBytes);
+    raw_state = calloc(sizeof(HarmonyEncoder)+silkEncSizeBytes+celtEncSizeBytes, 1);
+    st = (HarmonyEncoder*)raw_state;
+    st->silk_enc = (void*)(raw_state+sizeof(HarmonyEncoder));
+    st->celt_enc = (CELTEncoder*)(raw_state+sizeof(HarmonyEncoder)+silkEncSizeBytes);
 
     st->Fs = Fs;
     st->celt_mode = celtMode;
@@ -87,7 +87,7 @@ HybridEncoder *hybrid_encoder_create(int Fs)
        return st;
 }
 
-int hybrid_encode(HybridEncoder *st, const short *pcm, int frame_size,
+int harmony_encode(HarmonyEncoder *st, const short *pcm, int frame_size,
                unsigned char *data, int bytes_per_packet)
 {
     int i;
@@ -199,7 +199,7 @@ int hybrid_encode(HybridEncoder *st, const short *pcm, int frame_size,
         data[0] = 0x80;
         data[0] |= tmp << 5;
         data[0] |= period<<3;
-    } else /* Hybrid */
+    } else /* Harmony */
     {
         data[0] = 0x60;
         data[0] |= (st->bandwidth-BANDWIDTH_SUPERWIDEBAND)<<4;
@@ -210,7 +210,7 @@ int hybrid_encode(HybridEncoder *st, const short *pcm, int frame_size,
     return ret+1;
 }
 
-void hybrid_encoder_ctl(HybridEncoder *st, int request, ...)
+void harmony_encoder_ctl(HarmonyEncoder *st, int request, ...)
 {
     va_list ap;
 
@@ -218,51 +218,51 @@ void hybrid_encoder_ctl(HybridEncoder *st, int request, ...)
 
     switch (request)
     {
-        case HYBRID_SET_MODE_REQUEST:
+        case HARMONY_SET_MODE_REQUEST:
         {
             int value = va_arg(ap, int);
             st->mode = value;
         }
         break;
-        case HYBRID_GET_MODE_REQUEST:
+        case HARMONY_GET_MODE_REQUEST:
         {
             int *value = va_arg(ap, int*);
             *value = st->mode;
         }
         break;
-        case HYBRID_SET_BANDWIDTH_REQUEST:
+        case HARMONY_SET_BANDWIDTH_REQUEST:
         {
             int value = va_arg(ap, int);
             st->bandwidth = value;
         }
         break;
-        case HYBRID_GET_BANDWIDTH_REQUEST:
+        case HARMONY_GET_BANDWIDTH_REQUEST:
         {
             int *value = va_arg(ap, int*);
             *value = st->bandwidth;
         }
         break;
-        case HYBRID_SET_VBR_RATE_REQUEST:
+        case HARMONY_SET_VBR_RATE_REQUEST:
         {
             int value = va_arg(ap, int);
             st->vbr_rate = value;
         }
         break;
-        case HYBRID_GET_VBR_RATE_REQUEST:
+        case HARMONY_GET_VBR_RATE_REQUEST:
         {
             int *value = va_arg(ap, int*);
             *value = st->vbr_rate;
         }
         break;
         default:
-            fprintf(stderr, "unknown hybrid_encoder_ctl() request: %d", request);
+            fprintf(stderr, "unknown harmony_encoder_ctl() request: %d", request);
             break;
     }
 
     va_end(ap);
 }
 
-void hybrid_encoder_destroy(HybridEncoder *st)
+void harmony_encoder_destroy(HarmonyEncoder *st)
 {
        celt_mode_destroy(st->celt_mode);
        free(st);
similarity index 93%
rename from src/hybrid_encoder.h
rename to src/harmony_encoder.h
index adb5f1d..045d273 100644 (file)
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-#ifndef HYBRID_ENCODER_H
-#define HYBRID_ENCODER_H
+#ifndef HARMONY_ENCODER_H
+#define HARMONY_ENCODER_H
 
 #include "celt.h"
-#include "hybrid.h"
+#include "harmony.h"
 #include "SKP_Silk_SDK_API.h"
 
 /* FIXME: This is only valid for 48 kHz */
 #define ENCODER_DELAY_COMPENSATION 130
 
-struct HybridEncoder {
+struct HarmonyEncoder {
        CELTMode    *celt_mode;
        CELTEncoder *celt_enc;
        void        *silk_enc;
@@ -54,5 +54,5 @@ struct HybridEncoder {
 };
 
 
-#endif /* HYBRID_ENCODER_H */
+#endif /* HARMONY_ENCODER_H */
 
similarity index 85%
rename from src/test_hybrid.c
rename to src/test_harmony.c
index 9a547a8..6c873ce 100644 (file)
@@ -38,7 +38,7 @@
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
-#include "hybrid.h"
+#include "harmony.h"
 
 
 #define MAX_PACKET 1024
@@ -48,8 +48,8 @@ int main(int argc, char *argv[])
    int err;
    char *inFile, *outFile;
    FILE *fin, *fout;
-   HybridEncoder *enc;
-   HybridDecoder *dec;
+   HarmonyEncoder *enc;
+   HarmonyDecoder *dec;
    int len;
    int frame_size, channels;
    int bytes_per_packet;
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
    double bits=0;
    if (argc != 9 && argc != 8 && argc != 7)
    {
-      fprintf (stderr, "Usage: test_hybrid <rate (kHz)> <channels> <frame size> "
+      fprintf (stderr, "Usage: test_harmony <rate (kHz)> <channels> <frame size> "
                " <bytes per packet>  [<VBR rate (kb/s)>] [<packet loss rate>] "
                "<input> <output>\n");
       return 1;
@@ -105,15 +105,15 @@ int main(int argc, char *argv[])
       return 1;
    }
 
-   enc = hybrid_encoder_create(rate);
-   dec = hybrid_decoder_create(rate);
+   enc = harmony_encoder_create(rate);
+   dec = harmony_decoder_create(rate);
 
    mode = MODE_HYBRID;
-   hybrid_encoder_ctl(enc, HYBRID_SET_BANDWIDTH(BANDWIDTH_FULLBAND));
-   hybrid_encoder_ctl(enc, HYBRID_SET_MODE(mode));
+   harmony_encoder_ctl(enc, HARMONY_SET_BANDWIDTH(BANDWIDTH_FULLBAND));
+   harmony_encoder_ctl(enc, HARMONY_SET_MODE(mode));
 
    if (vbr)
-       hybrid_encoder_ctl(enc, HYBRID_SET_VBR_RATE(vbr));
+       harmony_encoder_ctl(enc, HARMONY_SET_VBR_RATE(vbr));
 
    skip = 5*rate/1000 + 10;
 
@@ -130,14 +130,14 @@ int main(int argc, char *argv[])
           for (i=err;i<frame_size*channels;i++)
               in[i] = 0;
       }
-      len = hybrid_encode(enc, in, frame_size, data, bytes_per_packet);
+      len = harmony_encode(enc, in, frame_size, data, bytes_per_packet);
       if (len <= 0)
       {
-         fprintf (stderr, "hybrid_encode() returned %d\n", len);
+         fprintf (stderr, "harmony_encode() returned %d\n", len);
          return 1;
       }
       bits += len*8;
-      hybrid_decode(dec, rand()%100<loss ? NULL : data, len, out, frame_size);
+      harmony_decode(dec, rand()%100<loss ? NULL : data, len, out, frame_size);
       count++;
       tot_written += (frame_size-skip)*channels;
       write_samples = frame_size;
@@ -150,8 +150,8 @@ int main(int argc, char *argv[])
       skip = 0;
    }
    fprintf (stderr, "average bit-rate: %f kb/s\n", bits*rate/(frame_size*(double)count));
-   hybrid_encoder_destroy(enc);
-   hybrid_decoder_destroy(dec);
+   harmony_encoder_destroy(enc);
+   harmony_decoder_destroy(dec);
    fclose(fin);
    fclose(fout);
    free(in);