FFmpeg
Macros | Functions | Variables
cbs_h2645.c File Reference
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "bytestream.h"
#include "cbs.h"
#include "cbs_internal.h"
#include "cbs_h264.h"
#include "cbs_h265.h"
#include "cbs_h266.h"
#include "h264.h"
#include "h2645_parse.h"
#include "hevc.h"
#include "refstruct.h"
#include "vvc.h"
#include "cbs_sei_syntax_template.c"
#include "cbs_h264_syntax_template.c"
#include "cbs_h265_syntax_template.c"
#include "cbs_h266_syntax_template.c"

Go to the source code of this file.

Macros

#define HEADER(name)
 
#define CHECK(call)
 
#define FUNC_NAME2(rw, codec, name)   cbs_ ## codec ## _ ## rw ## _ ## name
 
#define FUNC_NAME1(rw, codec, name)   FUNC_NAME2(rw, codec, name)
 
#define FUNC_H264(name)   FUNC_NAME1(READWRITE, h264, name)
 
#define FUNC_H265(name)   FUNC_NAME1(READWRITE, h265, name)
 
#define FUNC_H266(name)   FUNC_NAME1(READWRITE, h266, name)
 
#define FUNC_SEI(name)   FUNC_NAME1(READWRITE, sei, name)
 
#define SEI_FUNC(name, args)
 
#define SUBSCRIPTS(subs, ...)   (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)
 
#define u(width, name, range_min, range_max)   xu(width, name, current->name, range_min, range_max, 0, )
 
#define flag(name)   ub(1, name)
 
#define ue(name, range_min, range_max)   xue(name, current->name, range_min, range_max, 0, )
 
#define i(width, name, range_min, range_max)   xi(width, name, current->name, range_min, range_max, 0, )
 
#define ib(width, name)   xi(width, name, current->name, MIN_INT_BITS(width), MAX_INT_BITS(width), 0, )
 
#define se(name, range_min, range_max)   xse(name, current->name, range_min, range_max, 0, )
 
#define us(width, name, range_min, range_max, subs, ...)   xu(width, name, current->name, range_min, range_max, subs, __VA_ARGS__)
 
#define ubs(width, name, subs, ...)   xu(width, name, current->name, 0, MAX_UINT_BITS(width), subs, __VA_ARGS__)
 
#define flags(name, subs, ...)   xu(1, name, current->name, 0, 1, subs, __VA_ARGS__)
 
#define ues(name, range_min, range_max, subs, ...)   xue(name, current->name, range_min, range_max, subs, __VA_ARGS__)
 
#define is(width, name, range_min, range_max, subs, ...)   xi(width, name, current->name, range_min, range_max, subs, __VA_ARGS__)
 
#define ibs(width, name, subs, ...)   xi(width, name, current->name, MIN_INT_BITS(width), MAX_INT_BITS(width), subs, __VA_ARGS__)
 
#define ses(name, range_min, range_max, subs, ...)   xse(name, current->name, range_min, range_max, subs, __VA_ARGS__)
 
#define fixed(width, name, value)
 
#define READ
 
#define READWRITE   read
 
#define RWContext   GetBitContext
 
#define ub(width, name)
 
#define xu(width, name, var, range_min, range_max, subs, ...)
 
#define xue(name, var, range_min, range_max, subs, ...)
 
#define xi(width, name, var, range_min, range_max, subs, ...)
 
#define xse(name, var, range_min, range_max, subs, ...)
 
#define infer(name, value)
 
#define more_rbsp_data(var)   ((var) = cbs_h2645_read_more_rbsp_data(rw))
 
#define bit_position(rw)   (get_bits_count(rw))
 
#define byte_alignment(rw)   (get_bits_count(rw) % 8)
 
#define allocate(name, size)
 
#define FUNC(name)   FUNC_SEI(name)
 
#define allocate(name, size)
 
#define FUNC(name)   FUNC_H264(name)
 
#define FUNC(name)   FUNC_H265(name)
 
#define FUNC(name)   FUNC_H266(name)
 
#define WRITE
 
#define READWRITE   write
 
#define RWContext   PutBitContext
 
#define ub(width, name)
 
#define xu(width, name, var, range_min, range_max, subs, ...)
 
#define xue(name, var, range_min, range_max, subs, ...)
 
#define xi(width, name, var, range_min, range_max, subs, ...)
 
#define xse(name, var, range_min, range_max, subs, ...)
 
#define infer(name, value)
 
#define more_rbsp_data(var)   (var)
 
#define bit_position(rw)   (put_bits_count(rw))
 
#define byte_alignment(rw)   (put_bits_count(rw) % 8)
 
#define allocate(name, size)
 
#define FUNC(name)   FUNC_SEI(name)
 
#define FUNC(name)   FUNC_H264(name)
 
#define FUNC(name)   FUNC_H265(name)
 
#define FUNC(name)   FUNC_H266(name)
 
#define cbs_h2645_replace_ps(h26n, ps_name, ps_var, id_element)
 
#define cbs_h266_replace_ps(h26n, ps_name, ps_var, id_element)
 
#define SEI_MESSAGE_RW(codec, name)
 

Functions

static int cbs_read_ue_golomb (CodedBitstreamContext *ctx, GetBitContext *gbc, const char *name, const int *subscripts, uint32_t *write_to, uint32_t range_min, uint32_t range_max)
 
static int cbs_read_se_golomb (CodedBitstreamContext *ctx, GetBitContext *gbc, const char *name, const int *subscripts, int32_t *write_to, int32_t range_min, int32_t range_max)
 
