FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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

#define SPLAT_CTX (   var,
  val,
  n 
)
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; \
} \
}
const char const char void * val
Definition: avisynth_c.h:771
#define AV_WN32A(p, v)
Definition: intreadwrite.h:538
uint8_t
int n
Definition: avisynth_c.h:684
#define AV_WN16A(p, v)
Definition: intreadwrite.h:534

Referenced by decode_coeffs().

#define SET_CTXS (   perf,
  dir,
  off,
  n 
)
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)
const char * b
Definition: vf_curves.c:116
#define s(width, name)
Definition: cbs_vp9.c:257
int n
Definition: avisynth_c.h:684
#define SPLAT_CTX(var, val, n)
if(ret< 0)
Definition: vf_mcdeint.c:279

Referenced by decode_mode().

#define STORE_COEF (   c,
  i,
 
)
Value:
do { \
if (is8bitsperpixel) { \
c[i] = v; \
} else { \
AV_WN32A(&c[i * 2], v); \
} \
} while (0)
#define AV_WN32A(p, v)
Definition: intreadwrite.h:538
if(ret< 0)
Definition: vf_mcdeint.c:279
static double c[64]

Referenced by decode_coeffs_b_generic().

#define MERGE (   la,
  end,
  step,
  rd 
)
Value:
for (n = 0; n < end; n += step) \
la[n] = !!rd(&la[n])
static av_cold int end(AVCodecContext *avctx)
Definition: avrndec.c:90
int n
Definition: avisynth_c.h:684
#define MERGE_CTX (   step,
  rd 
)
Value:
do { \
MERGE(l, end_y, step, rd); \
MERGE(a, end_x, step, rd); \
} while (0)
#define MERGE(la, end, step, rd)

Referenced by decode_coeffs().

#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; \
} \
} \
}
const char * b
Definition: vf_curves.c:116
TxfmType
Definition: vp9.h:37
#define td
Definition: regdef.h:70
int n
Definition: avisynth_c.h:684
#define AV_WN16A(p, v)
Definition: intreadwrite.h:534
enum TxfmType ff_vp9_intra_txfm_type[14]
Definition: vp9data.c:437
if(ret< 0)
Definition: vf_mcdeint.c:279
static double c[64]
for(j=16;j >0;--j)

Referenced by decode_coeffs().

#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)); \
} \
}
#define AV_WN32A(p, v)
Definition: intreadwrite.h:538
int(* cond)(enum AVPixelFormat pix_fmt)
Definition: pixdesc_query.c:28
static av_cold int end(AVCodecContext *avctx)
Definition: avrndec.c:90
#define FFMIN(a, b)
Definition: common.h:96
int n
Definition: avisynth_c.h:684
#define AV_WN64A(p, v)
Definition: intreadwrite.h:542
if(ret< 0)
Definition: vf_mcdeint.c:279
for(j=16;j >0;--j)
#define SPLAT_CTX (   step)
Value:
do { \
SPLAT(a, end_x, step, end_x == w4); \
SPLAT(l, end_y, step, end_y == h4); \
} while (0)
#define SPLAT(la, end, step, cond)
#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; \
} \
} \
}
#define td
Definition: regdef.h:70
int n
Definition: avisynth_c.h:684
#define AV_WN16A(p, v)
Definition: intreadwrite.h:534
if(ret< 0)
Definition: vf_mcdeint.c:279
static double c[64]
for(j=16;j >0;--j)

Referenced by decode_coeffs().

#define SPLAT_ZERO_CTX (   v,
  n 
)
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; \
}
int n
Definition: avisynth_c.h:684
#define AV_ZERO128(d)
Definition: intreadwrite.h:622
#define AV_ZERO64(d)
Definition: intreadwrite.h:618
#define AV_ZERO16(d)
Definition: intreadwrite.h:610
#define AV_ZERO32(d)
Definition: intreadwrite.h:614
#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)
#define SPLAT_ZERO_CTX(v, n)
#define s(width, name)
Definition: cbs_vp9.c:257
int n
Definition: avisynth_c.h:684
if(ret< 0)
Definition: vf_mcdeint.c:279

Referenced by ff_vp9_decode_block().

Function Documentation

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().

static void decode_mode ( VP9TileData td)
static

Definition at line 80 of file vp9block.c.

Referenced by ff_vp9_decode_block().

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
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.

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.

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.

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.

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().

static int decode_coeffs_8bpp ( VP9TileData td)
static

Definition at line 1131 of file vp9block.c.

Referenced by ff_vp9_decode_block().

static int decode_coeffs_16bpp ( VP9TileData td)
static

Definition at line 1136 of file vp9block.c.

Referenced by ff_vp9_decode_block().

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().

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().