FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
vp9.c File Reference
#include "avcodec.h"
#include "get_bits.h"
#include "internal.h"
#include "thread.h"
#include "videodsp.h"
#include "vp56.h"
#include "vp9.h"
#include "vp9data.h"
#include "vp9dsp.h"
#include "libavutil/avassert.h"
#include "libavutil/pixdesc.h"
#include "vp9_mc_template.c"

Go to the source code of this file.

Data Structures

struct  VP9mvrefPair
 
struct  VP9Frame
 
struct  VP9Filter
 
struct  VP9Block
 
struct  VP9Context
 

Macros

#define VP9_SYNCCODE   0x498342
 
#define CUR_FRAME   0
 
#define REF_FRAME_MVPAIR   1
 
#define REF_FRAME_SEGMAP   2
 
#define MAX_SEGMENT   8
 
#define assign(var, type, n)   var = (type) p; p += s->sb_cols * (n) * sizeof(*var)
 
#define INVALID_MV   0x80008000U
 
#define RETURN_DIRECT_MV(mv)
 
#define RETURN_MV(mv)
 
#define RETURN_SCALE_MV(mv, scale)
 
#define SPLAT_CTX(var, val, n)
 
#define SET_CTXS(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 memset_bpp(c, i1, v, i2, num)
 
#define memset_val(c, val, num)
 
#define assign_bpp(c, i1, v, i2)
 
#define assign_val(c, i, v)
 
#define scale_mv(n, dim)   (((int64_t)(n) * scale[dim]) >> 14)
 
#define mc_luma_dir(s, mc, dst, dst_ls, src, src_ls, tref, row, col, mv, px, py, pw, ph, bw, bh, w, h, i)
 
#define mc_chroma_dir(s, mc, dstu, dstv, dst_ls, srcu, srcu_ls, srcv, srcv_ls, tref, row, col, mv, px, py, pw, ph, bw, bh, w, h, i)
 
#define SCALED   1
 
#define FN(x)   x##_scaled_8bpp
 
#define BYTES_PER_PIXEL   1
 
#define FN(x)   x##_scaled_16bpp
 
#define BYTES_PER_PIXEL   2
 
#define mc_luma_dir(s, mc, dst, dst_ls, src, src_ls, tref, row, col, mv, px, py, pw, ph, bw, bh, w, h, i)
 
#define mc_chroma_dir(s, mc, dstu, dstv, dst_ls, srcu, srcu_ls, srcv, srcv_ls, tref, row, col, mv, px, py, pw, ph, bw, bh, w, h, i)
 
#define SCALED   0
 
#define FN(x)   x##_8bpp
 
#define BYTES_PER_PIXEL   1
 
#define FN(x)   x##_16bpp
 
#define BYTES_PER_PIXEL   2
 
#define SPLAT_ZERO_CTX(v, n)
 
#define SPLAT_ZERO_YUV(dir, var, off, n, dir2)
 

Enumerations

enum  CompPredMode { PRED_SINGLEREF, PRED_COMPREF, PRED_SWITCHABLE }
 
enum  BlockLevel { BL_64X64, BL_32X32, BL_16X16, BL_8X8 }
 
enum  BlockSize {
  BS_64x64, BS_64x32, BS_32x64, BS_32x32,
  BS_32x16, BS_16x32, BS_16x16, BS_16x8,
  BS_8x16, BS_8x8, BS_8x4, BS_4x8,
  BS_4x4, N_BS_SIZES
}
 

Functions

static int vp9_alloc_frame (AVCodecContext *ctx, VP9Frame *f)
 
static void vp9_unref_frame (AVCodecContext *ctx, VP9Frame *f)
 
static int vp9_ref_frame (AVCodecContext *ctx, VP9Frame *dst, VP9Frame *src)
 
static int update_size (AVCodecContext *ctx, int w, int h, enum AVPixelFormat fmt)
 
static int update_block_buffers (AVCodecContext *ctx)
 
static av_always_inline int get_sbits_inv (GetBitContext *gb, int n)
 
static av_always_inline int inv_recenter_nonneg (int v, int m)
 
static int update_prob (VP56RangeCoder *c, int p)
 
static enum AVPixelFormat read_colorspace_details (AVCodecContext *ctx)
 
static int decode_frame_header (AVCodecContext *ctx, const uint8_t *data, int size, int *ref)
 
static av_always_inline void clamp_mv (VP56mv *dst, const VP56mv *src, VP9Context *s)
 
static void find_ref_mvs (VP9Context *s, VP56mv *pmv, int ref, int z, int idx, int sb)
 
static av_always_inline int read_mv_component (VP9Context *s, int idx, int hp)
 
static void fill_mv (VP9Context *s, VP56mv *mv, int mode, int sb)
 
static av_always_inline void setctx_2d (uint8_t *ptr, int w, int h, ptrdiff_t stride, int v)
 
static void decode_mode (AVCodecContext *ctx)
 
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, const int16_t *qmul)
 
static int decode_coeffs_b_8bpp (VP9Context *s, 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, const int16_t *qmul)
 
static int decode_coeffs_b32_8bpp (VP9Context *s, 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, const int16_t *qmul)
 
