FFmpeg  4.3
Macros | Functions | Variables
cbs_vp9.c File Reference
#include "libavutil/avassert.h"
#include "cbs.h"
#include "cbs_internal.h"
#include "cbs_vp9.h"
#include "internal.h"
#include "cbs_vp9_syntax_template.c"

Go to the source code of this file.

Macros

#define HEADER(name)
 
#define CHECK(call)
 
#define FUNC_NAME(rw, codec, name)   cbs_ ## codec ## _ ## rw ## _ ## name
 
#define FUNC_VP9(rw, name)   FUNC_NAME(rw, vp9, name)
 
#define FUNC(name)   FUNC_VP9(READWRITE, name)
 
#define SUBSCRIPTS(subs, ...)   (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)
 
#define f(width, name)   xf(width, name, current->name, 0, )
 
#define s(width, name)   xs(width, name, current->name, 0, )
 
#define fs(width, name, subs, ...)   xf(width, name, current->name, subs, __VA_ARGS__)
 
#define ss(width, name, subs, ...)   xs(width, name, current->name, subs, __VA_ARGS__)
 
#define READ
 
#define READWRITE   read
 
#define RWContext   GetBitContext
 
#define xf(width, name, var, subs, ...)
 
#define xs(width, name, var, subs, ...)
 
#define increment(name, min, max)
 
#define fle(width, name, subs, ...)
 
#define delta_q(name)
 
#define prob(name, subs, ...)
 
#define fixed(width, name, value)
 
#define infer(name, value)
 
#define byte_alignment(rw)   (get_bits_count(rw) % 8)
 
#define WRITE
 
#define READWRITE   write
 
#define RWContext   PutBitContext
 
#define xf(width, name, var, subs, ...)
 
#define xs(width, name, var, subs, ...)
 
#define increment(name, min, max)
 
#define fle(width, name, subs, ...)
 
#define delta_q(name)
 
#define prob(name, subs, ...)
 
#define fixed(width, name, value)
 
#define infer(name, value)
 
#define byte_alignment(rw)   (put_bits_count(rw) % 8)
 

Functions

static int cbs_vp9_read_s (CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, int32_t *write_to)
 
static int cbs_vp9_write_s (CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, int32_t value)
 
static int cbs_vp9_read_increment (CodedBitstreamContext *ctx, GetBitContext *gbc, uint32_t range_min, uint32_t range_max, const char *name, uint32_t *write_to)
 
static int cbs_vp9_write_increment (CodedBitstreamContext *ctx, PutBitContext *pbc, uint32_t range_min, uint32_t range_max, const char *name, uint32_t value)
 
static int cbs_vp9_read_le (CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, uint32_t *write_to)
 
static int cbs_vp9_write_le (CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, uint32_t value)
 
static int cbs_vp9_split_fragment (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
 
static void cbs_vp9_free_frame (void *opaque, uint8_t *content)
 
static int cbs_vp9_read_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
 
static int cbs_vp9_write_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
 
static int cbs_vp9_assemble_fragment (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
 

Variables

const CodedBitstreamType ff_cbs_type_vp9
 

Macro Definition Documentation

◆ HEADER

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

Definition at line 239 of file cbs_vp9.c.

◆ CHECK

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

Definition at line 243 of file cbs_vp9.c.

◆ FUNC_NAME

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

Definition at line 249 of file cbs_vp9.c.

◆ FUNC_VP9

#define FUNC_VP9 (   rw,
  name 
)    FUNC_NAME(rw, vp9, name)

Definition at line 250 of file cbs_vp9.c.

◆ FUNC

#define FUNC (   name)    FUNC_VP9(READWRITE, name)

Definition at line 251 of file cbs_vp9.c.

◆ SUBSCRIPTS

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

Definition at line 253 of file cbs_vp9.c.

◆ f

#define f (   width,
  name 
)    xf(width, name, current->name, 0, )
Examples
decode_audio.c, decode_video.c, encode_audio.c, and encode_video.c.

Definition at line 255 of file cbs_vp9.c.

◆ s

#define s (   width,
  name 
)    xs(width, name, current->name, 0, )

Definition at line 257 of file cbs_vp9.c.

◆ fs

#define fs (   width,
  name,
  subs,
  ... 
)    xf(width, name, current->name, subs, __VA_ARGS__)

Definition at line 259 of file cbs_vp9.c.

◆ ss

#define ss (   width,
  name,
  subs,
  ... 
)    xs(width, name, current->name, subs, __VA_ARGS__)

Definition at line 261 of file cbs_vp9.c.

◆ READ

#define READ

Definition at line 264 of file cbs_vp9.c.

◆ READWRITE [1/2]

#define READWRITE   read

Definition at line 345 of file cbs_vp9.c.

