FFmpeg: libavcodec/hevc_parser.c Source File

FFmpeg
hevc_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 
25 #include "golomb.h"
26 #include "hevc.h"
27 #include "hevc_parse.h"
28 #include "hevc_ps.h"
29 #include "hevc_sei.h"
30 #include "h2645_parse.h"
31 #include "internal.h"
32 #include "parser.h"
33 
34  #define START_CODE 0x000001 ///< start_code_prefix_one_3bytes
35 
36  #define IS_IRAP_NAL(nal) (nal->type >= 16 && nal->type <= 23)
37  #define IS_IDR_NAL(nal) (nal->type == HEVC_NAL_IDR_W_RADL || nal->type == HEVC_NAL_IDR_N_LP)
38 
39  typedef struct HEVCParserContext {
40   ParseContext pc;
41 
42   H2645Packet pkt;
43   HEVCParamSets ps;
44   HEVCSEI sei;
45   SliceHeader sh;
46 
47   int is_avc;
48   int nal_length_size;
49   int parsed_extradata;
50 
51   int poc;
52   int pocTid0;
53 } HEVCParserContext;
54 
55  static int hevc_parse_slice_header(AVCodecParserContext *s, H2645NAL *nal,
56  AVCodecContext *avctx)
57 {
58  HEVCParserContext *ctx = s->priv_data;
59  HEVCParamSets *ps = &ctx->ps;
60  HEVCSEI *sei = &ctx->sei;
61  SliceHeader *sh = &ctx->sh;
62  GetBitContext *gb = &nal->gb;
63  const HEVCWindow *ow;
64  int i, num = 0, den = 0;
65 
66  sh->first_slice_in_pic_flag = get_bits1(gb);
67  s->picture_structure = sei->picture_timing.picture_struct;
68  s->field_order = sei->picture_timing.picture_struct;
69 
70  if (IS_IRAP_NAL(nal)) {
71  s->key_frame = 1;
72  sh->no_output_of_prior_pics_flag = get_bits1(gb);
73  }
74 
75  sh->pps_id = get_ue_golomb(gb);
76  if (sh->pps_id >= HEVC_MAX_PPS_COUNT || !ps->pps_list[sh->pps_id]) {
77  av_log(avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", sh->pps_id);
78  return AVERROR_INVALIDDATA;
79  }
80  ps->pps = (HEVCPPS*)ps->pps_list[sh->pps_id]->data;
81 
82  if (ps->pps->sps_id >= HEVC_MAX_SPS_COUNT || !ps->sps_list[ps->pps->sps_id]) {
83  av_log(avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", ps->pps->sps_id);
84  return AVERROR_INVALIDDATA;
85  }
86  if (ps->sps != (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data) {
87  ps->sps = (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data;
88  ps->vps = (HEVCVPS*)ps->vps_list[ps->sps->vps_id]->data;
89  }
90  ow = &ps->sps->output_window;
91 
92  s->coded_width = ps->sps->width;
93  s->coded_height = ps->sps->height;
94  s->width = ps->sps->width - ow->left_offset - ow->right_offset;
95  s->height = ps->sps->height - ow->top_offset - ow->bottom_offset;
96  s->format = ps->sps->pix_fmt;
97  avctx->profile = ps->sps->ptl.general_ptl.profile_idc;
98  avctx->level = ps->sps->ptl.general_ptl.level_idc;
99 
100  if (ps->vps->vps_timing_info_present_flag) {
101  num = ps->vps->vps_num_units_in_tick;
102  den = ps->vps->vps_time_scale;
103  } else if (ps->sps->vui.vui_timing_info_present_flag) {
104  num = ps->sps->vui.vui_num_units_in_tick;
105  den = ps->sps->vui.vui_time_scale;
106  }
107 
108  if (num != 0 && den != 0)
109  av_reduce(&avctx->framerate.den, &avctx->framerate.num,
110  num, den, 1 << 30);
111 
112  if (!sh->first_slice_in_pic_flag) {
113  int slice_address_length;
114 
115  if (ps->pps->dependent_slice_segments_enabled_flag)
116  sh->dependent_slice_segment_flag = get_bits1(gb);
117  else
118  sh->dependent_slice_segment_flag = 0;
119 
120  slice_address_length = av_ceil_log2_c(ps->sps->ctb_width *
121  ps->sps->ctb_height);
122  sh->slice_segment_addr = get_bitsz(gb, slice_address_length);
123  if (sh->slice_segment_addr >= ps->sps->ctb_width * ps->sps->ctb_height) {
124  av_log(avctx, AV_LOG_ERROR, "Invalid slice segment address: %u.\n",
125  sh->slice_segment_addr);
126  return AVERROR_INVALIDDATA;
127  }
128  } else
129  sh->dependent_slice_segment_flag = 0;
130 
131  if (sh->dependent_slice_segment_flag)
132  return 0; /* break; */
133 
134  for (i = 0; i < ps->pps->num_extra_slice_header_bits; i++)
135  skip_bits(gb, 1); // slice_reserved_undetermined_flag[]
136 
137  sh->slice_type = get_ue_golomb(gb);
138  if (!(sh->slice_type == HEVC_SLICE_I || sh->slice_type == HEVC_SLICE_P ||
139  sh->slice_type == HEVC_SLICE_B)) {
140  av_log(avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n",
141  sh->slice_type);
142  return AVERROR_INVALIDDATA;
143  }
144  s->pict_type = sh->slice_type == HEVC_SLICE_B ? AV_PICTURE_TYPE_B :
145  sh->slice_type == HEVC_SLICE_P ? AV_PICTURE_TYPE_P :
146  AV_PICTURE_TYPE_I;
147 
148  if (ps->pps->output_flag_present_flag)
149  sh->pic_output_flag = get_bits1(gb);
150 
151  if (ps->sps->separate_colour_plane_flag)
152  sh->colour_plane_id = get_bits(gb, 2);
153 
154  if (!IS_IDR_NAL(nal)) {
155  sh->pic_order_cnt_lsb = get_bits(gb, ps->sps->log2_max_poc_lsb);
156  s->output_picture_number = ctx->poc = ff_hevc_compute_poc(ps->sps, ctx->pocTid0, sh->pic_order_cnt_lsb, nal->type);
157  } else
158  s->output_picture_number = ctx->poc = 0;
159 
160  if (nal->temporal_id == 0 &&
161  nal->type != HEVC_NAL_TRAIL_N &&
162  nal->type != HEVC_NAL_TSA_N &&
163  nal->type != HEVC_NAL_STSA_N &&
164  nal->type != HEVC_NAL_RADL_N &&
165  nal->type != HEVC_NAL_RASL_N &&
166  nal->type != HEVC_NAL_RADL_R &&
167  nal->type != HEVC_NAL_RASL_R)
168  ctx->pocTid0 = ctx->poc;
169 
170  return 1; /* no need to evaluate the rest */
171 }
172 
173 /**
174  * Parse NAL units of found picture and decode some basic information.
175  *
176  * @param s parser context.
177  * @param avctx codec context.
178  * @param buf buffer with field/frame data.
179  * @param buf_size size of the buffer.
180  */
181  static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
182  int buf_size, AVCodecContext *avctx)
183 {
184  HEVCParserContext *ctx = s->priv_data;
185  HEVCParamSets *ps = &ctx->ps;
186  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 
194  ff_hevc_reset_sei(sei);
195 
196  ret = ff_h2645_packet_split(&ctx->pkt, buf, buf_size, avctx, ctx->is_avc,
197  ctx->nal_length_size, AV_CODEC_ID_HEVC, 1);
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  switch (nal->type) {
206  case HEVC_NAL_VPS:
207  ff_hevc_decode_nal_vps(gb, avctx, ps);
208  break;
209  case HEVC_NAL_SPS:
210  ff_hevc_decode_nal_sps(gb, avctx, ps, 1);
211  break;
212  case HEVC_NAL_PPS:
213  ff_hevc_decode_nal_pps(gb, avctx, ps);
214  break;
215  case HEVC_NAL_SEI_PREFIX:
216  case HEVC_NAL_SEI_SUFFIX:
217  ff_hevc_decode_nal_sei(gb, avctx, sei, ps, nal->type);
218  break;
219  case HEVC_NAL_TRAIL_N:
220  case HEVC_NAL_TRAIL_R:
221  case HEVC_NAL_TSA_N:
222  case HEVC_NAL_TSA_R:
223  case HEVC_NAL_STSA_N:
224  case HEVC_NAL_STSA_R:
225  case HEVC_NAL_BLA_W_LP:
226  case HEVC_NAL_BLA_W_RADL:
227  case HEVC_NAL_BLA_N_LP:
228  case HEVC_NAL_IDR_W_RADL:
229  case HEVC_NAL_IDR_N_LP:
230  case HEVC_NAL_CRA_NUT:
231  case HEVC_NAL_RADL_N:
232  case HEVC_NAL_RADL_R:
233  case HEVC_NAL_RASL_N:
234  case HEVC_NAL_RASL_R:
235  ret = hevc_parse_slice_header(s, nal, avctx);
236  if (ret)
237  return ret;
238  break;
239  }
240  }
241  /* didn't find a picture! */
242  av_log(avctx, AV_LOG_ERROR, "missing picture in access unit\n");
243  return -1;
244 }
245 
246 /**
247  * Find the end of the current frame in the bitstream.
248  * @return the position of the first byte of the next frame, or END_NOT_FOUND
249  */
250  static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf,
251  int buf_size)
252 {
253  HEVCParserContext *ctx = s->priv_data;
254  ParseContext *pc = &ctx->pc;
255  int i;
256 
257  for (i = 0; i < buf_size; i++) {
258  int nut;
259 
260  pc->state64 = (pc->state64 << 8) | buf[i];
261 
262  if (((pc->state64 >> 3 * 8) & 0xFFFFFF) != START_CODE)
263  continue;
264 
265  nut = (pc->state64 >> 2 * 8 + 1) & 0x3F;
266  // Beginning of access unit
267  if ((nut >= HEVC_NAL_VPS && nut <= HEVC_NAL_EOB_NUT) || nut == HEVC_NAL_SEI_PREFIX ||
268  (nut >= 41 && nut <= 44) || (nut >= 48 && nut <= 55)) {
269  if (pc->frame_start_found) {
270  pc->frame_start_found = 0;
271  return i - 5;
272  }
273  } else if (nut <= HEVC_NAL_RASL_R ||
274  (nut >= HEVC_NAL_BLA_W_LP && nut <= HEVC_NAL_CRA_NUT)) {
275  int first_slice_segment_in_pic_flag = buf[i] >> 7;
276  if (first_slice_segment_in_pic_flag) {
277  if (!pc->frame_start_found) {
278  pc->frame_start_found = 1;
279  } else { // First slice of next frame found
280  pc->frame_start_found = 0;
281  return i - 5;
282  }
283  }
284  }
285  }
286 
287  return END_NOT_FOUND;
288 }
289 
290  static int hevc_parse(AVCodecParserContext *s, AVCodecContext *avctx,
291  const uint8_t **poutbuf, int *poutbuf_size,
292  const uint8_t *buf, int buf_size)
293 {
294  int next;
295  HEVCParserContext *ctx = s->priv_data;
296  ParseContext *pc = &ctx->pc;
297 
298  if (avctx->extradata && !ctx->parsed_extradata) {
299  ff_hevc_decode_extradata(avctx->extradata, avctx->extradata_size, &ctx->ps, &ctx->sei,
300  &ctx->is_avc, &ctx->nal_length_size, avctx->err_recognition,
301  1, avctx);
302  ctx->parsed_extradata = 1;
303  }
304 
305  if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
306  next = buf_size;
307  } else {
308  next = hevc_find_frame_end(s, buf, buf_size);
309  if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
310  *poutbuf = NULL;
311  *poutbuf_size = 0;
312  return buf_size;
313  }
314  }
315 
316  parse_nal_units(s, buf, buf_size, avctx);
317 
318  *poutbuf = buf;
319  *poutbuf_size = buf_size;
320  return next;
321 }
322 
323 // Split after the parameter sets at the beginning of the stream if they exist.
324  static int hevc_split(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
325 {
326  const uint8_t *ptr = buf, *end = buf + buf_size;
327  uint32_t state = -1;
328  int has_vps = 0;
329  int has_sps = 0;
330  int has_pps = 0;
331  int nut;
332 
333  while (ptr < end) {
334  ptr = avpriv_find_start_code(ptr, end, &state);
335  if ((state >> 8) != START_CODE)
336  break;
337  nut = (state >> 1) & 0x3F;
338  if (nut == HEVC_NAL_VPS)
339  has_vps = 1;
340  else if (nut == HEVC_NAL_SPS)
341  has_sps = 1;
342  else if (nut == HEVC_NAL_PPS)
343  has_pps = 1;
344  else if ((nut != HEVC_NAL_SEI_PREFIX || has_pps) &&
345  nut != HEVC_NAL_AUD) {
346  if (has_vps && has_sps) {
347  while (ptr - 4 > buf && ptr[-5] == 0)
348  ptr--;
349  return ptr - 4 - buf;
350  }
351  }
352  }
353  return 0;
354 }
355 
356  static void hevc_parser_close(AVCodecParserContext *s)
357 {
358  HEVCParserContext *ctx = s->priv_data;
359 
360  ff_hevc_ps_uninit(&ctx->ps);
361  ff_h2645_packet_uninit(&ctx->pkt);
362  ff_hevc_reset_sei(&ctx->sei);
363 
364  av_freep(&ctx->pc.buffer);
365 }
366 
367  AVCodecParser ff_hevc_parser = {
368  .codec_ids = { AV_CODEC_ID_HEVC },
369  .priv_data_size = sizeof(HEVCParserContext),
370  .parser_parse = hevc_parse,
371  .parser_close = hevc_parser_close,
372  .split = hevc_split,
373 };
ff_h2645_packet_split
int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length, void *logctx, int is_nalff, int nal_length_size, enum AVCodecID codec_id, int small_padding)
Split an input packet into NAL units.
Definition: h2645_parse.c:263
HEVCParamSets::pps
const HEVCPPS * pps
Definition: hevc_ps.h:403
NULL
#define NULL
Definition: coverity.c:32
AVCodecContext::framerate
AVRational framerate
Definition: avcodec.h:3040
s
const char * s
Definition: avisynth_c.h:768
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
SliceHeader::pic_order_cnt_lsb
int pic_order_cnt_lsb
Definition: hevc_ps.h:58
hevc_parse_slice_header
static int hevc_parse_slice_header(AVCodecParserContext *s, H2645NAL *nal, AVCodecContext *avctx)
Definition: hevc_parser.c:55
HEVCSPS::ctb_height
int ctb_height
Definition: hevc_ps.h:299
HEVCParamSets::vps_list
AVBufferRef * vps_list[HEVC_MAX_VPS_COUNT]
Definition: hevc_ps.h:396
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:269
hevc_split
static int hevc_split(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
Definition: hevc_parser.c:324
AVCodecParserContext::width
int width
Dimensions of the decoded video intended for presentation.
Definition: avcodec.h:5179
HEVCSPS::vui
VUI vui
Definition: hevc_ps.h:250
AVCodecParserContext::field_order
enum AVFieldOrder field_order
Definition: avcodec.h:5156
AVRational::num
int num
Numerator.
Definition: rational.h:59
VUI::vui_time_scale
uint32_t vui_time_scale
Definition: hevc_ps.h:159
AVCodecParser::codec_ids
int codec_ids[5]
Definition: avcodec.h:5200
AVCodecParserContext::coded_width
int coded_width
Dimensions of the coded video.
Definition: avcodec.h:5185
HEVCWindow::left_offset
unsigned int left_offset
Definition: hevc_ps.h:126
hevc_parse.h
H.265 parser code.
HEVCParserContext::pkt
H2645Packet pkt
Definition: hevc_parser.c:42
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: hevc_parse.c:77
SliceHeader::dependent_slice_segment_flag
uint8_t dependent_slice_segment_flag
Definition: hevc_ps.h:61
AVCodecContext::profile
int profile
profile
Definition: avcodec.h:2843
ParseContext::frame_start_found
int frame_start_found
Definition: parser.h:34
HEVCSPS::width
int width
Definition: hevc_ps.h:296
HEVCSPS::output_window
HEVCWindow output_window
Definition: hevc_ps.h:230
SliceHeader::slice_segment_addr
unsigned int slice_segment_addr
address (in raster order) of the first block in the current slice
Definition: hevc_ps.h:52
SliceHeader::slice_type
enum HEVCSliceType slice_type
Definition: hevc_ps.h:56
HEVCParamSets::sps_list
AVBufferRef * sps_list[HEVC_MAX_SPS_COUNT]
Definition: hevc_ps.h:397
AVCodecParserContext::picture_structure
enum AVPictureStructure picture_structure
Indicate whether a picture is coded as a frame, top field or bottom field.
Definition: avcodec.h:5166
HEVC_SLICE_I
Definition: hevc.h:74
uint8_t
uint8_t
Definition: audio_convert.c:194
HEVC_NAL_AUD
Definition: hevc.h:63
HEVCVPS::vps_timing_info_present_flag
uint8_t vps_timing_info_present_flag
Definition: hevc_ps.h:207
end
static av_cold int end(AVCodecContext *avctx)
Definition: avrndec.c:90
HEVCParamSets::vps
const HEVCVPS * vps
Definition: hevc_ps.h:401
AVCodecContext::extradata
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:1618
ff_h2645_packet_uninit
void ff_h2645_packet_uninit(H2645Packet *pkt)
Free all the allocated memory in the packet.
Definition: h2645_parse.c:386
SliceHeader::first_slice_in_pic_flag
uint8_t first_slice_in_pic_flag
Definition: hevc_ps.h:60
HEVCParamSets::pps_list
AVBufferRef * pps_list[HEVC_MAX_PPS_COUNT]
Definition: hevc_ps.h:398
SliceHeader::pic_output_flag
uint8_t pic_output_flag
Definition: hevc_ps.h:62
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
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
avpriv_find_start_code
const uint8_t * avpriv_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state)
SliceHeader::no_output_of_prior_pics_flag
uint8_t no_output_of_prior_pics_flag
Definition: hevc_ps.h:75
HEVCParserContext::ps
HEVCParamSets ps
Definition: hevc_parser.c:43
SliceHeader::colour_plane_id
uint8_t colour_plane_id
RPS coded in the slice header itself is stored here.
Definition: hevc_ps.h:63
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
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
HEVCSPS::log2_max_poc_lsb
unsigned int log2_max_poc_lsb
Definition: hevc_ps.h:239
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: hevc_ps.c:1727
ff_hevc_decode_nal_vps
int ff_hevc_decode_nal_vps(GetBitContext *gb, AVCodecContext *avctx, HEVCParamSets *ps)
Definition: hevc_ps.c:416
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:319
VUI::vui_timing_info_present_flag
int vui_timing_info_present_flag
Definition: hevc_ps.h:157
AVCodecParserContext::priv_data
void * priv_data
Definition: avcodec.h:5033
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: hevc_parser.c:250
split
static char * split(char *message, char delim)
Definition: af_channelmap.c:81
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: hevc_parser.c:181
HEVCVPS::vps_num_units_in_tick
uint32_t vps_num_units_in_tick
Definition: hevc_ps.h:208
HEVCParamSets::sps
const HEVCSPS * sps
Definition: hevc_ps.h:402
PTLCommon::profile_idc
uint8_t profile_idc
Definition: hevc_ps.h:178
AV_PICTURE_TYPE_I
Intra.
Definition: avutil.h:274
AVCodecContext::err_recognition
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
Definition: avcodec.h:2642
HEVCParserContext::parsed_extradata
int parsed_extradata
Definition: hevc_parser.c:49
HEVCWindow::top_offset
unsigned int top_offset
Definition: hevc_ps.h:128
ctx
AVFormatContext * ctx
Definition: movenc.c:48
HEVC_NAL_SPS
Definition: hevc.h:61
AVCodecContext::level
int level
level
Definition: avcodec.h:2953
IS_IDR_NAL
#define IS_IDR_NAL(nal)
Definition: hevc_parser.c:37
HEVCSPS::ctb_width
int ctb_width
Definition: hevc_ps.h:298
HEVCSPS::height
int height
Definition: hevc_ps.h:297
HEVCPPS::output_flag_present_flag
uint8_t output_flag_present_flag
Definition: hevc_ps.h:340
state
static struct @271 state
PTL::general_ptl
PTLCommon general_ptl
Definition: hevc_ps.h:188
H2645NAL::type
int type
NAL unit type.
Definition: h2645_parse.h:51
IS_IRAP_NAL
#define IS_IRAP_NAL(nal)
Definition: hevc_parser.c:36
HEVCSPS::vps_id
unsigned vps_id
Definition: hevc_ps.h:226
HEVCParserContext::pc
ParseContext pc
Definition: hevc_parser.c:40
SliceHeader::pps_id
unsigned int pps_id
address (in raster order) of the first block in the current slice segment
Definition: hevc_ps.h:49
HEVCVPS::vps_time_scale
uint32_t vps_time_scale
Definition: hevc_ps.h:209
HEVCSPS
Definition: hevc_ps.h:225
ff_hevc_ps_uninit
void ff_hevc_ps_uninit(HEVCParamSets *ps)
Definition: hevc_ps.c:1711
HEVCSPS::pix_fmt
enum AVPixelFormat pix_fmt
Definition: hevc_ps.h:237
HEVCVPS
Definition: hevc_ps.h:195
HEVCPPS
Definition: hevc_ps.h:318
ParseContext::buffer
uint8_t * buffer
Definition: parser.h:29
ff_hevc_reset_sei
void ff_hevc_reset_sei(HEVCSEI *s)
Reset SEI values that are stored on the Context.
Definition: hevc_sei.c:364
HEVCSPS::ptl
PTL ptl
Definition: hevc_ps.h:251
HEVC_SLICE_P
Definition: hevc.h:73
START_CODE
#define START_CODE
start_code_prefix_one_3bytes
Definition: hevc_parser.c:34
HEVCPPS::sps_id
unsigned int sps_id
seq_parameter_set_id
Definition: hevc_ps.h:319
HEVC_NAL_VPS
Definition: hevc.h:60
AVCodecContext
main external API structure.
Definition: avcodec.h:1518
HEVCPPS::num_extra_slice_header_bits
int num_extra_slice_header_bits
Definition: hevc_ps.h:365
AVBufferRef::data
uint8_t * data
The data buffer.
Definition: buffer.h:89
buf
void * buf
Definition: avisynth_c.h:690
ff_hevc_parser
AVCodecParser ff_hevc_parser
Definition: hevc_parser.c:367
VUI::vui_num_units_in_tick
uint32_t vui_num_units_in_tick
Definition: hevc_ps.h:158
AVCodecContext::extradata_size
int extradata_size
Definition: avcodec.h:1619
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:321
HEVCParserContext::sh
SliceHeader sh
Definition: hevc_parser.c:45
skip_bits
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:314
ParseContext::state64
uint64_t state64
contains the last 8 bytes in MSB order
Definition: parser.h:37
ff_hevc_decode_nal_pps
int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx, HEVCParamSets *ps)
Definition: hevc_ps.c:1466
HEVCSEI
Definition: hevc_sei.h:107
END_NOT_FOUND
#define END_NOT_FOUND
Definition: parser.h:40
ff_hevc_decode_nal_sps
int ff_hevc_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx, HEVCParamSets *ps, int apply_defdispwin)
Definition: hevc_ps.c:1217
AVCodecParserContext::output_picture_number
int output_picture_number
Picture number incremented in presentation or output order.
Definition: avcodec.h:5174
HEVCSEI::picture_timing
HEVCSEIPictureTiming picture_timing
Definition: hevc_sei.h:111
PTLCommon::level_idc
uint8_t level_idc
Definition: hevc_ps.h:180
internal.h
common internal api header.
common.h
common internal and external API header
if
if(ret< 0)
Definition: vf_mcdeint.c:279
H2645Packet::nb_nals
int nb_nals
Definition: h2645_parse.h:77
AV_PICTURE_TYPE_B
Bi-dir predicted.
Definition: avutil.h:276
PARSER_FLAG_COMPLETE_FRAMES
#define PARSER_FLAG_COMPLETE_FRAMES
Definition: avcodec.h:5066
sei
static int FUNC() sei(CodedBitstreamContext *ctx, RWContext *rw, H264RawSEI *current)
Definition: cbs_h264_syntax_template.c:796
AVRational::den
int den
Denominator.
Definition: rational.h:60
H2645NAL::gb
GetBitContext gb
Definition: h2645_parse.h:46
AVCodecParserContext::format
int format
The format of the coded data, corresponds to enum AVPixelFormat for video and for enum AVSampleFormat...
Definition: avcodec.h:5196
H2645Packet::nals
H2645NAL * nals
Definition: h2645_parse.h:75
HEVC_NAL_PPS
Definition: hevc.h:62
H2645NAL::temporal_id
int temporal_id
HEVC only, nuh_temporal_id_plus_1 - 1.
Definition: h2645_parse.h:56
HEVCWindow::right_offset
unsigned int right_offset
Definition: hevc_ps.h:127
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: hevc_parser.c:290
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
HEVC_SLICE_B
Definition: hevc.h:72
hevc_parser_close
static void hevc_parser_close(AVCodecParserContext *s)
Definition: hevc_parser.c:356
av_ceil_log2_c
static av_always_inline av_const int av_ceil_log2_c(int x)
Compute ceil(log2(x)).
Definition: common.h:332
golomb.h
exp golomb vlc stuff
AVCodecParserContext::key_frame
int key_frame
Set by parser to 1 for key frames and 0 for non-key frames.
Definition: avcodec.h:5081
ff_hevc_decode_nal_sei
int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEI *s, const HEVCParamSets *ps, int type)
Definition: hevc_sei.c:351
HEVCSPS::separate_colour_plane_flag
uint8_t separate_colour_plane_flag
Definition: hevc_ps.h:228
get_bitsz
static av_always_inline int get_bitsz(GetBitContext *s, int n)
Read 0-25 bits.
Definition: get_bits.h:284
AV_PICTURE_TYPE_P
Predicted.
Definition: avutil.h:275
HEVCWindow::bottom_offset
unsigned int bottom_offset
Definition: hevc_ps.h:129
HEVCPPS::dependent_slice_segments_enabled_flag
uint8_t dependent_slice_segments_enabled_flag
Definition: hevc_ps.h:343

Generated on Sun May 13 2018 02:03:47 for FFmpeg by   doxygen 1.8.6

AltStyle によって変換されたページ (->オリジナル) /