Fix crashes with VBR for short duration frames and very low bitrates. This may, howev...
[opus.git] / tests / laplace-test.c
index de10b82..417f4e1 100644 (file)
@@ -5,7 +5,17 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include "laplace.h"
-#include "stack_alloc.h"
+#define CELT_C 
+#include "../libcelt/stack_alloc.h"
+
+#include "../libcelt/rangeenc.c"
+#include "../libcelt/rangedec.c"
+#include "../libcelt/entenc.c"
+#include "../libcelt/entdec.c"
+#include "../libcelt/entcode.c"
+#include "../libcelt/laplace.c"
+
+#define DATA_SIZE 40000
 
 int main(void)
 {
@@ -14,9 +24,12 @@ int main(void)
    ec_enc enc;
    ec_dec dec;
    ec_byte_buffer buf;
+   unsigned char *ptr;
    int val[10000], decay[10000];
    ALLOC_STACK;
-   ec_byte_writeinit(&buf);
+   ptr = malloc(DATA_SIZE);
+   ec_byte_writeinit_buffer(&buf, ptr, DATA_SIZE);
+   //ec_byte_writeinit(&buf);
    ec_enc_init(&enc,&buf);
    
    val[0] = 3; decay[0] = 6000;
@@ -45,6 +58,5 @@ int main(void)
       }
    }
    
-   ec_byte_writeclear(&buf);
    return ret;
 }