static int decode_coeffs_b_16bpp (VP9Context *s, 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, const int16_t *qmul)
 
static int decode_coeffs_b32_16bpp (VP9Context *s, 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, const int16_t *qmul)
 
static av_always_inline int decode_coeffs (AVCodecContext *ctx, int is8bitsperpixel)
 
static int decode_coeffs_8bpp (AVCodecContext *ctx)
 
static int decode_coeffs_16bpp (AVCodecContext *ctx)
 
static av_always_inline int check_intra_mode (VP9Context *s, int mode, uint8_t **a, uint8_t *dst_edge, ptrdiff_t stride_edge, uint8_t *dst_inner, ptrdiff_t stride_inner, uint8_t *l, int col, int x, int w, int row, int y, enum TxfmMode tx, int p, int ss_h, int ss_v, int bytesperpixel)
 
static av_always_inline void intra_recon (AVCodecContext *ctx, ptrdiff_t y_off, ptrdiff_t uv_off, int bytesperpixel)
 
static void intra_recon_8bpp (AVCodecContext *ctx, ptrdiff_t y_off, ptrdiff_t uv_off)
 
static void intra_recon_16bpp (AVCodecContext *ctx, ptrdiff_t y_off, ptrdiff_t uv_off)
 
static av_always_inline void mc_luma_scaled (VP9Context *s, vp9_scaled_mc_func smc, uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *ref, ptrdiff_t ref_stride, ThreadFrame *ref_frame, ptrdiff_t y, ptrdiff_t x, const VP56mv *in_mv, int px, int py, int pw, int ph, int bw, int bh, int w, int h, int bytesperpixel, const uint16_t *scale, const uint8_t *step)
 
static av_always_inline void mc_chroma_scaled (VP9Context *s, vp9_scaled_mc_func smc, uint8_t *dst_u, uint8_t *dst_v, ptrdiff_t dst_stride, const uint8_t *ref_u, ptrdiff_t src_stride_u, const uint8_t *ref_v, ptrdiff_t src_stride_v, ThreadFrame *ref_frame, ptrdiff_t y, ptrdiff_t x, const VP56mv *in_mv, int px, int py, int pw, int ph, int bw, int bh, int w, int h, int bytesperpixel, const uint16_t *scale, const uint8_t *step)
 
static av_always_inline void mc_luma_unscaled (VP9Context *s, vp9_mc_func(*mc)[2], uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *ref, ptrdiff_t ref_stride, ThreadFrame *ref_frame, ptrdiff_t y, ptrdiff_t x, const VP56mv *mv, int bw, int bh, int w, int h, int bytesperpixel)
 
static av_always_inline void mc_chroma_unscaled (VP9Context *s, vp9_mc_func(*mc)[2], uint8_t *dst_u, uint8_t *dst_v, ptrdiff_t dst_stride, const uint8_t *ref_u, ptrdiff_t src_stride_u, const uint8_t *ref_v, ptrdiff_t src_stride_v, ThreadFrame *ref_frame, ptrdiff_t y, ptrdiff_t x, const VP56mv *mv, int bw, int bh, int w, int h, int bytesperpixel)
 
static av_always_inline void inter_recon (AVCodecContext *ctx, int bytesperpixel)
 
static void inter_recon_8bpp (AVCodecContext *ctx)
 
static void inter_recon_16bpp (AVCodecContext *ctx)
 
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 void decode_b (AVCodecContext *ctx, int row, int col, struct VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff, enum BlockLevel bl, enum BlockPartition bp)
 
static void decode_sb (AVCodecContext *ctx, int row, int col, struct VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff, enum BlockLevel bl)
 
static void decode_sb_mem (AVCodecContext *ctx, int row, int col, struct VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff, enum BlockLevel bl)
 
static av_always_inline void filter_plane_cols (VP9Context *s, int col, int ss_h, int ss_v, uint8_t *lvl, uint8_t(*mask)[4], uint8_t *dst, ptrdiff_t ls)
 
static av_always_inline void filter_plane_rows (VP9Context *s, int row, int ss_h, int ss_v, uint8_t *lvl, uint8_t(*mask)[4], uint8_t *dst, ptrdiff_t ls)
 
static void loopfilter_sb (AVCodecContext *ctx, struct VP9Filter *lflvl, int row, int col, ptrdiff_t yoff, ptrdiff_t uvoff)
 
static void set_tile_offset (int *start, int *end, int idx, int log2_n, int n)
 
static av_always_inline void adapt_prob (uint8_t *p, unsigned ct0, unsigned ct1, int max_count, int update_factor)
 
static void adapt_probs (VP9Context *s)
 
static void free_buffers (VP9Context *s)
 
static av_cold int vp9_decode_free (AVCodecContext *ctx)
 
static int vp9_decode_frame (AVCodecContext *ctx, void *frame, int *got_frame, AVPacket *pkt)
 
static void vp9_decode_flush (AVCodecContext *ctx)
 
static int init_frames (AVCodecContext *ctx)
 
static av_cold int vp9_decode_init (AVCodecContext *ctx)
 
static av_cold int vp9_decode_init_thread_copy (AVCodecContext *avctx)
 