◆ RWContext [1/2]

#define RWContext   GetBitContext

Definition at line 346 of file cbs_vp9.c.

◆ xf [1/2]

#define xf (   width,
  name,
  var,
  subs,
  ... 
)
Value:
do { \
uint32_t value; \
SUBSCRIPTS(subs, __VA_ARGS__), \
&value, 0, (1 << width) - 1)); \
var = value; \
} while (0)

Definition at line 348 of file cbs_vp9.c.

◆ xs [1/2]

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

Definition at line 353 of file cbs_vp9.c.

◆ increment [1/2]

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

Definition at line 358 of file cbs_vp9.c.

◆ fle [1/2]

#define fle (   width,
  name,
  subs,
  ... 
)
Value:
do { \
SUBSCRIPTS(subs, __VA_ARGS__), &current->name)); \
} while (0)

Definition at line 362 of file cbs_vp9.c.

◆ delta_q [1/2]

#define delta_q (   name)
Value:
do { \
uint8_t delta_coded; \
int8_t delta_q; \
xf(1, name.delta_coded, delta_coded, 0, ); \
if (delta_coded) \
xs(4, name.delta_q, delta_q, 0, ); \
else \
delta_q = 0; \
current->name = delta_q; \
} while (0)

Definition at line 367 of file cbs_vp9.c.

◆ prob [1/2]

#define prob (   name,
  subs,
  ... 
)
Value:
do { \
uint8_t prob_coded; \
uint8_t prob; \
xf(1, name.prob_coded, prob_coded, subs, __VA_ARGS__); \
if (prob_coded) \
xf(8, name.prob, prob, subs, __VA_ARGS__); \
else \
prob = 255; \
current->name = prob; \
} while (0)

Definition at line 373 of file cbs_vp9.c.

◆ fixed [1/2]

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

Definition at line 379 of file cbs_vp9.c.

◆ infer [1/2]

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

Definition at line 384 of file cbs_vp9.c.

◆ byte_alignment [1/2]

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

Definition at line 393 of file cbs_vp9.c.

◆ WRITE

#define WRITE

Definition at line 344 of file cbs_vp9.c.

◆ READWRITE [2/2]

#define READWRITE   write

Definition at line 345 of file cbs_vp9.c.

◆ RWContext [2/2]

#define RWContext   PutBitContext

Definition at line 346 of file cbs_vp9.c.

◆ xf [2/2]

#define xf (   width,
  name,
  var,
  subs,
  ... 
)
Value:
do { \
SUBSCRIPTS(subs, __VA_ARGS__), \
var, 0, (1 << width) - 1)); \
} while (0)

Definition at line 348 of file cbs_vp9.c.

◆ xs [2/2]

#define xs (   width,
  name,
  var,
  subs,
  ... 
)
Value:
do { \
SUBSCRIPTS(subs, __VA_ARGS__), var)); \
} while (0)

Definition at line 353 of file cbs_vp9.c.

◆ increment [2/2]

#define increment (   name,
  min,
  max 
)
Value:
do { \
CHECK(cbs_vp9_write_increment(ctx, rw, min, max, #name, current->name)); \
} while (0)

Definition at line 358 of file cbs_vp9.c.

◆ fle [2/2]

#define fle (   width,
  name,
  subs,
  ... 
)
Value:
do { \
SUBSCRIPTS(subs, __VA_ARGS__), current->name)); \
} while (0)

Definition at line 362 of file cbs_vp9.c.

◆ delta_q [2/2]

#define delta_q (   name)
Value:
do { \
xf(1, name.delta_coded, !!current->name, 0, ); \
if (current->name) \
xs(4, name.delta_q, current->name, 0, ); \
} while (0)

Definition at line 367 of file cbs_vp9.c.

◆ prob [2/2]

#define prob (   name,
  subs,
  ... 
)
Value:
do { \
xf(1, name.prob_coded, current->name != 255, subs, __VA_ARGS__); \
if (current->name != 255) \
xf(8, name.prob, current->name, subs, __VA_ARGS__); \
} while (0)

Definition at line 373 of file cbs_vp9.c.

◆ fixed [2/2]

#define fixed (   width,
  name,
  value 
)
Value:
do { \
0, value, value, value)); \
} while (0)

Definition at line 379 of file cbs_vp9.c.

◆ infer [2/2]

