libgpac
Documentation of the core library of GPAC
Loading...
Searching...
No Matches
av1merge.c File Reference
#include <gpac/bitstream.h>
#include <gpac/filters.h>
#include <gpac/avparse.h>
#include <gpac/constants.h>
#include <gpac/internal/media_dev.h>
+ Include dependency graph for av1merge.c:

Data Structures

struct  AV1TilePidCtx
 
struct  GF_AV1MergeCtx
 

Macros

#define AV1_SUPERRES_DENOM_MIN   9
 
#define AV1_SUPERRES_DENOM_BITS   3
 
#define AV1_SUPERRES_NUM   8
 
#define AV1_LAST_FRAME   1
 
#define AV1_REFS_PER_FRAME   7
 
#define AV1_PRIMARY_REF_NONE   7
 
#define AV1_NUM_REF_FRAMES   8
 
#define AV1_ALL_FRAMES   ((1 << AV1_NUM_REF_FRAMES) - 1)
 
#define REWRITE(bits, name_unused)   bs_rewrite(ctx->bs_in, ctx->bs_out, bits)
 
#define REWRITEi(bits, name_unused)   bs_rewrite(bs_ori, bs_new, bits)
 
#define gf_bs_log(_bs, _nBits, _fname, _val)   gf_bs_log_idx(_bs, _nBits, _fname, _val, -1, -1, -1)
 
#define MAX_TILE_WIDTH   4096
 
#define MAX_TILE_AREA   (4096 * 2304)
 
#define gf_bs_read_int_log(_bs, _nBits, _fname)   gf_bs_read_int_log_idx3(_bs, _nBits, _fname, -1, -1, -1)
 
#define OFFS(_n)   #_n, offsetof(GF_AV1MergeCtx, _n)
 

Functions

static void release_buffer (GF_Filter *filter, GF_FilterPid *pid, GF_FilterPacket *pck)
 
static GFINLINE int bs_rewrite (GF_BitStream *bs_ori, GF_BitStream *bs_new, s32 bits)
 
static u32 count_bits (u32 val)
 
static void av1merge_rewrite_seq_hdr (GF_AV1MergeCtx *ctx, GF_BitStream *bs_ori, GF_BitStream *bs_new)
 
u64 av1_bit_position (GF_BitStream *bs)
 
static void av1merge_copy_bits (GF_BitStream *src, GF_BitStream *dst, u64 end)
 
static void av1merge_copy_trailing_bits (GF_BitStream *src, GF_BitStream *dst, const u8 *data, u32 end)
 
static void av1merge_flush_obu (GF_BitStream *payload, GF_BitStream *dst, const u8 *header, u32 header_size)
 
static GF_Err av1merge_rewrite_config (GF_AV1MergeCtx *ctx, u8 **new_dsi, u32 *new_size)
 
void gf_bs_log_idx (GF_BitStream *bs, u32 nBits, const char *fname, s64 val, s32 idx1, s32 idx2, s32 idx3)
 
static u32 gf_bs_read_int_log_idx3 (GF_BitStream *bs, u32 nBits, const char *fname, s32 idx1, s32 idx2, s32 idx3)
 
static u32 av1_read_ns (GF_BitStream *bs, u32 n, const char *fname)
 
static void av1merge_write_ns (GF_BitStream *bs, u32 n, u32 value)
 
static GF_Err av1merge_rewrite_tile_info (GF_AV1MergeCtx *ctx, AV1State *state)
 
static void superres_params (GF_BitStream *bs_ori, GF_BitStream *bs_new, AV1State *state)
 
static void av1_frame_size (GF_AV1MergeCtx *ctx, GF_BitStream *bs_ori, GF_BitStream *bs_new, AV1State *state, Bool frame_size_override_flag)
 
static void av1_render_size (GF_AV1MergeCtx *ctx, GF_BitStream *bs_ori, GF_BitStream *bs_new)
 
static void frame_size_with_refs (GF_AV1MergeCtx *ctx, GF_BitStream *bs_ori, GF_BitStream *bs_new, AV1State *state, Bool frame_size_override_flag, s8 *ref_frame_idx)
 
static GF_Err av1merge_rewrite_uncompressed_header (GF_AV1MergeCtx *ctx, AV1State *state)
 
static void av1merge_write_tile_group (GF_AV1MergeCtx *ctx, u32 first, u32 last)
 