static int vp9_decode_update_thread_context (AVCodecContext *dst, const AVCodecContext *src)
 

Variables

static const uint8_t bwh_tab [2][N_BS_SIZES][2]
 
static const AVProfile profiles []
 
AVCodec ff_vp9_decoder
 

Macro Definition Documentation

#define VP9_SYNCCODE   0x498342

Definition at line 36 of file vp9.c.

Referenced by decode_frame_header().

#define CUR_FRAME   0
#define REF_FRAME_MVPAIR   1

Definition at line 132 of file vp9.c.

Referenced by find_ref_mvs(), and vp9_decode_frame().

#define REF_FRAME_SEGMAP   2

Definition at line 133 of file vp9.c.

Referenced by decode_mode(), and vp9_decode_frame().

#define MAX_SEGMENT   8

Definition at line 150 of file vp9.c.

#define assign (   var,
  type,
  n 
)    var = (type) p; p += s->sb_cols * (n) * sizeof(*var)

Referenced by update_size().

#define INVALID_MV   0x80008000U

Referenced by find_ref_mvs().

#define RETURN_DIRECT_MV (   mv)
Value:
do { \
uint32_t m = AV_RN32A(&mv); \
if (!idx) { \
AV_WN32A(pmv, m); \
} else if (mem == INVALID_MV) { \
mem = m; \
} else if (m != mem) { \
AV_WN32A(pmv, m); \
} \
} while (0)
#define INVALID_MV
#define AV_WN32A(p, v)
Definition: intreadwrite.h:538
#define AV_RN32A(p)
Definition: intreadwrite.h:526
if()
Definition: avfilter.c:975
int mem
Definition: avisynth_c.h:684
unsigned m
Definition: audioconvert.c:187
return
static const int8_t mv[256][2]
Definition: 4xm.c:77

Referenced by find_ref_mvs().

#define RETURN_MV (   mv)

Referenced by find_ref_mvs().

#define RETURN_SCALE_MV (   mv,
  scale 
)
Value:
do { \
if (scale) { \
VP56mv mv_temp = { -mv.x, -mv.y }; \
RETURN_MV(mv_temp); \
} else { \
} \
} while (0)
if()
Definition: avfilter.c:975
static const int8_t mv[256][2]
Definition: 4xm.c:77
#define RETURN_MV(mv)

Referenced by find_ref_mvs().

#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:634
#define AV_WN32A(p, v)
Definition: intreadwrite.h:538
uint8_t
int n
Definition: avisynth_c.h:547
#define AV_WN16A(p, v)
Definition: intreadwrite.h:534

Referenced by decode_coeffs().

