vp8dsp.c File Reference

VP8 compatible video decoder. More...

#include "dsputil.h"
#include "vp8dsp.h"
#include "libavutil/common.h"
Include dependency graph for vp8dsp.c:

Go to the source code of this file.

Macros

#define MUL_20091(a)   ((((a)*20091) >> 16) + (a))
 
#define MUL_35468(a)   (((a)*35468) >> 16)
 
#define LOAD_PIXELS
 
#define clip_int8(n)   (cm[n+0x80]-0x80)
 
#define LOOP_FILTER(dir, size, stridea, strideb, maybe_inline)
 
#define UV_LOOP_FILTER(dir, stridea, strideb)
 
#define PUT_PIXELS(WIDTH)
 
#define FILTER_6TAP(src, F, stride)
 
#define FILTER_4TAP(src, F, stride)
 
#define VP8_EPEL_H(SIZE, TAPS)
 
#define VP8_EPEL_V(SIZE, TAPS)
 
#define VP8_EPEL_HV(SIZE, HTAPS, VTAPS)
 
#define VP8_BILINEAR(SIZE)
 
#define VP8_MC_FUNC(IDX, SIZE)
 
#define VP8_BILINEAR_MC_FUNC(IDX, SIZE)
 

Functions

static void vp8_luma_dc_wht_c (int16_t block[4][4][16], int16_t dc[16])
 
static void vp8_luma_dc_wht_dc_c (int16_t block[4][4][16], int16_t dc[16])
 
static void vp8_idct_add_c (uint8_t *dst, int16_t block[16], ptrdiff_t stride)
 
static void vp8_idct_dc_add_c (uint8_t *dst, int16_t block[16], ptrdiff_t stride)
 
static void vp8_idct_dc_add4uv_c (uint8_t *dst, int16_t block[4][16], ptrdiff_t stride)
 
static void vp8_idct_dc_add4y_c (uint8_t *dst, int16_t block[4][16], ptrdiff_t stride)
 
static av_always_inline void filter_common (uint8_t *p, ptrdiff_t stride, int is4tap)
 
static av_always_inline int simple_limit (uint8_t *p, ptrdiff_t stride, int flim)
 
static av_always_inline int normal_limit (uint8_t *p, ptrdiff_t stride, int E, int I)
 E - limit at the macroblock edge I - limit for interior difference. More...
 
static av_always_inline int hev (uint8_t *p, ptrdiff_t stride, int thresh)
 
static av_always_inline void filter_mbedge (uint8_t *p, ptrdiff_t stride)
 
static void vp8_v_loop_filter_simple_c (uint8_t *dst, ptrdiff_t stride, int flim)
 
static void vp8_h_loop_filter_simple_c (uint8_t *dst, ptrdiff_t stride, int flim)
 
av_cold void ff_vp8dsp_init (VP8DSPContext *dsp)
 

Variables

static const uint8_t subpel_filters [7][6]
 

Detailed Description

VP8 compatible video decoder.

Definition in file vp8dsp.c.

Macro Definition Documentation

#define clip_int8 (   n)    (cm[n+0x80]-0x80)

Definition at line 157 of file vp8dsp.c.

Referenced by filter_common(), and filter_mbedge().

#define FILTER_4TAP (   src,
  F,
  stride 
)
Value:
cm[(F[2]*src[x+0*stride] - F[1]*src[x-1*stride] + \
F[3]*src[x+1*stride] - F[4]*src[x+2*stride] + 64) >> 7]
int stride
Definition: mace.c:144
#define cm
Definition: dvbsubdec.c:34
Discrete Time axis x
#define F
Definition: af_aformat.c:50
AVS_Value src
Definition: avisynth_c.h:523

Definition at line 332 of file vp8dsp.c.

#define FILTER_6TAP (   src,
  F,
  stride 
)
Value:
cm[(F[2]*src[x+0*stride] - F[1]*src[x-1*stride] + F[0]*src[x-2*stride] + \
F[3]*src[x+1*stride] - F[4]*src[x+2*stride] + F[5]*src[x+3*stride] + 64) >> 7]
int stride
Definition: mace.c:144
#define cm
Definition: dvbsubdec.c:34
Discrete Time axis x
#define F
Definition: af_aformat.c:50
AVS_Value src
Definition: avisynth_c.h:523

