]> git.sesse.net Git - ffmpeg/blob - libavcodec/bytestream.h
CABAC assembler optimizations ported to AMD64
[ffmpeg] / libavcodec / bytestream.h
1 /*
2  * Bytestream functions
3  * copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier@free.fr>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21
22 #ifndef FFMPEG_BYTESTREAM_H
23 #define FFMPEG_BYTESTREAM_H
24
25 static always_inline unsigned int bytestream_get_le32(uint8_t **b)
26 {
27     (*b) += 4;
28     return LE_32(*b - 4);
29 }
30
31 static always_inline unsigned int bytestream_get_le16(uint8_t **b)
32 {
33     (*b) += 2;
34     return LE_16(*b - 2);
35 }
36
37 static always_inline unsigned int bytestream_get_byte(uint8_t **b)
38 {
39     (*b)++;
40     return (*b)[-1];
41 }
42
43 static always_inline unsigned int bytestream_get_buffer(uint8_t **b, uint8_t *dst, unsigned int size)
44 {
45     memcpy(dst, *b, size);
46     (*b) += size;
47     return size;
48 }
49
50 #endif /* FFMPEG_BYTESTREAM_H */