static int cbs_write_ue_golomb (CodedBitstreamContext *ctx, PutBitContext *pbc, const char *name, const int *subscripts, uint32_t value, uint32_t range_min, uint32_t range_max)
 
static int cbs_write_se_golomb (CodedBitstreamContext *ctx, PutBitContext *pbc, const char *name, const int *subscripts, int32_t value, int32_t range_min, int32_t range_max)
 
static int cbs_h265_payload_extension_present (GetBitContext *gbc, uint32_t payload_size, int cur_pos)
 
static int cbs_h2645_read_more_rbsp_data (GetBitContext *gbc)
 
static int cbs_h2645_fragment_add_nals (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const H2645Packet *packet)
 
static int cbs_h2645_split_fragment (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
 
 cbs_h2645_replace_ps (cbs_h2645_replace_ps(4, cbs_h2645_replace_ps(SPS, cbs_h2645_replace_ps(sps, seq_parameter_set_id)
 
static int cbs_h264_read_nal_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
 
static int cbs_h265_read_nal_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
 
static int cbs_h266_read_nal_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
 
static int cbs_h2645_write_slice_data (CodedBitstreamContext *ctx, PutBitContext *pbc, const uint8_t *data, size_t data_size, int data_bit_start)
 
static int cbs_h264_write_nal_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
 
static int cbs_h265_write_nal_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
 
static int cbs_h264_discarded_nal_unit (CodedBitstreamContext *ctx, const CodedBitstreamUnit *unit, enum AVDiscard skip)
 
static int cbs_h265_discarded_nal_unit (CodedBitstreamContext *ctx, const CodedBitstreamUnit *unit, enum AVDiscard skip)
 
static int cbs_h266_write_nal_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
 
static int cbs_h2645_unit_requires_zero_byte (enum AVCodecID codec_id, CodedBitstreamUnitType type, int nal_unit_index)
 
static int cbs_h2645_assemble_fragment (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
 
static void cbs_h264_flush (CodedBitstreamContext *ctx)
 
static void cbs_h264_close (CodedBitstreamContext *ctx)
 
static void cbs_h265_flush (CodedBitstreamContext *ctx)
 
static void cbs_h265_close (CodedBitstreamContext *ctx)
 
static void cbs_h266_flush (CodedBitstreamContext *ctx)
 
static void cbs_h266_close (CodedBitstreamContext *ctx)
 
static void cbs_h264_free_sei (FFRefStructOpaque unused, void *content)
 
static void cbs_h265_free_sei (FFRefStructOpaque unused, void *content)
 
static void cbs_h266_free_sei (FFRefStructOpaque unused, void *content)
 
const SEIMessageTypeDescriptorff_cbs_sei_find_type (CodedBitstreamContext *ctx, int payload_type)
 Find the type descriptor for the given payload type. More...
 

Variables

static const CodedBitstreamUnitTypeDescriptor cbs_h264_unit_types []
 
static const CodedBitstreamUnitTypeDescriptor cbs_h265_unit_types []
 
static const CodedBitstreamUnitTypeDescriptor cbs_h266_unit_types []
 
const CodedBitstreamType ff_cbs_type_h264
 
const CodedBitstreamType ff_cbs_type_h265
 
const CodedBitstreamType ff_cbs_type_h266
 
static const SEIMessageTypeDescriptor cbs_sei_common_types []
 
static const SEIMessageTypeDescriptor cbs_sei_h264_types []
 
static const SEIMessageTypeDescriptor cbs_sei_h265_types []
 
static const SEIMessageTypeDescriptor cbs_sei_h266_types []
 

Macro Definition Documentation

◆ HEADER

#define HEADER (   name)
Value:
do { \
ff_cbs_trace_header(ctx, name); \
} while (0)

Definition at line 221 of file cbs_h2645.c.

◆ CHECK

#define CHECK (   call)
Value:
do { \
err = (call); \
if (err < 0) \
return err; \
} while (0)

Definition at line 225 of file cbs_h2645.c.

◆ FUNC_NAME2

#define FUNC_NAME2 (   rw,
  codec,
  name 
)    cbs_ ## codec ## _ ## rw ## _ ## name

Definition at line 231 of file cbs_h2645.c.

◆ FUNC_NAME1

#define FUNC_NAME1 (   rw,
  codec,
  name 
)    FUNC_NAME2(rw, codec, name)

Definition at line 232 of file cbs_h2645.c.

◆ FUNC_H264

#define FUNC_H264 (   name)    FUNC_NAME1(READWRITE, h264, name)

Definition at line 233 of file cbs_h2645.c.

◆ FUNC_H265

#define FUNC_H265 (   name)    FUNC_NAME1(READWRITE, h265, name)

Definition at line 234 of file cbs_h2645.c.

◆ FUNC_H266

#define FUNC_H266 (   name)    FUNC_NAME1(READWRITE, h266, name)

Definition at line 235 of file cbs_h2645.c.

◆ FUNC_SEI

#define FUNC_SEI (   name)    FUNC_NAME1(READWRITE, sei, name)

Definition at line 236 of file cbs_h2645.c.

◆ SEI_FUNC

#define SEI_FUNC (   name,
  args 
)
Value:
static int FUNC(name) args; \
static int FUNC(name ## _internal)(CodedBitstreamContext *ctx, \
RWContext *rw, void *cur, \
SEIMessageState *state) \
{ \
return FUNC(name)(ctx, rw, cur, state); \
} \
static int FUNC(name) args

Definition at line 238 of file cbs_h2645.c.

◆ SUBSCRIPTS

#define SUBSCRIPTS (   subs,
  ... 
)    (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)

Definition at line 248 of file cbs_h2645.c.

◆ u

#define u (   width,
  name,
  range_min,
  range_max 
)    xu(width, name, current->name, range_min, range_max, 0, )

