/src/vlc/contrib/contrib-build/bpg/libavcodec/bytestream.h
Line | Count | Source |
1 | | /* |
2 | | * Bytestream functions |
3 | | * copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier@free.fr> |
4 | | * Copyright (c) 2012 Aneesh Dogra (lionaneesh) <lionaneesh@gmail.com> |
5 | | * |
6 | | * This file is part of FFmpeg. |
7 | | * |
8 | | * FFmpeg is free software; you can redistribute it and/or |
9 | | * modify it under the terms of the GNU Lesser General Public |
10 | | * License as published by the Free Software Foundation; either |
11 | | * version 2.1 of the License, or (at your option) any later version. |
12 | | * |
13 | | * FFmpeg is distributed in the hope that it will be useful, |
14 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | | * Lesser General Public License for more details. |
17 | | * |
18 | | * You should have received a copy of the GNU Lesser General Public |
19 | | * License along with FFmpeg; if not, write to the Free Software |
20 | | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
21 | | */ |
22 | | |
23 | | #ifndef AVCODEC_BYTESTREAM_H |
24 | | #define AVCODEC_BYTESTREAM_H |
25 | | |
26 | | #include <stdint.h> |
27 | | #include <string.h> |
28 | | |
29 | | #include "libavutil/avassert.h" |
30 | | #include "libavutil/common.h" |
31 | | #include "libavutil/intreadwrite.h" |
32 | | |
33 | | typedef struct GetByteContext { |
34 | | const uint8_t *buffer, *buffer_end, *buffer_start; |
35 | | } GetByteContext; |
36 | | |
37 | | typedef struct PutByteContext { |
38 | | uint8_t *buffer, *buffer_end, *buffer_start; |
39 | | int eof; |
40 | | } PutByteContext; |
41 | | |
42 | | #define DEF(type, name, bytes, read, write) \ |
43 | 0 | static av_always_inline type bytestream_get_ ## name(const uint8_t **b) \ |
44 | 0 | { \ |
45 | 0 | (*b) += bytes; \ |
46 | 0 | return read(*b - bytes); \ |
47 | 0 | } \ Unexecuted instantiation: hevc.c:bytestream_get_le64 Unexecuted instantiation: hevc.c:bytestream_get_le32 Unexecuted instantiation: hevc.c:bytestream_get_le24 Unexecuted instantiation: hevc.c:bytestream_get_le16 Unexecuted instantiation: hevc.c:bytestream_get_be64 Unexecuted instantiation: hevc.c:bytestream_get_be32 Unexecuted instantiation: hevc.c:bytestream_get_be24 Unexecuted instantiation: hevc.c:bytestream_get_be16 Unexecuted instantiation: hevc.c:bytestream_get_byte Unexecuted instantiation: utils.c:bytestream_get_le64 Unexecuted instantiation: utils.c:bytestream_get_le32 Unexecuted instantiation: utils.c:bytestream_get_le24 Unexecuted instantiation: utils.c:bytestream_get_le16 Unexecuted instantiation: utils.c:bytestream_get_be64 Unexecuted instantiation: utils.c:bytestream_get_be32 Unexecuted instantiation: utils.c:bytestream_get_be24 Unexecuted instantiation: utils.c:bytestream_get_be16 Unexecuted instantiation: utils.c:bytestream_get_byte |
48 | | static av_always_inline void bytestream_put_ ## name(uint8_t **b, \ |
49 | 0 | const type value) \ |
50 | 0 | { \ |
51 | 0 | write(*b, value); \ |
52 | 0 | (*b) += bytes; \ |
53 | 0 | } \ Unexecuted instantiation: hevc.c:bytestream_put_le64 Unexecuted instantiation: hevc.c:bytestream_put_le32 Unexecuted instantiation: hevc.c:bytestream_put_le24 Unexecuted instantiation: hevc.c:bytestream_put_le16 Unexecuted instantiation: hevc.c:bytestream_put_be64 Unexecuted instantiation: hevc.c:bytestream_put_be32 Unexecuted instantiation: hevc.c:bytestream_put_be24 Unexecuted instantiation: hevc.c:bytestream_put_be16 Unexecuted instantiation: hevc.c:bytestream_put_byte Unexecuted instantiation: utils.c:bytestream_put_le64 Unexecuted instantiation: utils.c:bytestream_put_le32 Unexecuted instantiation: utils.c:bytestream_put_le24 Unexecuted instantiation: utils.c:bytestream_put_le16 Unexecuted instantiation: utils.c:bytestream_put_be64 Unexecuted instantiation: utils.c:bytestream_put_be32 Unexecuted instantiation: utils.c:bytestream_put_be24 Unexecuted instantiation: utils.c:bytestream_put_be16 Unexecuted instantiation: utils.c:bytestream_put_byte |
54 | | static av_always_inline void bytestream2_put_ ## name ## u(PutByteContext *p, \ |
55 | 0 | const type value) \ |
56 | 0 | { \ |
57 | 0 | bytestream_put_ ## name(&p->buffer, value); \ |
58 | 0 | } \ Unexecuted instantiation: hevc.c:bytestream2_put_le64u Unexecuted instantiation: hevc.c:bytestream2_put_le32u Unexecuted instantiation: hevc.c:bytestream2_put_le24u Unexecuted instantiation: hevc.c:bytestream2_put_le16u Unexecuted instantiation: hevc.c:bytestream2_put_be64u Unexecuted instantiation: hevc.c:bytestream2_put_be32u Unexecuted instantiation: hevc.c:bytestream2_put_be24u Unexecuted instantiation: hevc.c:bytestream2_put_be16u Unexecuted instantiation: hevc.c:bytestream2_put_byteu Unexecuted instantiation: utils.c:bytestream2_put_le64u Unexecuted instantiation: utils.c:bytestream2_put_le32u Unexecuted instantiation: utils.c:bytestream2_put_le24u Unexecuted instantiation: utils.c:bytestream2_put_le16u Unexecuted instantiation: utils.c:bytestream2_put_be64u Unexecuted instantiation: utils.c:bytestream2_put_be32u Unexecuted instantiation: utils.c:bytestream2_put_be24u Unexecuted instantiation: utils.c:bytestream2_put_be16u Unexecuted instantiation: utils.c:bytestream2_put_byteu |
59 | | static av_always_inline void bytestream2_put_ ## name(PutByteContext *p, \ |
60 | 0 | const type value) \ |
61 | 0 | { \ |
62 | 0 | if (!p->eof && (p->buffer_end - p->buffer >= bytes)) { \ |
63 | 0 | write(p->buffer, value); \ |
64 | 0 | p->buffer += bytes; \ |
65 | 0 | } else \ |
66 | 0 | p->eof = 1; \ |
67 | 0 | } \ Unexecuted instantiation: hevc.c:bytestream2_put_le64 Unexecuted instantiation: hevc.c:bytestream2_put_le32 Unexecuted instantiation: hevc.c:bytestream2_put_le24 Unexecuted instantiation: hevc.c:bytestream2_put_le16 Unexecuted instantiation: hevc.c:bytestream2_put_be64 Unexecuted instantiation: hevc.c:bytestream2_put_be32 Unexecuted instantiation: hevc.c:bytestream2_put_be24 Unexecuted instantiation: hevc.c:bytestream2_put_be16 Unexecuted instantiation: hevc.c:bytestream2_put_byte Unexecuted instantiation: utils.c:bytestream2_put_le64 Unexecuted instantiation: utils.c:bytestream2_put_le32 Unexecuted instantiation: utils.c:bytestream2_put_le24 Unexecuted instantiation: utils.c:bytestream2_put_le16 Unexecuted instantiation: utils.c:bytestream2_put_be64 Unexecuted instantiation: utils.c:bytestream2_put_be32 Unexecuted instantiation: utils.c:bytestream2_put_be24 Unexecuted instantiation: utils.c:bytestream2_put_be16 Unexecuted instantiation: utils.c:bytestream2_put_byte |
68 | 0 | static av_always_inline type bytestream2_get_ ## name ## u(GetByteContext *g) \ |
69 | 0 | { \ |
70 | 0 | return bytestream_get_ ## name(&g->buffer); \ |
71 | 0 | } \ Unexecuted instantiation: hevc.c:bytestream2_get_le64u Unexecuted instantiation: hevc.c:bytestream2_get_le32u Unexecuted instantiation: hevc.c:bytestream2_get_le24u Unexecuted instantiation: hevc.c:bytestream2_get_le16u Unexecuted instantiation: hevc.c:bytestream2_get_be64u Unexecuted instantiation: hevc.c:bytestream2_get_be32u Unexecuted instantiation: hevc.c:bytestream2_get_be24u Unexecuted instantiation: hevc.c:bytestream2_get_be16u Unexecuted instantiation: hevc.c:bytestream2_get_byteu Unexecuted instantiation: utils.c:bytestream2_get_le64u Unexecuted instantiation: utils.c:bytestream2_get_le32u Unexecuted instantiation: utils.c:bytestream2_get_le24u Unexecuted instantiation: utils.c:bytestream2_get_le16u Unexecuted instantiation: utils.c:bytestream2_get_be64u Unexecuted instantiation: utils.c:bytestream2_get_be32u Unexecuted instantiation: utils.c:bytestream2_get_be24u Unexecuted instantiation: utils.c:bytestream2_get_be16u Unexecuted instantiation: utils.c:bytestream2_get_byteu |
72 | 0 | static av_always_inline type bytestream2_get_ ## name(GetByteContext *g) \ |
73 | 0 | { \ |
74 | 0 | if (g->buffer_end - g->buffer < bytes) \ |
75 | 0 | return 0; \ |
76 | 0 | return bytestream2_get_ ## name ## u(g); \ |
77 | 0 | } \ Unexecuted instantiation: hevc.c:bytestream2_get_le64 Unexecuted instantiation: hevc.c:bytestream2_get_le32 Unexecuted instantiation: hevc.c:bytestream2_get_le24 Unexecuted instantiation: hevc.c:bytestream2_get_le16 Unexecuted instantiation: hevc.c:bytestream2_get_be64 Unexecuted instantiation: hevc.c:bytestream2_get_be32 Unexecuted instantiation: hevc.c:bytestream2_get_be24 Unexecuted instantiation: hevc.c:bytestream2_get_be16 Unexecuted instantiation: hevc.c:bytestream2_get_byte Unexecuted instantiation: utils.c:bytestream2_get_le64 Unexecuted instantiation: utils.c:bytestream2_get_le32 Unexecuted instantiation: utils.c:bytestream2_get_le24 Unexecuted instantiation: utils.c:bytestream2_get_le16 Unexecuted instantiation: utils.c:bytestream2_get_be64 Unexecuted instantiation: utils.c:bytestream2_get_be32 Unexecuted instantiation: utils.c:bytestream2_get_be24 Unexecuted instantiation: utils.c:bytestream2_get_be16 Unexecuted instantiation: utils.c:bytestream2_get_byte |
78 | 0 | static av_always_inline type bytestream2_peek_ ## name(GetByteContext *g) \ |
79 | 0 | { \ |
80 | 0 | if (g->buffer_end - g->buffer < bytes) \ |
81 | 0 | return 0; \ |
82 | 0 | return read(g->buffer); \ |
83 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_peek_le64 Unexecuted instantiation: hevc.c:bytestream2_peek_le32 Unexecuted instantiation: hevc.c:bytestream2_peek_le24 Unexecuted instantiation: hevc.c:bytestream2_peek_le16 Unexecuted instantiation: hevc.c:bytestream2_peek_be64 Unexecuted instantiation: hevc.c:bytestream2_peek_be32 Unexecuted instantiation: hevc.c:bytestream2_peek_be24 Unexecuted instantiation: hevc.c:bytestream2_peek_be16 Unexecuted instantiation: hevc.c:bytestream2_peek_byte Unexecuted instantiation: utils.c:bytestream2_peek_le64 Unexecuted instantiation: utils.c:bytestream2_peek_le32 Unexecuted instantiation: utils.c:bytestream2_peek_le24 Unexecuted instantiation: utils.c:bytestream2_peek_le16 Unexecuted instantiation: utils.c:bytestream2_peek_be64 Unexecuted instantiation: utils.c:bytestream2_peek_be32 Unexecuted instantiation: utils.c:bytestream2_peek_be24 Unexecuted instantiation: utils.c:bytestream2_peek_be16 Unexecuted instantiation: utils.c:bytestream2_peek_byte |
84 | | |
85 | | DEF(uint64_t, le64, 8, AV_RL64, AV_WL64) |
86 | | DEF(unsigned int, le32, 4, AV_RL32, AV_WL32) |
87 | | DEF(unsigned int, le24, 3, AV_RL24, AV_WL24) |
88 | | DEF(unsigned int, le16, 2, AV_RL16, AV_WL16) |
89 | | DEF(uint64_t, be64, 8, AV_RB64, AV_WB64) |
90 | | DEF(unsigned int, be32, 4, AV_RB32, AV_WB32) |
91 | | DEF(unsigned int, be24, 3, AV_RB24, AV_WB24) |
92 | | DEF(unsigned int, be16, 2, AV_RB16, AV_WB16) |
93 | | DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8) |
94 | | |
95 | | #if HAVE_BIGENDIAN |
96 | | # define bytestream2_get_ne16 bytestream2_get_be16 |
97 | | # define bytestream2_get_ne24 bytestream2_get_be24 |
98 | | # define bytestream2_get_ne32 bytestream2_get_be32 |
99 | | # define bytestream2_get_ne64 bytestream2_get_be64 |
100 | | # define bytestream2_get_ne16u bytestream2_get_be16u |
101 | | # define bytestream2_get_ne24u bytestream2_get_be24u |
102 | | # define bytestream2_get_ne32u bytestream2_get_be32u |
103 | | # define bytestream2_get_ne64u bytestream2_get_be64u |
104 | | # define bytestream2_put_ne16 bytestream2_put_be16 |
105 | | # define bytestream2_put_ne24 bytestream2_put_be24 |
106 | | # define bytestream2_put_ne32 bytestream2_put_be32 |
107 | | # define bytestream2_put_ne64 bytestream2_put_be64 |
108 | | # define bytestream2_peek_ne16 bytestream2_peek_be16 |
109 | | # define bytestream2_peek_ne24 bytestream2_peek_be24 |
110 | | # define bytestream2_peek_ne32 bytestream2_peek_be32 |
111 | | # define bytestream2_peek_ne64 bytestream2_peek_be64 |
112 | | #else |
113 | | # define bytestream2_get_ne16 bytestream2_get_le16 |
114 | | # define bytestream2_get_ne24 bytestream2_get_le24 |
115 | | # define bytestream2_get_ne32 bytestream2_get_le32 |
116 | | # define bytestream2_get_ne64 bytestream2_get_le64 |
117 | | # define bytestream2_get_ne16u bytestream2_get_le16u |
118 | | # define bytestream2_get_ne24u bytestream2_get_le24u |
119 | | # define bytestream2_get_ne32u bytestream2_get_le32u |
120 | | # define bytestream2_get_ne64u bytestream2_get_le64u |
121 | | # define bytestream2_put_ne16 bytestream2_put_le16 |
122 | | # define bytestream2_put_ne24 bytestream2_put_le24 |
123 | | # define bytestream2_put_ne32 bytestream2_put_le32 |
124 | | # define bytestream2_put_ne64 bytestream2_put_le64 |
125 | | # define bytestream2_peek_ne16 bytestream2_peek_le16 |
126 | | # define bytestream2_peek_ne24 bytestream2_peek_le24 |
127 | | # define bytestream2_peek_ne32 bytestream2_peek_le32 |
128 | | # define bytestream2_peek_ne64 bytestream2_peek_le64 |
129 | | #endif |
130 | | |
131 | | static av_always_inline void bytestream2_init(GetByteContext *g, |
132 | | const uint8_t *buf, |
133 | | int buf_size) |
134 | 0 | { |
135 | 0 | av_assert0(buf_size >= 0); |
136 | 0 | g->buffer = buf; |
137 | 0 | g->buffer_start = buf; |
138 | 0 | g->buffer_end = buf + buf_size; |
139 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_init Unexecuted instantiation: utils.c:bytestream2_init |
140 | | |
141 | | static av_always_inline void bytestream2_init_writer(PutByteContext *p, |
142 | | uint8_t *buf, |
143 | | int buf_size) |
144 | 0 | { |
145 | 0 | av_assert0(buf_size >= 0); |
146 | 0 | p->buffer = buf; |
147 | 0 | p->buffer_start = buf; |
148 | 0 | p->buffer_end = buf + buf_size; |
149 | 0 | p->eof = 0; |
150 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_init_writer Unexecuted instantiation: utils.c:bytestream2_init_writer |
151 | | |
152 | | static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g) |
153 | 0 | { |
154 | 0 | return g->buffer_end - g->buffer; |
155 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_get_bytes_left Unexecuted instantiation: utils.c:bytestream2_get_bytes_left |
156 | | |
157 | | static av_always_inline unsigned int bytestream2_get_bytes_left_p(PutByteContext *p) |
158 | 0 | { |
159 | 0 | return p->buffer_end - p->buffer; |
160 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_get_bytes_left_p Unexecuted instantiation: utils.c:bytestream2_get_bytes_left_p |
161 | | |
162 | | static av_always_inline void bytestream2_skip(GetByteContext *g, |
163 | | unsigned int size) |
164 | 0 | { |
165 | 0 | g->buffer += FFMIN(g->buffer_end - g->buffer, size); |
166 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_skip Unexecuted instantiation: utils.c:bytestream2_skip |
167 | | |
168 | | static av_always_inline void bytestream2_skipu(GetByteContext *g, |
169 | | unsigned int size) |
170 | 0 | { |
171 | 0 | g->buffer += size; |
172 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_skipu Unexecuted instantiation: utils.c:bytestream2_skipu |
173 | | |
174 | | static av_always_inline void bytestream2_skip_p(PutByteContext *p, |
175 | | unsigned int size) |
176 | 0 | { |
177 | 0 | int size2; |
178 | 0 | if (p->eof) |
179 | 0 | return; |
180 | 0 | size2 = FFMIN(p->buffer_end - p->buffer, size); |
181 | 0 | if (size2 != size) |
182 | 0 | p->eof = 1; |
183 | 0 | p->buffer += size2; |
184 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_skip_p Unexecuted instantiation: utils.c:bytestream2_skip_p |
185 | | |
186 | | static av_always_inline int bytestream2_tell(GetByteContext *g) |
187 | 0 | { |
188 | 0 | return (int)(g->buffer - g->buffer_start); |
189 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_tell Unexecuted instantiation: utils.c:bytestream2_tell |
190 | | |
191 | | static av_always_inline int bytestream2_tell_p(PutByteContext *p) |
192 | 0 | { |
193 | 0 | return (int)(p->buffer - p->buffer_start); |
194 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_tell_p Unexecuted instantiation: utils.c:bytestream2_tell_p |
195 | | |
196 | | static av_always_inline int bytestream2_size(GetByteContext *g) |
197 | 0 | { |
198 | 0 | return (int)(g->buffer_end - g->buffer_start); |
199 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_size Unexecuted instantiation: utils.c:bytestream2_size |
200 | | |
201 | | static av_always_inline int bytestream2_size_p(PutByteContext *p) |
202 | 0 | { |
203 | 0 | return (int)(p->buffer_end - p->buffer_start); |
204 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_size_p Unexecuted instantiation: utils.c:bytestream2_size_p |
205 | | |
206 | | static av_always_inline int bytestream2_seek(GetByteContext *g, |
207 | | int offset, |
208 | | int whence) |
209 | 0 | { |
210 | 0 | switch (whence) { |
211 | 0 | case SEEK_CUR: |
212 | 0 | offset = av_clip(offset, -(g->buffer - g->buffer_start), |
213 | 0 | g->buffer_end - g->buffer); |
214 | 0 | g->buffer += offset; |
215 | 0 | break; |
216 | 0 | case SEEK_END: |
217 | 0 | offset = av_clip(offset, -(g->buffer_end - g->buffer_start), 0); |
218 | 0 | g->buffer = g->buffer_end + offset; |
219 | 0 | break; |
220 | 0 | case SEEK_SET: |
221 | 0 | offset = av_clip(offset, 0, g->buffer_end - g->buffer_start); |
222 | 0 | g->buffer = g->buffer_start + offset; |
223 | 0 | break; |
224 | 0 | default: |
225 | 0 | return AVERROR(EINVAL); |
226 | 0 | } |
227 | 0 | return bytestream2_tell(g); |
228 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_seek Unexecuted instantiation: utils.c:bytestream2_seek |
229 | | |
230 | | static av_always_inline int bytestream2_seek_p(PutByteContext *p, |
231 | | int offset, |
232 | | int whence) |
233 | 0 | { |
234 | 0 | p->eof = 0; |
235 | 0 | switch (whence) { |
236 | 0 | case SEEK_CUR: |
237 | 0 | if (p->buffer_end - p->buffer < offset) |
238 | 0 | p->eof = 1; |
239 | 0 | offset = av_clip(offset, -(p->buffer - p->buffer_start), |
240 | 0 | p->buffer_end - p->buffer); |
241 | 0 | p->buffer += offset; |
242 | 0 | break; |
243 | 0 | case SEEK_END: |
244 | 0 | if (offset > 0) |
245 | 0 | p->eof = 1; |
246 | 0 | offset = av_clip(offset, -(p->buffer_end - p->buffer_start), 0); |
247 | 0 | p->buffer = p->buffer_end + offset; |
248 | 0 | break; |
249 | 0 | case SEEK_SET: |
250 | 0 | if (p->buffer_end - p->buffer_start < offset) |
251 | 0 | p->eof = 1; |
252 | 0 | offset = av_clip(offset, 0, p->buffer_end - p->buffer_start); |
253 | 0 | p->buffer = p->buffer_start + offset; |
254 | 0 | break; |
255 | 0 | default: |
256 | 0 | return AVERROR(EINVAL); |
257 | 0 | } |
258 | 0 | return bytestream2_tell_p(p); |
259 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_seek_p Unexecuted instantiation: utils.c:bytestream2_seek_p |
260 | | |
261 | | static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, |
262 | | uint8_t *dst, |
263 | | unsigned int size) |
264 | 0 | { |
265 | 0 | int size2 = FFMIN(g->buffer_end - g->buffer, size); |
266 | 0 | memcpy(dst, g->buffer, size2); |
267 | 0 | g->buffer += size2; |
268 | 0 | return size2; |
269 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_get_buffer Unexecuted instantiation: utils.c:bytestream2_get_buffer |
270 | | |
271 | | static av_always_inline unsigned int bytestream2_get_bufferu(GetByteContext *g, |
272 | | uint8_t *dst, |
273 | | unsigned int size) |
274 | 0 | { |
275 | 0 | memcpy(dst, g->buffer, size); |
276 | 0 | g->buffer += size; |
277 | 0 | return size; |
278 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_get_bufferu Unexecuted instantiation: utils.c:bytestream2_get_bufferu |
279 | | |
280 | | static av_always_inline unsigned int bytestream2_put_buffer(PutByteContext *p, |
281 | | const uint8_t *src, |
282 | | unsigned int size) |
283 | 0 | { |
284 | 0 | int size2; |
285 | 0 | if (p->eof) |
286 | 0 | return 0; |
287 | 0 | size2 = FFMIN(p->buffer_end - p->buffer, size); |
288 | 0 | if (size2 != size) |
289 | 0 | p->eof = 1; |
290 | 0 | memcpy(p->buffer, src, size2); |
291 | 0 | p->buffer += size2; |
292 | 0 | return size2; |
293 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_put_buffer Unexecuted instantiation: utils.c:bytestream2_put_buffer |
294 | | |
295 | | static av_always_inline unsigned int bytestream2_put_bufferu(PutByteContext *p, |
296 | | const uint8_t *src, |
297 | | unsigned int size) |
298 | 0 | { |
299 | 0 | memcpy(p->buffer, src, size); |
300 | 0 | p->buffer += size; |
301 | 0 | return size; |
302 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_put_bufferu Unexecuted instantiation: utils.c:bytestream2_put_bufferu |
303 | | |
304 | | static av_always_inline void bytestream2_set_buffer(PutByteContext *p, |
305 | | const uint8_t c, |
306 | | unsigned int size) |
307 | 0 | { |
308 | 0 | int size2; |
309 | 0 | if (p->eof) |
310 | 0 | return; |
311 | 0 | size2 = FFMIN(p->buffer_end - p->buffer, size); |
312 | 0 | if (size2 != size) |
313 | 0 | p->eof = 1; |
314 | 0 | memset(p->buffer, c, size2); |
315 | 0 | p->buffer += size2; |
316 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_set_buffer Unexecuted instantiation: utils.c:bytestream2_set_buffer |
317 | | |
318 | | static av_always_inline void bytestream2_set_bufferu(PutByteContext *p, |
319 | | const uint8_t c, |
320 | | unsigned int size) |
321 | 0 | { |
322 | 0 | memset(p->buffer, c, size); |
323 | 0 | p->buffer += size; |
324 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_set_bufferu Unexecuted instantiation: utils.c:bytestream2_set_bufferu |
325 | | |
326 | | static av_always_inline unsigned int bytestream2_get_eof(PutByteContext *p) |
327 | 0 | { |
328 | 0 | return p->eof; |
329 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_get_eof Unexecuted instantiation: utils.c:bytestream2_get_eof |
330 | | |
331 | | static av_always_inline unsigned int bytestream2_copy_bufferu(PutByteContext *p, |
332 | | GetByteContext *g, |
333 | | unsigned int size) |
334 | 0 | { |
335 | 0 | memcpy(p->buffer, g->buffer, size); |
336 | 0 | p->buffer += size; |
337 | 0 | g->buffer += size; |
338 | 0 | return size; |
339 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_copy_bufferu Unexecuted instantiation: utils.c:bytestream2_copy_bufferu |
340 | | |
341 | | static av_always_inline unsigned int bytestream2_copy_buffer(PutByteContext *p, |
342 | | GetByteContext *g, |
343 | | unsigned int size) |
344 | 0 | { |
345 | 0 | int size2; |
346 | 0 |
|
347 | 0 | if (p->eof) |
348 | 0 | return 0; |
349 | 0 | size = FFMIN(g->buffer_end - g->buffer, size); |
350 | 0 | size2 = FFMIN(p->buffer_end - p->buffer, size); |
351 | 0 | if (size2 != size) |
352 | 0 | p->eof = 1; |
353 | 0 |
|
354 | 0 | return bytestream2_copy_bufferu(p, g, size2); |
355 | 0 | } Unexecuted instantiation: hevc.c:bytestream2_copy_buffer Unexecuted instantiation: utils.c:bytestream2_copy_buffer |
356 | | |
357 | | static av_always_inline unsigned int bytestream_get_buffer(const uint8_t **b, |
358 | | uint8_t *dst, |
359 | | unsigned int size) |
360 | 0 | { |
361 | 0 | memcpy(dst, *b, size); |
362 | 0 | (*b) += size; |
363 | 0 | return size; |
364 | 0 | } Unexecuted instantiation: hevc.c:bytestream_get_buffer Unexecuted instantiation: utils.c:bytestream_get_buffer |
365 | | |
366 | | static av_always_inline void bytestream_put_buffer(uint8_t **b, |
367 | | const uint8_t *src, |
368 | | unsigned int size) |
369 | 0 | { |
370 | 0 | memcpy(*b, src, size); |
371 | 0 | (*b) += size; |
372 | 0 | } Unexecuted instantiation: hevc.c:bytestream_put_buffer Unexecuted instantiation: utils.c:bytestream_put_buffer |
373 | | |
374 | | #endif /* AVCODEC_BYTESTREAM_H */ |