Definition at line 328 of file vp8dsp.c.

#define LOAD_PIXELS
Value:
int av_unused p3 = p[-4*stride];\
int av_unused p2 = p[-3*stride];\
int av_unused p1 = p[-2*stride];\
int av_unused p0 = p[-1*stride];\
int av_unused q0 = p[ 0*stride];\
int av_unused q1 = p[ 1*stride];\
int av_unused q2 = p[ 2*stride];\
int av_unused q3 = p[ 3*stride];
int stride
Definition: mace.c:144
#define av_unused
Definition: attributes.h:114

Definition at line 147 of file vp8dsp.c.

Referenced by filter_common(), filter_mbedge(), hev(), normal_limit(), and simple_limit().

#define LOOP_FILTER (   dir,
  size,
  stridea,
  strideb,
  maybe_inline 
)
Value:
static maybe_inline void vp8_ ## dir ## _loop_filter ## size ## _c(uint8_t *dst, ptrdiff_t stride,\
int flim_E, int flim_I, int hev_thresh)\
{\
int i;\
for (i = 0; i < size; i++)\
if (normal_limit(dst+i*stridea, strideb, flim_E, flim_I)) {\
if (hev(dst+i*stridea, strideb, hev_thresh))\
filter_common(dst+i*stridea, strideb, 1);\
filter_mbedge(dst+i*stridea, strideb);\
}\
}\
\
static maybe_inline void vp8_ ## dir ## _loop_filter ## size ## _inner_c(uint8_t *dst, ptrdiff_t stride,\
int flim_E, int flim_I, int hev_thresh)\
{\
int i;\
for (i = 0; i < size; i++)\
if (normal_limit(dst+i*stridea, strideb, flim_E, flim_I)) {\
int hv = hev(dst+i*stridea, strideb, hev_thresh);\
if (hv) \
filter_common(dst+i*stridea, strideb, 1);\
filter_common(dst+i*stridea, strideb, 0);\
}\
}
int stride
Definition: mace.c:144
initialize output if(nPeaks >3)%at least 3 peaks in spectrum for trying to find f0 nf0peaks
uint8_t
int size
static av_always_inline void filter_common(uint8_t *p, ptrdiff_t stride, int is4tap)
Definition: vp8dsp.c:159
synthesis window for stochastic i
static av_always_inline void filter_mbedge(uint8_t *p, ptrdiff_t stride)
Definition: vp8dsp.c:215
static av_always_inline int normal_limit(uint8_t *p, ptrdiff_t stride, int E, int I)
E - limit at the macroblock edge I - limit for interior difference.
Definition: vp8dsp.c:200
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160
static av_always_inline int hev(uint8_t *p, ptrdiff_t stride, int thresh)
Definition: vp8dsp.c:209
for(j=16;j >0;--j)

Definition at line 237 of file vp8dsp.c.

#define MUL_20091 (   a)    ((((a)*20091) >> 16) + (a))

Definition at line 78 of file vp8dsp.c.

Referenced by vp8_idct_add_c().

#define MUL_35468 (   a)    (((a)*35468) >> 16)

Definition at line 79 of file vp8dsp.c.

Referenced by vp8_idct_add_c().

#define PUT_PIXELS (   WIDTH)
Value:
static void put_vp8_pixels ## WIDTH ##_c(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, int h, int x, int y) { \
int i; \
for (i = 0; i < h; i++, dst+= dststride, src+= srcstride) { \
memcpy(dst, src, WIDTH); \
} \
}
#define WIDTH
uint8_t
Discrete Time axis x
AVS_Value src
Definition: avisynth_c.h:523
synthesis window for stochastic i
function y
Definition: D.m:1
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160
for(j=16;j >0;--j)

Definition at line 316 of file vp8dsp.c.