Definition at line 250 of file cbs_h2645.c.

◆ flag

#define flag (   name)    ub(1, name)

Definition at line 252 of file cbs_h2645.c.

◆ ue

#define ue (   name,
  range_min,
  range_max 
)    xue(name, current->name, range_min, range_max, 0, )

Definition at line 253 of file cbs_h2645.c.

◆ i

#define i (   width,
  name,
  range_min,
  range_max 
)    xi(width, name, current->name, range_min, range_max, 0, )

◆ ib

#define ib (   width,
  name 
)    xi(width, name, current->name, MIN_INT_BITS(width), MAX_INT_BITS(width), 0, )

Definition at line 257 of file cbs_h2645.c.

◆ se

#define se (   name,
  range_min,
  range_max 
)    xse(name, current->name, range_min, range_max, 0, )

Definition at line 259 of file cbs_h2645.c.

◆ us

#define us (   width,
  name,
  range_min,
  range_max,
  subs,
  ... 
)    xu(width, name, current->name, range_min, range_max, subs, __VA_ARGS__)

Definition at line 262 of file cbs_h2645.c.

◆ ubs

#define ubs (   width,
  name,
  subs,
  ... 
)    xu(width, name, current->name, 0, MAX_UINT_BITS(width), subs, __VA_ARGS__)

Definition at line 264 of file cbs_h2645.c.

◆ flags

#define flags (   name,
  subs,
  ... 
)    xu(1, name, current->name, 0, 1, subs, __VA_ARGS__)

Definition at line 266 of file cbs_h2645.c.

◆ ues

#define ues (   name,
  range_min,
  range_max,
  subs,
  ... 
)    xue(name, current->name, range_min, range_max, subs, __VA_ARGS__)

Definition at line 268 of file cbs_h2645.c.

◆ is

#define is (   width,
  name,
  range_min,
  range_max,
  subs,
  ... 
)    xi(width, name, current->name, range_min, range_max, subs, __VA_ARGS__)

Definition at line 270 of file cbs_h2645.c.

◆ ibs

#define ibs (   width,
  name,
  subs,
  ... 
)    xi(width, name, current->name, MIN_INT_BITS(width), MAX_INT_BITS(width), subs, __VA_ARGS__)

Definition at line 272 of file cbs_h2645.c.

◆ ses

#define ses (   name,
  range_min,
  range_max,
  subs,
  ... 
)    xse(name, current->name, range_min, range_max, subs, __VA_ARGS__)

Definition at line 274 of file cbs_h2645.c.

◆ fixed

#define fixed (   width,
  name,
  value 
)
Value:
do { \
av_unused uint32_t fixed_value = value; \
xu(width, name, fixed_value, value, value, 0, ); \
} while (0)

Definition at line 277 of file cbs_h2645.c.

◆ READ

#define READ

Definition at line 283 of file cbs_h2645.c.

◆ READWRITE [1/2]

#define READWRITE   read

Definition at line 397 of file cbs_h2645.c.

◆ RWContext [1/2]

#define RWContext   GetBitContext

Definition at line 398 of file cbs_h2645.c.

◆ ub [1/2]

#define ub (   width,
  name 
)
Value:
do { \
uint32_t value; \
&value)); \
current->name = value; \
} while (0)

Definition at line 400 of file cbs_h2645.c.

◆ xu [1/2]

#define xu (   width,
  name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
uint32_t value; \
SUBSCRIPTS(subs, __VA_ARGS__), \
&value, range_min, range_max)); \
var = value; \
} while (0)

Definition at line 405 of file cbs_h2645.c.

◆ xue [1/2]

#define xue (   name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
uint32_t value; \
CHECK(cbs_read_ue_golomb(ctx, rw, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
&value, range_min, range_max)); \
var = value; \
} while (0)

Definition at line 411 of file cbs_h2645.c.

◆ xi [1/2]

#define xi (   width,
  name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
int32_t value; \
CHECK(ff_cbs_read_signed(ctx, rw, width, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
&value, range_min, range_max)); \
var = value; \
} while (0)

Definition at line 417 of file cbs_h2645.c.

◆ xse [1/2]

#define xse (   name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
int32_t value; \
CHECK(cbs_read_se_golomb(ctx, rw, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
&value, range_min, range_max)); \
var = value; \
} while (0)

Definition at line 423 of file cbs_h2645.c.

◆ infer [1/2]

#define infer (   name,
  value 
)
Value:
do { \
current->name = value; \
} while (0)

Definition at line 430 of file cbs_h2645.c.

◆ more_rbsp_data [1/2]

#define more_rbsp_data (   var)    ((var) = cbs_h2645_read_more_rbsp_data(rw))

Definition at line 440 of file cbs_h2645.c.

◆ bit_position [1/2]

#define bit_position (   rw)    (get_bits_count(rw))

Definition at line 442 of file cbs_h2645.c.

◆ byte_alignment [1/2]

#define byte_alignment (   rw)    (get_bits_count(rw) % 8)

Definition at line 443 of file cbs_h2645.c.

◆ allocate [1/3]

#define allocate (   name,
  size 
)
Value:
do { \
if (!name) \
return AVERROR(ENOMEM); \
} while (0)

Definition at line 445 of file cbs_h2645.c.

◆ FUNC [1/8]

#define FUNC (   name)    FUNC_SEI(name)

Definition at line 465 of file cbs_h2645.c.

