FFmpeg  4.3
Macros | Functions
vp9block.c File Reference
#include "libavutil/avassert.h"
#include "avcodec.h"
#include "internal.h"
#include "videodsp.h"
#include "vp56.h"
#include "vp9.h"
#include "vp9data.h"
#include "vp9dec.h"

Go to the source code of this file.

Macros

#define SPLAT_CTX(var, val, n)
 
#define SET_CTXS(perf, dir, off, n)
 
#define STORE_COEF(c, i, v)
 
#define MERGE(la, end, step, rd)
 
#define MERGE_CTX(step, rd)
 
#define DECODE_Y_COEF_LOOP(step, mode_index, v)
 
#define SPLAT(la, end, step, cond)
 
#define SPLAT_CTX(step)
 
#define DECODE_UV_COEF_LOOP(step, v)
 
#define SPLAT_ZERO_CTX(v, n)
 
#define SPLAT_ZERO_YUV(dir, var, off, n, dir2)
 

Functions

static av_always_inline void setctx_2d (uint8_t *ptr, int w, int h, ptrdiff_t stride, int v)
 
static void decode_mode (VP9TileData *td)
 
static av_always_inline int decode_coeffs_b_generic (VP56RangeCoder *c, int16_t *coef, int n_coeffs, int is_tx32x32, int is8bitsperpixel, int bpp, unsigned(*cnt)[6][3], unsigned(*eob)[6][2], uint8_t(*p)[6][11], int nnz, const int16_t *scan, const int16_t(*nb)[2], const int16_t *band_counts, int16_t *qmul)
 
static int decode_coeffs_b_8bpp (VP9TileData *td, int16_t *coef, int n_coeffs, unsigned(*cnt)[6][3], unsigned(*eob)[6][2], uint8_t(*p)[6][11], int nnz, const int16_t *scan, const int16_t(*nb)[2], const int16_t *band_counts, int16_t *qmul)
 
static int decode_coeffs_b32_8bpp (VP9TileData *td, int16_t *coef, int n_coeffs, unsigned(*cnt)[6][3], unsigned(*eob)[6][2], uint8_t(*p)[6][11], int nnz, const int16_t *scan, const int16_t(*nb)[2], const int16_t *band_counts, int16_t *qmul)
 
static int decode_coeffs_b_16bpp (VP9TileData *td, int16_t *coef, int n_coeffs, unsigned(*cnt)[6][3], unsigned(*eob)[6][2], uint8_t(*p)[6][11], int nnz, const int16_t *scan, const int16_t(*nb)[2], const int16_t *band_counts, int16_t *qmul)
 
static int decode_coeffs_b32_16bpp (VP9TileData *td, int16_t *coef, int n_coeffs, unsigned(*cnt)[6][3], unsigned(*eob)[6][2], uint8_t(*p)[6][11], int nnz, const int16_t *scan, const int16_t(*nb)[2], const int16_t *band_counts, int16_t *qmul)
 
static av_always_inline int decode_coeffs (VP9TileData *td, int is8bitsperpixel)
 
static int decode_coeffs_8bpp (VP9TileData *td)
 
static int decode_coeffs_16bpp (VP9TileData *td)
 
static av_always_inline void mask_edges (uint8_t(*mask)[8][4], int ss_h, int ss_v, int row_and_7, int col_and_7, int w, int h, int col_end, int row_end, enum TxfmMode tx, int skip_inter)
 
void ff_vp9_decode_block (VP9TileData *td, int row, int col, VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff, enum BlockLevel bl, enum BlockPartition bp)
 

Macro Definition Documentation

◆ SPLAT_CTX [1/2]

#define SPLAT_CTX (   var,
  val,
 
)
Value:
switch (n) { \
case 1: var = val; break; \
case 2: AV_WN16A(&var, val * 0x0101); break; \
case 4: AV_WN32A(&var, val * 0x01010101); break; \
case 8: { \
uint32_t v32 = val * 0x01010101; \
AV_WN32A( &var, v32); \
AV_WN32A(&((uint8_t *) &var)[4], v32); \
break; \
} \
case 16: { \
uint32_t v32 = val * 0x01010101; \
AV_WN32A( &var, v32); \
AV_WN32A(&((uint8_t *) &var)[4], v32); \
AV_WN32A(&((uint8_t *) &var)[8], v32); \
AV_WN32A(&((uint8_t *) &var)[12], v32); \
break; \
} \
}