#define UV_LOOP_FILTER (   dir,
  stridea,
  strideb 
)
Value:
LOOP_FILTER(dir, 8, stridea, strideb, av_always_inline) \
static void vp8_ ## dir ## _loop_filter8uv_c(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride,\
int fE, int fI, int hev_thresh)\
{\
vp8_ ## dir ## _loop_filter8_c(dstU, stride, fE, fI, hev_thresh);\
vp8_ ## dir ## _loop_filter8_c(dstV, stride, fE, fI, hev_thresh);\
}\
static void vp8_ ## dir ## _loop_filter8uv_inner_c(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride,\
int fE, int fI, int hev_thresh)\
{\
vp8_ ## dir ## _loop_filter8_inner_c(dstU, stride, fE, fI, hev_thresh);\
vp8_ ## dir ## _loop_filter8_inner_c(dstV, stride, fE, fI, hev_thresh);\
}
int stride
Definition: mace.c:144
uint8_t
#define LOOP_FILTER(dir, size, stridea, strideb, maybe_inline)
Definition: vp8dsp.c:237
#define av_always_inline
Definition: attributes.h:41

Definition at line 270 of file vp8dsp.c.

#define VP8_BILINEAR (   SIZE)

Definition at line 417 of file vp8dsp.c.

#define VP8_BILINEAR_MC_FUNC (   IDX,
  SIZE 
)
Value:
dsp->put_vp8_bilinear_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; \
dsp->put_vp8_bilinear_pixels_tab[IDX][0][1] = put_vp8_bilinear ## SIZE ## _h_c; \
dsp->put_vp8_bilinear_pixels_tab[IDX][0][2] = put_vp8_bilinear ## SIZE ## _h_c; \
dsp->put_vp8_bilinear_pixels_tab[IDX][1][0] = put_vp8_bilinear ## SIZE ## _v_c; \
dsp->put_vp8_bilinear_pixels_tab[IDX][1][1] = put_vp8_bilinear ## SIZE ## _hv_c; \
dsp->put_vp8_bilinear_pixels_tab[IDX][1][2] = put_vp8_bilinear ## SIZE ## _hv_c; \
dsp->put_vp8_bilinear_pixels_tab[IDX][2][0] = put_vp8_bilinear ## SIZE ## _v_c; \
dsp->put_vp8_bilinear_pixels_tab[IDX][2][1] = put_vp8_bilinear ## SIZE ## _hv_c; \
dsp->put_vp8_bilinear_pixels_tab[IDX][2][2] = put_vp8_bilinear ## SIZE ## _hv_c
#define SIZE
Definition: golomb-test.c:31

Definition at line 483 of file vp8dsp.c.

Referenced by ff_vp8dsp_init().

#define VP8_EPEL_H (   SIZE,
  TAPS 
)
Value:
static void put_vp8_epel ## SIZE ## _h ## TAPS ## _c(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, int h, int mx, int my) \
{ \
const uint8_t *filter = subpel_filters[mx-1]; \
int x, y; \
for (y = 0; y < h; y++) { \
for (x = 0; x < SIZE; x++) \
dst[x] = FILTER_ ## TAPS ## TAP(src, filter, 1); \
dst += dststride; \
src += srcstride; \
} \
}
#define ff_cropTbl
#define MAX_NEG_CROP
Definition: dsputil.h:47
uint8_t
#define SIZE
Definition: golomb-test.c:31
the mask is usually to keep the same permissions Filters should remove permissions on reference they give to output whenever necessary It can be automatically done by setting the rej_perms field on the output pad Here are a few guidelines corresponding to common then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
static const uint8_t subpel_filters[7][6]
Definition: vp8dsp.c:306
#define cm
Definition: dvbsubdec.c:34
Discrete Time axis x
AVS_Value src
Definition: avisynth_c.h:523
function y
Definition: D.m:1
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160
for(j=16;j >0;--j)

Definition at line 336 of file vp8dsp.c.

