FFmpeg
parser.c
Go to the documentation of this file.
1 /*
2  * HEVC Annex B format parser
3  *
4  * Copyright (C) 2012 - 2013 Guillaume Martres
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 #include "libavutil/common.h"
24 #include "libavutil/mem.h"
25 
26 #include "golomb.h"
27 #include "hevc.h"
28 #include "parser_internal.h"
29 #include "parse.h"
30 #include "ps.h"
31 #include "sei.h"
32 #include "h2645_parse.h"
33 #include "parser.h"
34 
35 #define START_CODE 0x000001 ///< start_code_prefix_one_3bytes
36 
37 #define IS_IRAP_NAL(nal) (nal->type >= 16 && nal->type <= 23)
38 #define IS_IDR_NAL(nal) (nal->type == HEVC_NAL_IDR_W_RADL || nal->type == HEVC_NAL_IDR_N_LP)
39 
40 typedef struct HEVCParserContext {
42 
46 
47  int is_avc;
50 
51  int poc;
52  int pocTid0;
54 
56  AVCodecContext *avctx)
57 {
58  HEVCParserContext *ctx = s->priv_data;
59  HEVCParamSets *ps = &ctx->ps;
60  HEVCSEI *sei = &ctx->sei;
61  GetBitContext *gb = &nal->gb;
62  const HEVCPPS *pps;
63  const HEVCSPS *sps;
64  const HEVCWindow *ow;
65  int i, num = 0, den = 0;
66 
67  unsigned int pps_id, first_slice_in_pic_flag, dependent_slice_segment_flag;
68  enum HEVCSliceType slice_type;
69 
70  first_slice_in_pic_flag = get_bits1(gb);
71  s->picture_structure = sei->picture_timing.picture_struct;
72  s->field_order = sei->picture_timing.picture_struct;
73 
74  if (IS_IRAP_NAL(nal)) {
75  s->key_frame = 1;
76  skip_bits1(gb); // no_output_of_prior_pics_flag
77  }
78 
79  pps_id = get_ue_golomb(gb);
80  if (pps_id >= HEVC_MAX_PPS_COUNT || !ps->pps_list[pps_id]) {
81  av_log(avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", pps_id);
82  return AVERROR_INVALIDDATA;
83  }
84  pps = ps->pps_list[pps_id];
85  sps = pps->sps;
86 
87  ow = &sps->output_window;
88 
89  s->coded_width = sps->width;
90  s->coded_height = sps->height;
91  s->width = sps->width - ow->left_offset - ow->right_offset;
92  s->height = sps->height - ow->top_offset - ow->bottom_offset;
93  s->format = sps->pix_fmt;
94  avctx->profile = sps->ptl.general_ptl.profile_idc;
95  avctx->level = sps->ptl.general_ptl.level_idc;
96 
97  if (sps->vps->vps_timing_info_present_flag) {
98  num = sps->vps->vps_num_units_in_tick;
99  den = sps->vps->vps_time_scale;
100  } else if (sps->vui.vui_timing_info_present_flag) {
101  num = sps->vui.vui_num_units_in_tick;
102  den = sps->vui.vui_time_scale;
103  }
104 
105  if (num > 0 && den > 0)
106  av_reduce(&avctx->framerate.den, &avctx->framerate.num,
107  num, den, 1 << 30);
108 
109  if (!first_slice_in_pic_flag) {
110  unsigned int slice_segment_addr;
111  int slice_address_length;
112 
113  if (pps->dependent_slice_segments_enabled_flag)
114  dependent_slice_segment_flag = get_bits1(gb);
115  else
116  dependent_slice_segment_flag = 0;
117 
118  slice_address_length = av_ceil_log2_c(sps->ctb_width *
119  sps->ctb_height);
120  slice_segment_addr = get_bitsz(gb, slice_address_length);
121  if (slice_segment_addr >= sps->ctb_width * sps->ctb_height) {
122  av_log(avctx, AV_LOG_ERROR, "Invalid slice segment address: %u.\n",
123  slice_segment_addr);
124  return AVERROR_INVALIDDATA;
125  }
126  } else
127  dependent_slice_segment_flag = 0;
128 
129  if (dependent_slice_segment_flag)
130  return 0; /* break; */
131 
132  for (i = 0; i < pps->num_extra_slice_header_bits; i++)
133  skip_bits(gb, 1); // slice_reserved_undetermined_flag[]
134 
135  slice_type = get_ue_golomb_31(gb);
136  if (!(slice_type == HEVC_SLICE_I || slice_type == HEVC_SLICE_P ||
137  slice_type == HEVC_SLICE_B)) {
138  av_log(avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n",
139  slice_type);
140  return AVERROR_INVALIDDATA;
141  }
142  s->pict_type = slice_type == HEVC_SLICE_B ? AV_PICTURE_TYPE_B :
143  slice_type == HEVC_SLICE_P ? AV_PICTURE_TYPE_P :
145 
146  if (pps->output_flag_present_flag)
147  skip_bits1(gb); // pic_output_flag
148 
149  if (sps->separate_colour_plane)
150  skip_bits(gb, 2); // colour_plane_id
151 
152  if (!IS_IDR_NAL(nal)) {
153  int pic_order_cnt_lsb = get_bits(gb, sps->log2_max_poc_lsb);
154  s->output_picture_number = ctx->poc =
155  ff_hevc_compute_poc(sps, ctx->pocTid0, pic_order_cnt_lsb, nal->type);
156  } else
157  s->output_picture_number = ctx->poc = 0;
158 
159  if (nal->temporal_id == 0 &&
160  nal->type != HEVC_NAL_TRAIL_N &&
161  nal->type != HEVC_NAL_TSA_N &&
162  nal->type != HEVC_NAL_STSA_N &&
163  nal->type != HEVC_NAL_RADL_N &&
164  nal->type != HEVC_NAL_RASL_N &&
165  nal->type != HEVC_NAL_RADL_R &&
166  nal->type != HEVC_NAL_RASL_R)
167  ctx->pocTid0 = ctx->poc;
168 
169  return 1; /* no need to evaluate the rest */
170 }
171 
172 /**
173  * Parse NAL units of found picture and decode some basic information.
174  *
175  * @param s parser context.
176  * @param avctx codec context.
177  * @param buf buffer with field/frame data.
178  * @param buf_size size of the buffer.
179  */
180 static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
181  int buf_size, AVCodecContext *avctx)
182 {
183  HEVCParserContext *ctx = s->priv_data;
184  HEVCParamSets *ps = &ctx->ps;
185  HEVCSEI *sei = &ctx->sei;
187  int ret, i;
188 
189  /* set some sane default values */
190  s->pict_type = AV_PICTURE_TYPE_I;
191  s->key_frame = 0;
192  s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;
193 
195 
196  ret = ff_h2645_packet_split(&ctx->pkt, buf, buf_size, avctx,
197  ctx->nal_length_size, AV_CODEC_ID_HEVC, flags);
198  if (ret < 0)
199  return ret;
200 
201  for (i = 0; i < ctx->pkt.nb_nals; i++) {
202  H2645NAL *nal = &ctx->pkt.nals[i];
203  GetBitContext *gb = &nal->gb;
204 
205  if (nal->nuh_layer_id > 0)
206  continue;
207 
208  switch (nal->type) {
209  case HEVC_NAL_VPS:
210  ff_hevc_decode_nal_vps(gb, avctx, ps);
211  break;
212  case HEVC_NAL_SPS:
213  ff_hevc_decode_nal_sps(gb, avctx, ps, nal->nuh_layer_id, 1);
214  break;
215  case HEVC_NAL_PPS:
216  ff_hevc_decode_nal_pps(gb, avctx, ps);
217  break;
218  case HEVC_NAL_SEI_PREFIX:
219  case HEVC_NAL_SEI_SUFFIX:
220  ff_hevc_decode_nal_sei(gb, avctx, sei, ps, nal->type);
221  break;
222  case HEVC_NAL_TRAIL_N:
223  case HEVC_NAL_TRAIL_R:
224  case HEVC_NAL_TSA_N:
225  case HEVC_NAL_TSA_R:
226  case HEVC_NAL_STSA_N:
227  case HEVC_NAL_STSA_R:
228  case HEVC_NAL_BLA_W_LP:
229  case HEVC_NAL_BLA_W_RADL:
230  case HEVC_NAL_BLA_N_LP:
231  case HEVC_NAL_IDR_W_RADL:
232  case HEVC_NAL_IDR_N_LP:
233  case HEVC_NAL_CRA_NUT:
234  case HEVC_NAL_RADL_N:
235  case HEVC_NAL_RADL_R:
236  case HEVC_NAL_RASL_N:
237  case HEVC_NAL_RASL_R:
238  if (ctx->sei.picture_timing.picture_struct == HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING) {
239  s->repeat_pict = 1;
240  } else if (ctx->sei.picture_timing.picture_struct == HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING) {
241  s->repeat_pict = 2;
242  }
243  ret = hevc_parse_slice_header(s, nal, avctx);
244  if (ret)
245  return ret;
246  break;
247  }
248  }
249  /* didn't find a picture! */
250  av_log(avctx, AV_LOG_ERROR, "missing picture in access unit with size %d\n", buf_size);
251  return -1;
252 }
253 
254 /**
255  * Find the end of the current frame in the bitstream.
256  * @return the position of the first byte of the next frame, or END_NOT_FOUND
257  */
258 static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf,
259  int buf_size)
260 {
261  HEVCParserContext *ctx = s->priv_data;
262  ParseContext *pc = &ctx->pc;
263  int i;
264 
265  for (i = 0; i < buf_size; i++) {
266  int nut, layer_id;
267 
268  pc->state64 = (pc->state64 << 8) | buf[i];
269 
270  if (((pc->state64 >> 3 * 8) & 0xFFFFFF) != START_CODE)
271  continue;
272 
273  nut = (pc->state64 >> 2 * 8 + 1) & 0x3F;
274 
275  layer_id = (pc->state64 >> 11) & 0x3F;
276  if (layer_id > 0)
277  continue;
278 
279  // Beginning of access unit
280  if ((nut >= HEVC_NAL_VPS && nut <= HEVC_NAL_EOB_NUT) || nut == HEVC_NAL_SEI_PREFIX ||
281  (nut >= 41 && nut <= 44) || (nut >= 48 && nut <= 55)) {
282  if (pc->frame_start_found) {
283  pc->frame_start_found = 0;
284  if (!((pc->state64 >> 6 * 8) & 0xFF))
285  return i - 6;
286  return i - 5;
287  }
288  } else if (nut <= HEVC_NAL_RASL_R ||
289  (nut >= HEVC_NAL_BLA_W_LP && nut <= HEVC_NAL_CRA_NUT)) {
290  int first_slice_segment_in_pic_flag = buf[i] >> 7;
291  if (first_slice_segment_in_pic_flag) {
292  if (!pc->frame_start_found) {
293  pc->frame_start_found = 1;
294  } else { // First slice of next frame found
295  pc->frame_start_found = 0;
296  if (!((pc->state64 >> 6 * 8) & 0xFF))
297  return i - 6;
298  return i - 5;
299  }
300  }
301  }
302  }
303 
304  return END_NOT_FOUND;
305 }
306 
308  const uint8_t **poutbuf, int *poutbuf_size,
309  const uint8_t *buf, int buf_size)
310 {
311  int next;
312  HEVCParserContext *ctx = s->priv_data;
313  ParseContext *pc = &ctx->pc;
314  int is_dummy_buf = !buf_size;
315  const uint8_t *dummy_buf = buf;
316 
317  if (avctx->extradata && !ctx->parsed_extradata) {
318  ff_hevc_decode_extradata(avctx->extradata, avctx->extradata_size, &ctx->ps, &ctx->sei,
319  &ctx->is_avc, &ctx->nal_length_size, avctx->err_recognition,
320  1, avctx);
321  ctx->parsed_extradata = 1;
322  }
323 
324  if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
325  next = buf_size;
326  } else {
327  next = hevc_find_frame_end(s, buf, buf_size);
328  if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
329  *poutbuf = NULL;
330  *poutbuf_size = 0;
331  return buf_size;
332  }
333  }
334 
335  is_dummy_buf &= (dummy_buf == buf);
336 
337  if (!is_dummy_buf)
338  parse_nal_units(s, buf, buf_size, avctx);
339 
340  *poutbuf = buf;
341  *poutbuf_size = buf_size;
342  return next;
343 }
344 
346 {
347  HEVCParserContext *ctx = s->priv_data;
348 
349  ff_hevc_ps_uninit(&ctx->ps);
351  ff_hevc_reset_sei(&ctx->sei);
352 
353  av_freep(&ctx->pc.buffer);
354 }
355 
358  .priv_data_size = sizeof(HEVCParserContext),
359  .parse = hevc_parse,
361 };
flags
const SwsFlags flags[]
Definition: swscale.c:61
ff_hevc_decode_extradata
int ff_hevc_decode_extradata(const uint8_t *data, int size, HEVCParamSets *ps, HEVCSEI *sei, int *is_nalff, int *nal_length_size, int err_recognition, int apply_defdispwin, void *logctx)
Definition: parse.c:79
hevc_parse
static int hevc_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
Definition: parser.c:307
HEVCParserContext::sei
HEVCSEI sei
Definition: parser.c:45
h2645_parse.h
hevc_parser_close
static void hevc_parser_close(AVCodecParserContext *s)
Definition: parser.c:345
HEVCWindow::bottom_offset
unsigned int bottom_offset
Definition: ps.h:95
HEVCParamSets::pps_list
const HEVCPPS * pps_list[HEVC_MAX_PPS_COUNT]
RefStruct references.
Definition: ps.h:514
AV_PICTURE_STRUCTURE_UNKNOWN
@ AV_PICTURE_STRUCTURE_UNKNOWN
unknown
Definition: avcodec.h:2569
AVCodecContext::err_recognition
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
Definition: avcodec.h:1398
HEVCParserContext::pc
ParseContext pc
Definition: parser.c:41
HEVCParserContext::pocTid0
int pocTid0
Definition: parser.c:52
parser_internal.h
H2645NAL::nuh_layer_id
int nuh_layer_id
Definition: h2645_parse.h:67
get_ue_golomb
static int get_ue_golomb(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to 8190.
Definition: golomb.h:53
HEVC_NAL_BLA_N_LP
@ HEVC_NAL_BLA_N_LP
Definition: hevc.h:47
ff_h2645_packet_uninit
void ff_h2645_packet_uninit(H2645Packet *pkt)
Free all the allocated memory in the packet.
Definition: h2645_parse.c:604
hevc_parse_slice_header
static int hevc_parse_slice_header(AVCodecParserContext *s, H2645NAL *nal, AVCodecContext *avctx)
Definition: parser.c:55
HEVC_NAL_TSA_N
@ HEVC_NAL_TSA_N
Definition: hevc.h:31
HEVC_NAL_IDR_N_LP
@ HEVC_NAL_IDR_N_LP
Definition: hevc.h:49
HEVC_NAL_IDR_W_RADL
@ HEVC_NAL_IDR_W_RADL
Definition: hevc.h:48
H2645NAL::temporal_id
int temporal_id
HEVC only, nuh_temporal_id_plus_1 - 1.
Definition: h2645_parse.h:62
H2645_FLAG_SMALL_PADDING
@ H2645_FLAG_SMALL_PADDING
Definition: h2645_parse.h:98
skip_bits
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:379
AVCodecContext::framerate
AVRational framerate
Definition: avcodec.h:551
golomb.h
exp golomb vlc stuff
close
static av_cold void close(AVCodecParserContext *s)
Definition: apv_parser.c:136
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:333
ParseContext
Definition: parser.h:28
ff_hevc_compute_poc
int ff_hevc_compute_poc(const HEVCSPS *sps, int pocTid0, int poc_lsb, int nal_unit_type)
Compute POC of the current frame and return it.
Definition: ps.c:2446
HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING
@ HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING
Definition: sei.h:37
HEVCParserContext::parsed_extradata
int parsed_extradata
Definition: parser.c:49
HEVCWindow::left_offset
unsigned int left_offset
Definition: ps.h:92
GetBitContext
Definition: get_bits.h:109
sei.h
HEVC_NAL_SEI_SUFFIX
@ HEVC_NAL_SEI_SUFFIX
Definition: hevc.h:69
H2645_FLAG_IS_NALFF
@ H2645_FLAG_IS_NALFF
Definition: h2645_parse.h:97
HEVCParserContext::is_avc
int is_avc
Definition: parser.c:47
HEVC_NAL_SEI_PREFIX
@ HEVC_NAL_SEI_PREFIX
Definition: hevc.h:68
av_reduce
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
Definition: rational.c:35
AVRational::num
int num
Numerator.
Definition: rational.h:59
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
HEVC_SLICE_B
@ HEVC_SLICE_B
Definition: hevc.h:96
HEVCParserContext::pkt
H2645Packet pkt
Definition: parser.c:43
AVCodecContext::extradata_size
int extradata_size
Definition: avcodec.h:515
ff_hevc_decode_nal_sei
int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEI *s, const HEVCParamSets *ps, enum HEVCNALUnitType type)
Definition: sei.c:303
s
#define s(width, name)
Definition: cbs_vp9.c:198
HEVCSEI
Definition: sei.h:106
HEVC_NAL_VPS
@ HEVC_NAL_VPS
Definition: hevc.h:61
parse_nal_units
static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf, int buf_size, AVCodecContext *avctx)
Parse NAL units of found picture and decode some basic information.
Definition: parser.c:180
ctx
AVFormatContext * ctx
Definition: movenc.c:49
hevc.h
HEVCWindow::top_offset
unsigned int top_offset
Definition: ps.h:94
H2645NAL::type
int type
NAL unit type.
Definition: h2645_parse.h:52
ff_hevc_decode_nal_vps
int ff_hevc_decode_nal_vps(GetBitContext *gb, AVCodecContext *avctx, HEVCParamSets *ps)
Definition: ps.c:761
NULL
#define NULL
Definition: coverity.c:32
parse.h
HEVC_SLICE_I
@ HEVC_SLICE_I
Definition: hevc.h:98
ff_hevc_decode_nal_pps
int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx, HEVCParamSets *ps)
Definition: ps.c:2162
AV_PICTURE_TYPE_I
@ AV_PICTURE_TYPE_I
Intra.
Definition: avutil.h:278
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:386
HEVC_NAL_STSA_N
@ HEVC_NAL_STSA_N
Definition: hevc.h:33
ff_hevc_reset_sei
static void ff_hevc_reset_sei(HEVCSEI *sei)
Reset SEI values that are stored on the Context.
Definition: sei.h:128
ParseContext::frame_start_found
int frame_start_found
Definition: parser.h:34
HEVCSliceType
HEVCSliceType
Definition: hevc.h:95
sei
static int FUNC() sei(CodedBitstreamContext *ctx, RWContext *rw, H264RawSEI *current)
Definition: cbs_h264_syntax_template.c:858
parse
static int parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
Definition: apv_parser.c:46
AVCodecContext::level
int level
Encoding level descriptor.
Definition: avcodec.h:1628
HEVCWindow
Definition: ps.h:91
hevc_find_frame_end
static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf, int buf_size)
Find the end of the current frame in the bitstream.
Definition: parser.c:258
HEVC_NAL_RASL_R
@ HEVC_NAL_RASL_R
Definition: hevc.h:38
HEVC_NAL_RASL_N
@ HEVC_NAL_RASL_N
Definition: hevc.h:37
HEVC_NAL_SPS
@ HEVC_NAL_SPS
Definition: hevc.h:62
HEVCParserContext::nal_length_size
int nal_length_size
Definition: parser.c:48
H2645NAL::gb
GetBitContext gb
Definition: h2645_parse.h:47
H2645NAL
Definition: h2645_parse.h:34
ps.h
HEVC_NAL_PPS
@ HEVC_NAL_PPS
Definition: hevc.h:63
HEVC_NAL_STSA_R
@ HEVC_NAL_STSA_R
Definition: hevc.h:34
skip_bits1
static void skip_bits1(GetBitContext *s)
Definition: get_bits.h:411
IS_IDR_NAL
#define IS_IDR_NAL(nal)
Definition: parser.c:38
ff_combine_frame
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
Combine the (truncated) bitstream to a complete frame.
Definition: parser.c:211
FFCodecParser
Definition: parser_internal.h:29
ff_hevc_ps_uninit
void ff_hevc_ps_uninit(HEVCParamSets *ps)
Definition: ps.c:2434
HEVC_NAL_TSA_R
@ HEVC_NAL_TSA_R
Definition: hevc.h:32
PARSER_FLAG_COMPLETE_FRAMES
#define PARSER_FLAG_COMPLETE_FRAMES
Definition: avcodec.h:2609
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
IS_IRAP_NAL
#define IS_IRAP_NAL(nal)
Definition: parser.c:37
AVCodecContext::extradata
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
Definition: avcodec.h:514
HEVCParserContext::ps
HEVCParamSets ps
Definition: parser.c:44
common.h
ff_hevc_parser
const FFCodecParser ff_hevc_parser
Definition: parser.c:356
AV_CODEC_ID_HEVC
@ AV_CODEC_ID_HEVC
Definition: codec_id.h:228
parser.h
PARSER_CODEC_LIST
#define PARSER_CODEC_LIST(...)
Definition: parser_internal.h:76
HEVCParserContext::poc
int poc
Definition: parser.c:51
START_CODE
#define START_CODE
start_code_prefix_one_3bytes
Definition: parser.c:35
AVCodecParserContext
Definition: avcodec.h:2575
ret
ret
Definition: filter_design.txt:187
HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING
@ HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING
Definition: sei.h:36
HEVC_NAL_EOB_NUT
@ HEVC_NAL_EOB_NUT
Definition: hevc.h:66
sps
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
Definition: cbs_h264_syntax_template.c:260
HEVCParserContext
Definition: parser.c:40
AVCodecContext
main external API structure.
Definition: avcodec.h:431
get_ue_golomb_31
static int get_ue_golomb_31(GetBitContext *gb)
read unsigned exp golomb code, constraint to a max of 31.
Definition: golomb.h:120
HEVC_NAL_CRA_NUT
@ HEVC_NAL_CRA_NUT
Definition: hevc.h:50
ff_hevc_decode_nal_sps
int ff_hevc_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx, HEVCParamSets *ps, unsigned nuh_layer_id, int apply_defdispwin)
Definition: ps.c:1700
AV_PICTURE_TYPE_B
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
Definition: avutil.h:280
AVRational::den
int den
Denominator.
Definition: rational.h:60
AVCodecContext::profile
int profile
profile
Definition: avcodec.h:1618
ParseContext::state64
uint64_t state64
contains the last 8 bytes in MSB order
Definition: parser.h:37
pps
uint64_t pps
Definition: dovi_rpuenc.c:36
HEVCWindow::right_offset
unsigned int right_offset
Definition: ps.h:93
AV_PICTURE_TYPE_P
@ AV_PICTURE_TYPE_P
Predicted.
Definition: avutil.h:279
mem.h
get_bitsz
static av_always_inline int get_bitsz(GetBitContext *s, int n)
Read 0-25 bits.
Definition: get_bits.h:349
HEVC_MAX_PPS_COUNT
@ HEVC_MAX_PPS_COUNT
Definition: hevc.h:117
HEVCSPS
Definition: ps.h:255
HEVCPPS
Definition: ps.h:374
HEVC_NAL_TRAIL_R
@ HEVC_NAL_TRAIL_R
Definition: hevc.h:30
HEVC_NAL_RADL_R
@ HEVC_NAL_RADL_R
Definition: hevc.h:36
END_NOT_FOUND
#define END_NOT_FOUND
Definition: parser.h:40
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
ff_h2645_packet_split
int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length, void *logctx, int nal_length_size, enum AVCodecID codec_id, int flags)
Split an input packet into NAL units.
Definition: h2645_parse.c:466
HEVC_NAL_RADL_N
@ HEVC_NAL_RADL_N
Definition: hevc.h:35
H2645Packet
Definition: h2645_parse.h:82
HEVC_NAL_BLA_W_RADL
@ HEVC_NAL_BLA_W_RADL
Definition: hevc.h:46
av_ceil_log2_c
static av_always_inline av_const int av_ceil_log2_c(int x)
Compute ceil(log2(x)).
Definition: common.h:436
HEVC_NAL_TRAIL_N
@ HEVC_NAL_TRAIL_N
Definition: hevc.h:29
HEVC_SLICE_P
@ HEVC_SLICE_P
Definition: hevc.h:97
HEVC_NAL_BLA_W_LP
@ HEVC_NAL_BLA_W_LP
Definition: hevc.h:45
HEVCParamSets
Definition: ps.h:511