◆ allocate [2/3]

#define allocate (   name,
  size 
)
Value:
do { \
name ## _ref = av_buffer_allocz(size + \
if (!name ## _ref) \
return AVERROR(ENOMEM); \
name = name ## _ref->data; \
} while (0)

Definition at line 445 of file cbs_h2645.c.

◆ FUNC [2/8]

#define FUNC (   name)    FUNC_H264(name)

Definition at line 465 of file cbs_h2645.c.

◆ FUNC [3/8]

#define FUNC (   name)    FUNC_H265(name)

Definition at line 465 of file cbs_h2645.c.

◆ FUNC [4/8]

#define FUNC (   name)    FUNC_H266(name)

Definition at line 465 of file cbs_h2645.c.

◆ WRITE

#define WRITE

Definition at line 396 of file cbs_h2645.c.

◆ READWRITE [2/2]

#define READWRITE   write

Definition at line 397 of file cbs_h2645.c.

◆ RWContext [2/2]

#define RWContext   PutBitContext

Definition at line 398 of file cbs_h2645.c.

◆ ub [2/2]

#define ub (   width,
  name 
)
Value:
do { \
uint32_t value = current->name; \
value)); \
} while (0)

Definition at line 400 of file cbs_h2645.c.

◆ xu [2/2]

#define xu (   width,
  name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
uint32_t value = var; \
SUBSCRIPTS(subs, __VA_ARGS__), \
value, range_min, range_max)); \
} while (0)

Definition at line 405 of file cbs_h2645.c.

◆ xue [2/2]

#define xue (   name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
uint32_t value = var; \
CHECK(cbs_write_ue_golomb(ctx, rw, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
value, range_min, range_max)); \
} while (0)

Definition at line 411 of file cbs_h2645.c.

◆ xi [2/2]

#define xi (   width,
  name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
int32_t value = var; \
SUBSCRIPTS(subs, __VA_ARGS__), \
value, range_min, range_max)); \
} while (0)

Definition at line 417 of file cbs_h2645.c.

◆ xse [2/2]

#define xse (   name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
int32_t value = var; \
CHECK(cbs_write_se_golomb(ctx, rw, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
value, range_min, range_max)); \
} while (0)

Definition at line 423 of file cbs_h2645.c.

◆ infer [2/2]

#define infer (   name,
  value 
)
Value:
do { \
if (current->name != (value)) { \
av_log(ctx->log_ctx, AV_LOG_ERROR, \
"%s does not match inferred value: " \
"%"PRId64", but should be %"PRId64".\n", \
#name, (int64_t)current->name, (int64_t)(value)); \
} \
} while (0)

Definition at line 430 of file cbs_h2645.c.

◆ more_rbsp_data [2/2]

#define more_rbsp_data (   var)    (var)

Definition at line 440 of file cbs_h2645.c.

◆ bit_position [2/2]

#define bit_position (   rw)    (put_bits_count(rw))

Definition at line 442 of file cbs_h2645.c.

◆ byte_alignment [2/2]

#define byte_alignment (   rw)    (put_bits_count(rw) % 8)

Definition at line 443 of file cbs_h2645.c.

◆ allocate [3/3]

#define allocate (   name,
  size 
)
Value:
do { \
if (!name) { \
av_log(ctx->log_ctx, AV_LOG_ERROR, "%s must be set " \
"for writing.\n", #name); \
} \
} while (0)

Definition at line 445 of file cbs_h2645.c.

◆ FUNC [5/8]

#define FUNC (   name)    FUNC_SEI(name)

Definition at line 465 of file cbs_h2645.c.

◆ FUNC [6/8]

#define FUNC (   name)    FUNC_H264(name)

Definition at line 465 of file cbs_h2645.c.

◆ FUNC [7/8]

#define FUNC (   name)    FUNC_H265(name)

Definition at line 465 of file cbs_h2645.c.

◆ FUNC [8/8]

#define FUNC (   name)    FUNC_H266(name)

Definition at line 465 of file cbs_h2645.c.

◆ cbs_h2645_replace_ps

#define cbs_h2645_replace_ps (   h26n,
  ps_name,
  ps_var,
  id_element 
)
Value:
static int cbs_h26 ## h26n ## _replace_ ## ps_var(CodedBitstreamContext *ctx, \
{ \
CodedBitstreamH26 ## h26n ## Context *priv = ctx->priv_data; \
H26 ## h26n ## Raw ## ps_name *ps_var = unit->content; \
unsigned int id = ps_var->id_element; \
int err = ff_cbs_make_unit_refcounted(ctx, unit); \
if (err < 0) \
return err; \
if (priv->ps_var[id] == priv->active_ ## ps_var) \
priv->active_ ## ps_var = NULL ; \
av_assert0(unit->content_ref); \
ff_refstruct_replace(&priv->ps_var[id], unit->content_ref); \
return 0; \
}

Definition at line 748 of file cbs_h2645.c.

◆ cbs_h266_replace_ps

#define cbs_h266_replace_ps (   h26n,
  ps_name,
  ps_var,
  id_element 
)
Value:
static int cbs_h26 ## h26n ## _replace_ ## ps_var(CodedBitstreamContext *ctx, \
{ \
CodedBitstreamH26 ## h26n ## Context *priv = ctx->priv_data; \
H26 ## h26n ## Raw ## ps_name *ps_var = unit->content; \
unsigned int id = ps_var->id_element; \
int err = ff_cbs_make_unit_refcounted(ctx, unit); \
if (err < 0) \
return err; \
av_assert0(unit->content_ref); \
ff_refstruct_replace(&priv->ps_var[id], unit->content_ref); \
return 0; \
}