#define VP8_EPEL_HV (   SIZE,
  HTAPS,
  VTAPS 
)
Value:
static void put_vp8_epel ## SIZE ## _h ## HTAPS ## v ## VTAPS ## _c(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, int h, int mx, int my) \
{ \
const uint8_t *filter = subpel_filters[mx-1]; \
int x, y; \
uint8_t tmp_array[(2*SIZE+VTAPS-1)*SIZE]; \
uint8_t *tmp = tmp_array; \
src -= (2-(VTAPS==4))*srcstride; \
for (y = 0; y < h+VTAPS-1; y++) { \
for (x = 0; x < SIZE; x++) \
tmp[x] = FILTER_ ## HTAPS ## TAP(src, filter, 1); \
tmp += SIZE; \
src += srcstride; \
} \
\
tmp = tmp_array + (2-(VTAPS==4))*SIZE; \
for (y = 0; y < h; y++) { \
for (x = 0; x < SIZE; x++) \
dst[x] = FILTER_ ## VTAPS ## TAP(tmp, filter, SIZE); \
dst += dststride; \
tmp += SIZE; \
} \
}
float v
#define ff_cropTbl
#define MAX_NEG_CROP
Definition: dsputil.h:47
uint8_t
#define SIZE
Definition: golomb-test.c:31
the mask is usually to keep the same permissions Filters should remove permissions on reference they give to output whenever necessary It can be automatically done by setting the rej_perms field on the output pad Here are a few guidelines corresponding to common then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
static const uint8_t subpel_filters[7][6]
Definition: vp8dsp.c:306
#define cm
Definition: dvbsubdec.c:34
Discrete Time axis x
AVS_Value src
Definition: avisynth_c.h:523
function y
Definition: D.m:1
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160
for(j=16;j >0;--j)

Definition at line 364 of file vp8dsp.c.

#define VP8_EPEL_V (   SIZE,
  TAPS 
)
Value:
static void put_vp8_epel ## SIZE ## _v ## TAPS ## _c(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, int h, int mx, int my) \
{ \
const uint8_t *filter = subpel_filters[my-1]; \
int x, y; \
for (y = 0; y < h; y++) { \
for (x = 0; x < SIZE; x++) \
dst[x] = FILTER_ ## TAPS ## TAP(src, filter, srcstride); \
dst += dststride; \
src += srcstride; \
} \
}
#define ff_cropTbl
#define MAX_NEG_CROP
Definition: dsputil.h:47
uint8_t
#define SIZE
Definition: golomb-test.c:31
the mask is usually to keep the same permissions Filters should remove permissions on reference they give to output whenever necessary It can be automatically done by setting the rej_perms field on the output pad Here are a few guidelines corresponding to common then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
static const uint8_t subpel_filters[7][6]
Definition: vp8dsp.c:306
#define cm
Definition: dvbsubdec.c:34
Discrete Time axis x
AVS_Value src
Definition: avisynth_c.h:523
function y
Definition: D.m:1
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160
for(j=16;j >0;--j)

Definition at line 350 of file vp8dsp.c.

#define VP8_MC_FUNC (   IDX,
  SIZE 
)
Value:
dsp->put_vp8_epel_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; \
dsp->put_vp8_epel_pixels_tab[IDX][0][1] = put_vp8_epel ## SIZE ## _h4_c; \
dsp->put_vp8_epel_pixels_tab[IDX][0][2] = put_vp8_epel ## SIZE ## _h6_c; \
dsp->put_vp8_epel_pixels_tab[IDX][1][0] = put_vp8_epel ## SIZE ## _v4_c; \
dsp->put_vp8_epel_pixels_tab[IDX][1][1] = put_vp8_epel ## SIZE ## _h4v4_c; \
dsp->put_vp8_epel_pixels_tab[IDX][1][2] = put_vp8_epel ## SIZE ## _h6v4_c; \
dsp->put_vp8_epel_pixels_tab[IDX][2][0] = put_vp8_epel ## SIZE ## _v6_c; \
dsp->put_vp8_epel_pixels_tab[IDX][2][1] = put_vp8_epel ## SIZE ## _h4v6_c; \
dsp->put_vp8_epel_pixels_tab[IDX][2][2] = put_vp8_epel ## SIZE ## _h6v6_c
#define SIZE
Definition: golomb-test.c:31

