forked from DarkMorford/alac
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaglib.h
81 lines (61 loc) · 2.02 KB
/
aglib.h
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
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
* Copyright (c) 2011 Apple Inc. All rights reserved.
*
* @APPLE_APACHE_LICENSE_HEADER_START@
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @APPLE_APACHE_LICENSE_HEADER_END@
*/
/*
File: aglib.h
Copyright: (C) 2001-2011 Apple, Inc.
*/
#ifndef AGLIB_H
#define AGLIB_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define QBSHIFT 9
#define QB (1<<QBSHIFT)
#define PB0 40
#define MB0 10
#define KB0 14
#define MAX_RUN_DEFAULT 255
#define MMULSHIFT 2
#define MDENSHIFT (QBSHIFT - MMULSHIFT - 1)
#define MOFF ((1<<(MDENSHIFT-2)))
#define BITOFF 24
/* Max. prefix of 1's. */
#define MAX_PREFIX_16 9
#define MAX_PREFIX_TOLONG_16 15
#define MAX_PREFIX_32 9
/* Max. bits in 16-bit data type */
#define MAX_DATATYPE_BITS_16 16
typedef struct AGParamRec
{
uint32_t mb, mb0, pb, kb, wb, qb;
uint32_t fw, sw;
uint32_t maxrun;
// fw = 1, sw = 1;
} AGParamRec, *AGParamRecPtr;
struct BitBuffer;
void set_standard_ag_params(AGParamRecPtr params, uint32_t fullwidth, uint32_t sectorwidth);
void set_ag_params(AGParamRecPtr params, uint32_t m, uint32_t p, uint32_t k, uint32_t f, uint32_t s, uint32_t maxrun);
int32_t dyn_comp(AGParamRecPtr params, int32_t * pc, struct BitBuffer * bitstream, uint32_t numSamples, int32_t bitSize, uint32_t * outNumBits);
int32_t dyn_decomp(AGParamRecPtr params, struct BitBuffer * bitstream, int32_t * pc, uint32_t numSamples, int32_t maxSize, uint32_t * outNumBits);
#ifdef __cplusplus
}
#endif
#endif //#ifndef AGLIB_H