◆ SEI_MESSAGE_RW

#define SEI_MESSAGE_RW (   codec,
  name 
)
Value:
.read = cbs_ ## codec ## _read_ ## name ## _internal, \
.write = cbs_ ## codec ## _write_ ## name ## _internal

Definition at line 2084 of file cbs_h2645.c.

Function Documentation

◆ cbs_read_ue_golomb()

static int cbs_read_ue_golomb ( CodedBitstreamContext ctx,
GetBitContext gbc,
const char *  name,
const int subscripts,
uint32_t *  write_to,
uint32_t  range_min,
uint32_t  range_max 
)
static

Definition at line 35 of file cbs_h2645.c.

◆ cbs_read_se_golomb()

static int cbs_read_se_golomb ( CodedBitstreamContext ctx,
GetBitContext gbc,
const char *  name,
const int subscripts,
int32_t write_to,
int32_t  range_min,
int32_t  range_max 
)
static

Definition at line 84 of file cbs_h2645.c.

◆ cbs_write_ue_golomb()

static int cbs_write_ue_golomb ( CodedBitstreamContext ctx,
PutBitContext pbc,
const char *  name,
const int subscripts,
uint32_t  value,
uint32_t  range_min,
uint32_t  range_max 
)
static

Definition at line 139 of file cbs_h2645.c.

◆ cbs_write_se_golomb()

static int cbs_write_se_golomb ( CodedBitstreamContext ctx,
PutBitContext pbc,
const char *  name,
const int subscripts,
int32_t  value,
int32_t  range_min,
int32_t  range_max 
)
static

Definition at line 171 of file cbs_h2645.c.

◆ cbs_h265_payload_extension_present()

static int cbs_h265_payload_extension_present ( GetBitContext gbc,
uint32_t  payload_size,
int  cur_pos 
)
static

Definition at line 213 of file cbs_h2645.c.

Referenced by payload_extension(), and SEI_FUNC().

◆ cbs_h2645_read_more_rbsp_data()

static int cbs_h2645_read_more_rbsp_data ( GetBitContext gbc)
static

◆ cbs_h2645_fragment_add_nals()

static int cbs_h2645_fragment_add_nals ( CodedBitstreamContext ctx,
CodedBitstreamFragment frag,
const H2645Packet packet 
)
static

Definition at line 489 of file cbs_h2645.c.

Referenced by cbs_h2645_split_fragment().

◆ cbs_h2645_split_fragment()

static int cbs_h2645_split_fragment ( CodedBitstreamContext ctx,
CodedBitstreamFragment frag,
int  header 
)
static

Definition at line 524 of file cbs_h2645.c.

◆ cbs_h2645_replace_ps()

cbs_h2645_replace_ps ( cbs_h2645_replace_ps(  4,
cbs_h2645_replace_ps(  SPS,
cbs_h2645_replace_ps(  sps,
seq_parameter_set_id   
)

Definition at line 765 of file cbs_h2645.c.

◆ cbs_h264_read_nal_unit()

static int cbs_h264_read_nal_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit 
)
static

Definition at line 806 of file cbs_h2645.c.

◆ cbs_h265_read_nal_unit()

static int cbs_h265_read_nal_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit 
)
static

Definition at line 925 of file cbs_h2645.c.

◆ cbs_h266_read_nal_unit()

static int cbs_h266_read_nal_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit 
)
static

Definition at line 1046 of file cbs_h2645.c.

◆ cbs_h2645_write_slice_data()

static int cbs_h2645_write_slice_data ( CodedBitstreamContext ctx,
PutBitContext pbc,
const uint8_t *  data,
size_t  data_size,
int  data_bit_start 
)
static

◆ cbs_h264_write_nal_unit()

static int cbs_h264_write_nal_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit,
PutBitContext pbc 
)
static

Definition at line 1261 of file cbs_h2645.c.

◆ cbs_h265_write_nal_unit()

static int cbs_h265_write_nal_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit,
PutBitContext pbc 
)
static

Definition at line 1378 of file cbs_h2645.c.

◆ cbs_h264_discarded_nal_unit()

static int cbs_h264_discarded_nal_unit ( CodedBitstreamContext ctx,
const CodedBitstreamUnit unit,
enum AVDiscard  skip 
)
static

Definition at line 1490 of file cbs_h2645.c.

◆ cbs_h265_discarded_nal_unit()

static int cbs_h265_discarded_nal_unit ( CodedBitstreamContext ctx,
const CodedBitstreamUnit unit,
enum AVDiscard  skip 
)
static

Definition at line 1542 of file cbs_h2645.c.

◆ cbs_h266_write_nal_unit()

static int cbs_h266_write_nal_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit,
PutBitContext pbc 
)
static

Definition at line 1615 of file cbs_h2645.c.

◆ cbs_h2645_unit_requires_zero_byte()

static int cbs_h2645_unit_requires_zero_byte ( enum AVCodecID  codec_id,
CodedBitstreamUnitType  type,
int  nal_unit_index 
)
static

Definition at line 1764 of file cbs_h2645.c.

Referenced by cbs_h2645_assemble_fragment().

◆ cbs_h2645_assemble_fragment()

static int cbs_h2645_assemble_fragment ( CodedBitstreamContext ctx,
CodedBitstreamFragment frag 
)
static

Definition at line 1782 of file cbs_h2645.c.

◆ cbs_h264_flush()

static void cbs_h264_flush ( CodedBitstreamContext ctx)
static

Definition at line 1862 of file cbs_h2645.c.