#define SET_CTXS (   dir,
  off,
  n 
)
Value:
do { \
SPLAT_CTX(s->dir##_skip_ctx[off], b->skip, n); \
SPLAT_CTX(s->dir##_txfm_ctx[off], b->tx, n); \
SPLAT_CTX(s->dir##_partition_ctx[off], dir##_ctx[b->bs], n); \
if (!s->keyframe && !s->intraonly) { \
SPLAT_CTX(s->dir##_intra_ctx[off], b->intra, n); \
SPLAT_CTX(s->dir##_comp_ctx[off], b->comp, n); \
SPLAT_CTX(s->dir##_mode_ctx[off], b->mode[3], n); \
if (!b->intra) { \
SPLAT_CTX(s->dir##_ref_ctx[off], vref, n); \
if (s->filtermode == FILTER_SWITCHABLE) { \
SPLAT_CTX(s->dir##_filter_ctx[off], filter_id, n); \
} \
} \
} \
} while (0)
const char * s
Definition: avisynth_c.h:631
#define SPLAT_CTX(var, val, n)
const char * b
Definition: vf_curves.c:109
if()
Definition: avfilter.c:975
int n
Definition: avisynth_c.h:547

Referenced by decode_mode().

#define STORE_COEF (   c,
  i,
  v 
)
Value:
do { \
if (is8bitsperpixel) { \
c[i] = v; \
} else { \
AV_WN32A(&c[i * 2], v); \
} \
} while (0)
float v
#define AV_WN32A(p, v)
Definition: intreadwrite.h:538
if()
Definition: avfilter.c:975
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:67
int n
Definition: avisynth_c.h:547
#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,
  v 
)
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 = vp9_intra_txfm_type[b->mode[mode_index]]; \
res = (is8bitsperpixel ? decode_coeffs_b##v##_8bpp : decode_coeffs_b##v##_16bpp) \
(s, s->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] = !!res; \
total_coeff |= !!res; \
if (step >= 4) { \
AV_WN16A(&s->eob[n], res); \
} else { \
s->eob[n] = res; \
} \
} \
}
float v
const char * s
Definition: avisynth_c.h:631
const char * b
Definition: vf_curves.c:109
if()
Definition: avfilter.c:975
TxfmType
Definition: vp9.h:37
static enum TxfmType vp9_intra_txfm_type[14]
Definition: vp9data.h:445
float y
int n
Definition: avisynth_c.h:547
#define AV_WN16A(p, v)
Definition: intreadwrite.h:534
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
if()
Definition: avfilter.c:975
static av_cold int end(AVCodecContext *avctx)
Definition: avrndec.c:67
#define FFMIN(a, b)
Definition: common.h:66
int n
Definition: avisynth_c.h:547
#define AV_WN64A(p, v)
Definition: intreadwrite.h:542
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,
  v 
)
Value:
for (n = 0, y = 0; y < end_y; y += step) { \
for (x = 0; x < end_x; x += step, n += step * step) { \
res = (is8bitsperpixel ? decode_coeffs_b##v##_8bpp : decode_coeffs_b##v##_16bpp) \
(s, s->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] = !!res; \
total_coeff |= !!res; \
if (step >= 4) { \
AV_WN16A(&s->uveob[pl][n], res); \
} else { \
s->uveob[pl][n] = res; \
} \
} \
}
float v
const char * s
Definition: avisynth_c.h:631
if()
Definition: avfilter.c:975
float y
int n
Definition: avisynth_c.h:547
#define AV_WN16A(p, v)
Definition: intreadwrite.h:534
static double c[64]
for(j=16;j >0;--j)

Referenced by decode_coeffs().

#define memset_bpp (   c,
  i1,
  v,
  i2,
  num 
)
Value:
do { \
if (bytesperpixel == 1) { \
memset(&(c)[(i1)], (v)[(i2)], (num)); \
} else { \
int n, val = AV_RN16A(&(v)[(i2) * 2]); \
for (n = 0; n < (num); n++) { \
AV_WN16A(&(c)[((i1) + n) * 2], val); \
} \
} \
} while (0)
const char const char void * val
Definition: avisynth_c.h:634
float v
if()
Definition: avfilter.c:975
int n
Definition: avisynth_c.h:547
#define AV_WN16A(p, v)
Definition: intreadwrite.h:534
static double c[64]
#define AV_RN16A(p)
Definition: intreadwrite.h:522
for(j=16;j >0;--j)

Referenced by check_intra_mode().

#define memset_val (   c,
  val,
  num 
)
Value:
do { \
if (bytesperpixel == 1) { \
memset((c), (val), (num)); \
} else { \
int n; \
for (n = 0; n < (num); n++) { \
AV_WN16A(&(c)[n * 2], (val)); \
} \
} \
} while (0)
const char const char void * val
Definition: avisynth_c.h:634
if()
Definition: avfilter.c:975
int n
Definition: avisynth_c.h:547
#define AV_WN16A(p, v)
Definition: intreadwrite.h:534
static double c[64]
for(j=16;j >0;--j)

Referenced by check_intra_mode().

#define assign_bpp (   c,
  i1,
  v,
  i2 
)
Value:
do { \
if (bytesperpixel == 1) { \
(c)[(i1)] = (v)[(i2)]; \
} else { \
AV_COPY16(&(c)[(i1) * 2], &(v)[(i2) * 2]); \
} \
} while (0)
float v
if()
Definition: avfilter.c:975
#define AV_COPY16(d, s)
Definition: intreadwrite.h:582
static double c[64]

Referenced by check_intra_mode().

#define assign_val (   c,
  i,
  v 
)
Value:
do { \
if (bytesperpixel == 1) { \
(c)[(i)] = (v); \
} else { \
AV_WN16A(&(c)[(i) * 2], (v)); \
} \
} while (0)
float v
if()
Definition: avfilter.c:975
#define AV_WN16A(p, v)
Definition: intreadwrite.h:534
static double c[64]

Referenced by check_intra_mode().

#define scale_mv (   n,
  dim 
)    (((int64_t)(n) * scale[dim]) >> 14)
#define mc_luma_dir (   s,
  mc,
  dst,
  dst_ls,
  src,
  src_ls,
  tref,
  row,
  col,
  mv,
  px,
  py,
  pw,
  ph,
  bw,
  bh,
  w,
  h,
 
)
Value:
mc_luma_scaled(s, s->dsp.s##mc, dst, dst_ls, src, src_ls, tref, row, col, \
mv, px, py, pw, ph, bw, bh, w, h, bytesperpixel, \
s->mvscale[b->ref[i]], s->mvstep[b->ref[i]])
const char * s
Definition: avisynth_c.h:631
const char * b
Definition: vf_curves.c:109
#define mc
static const int8_t mv[256][2]
Definition: 4xm.c:77
AVS_Value src
Definition: avisynth_c.h:482
static av_always_inline void mc_luma_scaled(VP9Context *s, vp9_scaled_mc_func smc, uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *ref, ptrdiff_t ref_stride, ThreadFrame *ref_frame, ptrdiff_t y, ptrdiff_t x, const VP56mv *in_mv, int px, int py, int pw, int ph, int bw, int bh, int w, int h, int bytesperpixel, const uint16_t *scale, const uint8_t *step)
Definition: vp9.c:2760

Definition at line 2977 of file vp9.c.

Referenced by inter_pred().