#define infer (   name,
  value 
)
Value:
do { \
if (current->name != (value)) { \
av_log(ctx->log_ctx, AV_LOG_WARNING, "Warning: " \
"%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 384 of file cbs_vp9.c.

◆ byte_alignment [2/2]

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

Definition at line 393 of file cbs_vp9.c.

Function Documentation

◆ cbs_vp9_read_s()

static int cbs_vp9_read_s ( CodedBitstreamContext ctx,
GetBitContext gbc,
int  width,
const char *  name,
const int subscripts,
int32_t write_to 
)
static

Definition at line 27 of file cbs_vp9.c.

◆ cbs_vp9_write_s()

static int cbs_vp9_write_s ( CodedBitstreamContext ctx,
PutBitContext pbc,
int  width,
const char *  name,
const int subscripts,
int32_t  value 
)
static

Definition at line 64 of file cbs_vp9.c.

◆ cbs_vp9_read_increment()

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

Definition at line 95 of file cbs_vp9.c.

◆ cbs_vp9_write_increment()

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

Definition at line 131 of file cbs_vp9.c.

◆ cbs_vp9_read_le()

static int cbs_vp9_read_le ( CodedBitstreamContext ctx,
GetBitContext gbc,
int  width,
const char *  name,
const int subscripts,
uint32_t *  write_to 
)
static

Definition at line 172 of file cbs_vp9.c.

◆ cbs_vp9_write_le()

static int cbs_vp9_write_le ( CodedBitstreamContext ctx,
PutBitContext pbc,
int  width,
const char *  name,
const int subscripts,
uint32_t  value 
)
static

Definition at line 210 of file cbs_vp9.c.

◆ cbs_vp9_split_fragment()

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

Definition at line 411 of file cbs_vp9.c.

◆ cbs_vp9_free_frame()

static void cbs_vp9_free_frame ( void opaque,
uint8_t content 
)
static

Definition at line 482 of file cbs_vp9.c.

Referenced by cbs_vp9_read_unit().

◆ cbs_vp9_read_unit()

static int cbs_vp9_read_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit 
)
static

Definition at line 489 of file cbs_vp9.c.

◆ cbs_vp9_write_unit()

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

Definition at line 529 of file cbs_vp9.c.

◆ cbs_vp9_assemble_fragment()

static int cbs_vp9_assemble_fragment ( CodedBitstreamContext ctx,
CodedBitstreamFragment frag 
)
static

Definition at line 555 of file cbs_vp9.c.

Variable Documentation

◆ ff_cbs_type_vp9

const CodedBitstreamType ff_cbs_type_vp9
Initial value:
= {
.codec_id = AV_CODEC_ID_VP9,
.priv_data_size = sizeof(CodedBitstreamVP9Context),
.split_fragment = &cbs_vp9_split_fragment,
.read_unit = &cbs_vp9_read_unit,
.write_unit = &cbs_vp9_write_unit,
.assemble_fragment = &cbs_vp9_assemble_fragment,
}

Definition at line 645 of file cbs_vp9.c.

AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
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
SUBSCRIPTS
#define SUBSCRIPTS(subs,...)
Definition: cbs_vp9.c:253
rw
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo ug rw
Definition: fate.txt:150
cbs_vp9_write_increment
static int cbs_vp9_write_increment(CodedBitstreamContext *ctx, PutBitContext *pbc, uint32_t range_min, uint32_t range_max, const char *name, uint32_t value)
Definition: cbs_vp9.c:131
cbs_vp9_split_fragment
static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
Definition: cbs_vp9.c:411
max
#define max(a, b)
Definition: cuda_runtime.h:33
cbs_vp9_write_le
static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, uint32_t value)
Definition: cbs_vp9.c:210
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:528
cbs_vp9_assemble_fragment
static int cbs_vp9_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Definition: cbs_vp9.c:555
cbs_vp9_read_s
static int cbs_vp9_read_s(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, int32_t *write_to)
Definition: cbs_vp9.c:27
width
#define width
AV_CODEC_ID_VP9
@ AV_CODEC_ID_VP9
Definition: codec_id.h:217
ctx
AVFormatContext * ctx
Definition: movenc.c:48
cbs_vp9_read_unit
static int cbs_vp9_read_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Definition: cbs_vp9.c:489
cbs_vp9_write_unit
static int cbs_vp9_write_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
Definition: cbs_vp9.c:529
cbs_vp9_read_increment
static int cbs_vp9_read_increment(CodedBitstreamContext *ctx, GetBitContext *gbc, uint32_t range_min, uint32_t range_max, const char *name, uint32_t *write_to)
Definition: cbs_vp9.c:95
CodedBitstreamVP9Context
Definition: cbs_vp9.h:192
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
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:485
cbs_vp9_read_le
static int cbs_vp9_read_le(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, uint32_t *write_to)
Definition: cbs_vp9.c:172
prob
#define prob(name, subs,...)
Definition: cbs_vp9.c:373
delta_q
#define delta_q(name)
Definition: cbs_vp9.c:367
cbs_vp9_write_s
static int cbs_vp9_write_s(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, int32_t value)
Definition: cbs_vp9.c:64
min
float min
Definition: vorbis_enc_data.h:456