static void av1merge_write_sparse_groups (GF_AV1MergeCtx *ctx, AV1TilePidCtx *base)
 
static Bool av1merge_frame_obu (ObuType type)
 
static GF_Err av1merge_next_obu (GF_AV1MergeCtx *ctx, AV1TilePidCtx *tile)
 
static GF_Err av1merge_rewrite_pck (GF_AV1MergeCtx *ctx)
 
static void av1merge_copy_output_properties (GF_AV1MergeCtx *ctx, GF_FilterPid *pid)
 
static Bool av1merge_try_implicit_grid (GF_AV1MergeCtx *ctx, u32 rows, u32 sb_size, Bool assign)
 
static GF_Err av1merge_implicit_grid (GF_AV1MergeCtx *ctx)
 
static GF_Err av1merge_build_srdmap (GF_AV1MergeCtx *ctx, Bool relative)
 
static GF_Err av1merge_insert_boundary (u32 *values, u32 *count, u32 capacity, u32 value)
 
static GF_Err av1merge_rebuild_grid (GF_AV1MergeCtx *ctx)
 
static GF_Err av1merge_configure_pid (GF_Filter *filter, GF_FilterPid *pid, Bool is_remove)
 
static GF_Err av1merge_process (GF_Filter *filter)
 
static Bool av1merge_process_event (GF_Filter *filter, const GF_FilterEvent *evt)
 
static GF_Err av1merge_initialize (GF_Filter *filter)
 
static void av1merge_finalize (GF_Filter *filter)
 
const GF_FilterRegister * av1merge_register (GF_FilterSession *session)
 

Variables

static const GF_FilterCapability AV1MergeCaps []
 
static const GF_FilterArgs AV1MergeArgs []
 
GF_FilterRegister AV1MergeRegister
 

Data Structure Documentation

◆ AV1TilePidCtx

struct AV1TilePidCtx
+ Collaboration diagram for AV1TilePidCtx:
Data Fields
GF_FilterPid * pid
AV1State state
u32 last_size
u32 packet_start
u32 packet_end
u32 obu_pos
u32 tile_start
u32 tile_id
Bool has_pos
s32 pos_x
s32 pos_y
u32 grid_x
u32 grid_y
u32 obu_start
u32 payload_start
u32 header_size
u64 header_end_bits
ObuType obu_type
u32 dsi_crc
u32 width
u32 height
u32 render_width
u32 render_height
u8 base_q_idx
u32 ref_render_width[AV1_NUM_REF_FRAMES]
u32 ref_render_height[AV1_NUM_REF_FRAMES]
u32 timescale
u32 nb_pck

◆ GF_AV1MergeCtx

struct GF_AV1MergeCtx
+ Collaboration diagram for GF_AV1MergeCtx:
Data Fields
GF_List * ipids
GF_FilterPid * opid
Bool in_error
u32 cols
u32 rows
u32 col_width[AV1_MAX_TILE_COLS]
u32 row_height[AV1_MAX_TILE_ROWS]
u32 out_width
u32 out_height
u32 render_width
u32 render_height
Bool cols_forced
Bool rows_forced
Bool grid_changed
Bool has_gaps
AV1TilePidCtx * incomplete_tile
Bool drain
u8 tile_size_bytes
u8 * buffer
u32 buffer_alloc
AV1State rewrite_state
GF_List * ordered_ipids
Bool is_playing
GF_FEVT_Play play_evt
GF_BitStream * bs_in
GF_BitStream * bs_out
GF_BitStream * bs_pck

Macro Definition Documentation

◆ AV1_SUPERRES_DENOM_MIN

#define AV1_SUPERRES_DENOM_MIN   9

◆ AV1_SUPERRES_DENOM_BITS

#define AV1_SUPERRES_DENOM_BITS   3

◆ AV1_SUPERRES_NUM

#define AV1_SUPERRES_NUM   8

◆ AV1_LAST_FRAME

#define AV1_LAST_FRAME   1

◆ AV1_REFS_PER_FRAME

#define AV1_REFS_PER_FRAME   7

◆ AV1_PRIMARY_REF_NONE

#define AV1_PRIMARY_REF_NONE   7

◆ AV1_NUM_REF_FRAMES

#define AV1_NUM_REF_FRAMES   8

◆ AV1_ALL_FRAMES

#define AV1_ALL_FRAMES   ((1 << AV1_NUM_REF_FRAMES) - 1)

◆ REWRITE