◆ SET_CTXS

#define SET_CTXS (   perf,
  dir,
  off,
 
)
Value:
do { \
SPLAT_CTX(perf->dir##_skip_ctx[off], b->skip, n); \
SPLAT_CTX(perf->dir##_txfm_ctx[off], b->tx, n); \
SPLAT_CTX(perf->dir##_partition_ctx[off], dir##_ctx[b->bs], n); \
if (!s->s.h.keyframe && !s->s.h.intraonly) { \
SPLAT_CTX(perf->dir##_intra_ctx[off], b->intra, n); \
SPLAT_CTX(perf->dir##_comp_ctx[off], b->comp, n); \
SPLAT_CTX(perf->dir##_mode_ctx[off], b->mode[3], n); \
if (!b->intra) { \
SPLAT_CTX(perf->dir##_ref_ctx[off], vref, n); \
if (s->s.h.filtermode == FILTER_SWITCHABLE) { \
SPLAT_CTX(perf->dir##_filter_ctx[off], filter_id, n); \
} \
} \
} \
} while (0)

◆ STORE_COEF

#define STORE_COEF (   c,
  i,
 
)
Value:
do { \
if (is8bitsperpixel) { \
c[i] = v; \
} else { \
AV_WN32A(&c[i * 2], v); \
} \
} while (0)

◆ MERGE

#define MERGE (   la,
  end,
  step,
  rd 
)
Value:
for (n = 0; n < end; n += step) \
la[n] = !!rd(&la[n])

◆ MERGE_CTX

#define MERGE_CTX (   step,
  rd 
)
Value:
do { \
MERGE(l, end_y, step, rd); \
MERGE(a, end_x, step, rd); \
} while (0)

◆ DECODE_Y_COEF_LOOP

#define DECODE_Y_COEF_LOOP (   step,
  mode_index,
 
)
Value:
for (n = 0, y = 0; y < end_y; y += step) { \
for (x = 0; x < end_x; x += step, n += step * step) { \
enum TxfmType txtp = ff_vp9_intra_txfm_type[b->mode[mode_index]]; \
ret = (is8bitsperpixel ? decode_coeffs_b##v##_8bpp : decode_coeffs_b##v##_16bpp) \
(td, td->block + 16 * n * bytesperpixel, 16 * step * step, \
c, e, p, a[x] + l[y], yscans[txtp], \
ynbs[txtp], y_band_counts, qmul[0]); \
a[x] = l[y] = !!ret; \
total_coeff |= !!ret; \
if (step >= 4) { \
AV_WN16A(&td->eob[n], ret); \
} else { \
td->eob[n] = ret; \
} \
} \
}

◆ SPLAT

#define SPLAT (   la,
  end,
  step,
  cond 
)
Value:
if (step == 2) { \
for (n = 1; n < end; n += step) \
la[n] = la[n - 1]; \
} else if (step == 4) { \
if (cond) { \
for (n = 0; n < end; n += step) \
AV_WN32A(&la[n], la[n] * 0x01010101); \
} else { \
for (n = 0; n < end; n += step) \
memset(&la[n + 1], la[n], FFMIN(end - n - 1, 3)); \
} \
} else /* step == 8 */ { \
if (cond) { \
if (HAVE_FAST_64BIT) { \
for (n = 0; n < end; n += step) \
AV_WN64A(&la[n], la[n] * 0x0101010101010101ULL); \
} else { \
for (n = 0; n < end; n += step) { \
uint32_t v32 = la[n] * 0x01010101; \
AV_WN32A(&la[n], v32); \
AV_WN32A(&la[n + 4], v32); \
} \
} \
} else { \
for (n = 0; n < end; n += step) \
memset(&la[n + 1], la[n], FFMIN(end - n - 1, 7)); \
} \
}

◆ SPLAT_CTX [2/2]

#define SPLAT_CTX (   step)
Value:
do { \
SPLAT(a, end_x, step, end_x == w4); \
SPLAT(l, end_y, step, end_y == h4); \
} while (0)

◆ DECODE_UV_COEF_LOOP

#define DECODE_UV_COEF_LOOP (   step,
 
)
Value:
for (n = 0, y = 0; y < end_y; y += step) { \
for (x = 0; x < end_x; x += step, n += step * step) { \
ret = (is8bitsperpixel ? decode_coeffs_b##v##_8bpp : decode_coeffs_b##v##_16bpp) \
(td, td->uvblock[pl] + 16 * n * bytesperpixel, \
16 * step * step, c, e, p, a[x] + l[y], \
uvscan, uvnb, uv_band_counts, qmul[1]); \
a[x] = l[y] = !!ret; \
total_coeff |= !!ret; \
if (step >= 4) { \
AV_WN16A(&td->uveob[pl][n], ret); \
} else { \
td->uveob[pl][n] = ret; \
} \
} \
}

◆ SPLAT_ZERO_CTX

#define SPLAT_ZERO_CTX (   v,
 
)
Value:
switch (n) { \
case 1: v = 0; break; \
case 2: AV_ZERO16(&v); break; \
case 4: AV_ZERO32(&v); break; \
case 8: AV_ZERO64(&v); break; \
case 16: AV_ZERO128(&v); break; \
}

◆ SPLAT_ZERO_YUV

#define SPLAT_ZERO_YUV (   dir,
  var,
  off,
  n,
  dir2 
)
Value:
do { \
SPLAT_ZERO_CTX(dir##_y_##var[off * 2], n * 2); \
if (s->ss_##dir2) { \
SPLAT_ZERO_CTX(dir##_uv_##var[0][off], n); \
SPLAT_ZERO_CTX(dir##_uv_##var[1][off], n); \
} else { \
SPLAT_ZERO_CTX(dir##_uv_##var[0][off * 2], n * 2); \
SPLAT_ZERO_CTX(dir##_uv_##var[1][off * 2], n * 2); \
} \
} while (0)

Function Documentation

◆ setctx_2d()

static av_always_inline void setctx_2d ( uint8_t ptr,
int  w,
int  h,
ptrdiff_t  stride,
int  v 
)
static

Definition at line 34 of file vp9block.c.

Referenced by decode_mode(), and ff_vp9_decode_block().

◆ decode_mode()

static void decode_mode ( VP9TileData td)
static

Definition at line 80 of file vp9block.c.

Referenced by ff_vp9_decode_block().

◆ decode_coeffs_b_generic()

static av_always_inline int decode_coeffs_b_generic ( VP56RangeCoder c,
int16_t *  coef,
int  n_coeffs,
int  is_tx32x32,
int  is8bitsperpixel,
int  bpp,
unsigned(*)  cnt[6][3],
unsigned(*)  eob[6][2],
uint8_t(*)  p[6][11],
int  nnz,
const int16_t *  scan,
const int16_t(*)  nb[2],
const int16_t *  band_counts,
int16_t *  qmul 
)
static

◆ decode_coeffs_b_8bpp()

static int decode_coeffs_b_8bpp ( VP9TileData td,
int16_t *  coef,
int  n_coeffs,
unsigned(*)  cnt[6][3],
unsigned(*)  eob[6][2],
uint8_t(*)  p[6][11],
int  nnz,
const int16_t *  scan,
const int16_t(*)  nb[2],
const int16_t *  band_counts,
int16_t *  qmul 
)
static

Definition at line 924 of file vp9block.c.

◆ decode_coeffs_b32_8bpp()

static int decode_coeffs_b32_8bpp ( VP9TileData td,
int16_t *  coef,
int  n_coeffs,
unsigned(*)  cnt[6][3],
unsigned(*)  eob[6][2],
uint8_t(*)  p[6][11],
int  nnz,
const int16_t *  scan,
const int16_t(*)  nb[2],
const int16_t *  band_counts,
int16_t *  qmul 
)
static

Definition at line 934 of file vp9block.c.

◆ decode_coeffs_b_16bpp()

static int decode_coeffs_b_16bpp ( VP9TileData td,
int16_t *  coef,
int  n_coeffs,
unsigned(*)  cnt[6][3],
unsigned(*)  eob[6][2],
uint8_t(*)  p[6][11],
int  nnz,
const int16_t *  scan,
const int16_t(*)  nb[2],
const int16_t *  band_counts,
int16_t *  qmul 
)
static

Definition at line 944 of file vp9block.c.

◆ decode_coeffs_b32_16bpp()

static int decode_coeffs_b32_16bpp ( VP9TileData td,
int16_t *  coef,
int  n_coeffs,
unsigned(*)  cnt[6][3],
unsigned(*)  eob[6][2],
uint8_t(*)  p[6][11],
int  nnz,
const int16_t *  scan,
const int16_t(*)  nb[2],
const int16_t *  band_counts,
int16_t *  qmul 
)
static

Definition at line 954 of file vp9block.c.

◆ decode_coeffs()

static av_always_inline int decode_coeffs ( VP9TileData td,
int  is8bitsperpixel 
)
static

Definition at line 964 of file vp9block.c.

Referenced by decode_coeffs_16bpp(), and decode_coeffs_8bpp().

◆ decode_coeffs_8bpp()

static int decode_coeffs_8bpp ( VP9TileData td)
static

Definition at line 1131 of file vp9block.c.

Referenced by ff_vp9_decode_block().

◆ decode_coeffs_16bpp()

static int decode_coeffs_16bpp ( VP9TileData td)
static

Definition at line 1136 of file vp9block.c.

Referenced by ff_vp9_decode_block().

◆ mask_edges()

static av_always_inline void mask_edges ( uint8_t(*)  mask[8][4],
int  ss_h,
int  ss_v,
int  row_and_7,
int  col_and_7,
int  w,
int  h,
int  col_end,
int  row_end,
enum TxfmMode  tx,
int  skip_inter 
)
static

Definition at line 1141 of file vp9block.c.

Referenced by ff_vp9_decode_block().

◆ ff_vp9_decode_block()

void ff_vp9_decode_block ( VP9TileData td,
int  row,
int  col,
VP9Filter lflvl,
ptrdiff_t  yoff,
ptrdiff_t  uvoff,
enum BlockLevel  bl,
enum BlockPartition  bp 
)

Definition at line 1263 of file vp9block.c.

Referenced by decode_sb(), and decode_sb_mem().

td
#define td
Definition: regdef.h:70
end
static av_cold int end(AVCodecContext *avctx)
Definition: avrndec.c:90
step
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step
Definition: rate_distortion.txt:58
b
#define b
Definition: input.c:41
AV_WN32A
#define AV_WN32A(p, v)
Definition: intreadwrite.h:538
FILTER_SWITCHABLE
@ FILTER_SWITCHABLE
Definition: vp9.h:70
x
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 x
Definition: fate.txt:150
val
static double val(void *priv, double ch)
Definition: aeval.c:76
s
#define s(width, name)
Definition: cbs_vp9.c:257
AV_ZERO64
#define AV_ZERO64(d)
Definition: intreadwrite.h:633
AV_ZERO32
#define AV_ZERO32(d)
Definition: intreadwrite.h:629
AV_WN16A
#define AV_WN16A(p, v)
Definition: intreadwrite.h:534
AV_ZERO128
#define AV_ZERO128(d)
Definition: intreadwrite.h:637
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
TxfmType
TxfmType
Definition: vp9.h:37
FFMIN
#define FFMIN(a, b)
Definition: common.h:96
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
ff_vp9_intra_txfm_type
enum TxfmType ff_vp9_intra_txfm_type[14]
Definition: vp9data.c:437
uint8_t
uint8_t
Definition: audio_convert.c:194
ret
ret
Definition: filter_design.txt:187
AV_WN64A
#define AV_WN64A(p, v)
Definition: intreadwrite.h:542
HAVE_FAST_64BIT
#define HAVE_FAST_64BIT
Definition: config.h:180
AV_ZERO16
#define AV_ZERO16(d)
Definition: intreadwrite.h:625
cond
int(* cond)(enum AVPixelFormat pix_fmt)
Definition: pixdesc_query.c:28