FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
h264_loopfilter.c File Reference

H.264 / AVC / MPEG-4 part10 loop filter. More...

#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "internal.h"
#include "avcodec.h"
#include "h264dec.h"
#include "h264_ps.h"
#include "mathops.h"
#include "mpegutils.h"
#include "rectangle.h"

Go to the source code of this file.

Macros

#define FILTER(hv, dir, edge, intra)
 

Functions

static av_always_inline void filter_mb_edgev (uint8_t *pix, int stride, const int16_t bS[4], unsigned int qp, int a, int b, const H264Context *h, int intra)
 
static av_always_inline void filter_mb_edgecv (uint8_t *pix, int stride, const int16_t bS[4], unsigned int qp, int a, int b, const H264Context *h, int intra)
 
static av_always_inline void filter_mb_mbaff_edgev (const H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp, int a, int b, int intra)
 
static av_always_inline void filter_mb_mbaff_edgecv (const H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp, int a, int b, int intra)
 
static av_always_inline void filter_mb_edgeh (uint8_t *pix, int stride, const int16_t bS[4], unsigned int qp, int a, int b, const H264Context *h, int intra)
 
static av_always_inline void filter_mb_edgech (uint8_t *pix, int stride, const int16_t bS[4], unsigned int qp, int a, int b, const H264Context *h, int intra)
 
static av_always_inline void h264_filter_mb_fast_internal (const H264Context *h, H264SliceContext *sl, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize, int pixel_shift)
 
void ff_h264_filter_mb_fast (const H264Context *h, H264SliceContext *sl, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize)
 
static int check_mv (H264SliceContext *sl, long b_idx, long bn_idx, int mvy_limit)
 
static av_always_inline void filter_mb_dir (const H264Context *h, H264SliceContext *sl, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize, int mb_xy, int mb_type, int mvy_limit, int first_vertical_edge_done, int a, int b, int chroma, int dir)
 
void ff_h264_filter_mb (const H264Context *h, H264SliceContext *sl, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize)
 

Variables

static const uint8_t alpha_table [52 *3]
 
static const uint8_t beta_table [52 *3]
 
static const uint8_t tc0_table [52 *3][4]
 

Detailed Description

H.264 / AVC / MPEG-4 part10 loop filter.

Author
Michael Niedermayer micha.nosp@m.elni.nosp@m.@gmx..nosp@m.at

Definition in file h264_loopfilter.c.

Macro Definition Documentation

#define FILTER (   hv,
  dir,
  edge,
  intra 
)
Value:
if(AV_RN64A(bS[dir][edge])) { \
filter_mb_edge##hv( &img_y[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qp : qp##dir, a, b, h, intra );\
if(chroma444){\
filter_mb_edge##hv( &img_cb[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\
filter_mb_edge##hv( &img_cr[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\
} else if(!(edge&1)) {\
filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\
filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\
}\
}\
}
static av_always_inline void chroma(WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, int offset_y, int offset_x, int column, int mirror)
Definition: vf_waveform.c:1337
const char * b
Definition: vf_curves.c:113
if(ret< 0)
Definition: vf_mcdeint.c:282
#define AV_RN64A(p)
Definition: intreadwrite.h:535

Referenced by h264_filter_mb_fast_internal().

Function Documentation

static av_always_inline void filter_mb_edgev ( uint8_t pix,
int  stride,
const int16_t  bS[4],
unsigned int  qp,
int  a,
int  b,
const H264Context h,
int  intra 
)
static

Definition at line 102 of file h264_loopfilter.c.

Referenced by filter_mb_dir(), and h264_filter_mb_fast_internal().

static av_always_inline void filter_mb_edgecv ( uint8_t pix,
int  stride,
const int16_t  bS[4],
unsigned int  qp,
int  a,
int  b,
const H264Context h,
int  intra 
)
static

Definition at line 124 of file h264_loopfilter.c.

Referenced by filter_mb_dir(), and h264_filter_mb_fast_internal().

static av_always_inline void filter_mb_mbaff_edgev ( const H264Context h,
uint8_t pix,
int  stride,
const int16_t  bS[7],
int  bsi,
int  qp,
int  a,
int  b,
int  intra 
)
static

Definition at line 146 of file h264_loopfilter.c.

Referenced by ff_h264_filter_mb().

static av_always_inline void filter_mb_mbaff_edgecv ( const H264Context h,
uint8_t pix,
int  stride,
const int16_t  bS[7],
int  bsi,
int  qp,
int  a,
int  b,
int  intra 
)
static

Definition at line 169 of file h264_loopfilter.c.

Referenced by ff_h264_filter_mb().

static av_always_inline void filter_mb_edgeh ( uint8_t pix,
int  stride,
const int16_t  bS[4],
unsigned int  qp,
int  a,
int  b,
const H264Context h,
int  intra 
)
static

