blob: 246c41c2437dd3c6de9ed2a4fe1f90960e71a59c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "libaec.h"
#include "check_aec.h"
#define BUF_SIZE (64 * 4)
int check_long_fs(struct test_state *state)
{
int status, size, i, bs;
size = state->bytes_per_sample;
bs = state->strm->block_size;
for (i = 0; i < bs / 2; i++) {
state->out(state->ubuf + size * i, state->xmin, size);
state->out(state->ubuf + bs * size / 2 + size * i, 65000, size);
}
printf("Checking long fs ... ");
status = state->codec(state);
if (status)
return status;
printf ("%s\n", CHECK_PASS);
return 0;
}
int main (void)
{
int status;
struct aec_stream strm;
struct test_state state;
state.buf_len = state.ibuf_len = BUF_SIZE;
state.cbuf_len = 2 * BUF_SIZE;
state.ubuf = (unsigned char *)malloc(state.buf_len);
state.cbuf = (unsigned char *)malloc(state.cbuf_len);
state.obuf = (unsigned char *)malloc(state.buf_len);
if (!state.ubuf || !state.cbuf || !state.obuf) {
printf("Not enough memory.\n");
return 99;
}
strm.flags = AEC_DATA_PREPROCESS;
state.strm = &strm;
strm.bits_per_sample = 16;
strm.block_size = 64;
strm.rsi = 1;
state.codec = encode_decode_large;
update_state(&state);
status = check_long_fs(&state);
if (status)
goto DESTRUCT;
DESTRUCT:
free(state.ubuf);
free(state.cbuf);
free(state.obuf);
return status;
}
|