#define mc_chroma_dir (   s,
  mc,
  dstu,
  dstv,
  dst_ls,
  srcu,
  srcu_ls,
  srcv,
  srcv_ls,
  tref,
  row,
  col,
  mv,
  px,
  py,
  pw,
  ph,
  bw,
  bh,
  w,
  h,
 
)
Value:
mc_chroma_scaled(s, s->dsp.s##mc, dstu, dstv, dst_ls, srcu, srcu_ls, srcv, srcv_ls, tref, \
row, col, mv, px, py, pw, ph, bw, bh, w, h, bytesperpixel, \
s->mvscale[b->ref[i]], s->mvstep[b->ref[i]])
const char * s
Definition: avisynth_c.h:631
const char * b
Definition: vf_curves.c:109
static av_always_inline void mc_chroma_scaled(VP9Context *s, vp9_scaled_mc_func smc, uint8_t *dst_u, uint8_t *dst_v, ptrdiff_t dst_stride, const uint8_t *ref_u, ptrdiff_t src_stride_u, const uint8_t *ref_v, ptrdiff_t src_stride_v, ThreadFrame *ref_frame, ptrdiff_t y, ptrdiff_t x, const VP56mv *in_mv, int px, int py, int pw, int ph, int bw, int bh, int w, int h, int bytesperpixel, const uint16_t *scale, const uint8_t *step)
Definition: vp9.c:2807
#define mc
static const int8_t mv[256][2]
Definition: 4xm.c:77

Definition at line 2981 of file vp9.c.

Referenced by inter_pred().

#define SCALED   1

Definition at line 2985 of file vp9.c.

#define FN (   x)    x##_scaled_8bpp

Definition at line 2991 of file vp9.c.

#define BYTES_PER_PIXEL   1

Definition at line 2992 of file vp9.c.

Referenced by inter_pred().

#define FN (   x)    x##_scaled_16bpp

Definition at line 2991 of file vp9.c.

#define BYTES_PER_PIXEL   2

Definition at line 2992 of file vp9.c.

#define mc_luma_dir (   s,
  mc,
  dst,
  dst_ls,
  src,
  src_ls,
  tref,
  row,
  col,
  mv,
  px,
  py,
  pw,
  ph,
  bw,
  bh,
  w,
  h,
 
)
Value:
mc_luma_unscaled(s, s->dsp.mc, dst, dst_ls, src, src_ls, tref, row, col, \
mv, bw, bh, w, h, bytesperpixel)
const char * s
Definition: avisynth_c.h:631
static av_always_inline void mc_luma_unscaled(VP9Context *s, vp9_mc_func(*mc)[2], uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *ref, ptrdiff_t ref_stride, ThreadFrame *ref_frame, ptrdiff_t y, ptrdiff_t x, const VP56mv *mv, int bw, int bh, int w, int h, int bytesperpixel)
Definition: vp9.c:2900
static const int8_t mv[256][2]
Definition: 4xm.c:77
AVS_Value src
Definition: avisynth_c.h:482

Definition at line 2977 of file vp9.c.

#define mc_chroma_dir (   s,
  mc,
  dstu,
  dstv,
  dst_ls,
  srcu,
  srcu_ls,
  srcv,
  srcv_ls,
  tref,
  row,
  col,
  mv,
  px,
  py,
  pw,
  ph,
  bw,
  bh,
  w,
  h,
 
)
Value:
mc_chroma_unscaled(s, s->dsp.mc, dstu, dstv, dst_ls, srcu, srcu_ls, srcv, srcv_ls, tref, \
row, col, mv, bw, bh, w, h, bytesperpixel)
const char * s
Definition: avisynth_c.h:631
static av_always_inline void mc_chroma_unscaled(VP9Context *s, vp9_mc_func(*mc)[2], uint8_t *dst_u, uint8_t *dst_v, ptrdiff_t dst_stride, const uint8_t *ref_u, ptrdiff_t src_stride_u, const uint8_t *ref_v, ptrdiff_t src_stride_v, ThreadFrame *ref_frame, ptrdiff_t y, ptrdiff_t x, const VP56mv *mv, int bw, int bh, int w, int h, int bytesperpixel)
Definition: vp9.c:2932
static const int8_t mv[256][2]
Definition: 4xm.c:77

Definition at line 2981 of file vp9.c.

#define SCALED   0

Definition at line 2985 of file vp9.c.

#define FN (   x)    x##_8bpp

Definition at line 2991 of file vp9.c.

#define BYTES_PER_PIXEL   1

Definition at line 2992 of file vp9.c.

#define FN (   x)    x##_16bpp

Definition at line 2991 of file vp9.c.

#define BYTES_PER_PIXEL   2

Definition at line 2992 of file vp9.c.