◆ cbs_h264_close()

static void cbs_h264_close ( CodedBitstreamContext ctx)
static

Definition at line 1876 of file cbs_h2645.c.

◆ cbs_h265_flush()

static void cbs_h265_flush ( CodedBitstreamContext ctx)
static

Definition at line 1889 of file cbs_h2645.c.

◆ cbs_h265_close()

static void cbs_h265_close ( CodedBitstreamContext ctx)
static

Definition at line 1905 of file cbs_h2645.c.

◆ cbs_h266_flush()

static void cbs_h266_flush ( CodedBitstreamContext ctx)
static

Definition at line 1920 of file cbs_h2645.c.

Referenced by cbs_h266_close().

◆ cbs_h266_close()

static void cbs_h266_close ( CodedBitstreamContext ctx)
static

Definition at line 1933 of file cbs_h2645.c.

◆ cbs_h264_free_sei()

static void cbs_h264_free_sei ( FFRefStructOpaque  unused,
void *  content 
)
static

Definition at line 1941 of file cbs_h2645.c.

◆ cbs_h265_free_sei()

static void cbs_h265_free_sei ( FFRefStructOpaque  unused,
void *  content 
)
static

Definition at line 1967 of file cbs_h2645.c.

◆ cbs_h266_free_sei()

static void cbs_h266_free_sei ( FFRefStructOpaque  unused,
void *  content 
)
static

Definition at line 1993 of file cbs_h2645.c.

◆ ff_cbs_sei_find_type()

const SEIMessageTypeDescriptor* ff_cbs_sei_find_type ( CodedBitstreamContext ctx,
int  payload_type 
)

Find the type descriptor for the given payload type.

Returns NULL if the payload type is not known.

Definition at line 2248 of file cbs_h2645.c.

Referenced by ff_cbs_sei_add_message(), and message().

Variable Documentation

◆ cbs_h264_unit_types

const CodedBitstreamUnitTypeDescriptor cbs_h264_unit_types[]
static

◆ cbs_h265_unit_types

const CodedBitstreamUnitTypeDescriptor cbs_h265_unit_types[]
static

◆ cbs_h266_unit_types

const CodedBitstreamUnitTypeDescriptor cbs_h266_unit_types[]
static

Definition at line 1999 of file cbs_h2645.c.

◆ ff_cbs_type_h264

const CodedBitstreamType ff_cbs_type_h264
Initial value:
= {
.codec_id = AV_CODEC_ID_H264,
.priv_data_size = sizeof(CodedBitstreamH264Context),
.unit_types = cbs_h264_unit_types,
.split_fragment = &cbs_h2645_split_fragment,
.read_unit = &cbs_h264_read_nal_unit,
.write_unit = &cbs_h264_write_nal_unit,
.discarded_unit = &cbs_h264_discarded_nal_unit,
.assemble_fragment = &cbs_h2645_assemble_fragment,
.close = &cbs_h264_close,
}

Definition at line 2033 of file cbs_h2645.c.

◆ ff_cbs_type_h265

const CodedBitstreamType ff_cbs_type_h265
Initial value:
= {
.codec_id = AV_CODEC_ID_HEVC,
.priv_data_size = sizeof(CodedBitstreamH265Context),
.unit_types = cbs_h265_unit_types,
.split_fragment = &cbs_h2645_split_fragment,
.read_unit = &cbs_h265_read_nal_unit,
.write_unit = &cbs_h265_write_nal_unit,
.discarded_unit = &cbs_h265_discarded_nal_unit,
.assemble_fragment = &cbs_h2645_assemble_fragment,
.close = &cbs_h265_close,
}

Definition at line 2050 of file cbs_h2645.c.

◆ ff_cbs_type_h266

const CodedBitstreamType ff_cbs_type_h266
Initial value:
= {
.codec_id = AV_CODEC_ID_VVC,
.priv_data_size = sizeof(CodedBitstreamH266Context),
.unit_types = cbs_h266_unit_types,
.split_fragment = &cbs_h2645_split_fragment,
.read_unit = &cbs_h266_read_nal_unit,
.write_unit = &cbs_h266_write_nal_unit,
.assemble_fragment = &cbs_h2645_assemble_fragment,
.close = &cbs_h266_close,
}

Definition at line 2067 of file cbs_h2645.c.

◆ cbs_sei_common_types

const SEIMessageTypeDescriptor cbs_sei_common_types[]
static

Definition at line 2088 of file cbs_h2645.c.

Referenced by ff_cbs_sei_find_type().

◆ cbs_sei_h264_types

const SEIMessageTypeDescriptor cbs_sei_h264_types[]
static

Definition at line 2134 of file cbs_h2645.c.

Referenced by ff_cbs_sei_find_type().

◆ cbs_sei_h265_types

const SEIMessageTypeDescriptor cbs_sei_h265_types[]
static

Definition at line 2174 of file cbs_h2645.c.

Referenced by ff_cbs_sei_find_type().

◆ cbs_sei_h266_types

const SEIMessageTypeDescriptor cbs_sei_h266_types[]
static
Initial value:
= {
{
0, 1,
SEI_MESSAGE_RW(h266, sei_decoded_picture_hash),
},
}

Definition at line 2238 of file cbs_h2645.c.

Referenced by ff_cbs_sei_find_type().

