annotate lib/libavutil/intreadwrite.h @ 2202:44d956d4f838

Merge
author Grumpy7
date Mon, 03 Feb 2014 23:07:15 +0100
parents 992d2e6f907d
children
rev   line source
2134
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
1 /*
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
2 * This file is part of FFmpeg.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
3 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
4 * FFmpeg is free software; you can redistribute it and/or
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
5 * modify it under the terms of the GNU Lesser General Public
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
6 * License as published by the Free Software Foundation; either
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
7 * version 2.1 of the License, or (at your option) any later version.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
8 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
9 * FFmpeg is distributed in the hope that it will be useful,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
12 * Lesser General Public License for more details.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
13 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
14 * You should have received a copy of the GNU Lesser General Public
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
15 * License along with FFmpeg; if not, write to the Free Software
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
17 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
18
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
19 #ifndef AVUTIL_INTREADWRITE_H
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
20 #define AVUTIL_INTREADWRITE_H
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
21
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
22 #include <stdint.h>
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
23 #include "libavutil/avconfig.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
24 #include "attributes.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
25 #include "bswap.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
26
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
27 typedef union {
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
28 uint64_t u64;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
29 uint32_t u32[2];
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
30 uint16_t u16[4];
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
31 uint8_t u8 [8];
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
32 double f64;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
33 float f32[2];
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
34 } av_alias av_alias64;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
35
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
36 typedef union {
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
37 uint32_t u32;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
38 uint16_t u16[2];
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
39 uint8_t u8 [4];
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
40 float f32;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
41 } av_alias av_alias32;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
42
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
43 typedef union {
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
44 uint16_t u16;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
45 uint8_t u8 [2];
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
46 } av_alias av_alias16;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
47
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
48 /*
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
49 * Arch-specific headers can provide any combination of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
50 * AV_[RW][BLN](16|24|32|48|64) and AV_(COPY|SWAP|ZERO)(64|128) macros.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
51 * Preprocessor symbols must be defined, even if these are implemented
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
52 * as inline functions.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
53 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
54
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
55 #ifdef HAVE_AV_CONFIG_H
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
56
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
57 #include "config.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
58
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
59 #if ARCH_ARM
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
60 # include "arm/intreadwrite.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
61 #elif ARCH_AVR32
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
62 # include "avr32/intreadwrite.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
63 #elif ARCH_MIPS
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
64 # include "mips/intreadwrite.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
65 #elif ARCH_PPC
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
66 # include "ppc/intreadwrite.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
67 #elif ARCH_TOMI
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
68 # include "tomi/intreadwrite.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
69 #elif ARCH_X86
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
70 # include "x86/intreadwrite.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
71 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
72
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
73 #endif /* HAVE_AV_CONFIG_H */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
74
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
75 /*
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
76 * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
77 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
78
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
79 #if AV_HAVE_BIGENDIAN
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
80
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
81 # if defined(AV_RN16) && !defined(AV_RB16)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
82 # define AV_RB16(p) AV_RN16(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
83 # elif !defined(AV_RN16) && defined(AV_RB16)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
84 # define AV_RN16(p) AV_RB16(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
85 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
86
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
87 # if defined(AV_WN16) && !defined(AV_WB16)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
88 # define AV_WB16(p, v) AV_WN16(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
89 # elif !defined(AV_WN16) && defined(AV_WB16)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
90 # define AV_WN16(p, v) AV_WB16(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
91 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
92
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
93 # if defined(AV_RN24) && !defined(AV_RB24)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
94 # define AV_RB24(p) AV_RN24(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
95 # elif !defined(AV_RN24) && defined(AV_RB24)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
96 # define AV_RN24(p) AV_RB24(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
97 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
98
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
99 # if defined(AV_WN24) && !defined(AV_WB24)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
100 # define AV_WB24(p, v) AV_WN24(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
101 # elif !defined(AV_WN24) && defined(AV_WB24)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
102 # define AV_WN24(p, v) AV_WB24(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
103 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
104
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
105 # if defined(AV_RN32) && !defined(AV_RB32)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
106 # define AV_RB32(p) AV_RN32(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
107 # elif !defined(AV_RN32) && defined(AV_RB32)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
108 # define AV_RN32(p) AV_RB32(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
109 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
110
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
111 # if defined(AV_WN32) && !defined(AV_WB32)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
112 # define AV_WB32(p, v) AV_WN32(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
113 # elif !defined(AV_WN32) && defined(AV_WB32)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
114 # define AV_WN32(p, v) AV_WB32(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
115 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
116
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
117 # if defined(AV_RN48) && !defined(AV_RB48)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
118 # define AV_RB48(p) AV_RN48(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
119 # elif !defined(AV_RN48) && defined(AV_RB48)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
120 # define AV_RN48(p) AV_RB48(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
121 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
122
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
123 # if defined(AV_WN48) && !defined(AV_WB48)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
124 # define AV_WB48(p, v) AV_WN48(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
125 # elif !defined(AV_WN48) && defined(AV_WB48)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
126 # define AV_WN48(p, v) AV_WB48(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
127 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
128
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
129 # if defined(AV_RN64) && !defined(AV_RB64)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
130 # define AV_RB64(p) AV_RN64(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
131 # elif !defined(AV_RN64) && defined(AV_RB64)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
132 # define AV_RN64(p) AV_RB64(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
133 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
134
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
135 # if defined(AV_WN64) && !defined(AV_WB64)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
136 # define AV_WB64(p, v) AV_WN64(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
137 # elif !defined(AV_WN64) && defined(AV_WB64)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
138 # define AV_WN64(p, v) AV_WB64(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
139 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
140
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
141 #else /* AV_HAVE_BIGENDIAN */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
142
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
143 # if defined(AV_RN16) && !defined(AV_RL16)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
144 # define AV_RL16(p) AV_RN16(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
145 # elif !defined(AV_RN16) && defined(AV_RL16)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
146 # define AV_RN16(p) AV_RL16(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
147 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
148
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
149 # if defined(AV_WN16) && !defined(AV_WL16)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
150 # define AV_WL16(p, v) AV_WN16(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
151 # elif !defined(AV_WN16) && defined(AV_WL16)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
152 # define AV_WN16(p, v) AV_WL16(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
153 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
154
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
155 # if defined(AV_RN24) && !defined(AV_RL24)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
156 # define AV_RL24(p) AV_RN24(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
157 # elif !defined(AV_RN24) && defined(AV_RL24)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
158 # define AV_RN24(p) AV_RL24(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
159 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
160
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
161 # if defined(AV_WN24) && !defined(AV_WL24)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
162 # define AV_WL24(p, v) AV_WN24(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
163 # elif !defined(AV_WN24) && defined(AV_WL24)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
164 # define AV_WN24(p, v) AV_WL24(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
165 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
166
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
167 # if defined(AV_RN32) && !defined(AV_RL32)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
168 # define AV_RL32(p) AV_RN32(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
169 # elif !defined(AV_RN32) && defined(AV_RL32)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
170 # define AV_RN32(p) AV_RL32(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
171 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
172
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
173 # if defined(AV_WN32) && !defined(AV_WL32)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
174 # define AV_WL32(p, v) AV_WN32(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
175 # elif !defined(AV_WN32) && defined(AV_WL32)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
176 # define AV_WN32(p, v) AV_WL32(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
177 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
178
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
179 # if defined(AV_RN48) && !defined(AV_RL48)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
180 # define AV_RL48(p) AV_RN48(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
181 # elif !defined(AV_RN48) && defined(AV_RL48)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
182 # define AV_RN48(p) AV_RL48(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
183 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
184
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
185 # if defined(AV_WN48) && !defined(AV_WL48)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
186 # define AV_WL48(p, v) AV_WN48(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
187 # elif !defined(AV_WN48) && defined(AV_WL48)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
188 # define AV_WN48(p, v) AV_WL48(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
189 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
190
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
191 # if defined(AV_RN64) && !defined(AV_RL64)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
192 # define AV_RL64(p) AV_RN64(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
193 # elif !defined(AV_RN64) && defined(AV_RL64)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
194 # define AV_RN64(p) AV_RL64(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
195 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
196
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
197 # if defined(AV_WN64) && !defined(AV_WL64)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
198 # define AV_WL64(p, v) AV_WN64(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
199 # elif !defined(AV_WN64) && defined(AV_WL64)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
200 # define AV_WN64(p, v) AV_WL64(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
201 # endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
202
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
203 #endif /* !AV_HAVE_BIGENDIAN */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
204
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
205 /*
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
206 * Define AV_[RW]N helper macros to simplify definitions not provided
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
207 * by per-arch headers.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
208 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
209
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
210 #if defined(__GNUC__) && !defined(__TI_COMPILER_VERSION__)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
211
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
212 union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
213 union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
214 union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
215
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
216 # define AV_RN(s, p) (((const union unaligned_##s *) (p))->l)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
217 # define AV_WN(s, p, v) ((((union unaligned_##s *) (p))->l) = (v))
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
218
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
219 #elif defined(__DECC)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
220
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
221 # define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p)))
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
222 # define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v))
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
223
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
224 #elif AV_HAVE_FAST_UNALIGNED
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
225
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
226 # define AV_RN(s, p) (((const av_alias##s*)(p))->u##s)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
227 # define AV_WN(s, p, v) (((av_alias##s*)(p))->u##s = (v))
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
228
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
229 #else
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
230
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
231 #ifndef AV_RB16
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
232 # define AV_RB16(x) \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
233 ((((const uint8_t*)(x))[0] << 8) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
234 ((const uint8_t*)(x))[1])
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
235 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
236 #ifndef AV_WB16
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
237 # define AV_WB16(p, darg) do { \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
238 unsigned d = (darg); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
239 ((uint8_t*)(p))[1] = (d); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
240 ((uint8_t*)(p))[0] = (d)>>8; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
241 } while(0)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
242 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
243
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
244 #ifndef AV_RL16
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
245 # define AV_RL16(x) \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
246 ((((const uint8_t*)(x))[1] << 8) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
247 ((const uint8_t*)(x))[0])
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
248 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
249 #ifndef AV_WL16
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
250 # define AV_WL16(p, darg) do { \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
251 unsigned d = (darg); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
252 ((uint8_t*)(p))[0] = (d); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
253 ((uint8_t*)(p))[1] = (d)>>8; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
254 } while(0)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
255 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
256
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
257 #ifndef AV_RB32
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
258 # define AV_RB32(x) \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
259 (((uint32_t)((const uint8_t*)(x))[0] << 24) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
260 (((const uint8_t*)(x))[1] << 16) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
261 (((const uint8_t*)(x))[2] << 8) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
262 ((const uint8_t*)(x))[3])
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
263 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
264 #ifndef AV_WB32
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
265 # define AV_WB32(p, darg) do { \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
266 unsigned d = (darg); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
267 ((uint8_t*)(p))[3] = (d); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
268 ((uint8_t*)(p))[2] = (d)>>8; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
269 ((uint8_t*)(p))[1] = (d)>>16; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
270 ((uint8_t*)(p))[0] = (d)>>24; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
271 } while(0)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
272 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
273
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
274 #ifndef AV_RL32
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
275 # define AV_RL32(x) \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
276 (((uint32_t)((const uint8_t*)(x))[3] << 24) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
277 (((const uint8_t*)(x))[2] << 16) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
278 (((const uint8_t*)(x))[1] << 8) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
279 ((const uint8_t*)(x))[0])
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
280 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
281 #ifndef AV_WL32
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
282 # define AV_WL32(p, darg) do { \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
283 unsigned d = (darg); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
284 ((uint8_t*)(p))[0] = (d); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
285 ((uint8_t*)(p))[1] = (d)>>8; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
286 ((uint8_t*)(p))[2] = (d)>>16; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
287 ((uint8_t*)(p))[3] = (d)>>24; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
288 } while(0)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
289 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
290
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
291 #ifndef AV_RB64
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
292 # define AV_RB64(x) \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
293 (((uint64_t)((const uint8_t*)(x))[0] << 56) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
294 ((uint64_t)((const uint8_t*)(x))[1] << 48) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
295 ((uint64_t)((const uint8_t*)(x))[2] << 40) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
296 ((uint64_t)((const uint8_t*)(x))[3] << 32) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
297 ((uint64_t)((const uint8_t*)(x))[4] << 24) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
298 ((uint64_t)((const uint8_t*)(x))[5] << 16) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
299 ((uint64_t)((const uint8_t*)(x))[6] << 8) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
300 (uint64_t)((const uint8_t*)(x))[7])
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
301 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
302 #ifndef AV_WB64
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
303 # define AV_WB64(p, darg) do { \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
304 uint64_t d = (darg); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
305 ((uint8_t*)(p))[7] = (d); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
306 ((uint8_t*)(p))[6] = (d)>>8; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
307 ((uint8_t*)(p))[5] = (d)>>16; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
308 ((uint8_t*)(p))[4] = (d)>>24; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
309 ((uint8_t*)(p))[3] = (d)>>32; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
310 ((uint8_t*)(p))[2] = (d)>>40; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
311 ((uint8_t*)(p))[1] = (d)>>48; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
312 ((uint8_t*)(p))[0] = (d)>>56; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
313 } while(0)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
314 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
315
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
316 #ifndef AV_RL64
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
317 # define AV_RL64(x) \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
318 (((uint64_t)((const uint8_t*)(x))[7] << 56) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
319 ((uint64_t)((const uint8_t*)(x))[6] << 48) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
320 ((uint64_t)((const uint8_t*)(x))[5] << 40) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
321 ((uint64_t)((const uint8_t*)(x))[4] << 32) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
322 ((uint64_t)((const uint8_t*)(x))[3] << 24) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
323 ((uint64_t)((const uint8_t*)(x))[2] << 16) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
324 ((uint64_t)((const uint8_t*)(x))[1] << 8) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
325 (uint64_t)((const uint8_t*)(x))[0])
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
326 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
327 #ifndef AV_WL64
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
328 # define AV_WL64(p, darg) do { \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
329 uint64_t d = (darg); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
330 ((uint8_t*)(p))[0] = (d); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
331 ((uint8_t*)(p))[1] = (d)>>8; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
332 ((uint8_t*)(p))[2] = (d)>>16; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
333 ((uint8_t*)(p))[3] = (d)>>24; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
334 ((uint8_t*)(p))[4] = (d)>>32; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
335 ((uint8_t*)(p))[5] = (d)>>40; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
336 ((uint8_t*)(p))[6] = (d)>>48; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
337 ((uint8_t*)(p))[7] = (d)>>56; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
338 } while(0)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
339 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
340
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
341 #if AV_HAVE_BIGENDIAN
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
342 # define AV_RN(s, p) AV_RB##s(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
343 # define AV_WN(s, p, v) AV_WB##s(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
344 #else
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
345 # define AV_RN(s, p) AV_RL##s(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
346 # define AV_WN(s, p, v) AV_WL##s(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
347 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
348
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
349 #endif /* HAVE_FAST_UNALIGNED */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
350
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
351 #ifndef AV_RN16
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
352 # define AV_RN16(p) AV_RN(16, p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
353 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
354
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
355 #ifndef AV_RN32
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
356 # define AV_RN32(p) AV_RN(32, p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
357 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
358
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
359 #ifndef AV_RN64
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
360 # define AV_RN64(p) AV_RN(64, p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
361 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
362
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
363 #ifndef AV_WN16
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
364 # define AV_WN16(p, v) AV_WN(16, p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
365 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
366
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
367 #ifndef AV_WN32
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
368 # define AV_WN32(p, v) AV_WN(32, p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
369 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
370
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
371 #ifndef AV_WN64
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
372 # define AV_WN64(p, v) AV_WN(64, p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
373 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
374
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
375 #if AV_HAVE_BIGENDIAN
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
376 # define AV_RB(s, p) AV_RN##s(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
377 # define AV_WB(s, p, v) AV_WN##s(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
378 # define AV_RL(s, p) av_bswap##s(AV_RN##s(p))
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
379 # define AV_WL(s, p, v) AV_WN##s(p, av_bswap##s(v))
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
380 #else
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
381 # define AV_RB(s, p) av_bswap##s(AV_RN##s(p))
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
382 # define AV_WB(s, p, v) AV_WN##s(p, av_bswap##s(v))
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
383 # define AV_RL(s, p) AV_RN##s(p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
384 # define AV_WL(s, p, v) AV_WN##s(p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
385 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
386
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
387 #define AV_RB8(x) (((const uint8_t*)(x))[0])
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
388 #define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
389
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
390 #define AV_RL8(x) AV_RB8(x)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
391 #define AV_WL8(p, d) AV_WB8(p, d)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
392
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
393 #ifndef AV_RB16
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
394 # define AV_RB16(p) AV_RB(16, p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
395 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
396 #ifndef AV_WB16
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
397 # define AV_WB16(p, v) AV_WB(16, p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
398 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
399
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
400 #ifndef AV_RL16
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
401 # define AV_RL16(p) AV_RL(16, p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
402 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
403 #ifndef AV_WL16
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
404 # define AV_WL16(p, v) AV_WL(16, p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
405 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
406
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
407 #ifndef AV_RB32
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
408 # define AV_RB32(p) AV_RB(32, p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
409 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
410 #ifndef AV_WB32
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
411 # define AV_WB32(p, v) AV_WB(32, p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
412 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
413
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
414 #ifndef AV_RL32
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
415 # define AV_RL32(p) AV_RL(32, p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
416 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
417 #ifndef AV_WL32
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
418 # define AV_WL32(p, v) AV_WL(32, p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
419 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
420
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
421 #ifndef AV_RB64
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
422 # define AV_RB64(p) AV_RB(64, p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
423 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
424 #ifndef AV_WB64
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
425 # define AV_WB64(p, v) AV_WB(64, p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
426 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
427
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
428 #ifndef AV_RL64
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
429 # define AV_RL64(p) AV_RL(64, p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
430 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
431 #ifndef AV_WL64
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
432 # define AV_WL64(p, v) AV_WL(64, p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
433 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
434
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
435 #ifndef AV_RB24
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
436 # define AV_RB24(x) \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
437 ((((const uint8_t*)(x))[0] << 16) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
438 (((const uint8_t*)(x))[1] << 8) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
439 ((const uint8_t*)(x))[2])
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
440 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
441 #ifndef AV_WB24
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
442 # define AV_WB24(p, d) do { \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
443 ((uint8_t*)(p))[2] = (d); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
444 ((uint8_t*)(p))[1] = (d)>>8; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
445 ((uint8_t*)(p))[0] = (d)>>16; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
446 } while(0)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
447 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
448
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
449 #ifndef AV_RL24
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
450 # define AV_RL24(x) \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
451 ((((const uint8_t*)(x))[2] << 16) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
452 (((const uint8_t*)(x))[1] << 8) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
453 ((const uint8_t*)(x))[0])
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
454 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
455 #ifndef AV_WL24
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
456 # define AV_WL24(p, d) do { \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
457 ((uint8_t*)(p))[0] = (d); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
458 ((uint8_t*)(p))[1] = (d)>>8; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
459 ((uint8_t*)(p))[2] = (d)>>16; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
460 } while(0)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
461 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
462
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
463 #ifndef AV_RB48
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
464 # define AV_RB48(x) \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
465 (((uint64_t)((const uint8_t*)(x))[0] << 40) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
466 ((uint64_t)((const uint8_t*)(x))[1] << 32) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
467 ((uint64_t)((const uint8_t*)(x))[2] << 24) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
468 ((uint64_t)((const uint8_t*)(x))[3] << 16) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
469 ((uint64_t)((const uint8_t*)(x))[4] << 8) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
470 (uint64_t)((const uint8_t*)(x))[5])
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
471 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
472 #ifndef AV_WB48
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
473 # define AV_WB48(p, darg) do { \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
474 uint64_t d = (darg); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
475 ((uint8_t*)(p))[5] = (d); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
476 ((uint8_t*)(p))[4] = (d)>>8; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
477 ((uint8_t*)(p))[3] = (d)>>16; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
478 ((uint8_t*)(p))[2] = (d)>>24; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
479 ((uint8_t*)(p))[1] = (d)>>32; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
480 ((uint8_t*)(p))[0] = (d)>>40; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
481 } while(0)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
482 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
483
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
484 #ifndef AV_RL48
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
485 # define AV_RL48(x) \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
486 (((uint64_t)((const uint8_t*)(x))[5] << 40) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
487 ((uint64_t)((const uint8_t*)(x))[4] << 32) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
488 ((uint64_t)((const uint8_t*)(x))[3] << 24) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
489 ((uint64_t)((const uint8_t*)(x))[2] << 16) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
490 ((uint64_t)((const uint8_t*)(x))[1] << 8) | \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
491 (uint64_t)((const uint8_t*)(x))[0])
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
492 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
493 #ifndef AV_WL48
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
494 # define AV_WL48(p, darg) do { \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
495 uint64_t d = (darg); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
496 ((uint8_t*)(p))[0] = (d); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
497 ((uint8_t*)(p))[1] = (d)>>8; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
498 ((uint8_t*)(p))[2] = (d)>>16; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
499 ((uint8_t*)(p))[3] = (d)>>24; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
500 ((uint8_t*)(p))[4] = (d)>>32; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
501 ((uint8_t*)(p))[5] = (d)>>40; \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
502 } while(0)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
503 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
504
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
505 /*
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
506 * The AV_[RW]NA macros access naturally aligned data
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
507 * in a type-safe way.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
508 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
509
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
510 #define AV_RNA(s, p) (((const av_alias##s*)(p))->u##s)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
511 #define AV_WNA(s, p, v) (((av_alias##s*)(p))->u##s = (v))
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
512
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
513 #ifndef AV_RN16A
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
514 # define AV_RN16A(p) AV_RNA(16, p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
515 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
516
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
517 #ifndef AV_RN32A
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
518 # define AV_RN32A(p) AV_RNA(32, p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
519 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
520
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
521 #ifndef AV_RN64A
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
522 # define AV_RN64A(p) AV_RNA(64, p)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
523 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
524
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
525 #ifndef AV_WN16A
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
526 # define AV_WN16A(p, v) AV_WNA(16, p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
527 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
528
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
529 #ifndef AV_WN32A
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
530 # define AV_WN32A(p, v) AV_WNA(32, p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
531 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
532
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
533 #ifndef AV_WN64A
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
534 # define AV_WN64A(p, v) AV_WNA(64, p, v)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
535 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
536
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
537 /*
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
538 * The AV_COPYxxU macros are suitable for copying data to/from unaligned
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
539 * memory locations.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
540 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
541
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
542 #define AV_COPYU(n, d, s) AV_WN##n(d, AV_RN##n(s));
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
543
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
544 #ifndef AV_COPY16U
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
545 # define AV_COPY16U(d, s) AV_COPYU(16, d, s)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
546 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
547
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
548 #ifndef AV_COPY32U
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
549 # define AV_COPY32U(d, s) AV_COPYU(32, d, s)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
550 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
551
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
552 #ifndef AV_COPY64U
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
553 # define AV_COPY64U(d, s) AV_COPYU(64, d, s)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
554 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
555
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
556 #ifndef AV_COPY128U
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
557 # define AV_COPY128U(d, s) \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
558 do { \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
559 AV_COPY64U(d, s); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
560 AV_COPY64U((char *)(d) + 8, (const char *)(s) + 8); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
561 } while(0)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
562 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
563
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
564 /* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
565 * naturally aligned. They may be implemented using MMX,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
566 * so emms_c() must be called before using any float code
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
567 * afterwards.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
568 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
569
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
570 #define AV_COPY(n, d, s) \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
571 (((av_alias##n*)(d))->u##n = ((const av_alias##n*)(s))->u##n)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
572
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
573 #ifndef AV_COPY16
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
574 # define AV_COPY16(d, s) AV_COPY(16, d, s)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
575 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
576
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
577 #ifndef AV_COPY32
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
578 # define AV_COPY32(d, s) AV_COPY(32, d, s)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
579 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
580
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
581 #ifndef AV_COPY64
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
582 # define AV_COPY64(d, s) AV_COPY(64, d, s)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
583 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
584
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
585 #ifndef AV_COPY128
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
586 # define AV_COPY128(d, s) \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
587 do { \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
588 AV_COPY64(d, s); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
589 AV_COPY64((char*)(d)+8, (char*)(s)+8); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
590 } while(0)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
591 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
592
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
593 #define AV_SWAP(n, a, b) FFSWAP(av_alias##n, *(av_alias##n*)(a), *(av_alias##n*)(b))
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
594
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
595 #ifndef AV_SWAP64
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
596 # define AV_SWAP64(a, b) AV_SWAP(64, a, b)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
597 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
598
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
599 #define AV_ZERO(n, d) (((av_alias##n*)(d))->u##n = 0)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
600
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
601 #ifndef AV_ZERO16
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
602 # define AV_ZERO16(d) AV_ZERO(16, d)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
603 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
604
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
605 #ifndef AV_ZERO32
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
606 # define AV_ZERO32(d) AV_ZERO(32, d)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
607 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
608
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
609 #ifndef AV_ZERO64
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
610 # define AV_ZERO64(d) AV_ZERO(64, d)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
611 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
612
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
613 #ifndef AV_ZERO128
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
614 # define AV_ZERO128(d) \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
615 do { \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
616 AV_ZERO64(d); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
617 AV_ZERO64((char*)(d)+8); \
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
618 } while(0)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
619 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
620
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
621 #endif /* AVUTIL_INTREADWRITE_H */