Definition at line 472 of file vp8dsp.c.

Referenced by ff_vp8dsp_init().

Function Documentation

av_cold void ff_vp8dsp_init ( VP8DSPContext dsp)

Definition at line 494 of file vp8dsp.c.

Referenced by vp8_decode_init().

static av_always_inline void filter_common ( uint8_t p,
ptrdiff_t  stride,
int  is4tap 
)
static

Definition at line 159 of file vp8dsp.c.

Referenced by vp8_h_loop_filter_simple_c(), and vp8_v_loop_filter_simple_c().

static av_always_inline void filter_mbedge ( uint8_t p,
ptrdiff_t  stride 
)
static

Definition at line 215 of file vp8dsp.c.

static av_always_inline int hev ( uint8_t p,
ptrdiff_t  stride,
int  thresh 
)
static

Definition at line 209 of file vp8dsp.c.

static av_always_inline int normal_limit ( uint8_t p,
ptrdiff_t  stride,
int  E,
int  I 
)
static

E - limit at the macroblock edge I - limit for interior difference.

Definition at line 200 of file vp8dsp.c.

static av_always_inline int simple_limit ( uint8_t p,
ptrdiff_t  stride,
int  flim 
)
static

Definition at line 190 of file vp8dsp.c.

Referenced by normal_limit(), vp8_h_loop_filter_simple_c(), and vp8_v_loop_filter_simple_c().

static void vp8_h_loop_filter_simple_c ( uint8_t dst,
ptrdiff_t  stride,
int  flim 
)
static

Definition at line 297 of file vp8dsp.c.

Referenced by ff_vp8dsp_init().

static void vp8_idct_add_c ( uint8_t dst,
int16_t  block[16],
ptrdiff_t  stride 
)
static

Definition at line 81 of file vp8dsp.c.

Referenced by ff_vp8dsp_init().

static void vp8_idct_dc_add4uv_c ( uint8_t dst,
int16_t  block[4][16],
ptrdiff_t  stride 
)
static

Definition at line 130 of file vp8dsp.c.

Referenced by ff_vp8dsp_init().

static void vp8_idct_dc_add4y_c ( uint8_t dst,
int16_t  block[4][16],
ptrdiff_t  stride 
)
static

Definition at line 138 of file vp8dsp.c.

Referenced by ff_vp8dsp_init().

static void vp8_idct_dc_add_c ( uint8_t dst,
int16_t  block[16],
ptrdiff_t  stride 
)
static

Definition at line 116 of file vp8dsp.c.

Referenced by ff_vp8dsp_init(), vp8_idct_dc_add4uv_c(), and vp8_idct_dc_add4y_c().

static void vp8_luma_dc_wht_c ( int16_t  block[4][4][16],
int16_t  dc[16] 
)
static

Definition at line 32 of file vp8dsp.c.

Referenced by ff_vp8dsp_init().

static void vp8_luma_dc_wht_dc_c ( int16_t  block[4][4][16],
int16_t  dc[16] 
)
static

Definition at line 65 of file vp8dsp.c.

Referenced by ff_vp8dsp_init().

static void vp8_v_loop_filter_simple_c ( uint8_t dst,
ptrdiff_t  stride,
int  flim 
)
static

Definition at line 288 of file vp8dsp.c.

Referenced by ff_vp8dsp_init().

Variable Documentation

const uint8_t subpel_filters[7][6]
static
Initial value:
= {
{ 0, 6, 123, 12, 1, 0 },
{ 2, 11, 108, 36, 8, 1 },
{ 0, 9, 93, 50, 6, 0 },
{ 3, 16, 77, 77, 16, 3 },
{ 0, 6, 50, 93, 9, 0 },
{ 1, 8, 36, 108, 11, 2 },
{ 0, 1, 12, 123, 6, 0 },
}

Definition at line 306 of file vp8dsp.c.