#define REWRITE (   bits,
  name_unused 
)    bs_rewrite(ctx->bs_in, ctx->bs_out, bits)

◆ REWRITEi

#define REWRITEi (   bits,
  name_unused 
)    bs_rewrite(bs_ori, bs_new, bits)

◆ gf_bs_log

#define gf_bs_log (   _bs,
  _nBits,
  _fname,
  _val 
)    gf_bs_log_idx(_bs, _nBits, _fname, _val, -1, -1, -1)

◆ MAX_TILE_WIDTH

#define MAX_TILE_WIDTH   4096

◆ MAX_TILE_AREA

#define MAX_TILE_AREA   (4096 * 2304)

◆ gf_bs_read_int_log

#define gf_bs_read_int_log (   _bs,
  _nBits,
  _fname 
)    gf_bs_read_int_log_idx3(_bs, _nBits, _fname, -1, -1, -1)

◆ OFFS

#define OFFS (   _n)    #_n, offsetof(GF_AV1MergeCtx, _n)

Function Documentation

◆ release_buffer()

static void release_buffer ( GF_Filter *  filter,
GF_FilterPid *  pid,
GF_FilterPacket *  pck 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bs_rewrite()

static GFINLINE int bs_rewrite ( GF_BitStream *  bs_ori,
GF_BitStream *  bs_new,
s32  bits 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ count_bits()

static u32 count_bits ( u32  val)
static
+ Here is the caller graph for this function:

◆ av1merge_rewrite_seq_hdr()

static void av1merge_rewrite_seq_hdr ( GF_AV1MergeCtx *  ctx,
GF_BitStream *  bs_ori,
GF_BitStream *  bs_new 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1_bit_position()

u64 av1_bit_position ( GF_BitStream *  bs)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1merge_copy_bits()

static void av1merge_copy_bits ( GF_BitStream *  src,
GF_BitStream *  dst,
u64  end 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1merge_copy_trailing_bits()

static void av1merge_copy_trailing_bits ( GF_BitStream *  src,
GF_BitStream *  dst,
const u8 *  data,
u32  end 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1merge_flush_obu()

static void av1merge_flush_obu ( GF_BitStream *  payload,
GF_BitStream *  dst,
const u8 *  header,
u32  header_size 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1merge_rewrite_config()

static GF_Err av1merge_rewrite_config ( GF_AV1MergeCtx *  ctx,
u8 **  new_dsi,
u32 *  new_size 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_bs_log_idx()

void gf_bs_log_idx ( GF_BitStream *  bs,
u32  nBits,
const char *  fname,
s64  val,
s32  idx1,
s32  idx2,
s32  idx3 
)
+ Here is the caller graph for this function:

◆ gf_bs_read_int_log_idx3()

static u32 gf_bs_read_int_log_idx3 ( GF_BitStream *  bs,
u32  nBits,
const char *  fname,
s32  idx1,
s32  idx2,
s32  idx3 
)
static
+ Here is the call graph for this function:

◆ av1_read_ns()

static u32 av1_read_ns ( GF_BitStream *  bs,
u32  n,
const char *  fname 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1merge_write_ns()

static void av1merge_write_ns ( GF_BitStream *  bs,
u32  n,
u32  value 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1merge_rewrite_tile_info()

static GF_Err av1merge_rewrite_tile_info ( GF_AV1MergeCtx *  ctx,
AV1State *  state 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ superres_params()

static void superres_params ( GF_BitStream *  bs_ori,
GF_BitStream *  bs_new,
AV1State *  state 
)
static
+ Here is the caller graph for this function:

◆ av1_frame_size()

static void av1_frame_size ( GF_AV1MergeCtx *  ctx,
GF_BitStream *  bs_ori,
GF_BitStream *  bs_new,
AV1State *  state,
Bool  frame_size_override_flag 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1_render_size()

static void av1_render_size ( GF_AV1MergeCtx *  ctx,
GF_BitStream *  bs_ori,
GF_BitStream *  bs_new 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ frame_size_with_refs()

static void frame_size_with_refs ( GF_AV1MergeCtx *  ctx,
GF_BitStream *  bs_ori,
GF_BitStream *  bs_new,
AV1State *  state,
Bool  frame_size_override_flag,
s8 *  ref_frame_idx 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1merge_rewrite_uncompressed_header()

static GF_Err av1merge_rewrite_uncompressed_header ( GF_AV1MergeCtx *  ctx,
AV1State *  state 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1merge_write_tile_group()

static void av1merge_write_tile_group ( GF_AV1MergeCtx *  ctx,
u32  first,
u32  last 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1merge_write_sparse_groups()

static void av1merge_write_sparse_groups ( GF_AV1MergeCtx *  ctx,
AV1TilePidCtx *  base 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1merge_frame_obu()

static Bool av1merge_frame_obu ( ObuType  type)
static
+ Here is the caller graph for this function:

◆ av1merge_next_obu()

static GF_Err av1merge_next_obu ( GF_AV1MergeCtx *  ctx,
AV1TilePidCtx *  tile 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1merge_rewrite_pck()

static GF_Err av1merge_rewrite_pck ( GF_AV1MergeCtx *  ctx)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1merge_copy_output_properties()

static void av1merge_copy_output_properties ( GF_AV1MergeCtx *  ctx,
GF_FilterPid *  pid 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1merge_try_implicit_grid()

static Bool av1merge_try_implicit_grid ( GF_AV1MergeCtx *  ctx,
u32  rows,
u32  sb_size,
Bool  assign 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1merge_implicit_grid()

static GF_Err av1merge_implicit_grid ( GF_AV1MergeCtx *  ctx)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1merge_build_srdmap()

static GF_Err av1merge_build_srdmap ( GF_AV1MergeCtx *  ctx,
Bool  relative 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1merge_insert_boundary()

static GF_Err av1merge_insert_boundary ( u32 *  values,
u32 *  count,
u32  capacity,
u32  value 
)
static
+ Here is the caller graph for this function:

◆ av1merge_rebuild_grid()

static GF_Err av1merge_rebuild_grid ( GF_AV1MergeCtx *  ctx)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ av1merge_configure_pid()

static GF_Err av1merge_configure_pid ( GF_Filter *  filter,
GF_FilterPid *  pid,
Bool  is_remove 
)
static
+ Here is the call graph for this function:

◆ av1merge_process()

static GF_Err av1merge_process ( GF_Filter *  filter)
static
+ Here is the call graph for this function:

◆ av1merge_process_event()

static Bool av1merge_process_event ( GF_Filter *  filter,
const GF_FilterEvent *  evt 
)
static
+ Here is the call graph for this function:

◆ av1merge_initialize()

static GF_Err av1merge_initialize ( GF_Filter *  filter)
static
+ Here is the call graph for this function:

◆ av1merge_finalize()

static void av1merge_finalize ( GF_Filter *  filter)
static
+ Here is the call graph for this function:

◆ av1merge_register()

const GF_FilterRegister * av1merge_register ( GF_FilterSession *  session)

Variable Documentation

◆ AV1MergeCaps

const GF_FilterCapability AV1MergeCaps[]
static
Initial value:
=
{
}
@ GF_CODECID_AV1
Definition constants.h:612
@ GF_STREAM_VISUAL
Definition constants.h:64
#define GF_CAPS_OUTPUT
Definition filters.h:2326
#define CAP_UINT(_f, _a, _b)
Definition filters.h:2260
#define GF_CAPS_INPUT_EXCLUDED
Definition filters.h:2322
#define CAP_BOOL(_f, _a, _b)
Definition filters.h:2268
#define GF_CAPS_INPUT
Definition filters.h:2314
@ GF_PROP_PID_CODECID
Definition filters.h:1159
@ GF_PROP_PID_STREAM_TYPE
Definition filters.h:1155
@ GF_PROP_PID_UNFRAMED
Definition filters.h:1161
@ GF_TRUE
Definition setup.h:485

◆ AV1MergeArgs

const GF_FilterArgs AV1MergeArgs[]
static
Initial value:
=
{
{ OFFS(rows), "required number of rows, constraining explicit or implicit positioning (0: automatic)", GF_PROP_UINT, "0", NULL, GF_FS_ARG_HINT_NORMAL},
{ OFFS(cols), "required number of columns, constraining explicit or implicit positioning (0: automatic)", GF_PROP_UINT, "0", NULL, GF_FS_ARG_HINT_NORMAL},
{0}
}
#define OFFS(_n)
Definition av1merge.c:1820
@ GF_FS_ARG_HINT_NORMAL
Definition filters.h:2188
@ GF_PROP_UINT
Definition filters.h:895

◆ AV1MergeRegister

GF_FilterRegister AV1MergeRegister