#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; \
}
float v
int n
Definition: avisynth_c.h:547
#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(s->dir##_y_##var[off * 2], n * 2); \
if (s->ss_##dir2) { \
SPLAT_ZERO_CTX(s->dir##_uv_##var[0][off], n); \
SPLAT_ZERO_CTX(s->dir##_uv_##var[1][off], n); \
} else { \
SPLAT_ZERO_CTX(s->dir##_uv_##var[0][off * 2], n * 2); \
SPLAT_ZERO_CTX(s->dir##_uv_##var[1][off * 2], n * 2); \
} \
} while (0)
const char * s
Definition: avisynth_c.h:631
if()
Definition: avfilter.c:975
int n
Definition: avisynth_c.h:547
#define SPLAT_ZERO_CTX(v, n)

Referenced by decode_b().

Enumeration Type Documentation

Enumerator
PRED_SINGLEREF 
PRED_COMPREF 
PRED_SWITCHABLE 

Definition at line 38 of file vp9.c.

enum BlockLevel
Enumerator
BL_64X64 
BL_32X32 
BL_16X16 
BL_8X8 

Definition at line 44 of file vp9.c.

enum BlockSize
Enumerator
BS_64x64 
BS_64x32 
BS_32x64 
BS_32x32 
BS_32x16 
BS_16x32 
BS_16x16 
BS_16x8 
BS_8x16 
BS_8x8 
BS_8x4 
BS_4x8 
BS_4x4 
N_BS_SIZES 

Definition at line 51 of file vp9.c.

Function Documentation

static int vp9_alloc_frame ( AVCodecContext ctx,
VP9Frame f 
)
static

Definition at line 269 of file vp9.c.

Referenced by vp9_decode_frame().

static void vp9_unref_frame ( AVCodecContext ctx,
VP9Frame f 
)
static
static int vp9_ref_frame ( AVCodecContext ctx,
VP9Frame dst,
VP9Frame src 
)
static

Definition at line 294 of file vp9.c.

Referenced by vp9_decode_frame(), and vp9_decode_update_thread_context().

static int update_size ( AVCodecContext ctx,
int  w,
int  h,
enum AVPixelFormat  fmt 
)
static

Definition at line 312 of file vp9.c.

Referenced by decode_frame_header().

static int update_block_buffers ( AVCodecContext ctx)
static

Definition at line 371 of file vp9.c.

Referenced by vp9_decode_frame().

static av_always_inline int get_sbits_inv ( GetBitContext gb,
int  n 
)
static

Definition at line 414 of file vp9.c.

Referenced by decode_frame_header().

static av_always_inline int inv_recenter_nonneg ( int  v,
int  m 
)
static

Definition at line 420 of file vp9.c.

Referenced by update_prob().

static int update_prob ( VP56RangeCoder c,
int  p 
)
static

Definition at line 426 of file vp9.c.

Referenced by decode_frame_header().

static enum AVPixelFormat read_colorspace_details ( AVCodecContext ctx)
static

Definition at line 483 of file vp9.c.

Referenced by decode_frame_header().

static int decode_frame_header ( AVCodecContext ctx,
const uint8_t data,
int  size,
int *  ref 
)
static

Definition at line 541 of file vp9.c.

Referenced by vp9_decode_frame().

static av_always_inline void clamp_mv ( VP56mv dst,
const VP56mv src,
VP9Context s 
)
static

Definition at line 1073 of file vp9.c.

Referenced by find_ref_mvs().

static void find_ref_mvs ( VP9Context s,
VP56mv pmv,
int  ref,
int  z,
int  idx,
int  sb 
)
static

Definition at line 1080 of file vp9.c.

Referenced by fill_mv().

static av_always_inline int read_mv_component ( VP9Context s,
int  idx,
int  hp 
)
static

Definition at line 1282 of file vp9.c.

Referenced by fill_mv().

static void fill_mv ( VP9Context s,
VP56mv mv,
int  mode,
int  sb 
)
static

Definition at line 1335 of file vp9.c.

Referenced by decode_mode().

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

Definition at line 1408 of file vp9.c.

Referenced by decode_b(), and decode_mode().

static void decode_mode ( AVCodecContext ctx)
static

Definition at line 1454 of file vp9.c.

Referenced by decode_b().

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,
const int16_t *  qmul 
)
static
static int decode_coeffs_b_8bpp ( VP9Context s,
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,
const int16_t *  qmul 
)
static

Definition at line 2282 of file vp9.c.

static int decode_coeffs_b32_8bpp ( VP9Context s,
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,
const int16_t *  qmul 
)
static

Definition at line 2292 of file vp9.c.

static int decode_coeffs_b_16bpp ( VP9Context s,
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,
const int16_t *  qmul 
)
static

Definition at line 2302 of file vp9.c.

static int decode_coeffs_b32_16bpp ( VP9Context s,
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,
const int16_t *  qmul 
)
static

Definition at line 2312 of file vp9.c.

static av_always_inline int decode_coeffs ( AVCodecContext ctx,
int  is8bitsperpixel 
)
static

Definition at line 2322 of file vp9.c.

Referenced by decode_coeffs_16bpp(), and decode_coeffs_8bpp().

static int decode_coeffs_8bpp ( AVCodecContext ctx)
static

Definition at line 2489 of file vp9.c.

Referenced by decode_b().

static int decode_coeffs_16bpp ( AVCodecContext ctx)
static

Definition at line 2494 of file vp9.c.

Referenced by decode_b().

static av_always_inline int check_intra_mode ( VP9Context s,
int  mode,
uint8_t **  a,
uint8_t dst_edge,
ptrdiff_t  stride_edge,
uint8_t dst_inner,
ptrdiff_t  stride_inner,
uint8_t l,
int  col,
int  x,
int  w,
int  row,
int  y,
enum TxfmMode  tx,
int  p,
int  ss_h,
int  ss_v,
int  bytesperpixel 
)
static

Definition at line 2499 of file vp9.c.

Referenced by intra_recon().

static av_always_inline void intra_recon ( AVCodecContext ctx,
ptrdiff_t  y_off,
ptrdiff_t  uv_off,
int  bytesperpixel 
)
static

Definition at line 2680 of file vp9.c.

Referenced by intra_recon_16bpp(), and intra_recon_8bpp().

static void intra_recon_8bpp ( AVCodecContext ctx,
ptrdiff_t  y_off,
ptrdiff_t  uv_off 
)
static

Definition at line 2750 of file vp9.c.

Referenced by decode_b().

static void intra_recon_16bpp ( AVCodecContext ctx,
ptrdiff_t  y_off,
ptrdiff_t  uv_off 
)
static

Definition at line 2755 of file vp9.c.

Referenced by decode_b().

static av_always_inline void mc_luma_scaled ( VP9Context s,
vp9_scaled_mc_func  smc,
uint8_t dst,
ptrdiff_t  dst_stride,
const uint8_t ref,
ptrdiff_t  ref_stride,
ThreadFrame ref_frame,
ptrdiff_t  y,
ptrdiff_t  x,
const VP56mv in_mv,
int  px,
int  py,
int  pw,
int  ph,
int  bw,
int  bh,
int  w,
int  h,
int  bytesperpixel,
const uint16_t *  scale,
const uint8_t step 
)
static

Definition at line 2760 of file vp9.c.

static av_always_inline void mc_chroma_scaled ( VP9Context s,
vp9_scaled_mc_func  smc,
uint8_t dst_u,
uint8_t dst_v,
ptrdiff_t  dst_stride,
const uint8_t ref_u,
ptrdiff_t  src_stride_u,
const uint8_t ref_v,
ptrdiff_t  src_stride_v,
ThreadFrame ref_frame,
ptrdiff_t  y,
ptrdiff_t  x,
const VP56mv in_mv,
int  px,
int  py,
int  pw,
int  ph,
int  bw,
int  bh,
int  w,
int  h,
int  bytesperpixel,
const uint16_t *  scale,
const uint8_t step 
)
static

Definition at line 2807 of file vp9.c.

static av_always_inline void mc_luma_unscaled ( VP9Context s,
vp9_mc_func(*)  mc[2],
uint8_t dst,
ptrdiff_t  dst_stride,
const uint8_t ref,
ptrdiff_t  ref_stride,
ThreadFrame ref_frame,
ptrdiff_t  y,
ptrdiff_t  x,
const VP56mv mv,
int  bw,
int  bh,
int  w,
int  h,
int  bytesperpixel 
)
static

Definition at line 2900 of file vp9.c.

static av_always_inline void mc_chroma_unscaled ( VP9Context s,
vp9_mc_func(*)  mc[2],
uint8_t dst_u,
uint8_t dst_v,
ptrdiff_t  dst_stride,
const uint8_t ref_u,
ptrdiff_t  src_stride_u,
const uint8_t ref_v,
ptrdiff_t  src_stride_v,
ThreadFrame ref_frame,
ptrdiff_t  y,
ptrdiff_t  x,
const VP56mv mv,
int  bw,
int  bh,
int  w,
int  h,
int  bytesperpixel 
)
static

Definition at line 2932 of file vp9.c.

static av_always_inline void inter_recon ( AVCodecContext ctx,
int  bytesperpixel 
)
static

Definition at line 3000 of file vp9.c.

Referenced by inter_recon_16bpp(), and inter_recon_8bpp().

static void inter_recon_8bpp ( AVCodecContext ctx)
static

Definition at line 3066 of file vp9.c.

Referenced by decode_b().

static void inter_recon_16bpp ( AVCodecContext ctx)
static

Definition at line 3071 of file vp9.c.

Referenced by decode_b().

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 3076 of file vp9.c.

Referenced by decode_b().

static void decode_b ( AVCodecContext ctx,
int  row,
int  col,
struct VP9Filter lflvl,
ptrdiff_t  yoff,
ptrdiff_t  uvoff,
enum BlockLevel  bl,
enum BlockPartition  bp 
)
static

Definition at line 3198 of file vp9.c.

Referenced by decode_sb(), and decode_sb_mem().

static void decode_sb ( AVCodecContext ctx,
int  row,
int  col,
struct VP9Filter lflvl,
ptrdiff_t  yoff,
ptrdiff_t  uvoff,
enum BlockLevel  bl 
)
static

Definition at line 3397 of file vp9.c.

Referenced by vp9_decode_frame().

static void decode_sb_mem ( AVCodecContext ctx,
int  row,
int  col,
struct VP9Filter lflvl,
ptrdiff_t  yoff,
ptrdiff_t  uvoff,
enum BlockLevel  bl 
)
static

Definition at line 3476 of file vp9.c.

Referenced by vp9_decode_frame().

static av_always_inline void filter_plane_cols ( VP9Context s,
int  col,
int  ss_h,
int  ss_v,
uint8_t lvl,
uint8_t(*)  mask[4],
uint8_t dst,
ptrdiff_t  ls 
)
static

Definition at line 3525 of file vp9.c.

Referenced by loopfilter_sb().

static av_always_inline void filter_plane_rows ( VP9Context s,
int  row,
int  ss_h,
int  ss_v,
uint8_t lvl,
uint8_t(*)  mask[4],
uint8_t dst,
ptrdiff_t  ls 
)
static

Definition at line 3600 of file vp9.c.

Referenced by loopfilter_sb().

static void loopfilter_sb ( AVCodecContext ctx,
struct VP9Filter lflvl,
int  row,
int  col,
ptrdiff_t  yoff,
ptrdiff_t  uvoff 
)
static

Definition at line 3677 of file vp9.c.

Referenced by vp9_decode_frame().

static void set_tile_offset ( int *  start,
int *  end,
int  idx,
int  log2_n,
int  n 
)
static

Definition at line 3703 of file vp9.c.

Referenced by vp9_decode_frame().

static av_always_inline void adapt_prob ( uint8_t p,
unsigned  ct0,
unsigned  ct1,
int  max_count,
int  update_factor 
)
static

Definition at line 3711 of file vp9.c.

Referenced by adapt_probs().

static void adapt_probs ( VP9Context s)
static

Definition at line 3729 of file vp9.c.

Referenced by vp9_decode_frame().

static void free_buffers ( VP9Context s)
static

Definition at line 3951 of file vp9.c.

Referenced by vp9_decode_free(), and vp9_decode_update_thread_context().

static av_cold int vp9_decode_free ( AVCodecContext ctx)
static

Definition at line 3958 of file vp9.c.

Referenced by init_frames().

static int vp9_decode_frame ( AVCodecContext ctx,
void frame,
int *  got_frame,
AVPacket pkt 
)
static

Definition at line 3984 of file vp9.c.

static void vp9_decode_flush ( AVCodecContext ctx)
static

Definition at line 4240 of file vp9.c.

static int init_frames ( AVCodecContext ctx)
static

Definition at line 4251 of file vp9.c.

Referenced by vp9_decode_init(), and vp9_decode_init_thread_copy().

static av_cold int vp9_decode_init ( AVCodecContext ctx)
static

Definition at line 4277 of file vp9.c.

static av_cold int vp9_decode_init_thread_copy ( AVCodecContext avctx)
static

Definition at line 4288 of file vp9.c.

static int vp9_decode_update_thread_context ( AVCodecContext dst,
const AVCodecContext src 
)
static

Definition at line 4293 of file vp9.c.

Variable Documentation

const uint8_t bwh_tab[2][N_BS_SIZES][2]
static
Initial value:
= {
{
{ 16, 16 }, { 16, 8 }, { 8, 16 }, { 8, 8 }, { 8, 4 }, { 4, 8 },
{ 4, 4 }, { 4, 2 }, { 2, 4 }, { 2, 2 }, { 2, 1 }, { 1, 2 }, { 1, 1 },
}, {
{ 8, 8 }, { 8, 4 }, { 4, 8 }, { 4, 4 }, { 4, 2 }, { 2, 4 },
{ 2, 2 }, { 2, 1 }, { 1, 2 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, { 1, 1 },
}
}

Definition at line 259 of file vp9.c.

Referenced by decode_b(), decode_coeffs(), decode_mode(), inter_pred(), inter_recon(), and intra_recon().

const AVProfile profiles[]
static
Initial value:
= {
{ FF_PROFILE_VP9_0, "Profile 0" },
{ FF_PROFILE_VP9_1, "Profile 1" },
{ FF_PROFILE_VP9_2, "Profile 2" },
{ FF_PROFILE_VP9_3, "Profile 3" },
}
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:2836
#define FF_PROFILE_VP9_1
Definition: avcodec.h:2916
#define FF_PROFILE_VP9_3
Definition: avcodec.h:2918
#define FF_PROFILE_VP9_0
Definition: avcodec.h:2915
#define FF_PROFILE_VP9_2
Definition: avcodec.h:2917

Definition at line 4340 of file vp9.c.

AVCodec ff_vp9_decoder
Initial value:
= {
.name = "vp9",
.long_name = NULL_IF_CONFIG_SMALL("Google VP9"),
.priv_data_size = sizeof(VP9Context),
.close = vp9_decode_free,
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static int vp9_decode_frame(AVCodecContext *ctx, void *frame, int *got_frame, AVPacket *pkt)
Definition: vp9.c:3984
static int vp9_decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
Definition: vp9.c:4293
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:789
static av_cold int vp9_decode_free(AVCodecContext *ctx)
Definition: vp9.c:3958
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:175
Definition: vp9.c:97
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
Definition: internal.h:214
static void vp9_decode_flush(AVCodecContext *ctx)
Definition: vp9.c:4240
static const AVProfile profiles[]
Definition: vp9.c:4340
static av_cold int vp9_decode_init_thread_copy(AVCodecContext *avctx)
Definition: vp9.c:4288
static void flush(AVCodecContext *avctx)
Definition: aacdec.c:514
static av_cold int vp9_decode_init(AVCodecContext *ctx)
Definition: vp9.c:4277
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
Definition: ccaption_dec.c:522
#define CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: avcodec.h:866
static int init_thread_copy(AVCodecContext *avctx)
Definition: alac.c:640

Definition at line 4348 of file vp9.c.