40 #define STARTCODE_TEST \
41 if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \
42 if (src[i + 2] != 3) { \
48 #if HAVE_FAST_UNALIGNED
49 #define FIND_FIRST_ZERO \
50 if (i > 0 && !src[i]) \
55 for (i = 0; i + 1 <
length; i += 9) {
57 (
AV_RN64A(src + i) - 0x0100010001000101ULL)) &
58 0x8000800080008080ULL))
65 for (i = 0; i + 1 <
length; i += 5) {
76 for (i = 0; i + 1 <
length; i += 2) {
79 if (i > 0 && src[i - 1] == 0)
85 if (i >= length - 1) {
102 while (si + 2 < length) {
104 if (src[si + 2] > 3) {
105 dst[di++] = src[si++];
106 dst[di++] = src[si++];
107 }
else if (src[si] == 0 && src[si + 1] == 0) {
108 if (src[si + 2] == 3) {
134 dst[di++] = src[si++];
137 dst[di++] = src[si++];
177 default :
return "?";
201 "nal_unit_type: %d(%s), nuh_layer_id: %d, temporal_id: %d\n",
204 return nuh_layer_id == 0;
211 int consumed, ret = 0;
214 while (length >= 4) {
216 int extract_length = 0;
220 for (i = 0; i < nal_length_size; i++)
221 extract_length = (extract_length << 8) | buf[i];
222 buf += nal_length_size;
223 length -= nal_length_size;
225 if (extract_length > length) {
231 while (buf[0] != 0 || buf[1] != 0 || buf[2] != 1) {
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
memory handling functions
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int ff_hevc_split_packet(HEVCContext *s, HEVCPacket *pkt, const uint8_t *buf, int length, AVCodecContext *avctx, int is_nalff, int nal_length_size)
Split an input packet into NAL units.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
main external API structure.
static unsigned int get_bits1(GetBitContext *s)
int skipped_bytes_pos_size
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
static int hls_nal_unit(HEVCNAL *nal, AVCodecContext *avctx)
int ff_hevc_extract_rbsp(HEVCContext *s, const uint8_t *src, int length, HEVCNAL *nal)
Extract the raw (unescaped) HEVC bitstream.
static const char * nal_unit_name(int nal_type)
#define av_malloc_array(a, b)