FFmpeg
Macros | Functions
aom_film_grain_template.c File Reference
#include "bit_depth_template.c"

Go to the source code of this file.

Macros

#define entry   int8_t
 
#define bitdepth   8
 
#define bitdepth_max   UINT8_MAX
 
#define HBD_DECL
 
#define HBD_CALL
 
#define SCALING_SIZE   256
 
#define add_noise_y(x, y, grain)
 
#define add_noise_uv(x, y, grain)
 

Functions

static void FUNC() generate_grain_y_c (entry buf[][GRAIN_WIDTH], const AVFilmGrainParams *const params HBD_DECL)
 
static void FUNC() generate_grain_uv_c (entry buf[][GRAIN_WIDTH], const entry buf_y[][GRAIN_WIDTH], const AVFilmGrainParams *const params, const intptr_t uv, const int subx, const int suby HBD_DECL)
 
static entry FUNC() sample_lut (const entry grain_lut[][GRAIN_WIDTH], const int offsets[2][2], const int subx, const int suby, const int bx, const int by, const int x, const int y)
 
static void FUNC() fgy_32x32xn_c (pixel *const dst_row, const pixel *const src_row, const ptrdiff_t stride, const AVFilmGrainParams *const params, const size_t pw, const uint8_t scaling[SCALING_SIZE], const entry grain_lut[][GRAIN_WIDTH], const int bh, const int row_num HBD_DECL)
 
static void FUNC() fguv_32x32xn_c (pixel *const dst_row, const pixel *const src_row, const ptrdiff_t stride, const AVFilmGrainParams *const params, const size_t pw, const uint8_t scaling[SCALING_SIZE], const entry grain_lut[][GRAIN_WIDTH], const int bh, const int row_num, const pixel *const luma_row, const ptrdiff_t luma_stride, const int uv, const int is_id, const int sx, const int sy HBD_DECL)
 
static void FUNC() generate_scaling (const uint8_t points[][2], const int num, uint8_t scaling[SCALING_SIZE] HBD_DECL)
 
static av_always_inline void FUNC() apply_grain_row (AVFrame *out, const AVFrame *in, const int ss_x, const int ss_y, const uint8_t scaling[3][SCALING_SIZE], const entry grain_lut[3][GRAIN_HEIGHT+1][GRAIN_WIDTH], const AVFilmGrainParams *params, const int row HBD_DECL)
 
static int FUNC() apply_film_grain (AVFrame *out_frame, const AVFrame *in_frame, const AVFilmGrainParams *params HBD_DECL)
 

Macro Definition Documentation

◆ entry

#define entry   int8_t

◆ bitdepth

#define bitdepth   8

Definition at line 67 of file aom_film_grain_template.c.

◆ bitdepth_max

#define bitdepth_max   UINT8_MAX

Definition at line 68 of file aom_film_grain_template.c.

◆ HBD_DECL

#define HBD_DECL

Definition at line 69 of file aom_film_grain_template.c.

◆ HBD_CALL

#define HBD_CALL

Definition at line 70 of file aom_film_grain_template.c.

◆ SCALING_SIZE

#define SCALING_SIZE   256

Definition at line 71 of file aom_film_grain_template.c.

◆ add_noise_y

#define add_noise_y (   x,
  y,
  grain 
)
Value:
src = (const pixel*)((const char*)src_row + (y) * stride) + (x) + bx; \
dst = (pixel*)((char*)dst_row + (y) * stride) + (x) + bx; \
noise = round2(scaling[ *src ] * (grain), data->scaling_shift); \
*dst = av_clip(*src + noise, min_value, max_value);

◆ add_noise_uv

#define add_noise_uv (   x,
  y,
  grain 
)
Value:
lx = (bx + x) << sx; \
ly = y << sy; \
luma = (const pixel*)((const char*)luma_row + ly * luma_stride) + lx;\
avg = luma[0]; \
if (sx) \
avg = (avg + luma[1] + 1) >> 1; \
src = (const pixel*)((const char *)src_row + (y) * stride) + bx + (x);\
dst = (pixel *) ((char *) dst_row + (y) * stride) + bx + (x); \
val = avg; \
if (!data->chroma_scaling_from_luma) { \
const int combined = avg * data->uv_mult_luma[uv] + \
*src * data->uv_mult[uv]; \
val = av_clip( (combined >> 6) + \
(data->uv_offset[uv] * (1 << bitdepth_min_8)), \
0, bitdepth_max ); \
} \
noise = round2(scaling[ val ] * (grain), data->scaling_shift); \
*dst = av_clip(*src + noise, min_value, max_value);