Definition at line 192 of file h264_loopfilter.c.

Referenced by filter_mb_dir(), and h264_filter_mb_fast_internal().

static av_always_inline void filter_mb_edgech ( uint8_t pix,
int  stride,
const int16_t  bS[4],
unsigned int  qp,
int  a,
int  b,
const H264Context h,
int  intra 
)
static

Definition at line 214 of file h264_loopfilter.c.

Referenced by filter_mb_dir(), and h264_filter_mb_fast_internal().

static av_always_inline void h264_filter_mb_fast_internal ( const H264Context h,
H264SliceContext sl,
int  mb_x,
int  mb_y,
uint8_t img_y,
uint8_t img_cb,
uint8_t img_cr,
unsigned int  linesize,
unsigned int  uvlinesize,
int  pixel_shift 
)
static

Definition at line 236 of file h264_loopfilter.c.

Referenced by ff_h264_filter_mb_fast().

void ff_h264_filter_mb_fast ( const H264Context h,
H264SliceContext sl,
int  mb_x,
int  mb_y,
uint8_t img_y,
uint8_t img_cb,
uint8_t img_cr,
unsigned int  linesize,
unsigned int  uvlinesize 
)

Definition at line 418 of file h264_loopfilter.c.

Referenced by loop_filter().

static int check_mv ( H264SliceContext sl,
long  b_idx,
long  bn_idx,
int  mvy_limit 
)
static

Definition at line 440 of file h264_loopfilter.c.

Referenced by filter_mb_dir().

static av_always_inline void filter_mb_dir ( const H264Context h,
H264SliceContext sl,
int  mb_x,
int  mb_y,
uint8_t img_y,
uint8_t img_cb,
uint8_t img_cr,
unsigned int  linesize,
unsigned int  uvlinesize,
int  mb_xy,
int  mb_type,
int  mvy_limit,
int  first_vertical_edge_done,
int  a,
int  b,
int  chroma,
int  dir 
)
static

Definition at line 470 of file h264_loopfilter.c.

Referenced by ff_h264_filter_mb().

void ff_h264_filter_mb ( const H264Context h,
H264SliceContext sl,
int  mb_x,
int  mb_y,
uint8_t img_y,
uint8_t img_cb,
uint8_t img_cr,
unsigned int  linesize,
unsigned int  uvlinesize 
)

Definition at line 718 of file h264_loopfilter.c.

Referenced by ff_h264_filter_mb_fast(), and loop_filter().

Variable Documentation

const uint8_t alpha_table[52 *3]
static
Initial value:
= {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 4, 4, 5, 6,
7, 8, 9, 10, 12, 13, 15, 17, 20, 22,
25, 28, 32, 36, 40, 45, 50, 56, 63, 71,
80, 90,101,113,127,144,162,182,203,226,
255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,
}

Definition at line 39 of file h264_loopfilter.c.

Referenced by filter_mb_edgech(), filter_mb_edgecv(), filter_mb_edgeh(), filter_mb_edgev(), filter_mb_mbaff_edgecv(), and filter_mb_mbaff_edgev().

const uint8_t beta_table[52 *3]
static
Initial value:
= {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 2, 2, 2, 3,
3, 3, 3, 4, 4, 4, 6, 6, 7, 7,
8, 8, 9, 9, 10, 10, 11, 11, 12, 12,
13, 13, 14, 14, 15, 15, 16, 16, 17, 17,
18, 18,
18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
}

Definition at line 55 of file h264_loopfilter.c.

Referenced by filter_mb_edgech(), filter_mb_edgecv(), filter_mb_edgeh(), filter_mb_edgev(), filter_mb_mbaff_edgecv(), and filter_mb_mbaff_edgev().

const uint8_t tc0_table[52 *3][4]
static
Initial value:
= {
{-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
{-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
{-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 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 }, {-1, 2, 2, 4 }, {-1, 2, 3, 4 },
{-1, 2, 3, 4 }, {-1, 3, 3, 5 }, {-1, 3, 4, 6 }, {-1, 3, 4, 6 }, {-1, 4, 5, 7 }, {-1, 4, 5, 8 },
{-1, 4, 6, 9 }, {-1, 5, 7,10 }, {-1, 6, 8,11 }, {-1, 6, 8,13 }, {-1, 7,10,14 }, {-1, 8,11,16 },
{-1, 9,12,18 }, {-1,10,13,20 }, {-1,11,15,23 }, {-1,13,17,25 },
{-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
{-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
{-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
{-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
{-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
{-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
{-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
{-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
{-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
}

Definition at line 71 of file h264_loopfilter.c.

Referenced by filter_mb_edgech(), filter_mb_edgecv(), filter_mb_edgeh(), filter_mb_edgev(), filter_mb_mbaff_edgecv(), and filter_mb_mbaff_edgev().