FFmpeg
Macros | Functions | Variables
h264_loopfilter.c File Reference
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "h264dec.h"
#include "h264_ps.h"
#include "mpegutils.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[], 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[], 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

◆ FILTER

#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(chroma){\
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 );\
}\
}\
}

Function Documentation

◆ filter_mb_edgev()

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 100 of file h264_loopfilter.c.

Referenced by filter_mb_dir(), and h264_filter_mb_fast_internal().

◆ filter_mb_edgecv()

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 122 of file h264_loopfilter.c.

Referenced by filter_mb_dir(), and h264_filter_mb_fast_internal().

◆ filter_mb_mbaff_edgev()

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

Definition at line 144 of file h264_loopfilter.c.

Referenced by ff_h264_filter_mb().

◆ filter_mb_mbaff_edgecv()

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

Definition at line 167 of file h264_loopfilter.c.

Referenced by ff_h264_filter_mb().

◆ filter_mb_edgeh()

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 190 of file h264_loopfilter.c.

Referenced by filter_mb_dir(), and h264_filter_mb_fast_internal().

◆ filter_mb_edgech()

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 212 of file h264_loopfilter.c.

Referenced by filter_mb_dir(), and h264_filter_mb_fast_internal().

◆ 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 234 of file h264_loopfilter.c.

Referenced by ff_h264_filter_mb_fast().

◆ 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 416 of file h264_loopfilter.c.

Referenced by loop_filter().

◆ check_mv()

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

Definition at line 438 of file h264_loopfilter.c.

Referenced by filter_mb_dir().

◆ 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 468 of file h264_loopfilter.c.

Referenced by ff_h264_filter_mb().

◆ 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 716 of file h264_loopfilter.c.

Referenced by ff_h264_filter_mb_fast(), and loop_filter().

Variable Documentation

◆ alpha_table

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

◆ beta_table

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

◆ tc0_table

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, 0, 0 },
{-1, 0,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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 69 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().

b
#define b
Definition: input.c:41
chroma
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, int jobnr, int nb_jobs)
Definition: vf_waveform.c:1639
AV_RN64A
#define AV_RN64A(p)
Definition: intreadwrite.h:526
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
h
h
Definition: vp9dsp_template.c:2070