Function Documentation

◆ generate_grain_y_c()

static void FUNC() generate_grain_y_c ( entry  buf[][GRAIN_WIDTH],
const AVFilmGrainParams *const params  HBD_DECL 
)
static

Definition at line 74 of file aom_film_grain_template.c.

Referenced by apply_film_grain().

◆ generate_grain_uv_c()

static void FUNC() generate_grain_uv_c ( entry  buf[][GRAIN_WIDTH],
const entry  buf_y[][GRAIN_WIDTH],
const AVFilmGrainParams *const  params,
const intptr_t  uv,
const int  subx,
const int suby  HBD_DECL 
)
static

Definition at line 114 of file aom_film_grain_template.c.

Referenced by apply_film_grain().

◆ sample_lut()

static entry FUNC() sample_lut ( const entry  grain_lut[][GRAIN_WIDTH],
const int  offsets[2][2],
const int  subx,
const int  suby,
const int  bx,
const int  by,
const int  x,
const int  y 
)
inlinestatic

Definition at line 175 of file aom_film_grain_template.c.

Referenced by fguv_32x32xn_c(), and fgy_32x32xn_c().

◆ fgy_32x32xn_c()

static void FUNC() fgy_32x32xn_c ( pixel *const  dst_row,
const pixel *const  src_row,
const ptrdiff_t  stride,
const AVFilmGrainParams *const  params,
const size_t  pw,
const uint8_t  scaling[SCALING_SIZE],
const entry  grain_lut[][GRAIN_WIDTH],
const int  bh,
const int row_num  HBD_DECL 
)
static

Definition at line 188 of file aom_film_grain_template.c.

Referenced by apply_grain_row().

◆ fguv_32x32xn_c()

static void FUNC() fguv_32x32xn_c ( pixel *const  dst_row,
const pixel *const  src_row,
const ptrdiff_t  stride,
const AVFilmGrainParams *const  params,
const size_t  pw,
const uint8_t  scaling[SCALING_SIZE],
const entry  grain_lut[][GRAIN_WIDTH],
const int  bh,
const int  row_num,
const pixel *const  luma_row,
const ptrdiff_t  luma_stride,
const int  uv,
const int  is_id,
const int  sx,
const int sy  HBD_DECL 
)
static

Definition at line 302 of file aom_film_grain_template.c.

Referenced by apply_grain_row().

◆ generate_scaling()

static void FUNC() generate_scaling ( const uint8_t  points[][2],
const int  num,
uint8_t scaling  HBD_DECL[SCALING_SIZE] 
)
static

Definition at line 433 of file aom_film_grain_template.c.

Referenced by apply_film_grain().

◆ apply_grain_row()

static av_always_inline void FUNC() apply_grain_row ( AVFrame out,
const AVFrame in,
const int  ss_x,
const int  ss_y,
const uint8_t  scaling[3][SCALING_SIZE],
const entry  grain_lut[3][GRAIN_HEIGHT+1][GRAIN_WIDTH],
const AVFilmGrainParams params,
const int row  HBD_DECL 
)
static

Definition at line 486 of file aom_film_grain_template.c.

Referenced by apply_film_grain().

◆ apply_film_grain()

static int FUNC() apply_film_grain ( AVFrame out_frame,
const AVFrame in_frame,
const AVFilmGrainParams *params  HBD_DECL 
)
static

Definition at line 545 of file aom_film_grain_template.c.

av_clip
#define av_clip
Definition: common.h:99
bitdepth_max
#define bitdepth_max
Definition: aom_film_grain_template.c:68
data
const char data[16]
Definition: mxf.c:148
noise
static int noise(AVBSFContext *ctx, AVPacket *pkt)
Definition: noise.c:127
val
static double val(void *priv, double ch)
Definition: aeval.c:78
pixel
uint8_t pixel
Definition: tiny_ssim.c:41
round2
static int round2(const int x, const uint64_t shift)
Definition: aom_film_grain.c:43
avg
#define avg(a, b, c, d)
Definition: colorspacedsp_template.c:28
stride
#define stride
Definition: h264pred_template.c:537
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418