FFmpeg
Loading...
Searching...
No Matches
aom_film_grain_template.c File Reference

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

Definition at line 66 of file aom_film_grain_template.c.

Referenced by add_entry(), apply_film_grain(), apply_grain_row(), asf_write_header1(), asmgen_op_cps(), av_dict_get(), av_exif_clone_ifd(), av_exif_free(), av_exif_set_entry(), av_frame_side_data_remove(), av_frame_side_data_remove_by_props(), av_parse_color(), avio_free_directory_entry(), cache_read(), calc_entropy(), color_string_to_rgba(), compute_alpha_vlcs(), create_entry(), dict_copy_entry(), dvdvideo_audio_stream_add(), dvdvideo_audio_stream_add_all(), dvdvideo_audio_stream_analyze(), dvdvideo_subp_stream_add(), dvdvideo_subp_stream_add_internal(), dvdvideo_subp_stream_analyze(), dvdvideo_video_stream_add(), dvdvideo_video_stream_analyze(), dvdvideo_video_stream_setup(), exif_attach_ifd(), exif_decode_tag(), exif_free_entry(), exif_get_ifd_size(), exif_ifd_to_dict(), exif_read_values(), exif_write_ifd(), exif_write_values(), ff_alloc_dir_entry(), ff_convert_lang_to(), ff_dnxhd_get_frame_size(), ff_dnxhd_get_hr_frame_size(), ff_exif_sanitize_ifd(), ff_get_pixfmt_from_fb_varinfo(), ff_hashtable_delete(), ff_hashtable_get(), ff_hashtable_set(), ff_parse_creation_time_metadata(), ff_queue_destroy(), ff_sws_uop_lookup(), ff_v4l2_m2m_codec_init(), fguv_32x32xn_c(), fgy_32x32xn_c(), fifo_thread_write_header(), flic_decode_frame_8BPP(), floor_encode(), gain_entry_compare(), generate_grain_uv_c(), generate_grain_y_c(), get_format_from_sample_fmt(), get_format_from_sample_fmt(), get_format_from_sample_fmt(), get_sample_flags(), h2645_sei_to_side_data(), id3_has_changed_values(), init(), input_callback(), libkvazaar_init(), libsmbc_read_dir(), libssh_read_dir(), list_op(), main(), mc_device_create(), mkv_assemble_cues(), mkv_write_seekhead(), mov_find_tref_tag(), mov_find_tref_tag(), mov_flush_fragment_interleaving(), mov_parse_vc1_frame(), mov_read_seek(), mov_write_tfrf_tag(), mxf_write_header_metadata_sets(), open_slave(), opt_show_entries(), pdv_read_header(), png_write_iccp(), pool_reset_entry(), print_entries(), put_codeword(), put_vector(), quantize_band_cost_cached(), rasm_free(), rasm_func_begin(), rasm_print(), refstruct_pool_uninit(), remove_side_data_by_entry(), residue_encode(), sample_lut(), segment_end(), segment_list_open(), select_voice(), side_data_exif_parse(), text_to_ass(), v4l2_get_device_list(), vc1_probe(), vgs_eval(), and write_header().

◆ bitdepth

◆ bitdepth_max

#define bitdepth_max   UINT8_MAX

Definition at line 68 of file aom_film_grain_template.c.

Referenced by fguv_32x32xn_c(), and fgy_32x32xn_c().

◆ HBD_DECL

◆ HBD_CALL

#define HBD_CALL

Definition at line 70 of file aom_film_grain_template.c.

Referenced by apply_film_grain(), and apply_grain_row().

◆ SCALING_SIZE

#define SCALING_SIZE   256

◆ 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);
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
static int round2(const int x, const uint64_t shift)
#define pixel
#define av_clip
Definition common.h:100
const char data[16]
Definition mxf.c:149
static int noise(AVBSFContext *ctx, AVPacket *pkt)
Definition noise.c:124
#define stride
#define src
Definition vp8dsp.c:248

Referenced by fgy_32x32xn_c().

◆ 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);
static double val(void *priv, double ch)
Definition aeval.c:77
#define bitdepth_max
#define avg(a, b, c, d)

Referenced by fguv_32x32xn_c().

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(), and generate_grain_y_c().

◆ 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(), and generate_grain_uv_c().

◆ 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(), fgy_32x32xn_c(), and sample_lut().

◆ 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(), and fgy_32x32xn_c().

◆ 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(), and fguv_32x32xn_c().

◆ 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(), and generate_scaling().

◆ 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(), and apply_grain_row().

◆ 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.

Referenced by apply_film_grain().