name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
CBS_UNIT_TYPE_COMPLEX
#define CBS_UNIT_TYPE_COMPLEX(type, structure, free_func)
Definition: cbs_internal.h:332
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
H264_NAL_AUD
@ H264_NAL_AUD
Definition: h264.h:43
FUNC
#define FUNC(name)
Definition: cbs_h2645.c:465
H265RawSEI
Definition: cbs_h265.h:673
cbs_h266_unit_types
static const CodedBitstreamUnitTypeDescriptor cbs_h266_unit_types[]
Definition: cbs_h2645.c:1999
CodedBitstreamContext
Context structure for coded bitstream operations.
Definition: cbs.h:219
data
const char data[16]
Definition: mxf.c:148
cbs_h2645_split_fragment
static int cbs_h2645_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
Definition: cbs_h2645.c:524
H264_NAL_SPS
@ H264_NAL_SPS
Definition: h264.h:41
H264_NAL_FILLER_DATA
@ H264_NAL_FILLER_DATA
Definition: h264.h:46
CodedBitstreamUnit
Coded bitstream unit structure.
Definition: cbs.h:70
H265RawSPS
Definition: cbs_h265.h:244
H265RawVPS
Definition: cbs_h265.h:183
H265RawPPS
Definition: cbs_h265.h:346
ff_cbs_write_unsigned
int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, uint32_t value, uint32_t range_min, uint32_t range_max)
Definition: cbs.c:646
cbs_h265_flush
static void cbs_h265_flush(CodedBitstreamContext *ctx)
Definition: cbs_h2645.c:1889
Context
Definition: async.c:56
state
static struct @377 state
CBS_UNIT_TYPE_INTERNAL_REF
#define CBS_UNIT_TYPE_INTERNAL_REF(type, structure, ref_field)
Definition: cbs_internal.h:312
cbs_h264_flush
static void cbs_h264_flush(CodedBitstreamContext *ctx)
Definition: cbs_h2645.c:1862
H264_NAL_IDR_SLICE
@ H264_NAL_IDR_SLICE
Definition: h264.h:39
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
extension_data
static int FUNC() extension_data(CodedBitstreamContext *ctx, RWContext *rw, H265RawExtensionData *current)
Definition: cbs_h265_syntax_template.c:61
H264_NAL_SLICE
@ H264_NAL_SLICE
Definition: h264.h:35
cbs_read_ue_golomb
static int cbs_read_ue_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc, const char *name, const int *subscripts, uint32_t *write_to, uint32_t range_min, uint32_t range_max)
Definition: cbs_h2645.c:35
width
#define width
cbs_h265_free_sei
static void cbs_h265_free_sei(FFRefStructOpaque unused, void *content)
Definition: cbs_h2645.c:1967
ctx
AVFormatContext * ctx
Definition: movenc.c:48
SEI_MESSAGE_TYPE_END
#define SEI_MESSAGE_TYPE_END
Definition: cbs_sei.h:130
H264_NAL_SEI
@ H264_NAL_SEI
Definition: h264.h:40
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:79
cbs_h266_read_nal_unit
static int cbs_h266_read_nal_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Definition: cbs_h2645.c:1046
NULL
#define NULL
Definition: coverity.c:32
H265RawAUD
Definition: cbs_h265.h:437
HEVC_NAL_PPS
@ HEVC_NAL_PPS
Definition: hevc.h:63
cbs_h265_write_nal_unit
static int cbs_h265_write_nal_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
Definition: cbs_h2645.c:1378
H264RawNALUnitHeader
Definition: cbs_h264.h:31
cbs_h266_close
static void cbs_h266_close(CodedBitstreamContext *ctx)
Definition: cbs_h2645.c:1933
flush
void(* flush)(AVBSFContext *ctx)
Definition: dts2pts.c:367
HEVC_NAL_SEI_SUFFIX
@ HEVC_NAL_SEI_SUFFIX
Definition: hevc.h:69
ff_refstruct_allocz
static void * ff_refstruct_allocz(size_t size)
Equivalent to ff_refstruct_alloc_ext(size, 0, NULL, NULL)
Definition: refstruct.h:105
HEVC_NAL_CRA_NUT
@ HEVC_NAL_CRA_NUT
Definition: hevc.h:50
CBS_UNIT_RANGE_INTERNAL_REF
#define CBS_UNIT_RANGE_INTERNAL_REF(range_start, range_end, structure, ref_field)
Definition: cbs_internal.h:315
ff_cbs_read_simple_unsigned
int ff_cbs_read_simple_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, uint32_t *write_to)
Definition: cbs.c:639
H264_NAL_END_STREAM
@ H264_NAL_END_STREAM
Definition: h264.h:45
HEVC_NAL_RASL_R
@ HEVC_NAL_RASL_R
Definition: hevc.h:38
cbs_h264_unit_types
static const CodedBitstreamUnitTypeDescriptor cbs_h264_unit_types[]
Definition: cbs_h2645.c:1947
CodedBitstreamH264Context
Definition: cbs_h264.h:404
H264_NAL_PPS
@ H264_NAL_PPS
Definition: h264.h:42
size
int size
Definition: twinvq_data.h:10344
HEVC_NAL_BLA_W_LP
@ HEVC_NAL_BLA_W_LP
Definition: hevc.h:45
ff_cbs_write_signed
int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, int32_t value, int32_t range_min, int32_t range_max)
Definition: cbs.c:714
CBS_UNIT_TYPE_POD
#define CBS_UNIT_TYPE_POD(type_, structure)
Definition: cbs_internal.h:288
CodedBitstreamH266Context
Definition: cbs_h266.h:866
AV_CODEC_ID_VVC
@ AV_CODEC_ID_VVC
Definition: codec_id.h:250
cbs_h264_discarded_nal_unit
static int cbs_h264_discarded_nal_unit(CodedBitstreamContext *ctx, const CodedBitstreamUnit *unit, enum AVDiscard skip)
Definition: cbs_h2645.c:1490
ff_cbs_read_signed
int ff_cbs_read_signed(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, int32_t *write_to, int32_t range_min, int32_t range_max)
Definition: cbs.c:682
cbs_h265_close
static void cbs_h265_close(CodedBitstreamContext *ctx)
Definition: cbs_h2645.c:1905
CBS_UNIT_TYPES_COMPLEX
#define CBS_UNIT_TYPES_COMPLEX(types, structure, free_func)
Definition: cbs_internal.h:325
H264_NAL_END_SEQUENCE
@ H264_NAL_END_SEQUENCE
Definition: h264.h:44
cbs_h266_flush
static void cbs_h266_flush(CodedBitstreamContext *ctx)
Definition: cbs_h2645.c:1920
AV_CODEC_ID_HEVC
@ AV_CODEC_ID_HEVC
Definition: codec_id.h:226
value
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
Definition: writing_filters.txt:86
cbs_write_se_golomb
static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, const char *name, const int *subscripts, int32_t value, int32_t range_min, int32_t range_max)
Definition: cbs_h2645.c:171
ff_cbs_make_unit_refcounted
int ff_cbs_make_unit_refcounted(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Make the content of a unit refcounted.
Definition: cbs.c:1034
SEI_MESSAGE_RW
#define SEI_MESSAGE_RW(codec, name)
Definition: cbs_h2645.c:2084
ff_cbs_read_unsigned
int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, uint32_t *write_to, uint32_t range_min, uint32_t range_max)
Definition: cbs.c:630
CBS_UNIT_TYPE_END_OF_LIST
#define CBS_UNIT_TYPE_END_OF_LIST
Definition: cbs_internal.h:335
HEVC_NAL_VPS
@ HEVC_NAL_VPS
Definition: hevc.h:61
cbs_read_se_golomb
static int cbs_read_se_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc, const char *name, const int *subscripts, int32_t *write_to, int32_t range_min, int32_t range_max)
Definition: cbs_h2645.c:84
av_buffer_allocz
AVBufferRef * av_buffer_allocz(size_t size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
Definition: buffer.c:93
H264RawSEI
Definition: cbs_h264.h:305
cbs_h264_close
static void cbs_h264_close(CodedBitstreamContext *ctx)
Definition: cbs_h2645.c:1876
cbs_h264_free_sei
static void cbs_h264_free_sei(FFRefStructOpaque unused, void *content)
Definition: cbs_h2645.c:1941
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: defs.h:40
HEVC_NAL_TRAIL_N
@ HEVC_NAL_TRAIL_N
Definition: hevc.h:29
HEVC_NAL_AUD
@ HEVC_NAL_AUD
Definition: hevc.h:64
H264RawAUD
Definition: cbs_h264.h:218
ff_cbs_write_simple_unsigned
int ff_cbs_write_simple_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, uint32_t value)
Definition: cbs.c:675
cbs_write_ue_golomb
static int cbs_write_ue_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, const char *name, const int *subscripts, uint32_t value, uint32_t range_min, uint32_t range_max)
Definition: cbs_h2645.c:139
H264_NAL_AUXILIARY_SLICE
@ H264_NAL_AUXILIARY_SLICE
Definition: h264.h:53
SEI_TYPE_DECODED_PICTURE_HASH
@ SEI_TYPE_DECODED_PICTURE_HASH
Definition: sei.h:91
HEVC_NAL_SPS
@ HEVC_NAL_SPS
Definition: hevc.h:62
cbs_h265_discarded_nal_unit
static int cbs_h265_discarded_nal_unit(CodedBitstreamContext *ctx, const CodedBitstreamUnit *unit, enum AVDiscard skip)
Definition: cbs_h2645.c:1542
cbs_h265_read_nal_unit
static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Definition: cbs_h2645.c:925
CBS_UNIT_TYPES_INTERNAL_REF
#define CBS_UNIT_TYPES_INTERNAL_REF(types, structure, ref_field)
Definition: cbs_internal.h:304
cbs_h265_unit_types
static const CodedBitstreamUnitTypeDescriptor cbs_h265_unit_types[]
Definition: cbs_h2645.c:1973
H264RawFiller
Definition: cbs_h264.h:397
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
cbs_h264_read_nal_unit
static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Definition: cbs_h2645.c:806
H264RawSPSExtension
Definition: cbs_h264.h:157
H266RawSEIDecodedPictureHash
Definition: cbs_h266.h:851
HEVC_NAL_SEI_PREFIX
@ HEVC_NAL_SEI_PREFIX
Definition: hevc.h:68
AVFormatContext::priv_data
void * priv_data
Format private data.
Definition: avformat.h:1391
cbs_h264_write_nal_unit
static int cbs_h264_write_nal_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
Definition: cbs_h2645.c:1261
cbs_h2645_assemble_fragment
static int cbs_h2645_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Definition: cbs_h2645.c:1782
CodedBitstreamH265Context
Definition: cbs_h265.h:678
H265RawSlice
Definition: cbs_h265.h:533
H264RawSlice
Definition: cbs_h264.h:388
cbs_h266_write_nal_unit
static int cbs_h266_write_nal_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
Definition: cbs_h2645.c:1615
H264_NAL_SPS_EXT
@ H264_NAL_SPS_EXT
Definition: h264.h:47
H264RawSPS
Definition: cbs_h264.h:102
SUBSCRIPTS
#define SUBSCRIPTS(subs,...)
Definition: cbs_h2645.c:248
H264RawPPS
Definition: cbs_h264.h:171