FFmpeg
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Data Structures | Macros | Enumerations | Functions | Variables
h274.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/bswap.h"
#include "libavutil/crc.h"
#include "libavutil/imgutils.h"
#include "libavutil/md5.h"
#include "libavutil/mem.h"
#include "h274.h"

Go to the source code of this file.

Data Structures

struct  H274HashContext
 

Macros

#define MD5_SIZE   16
 
#define CAL_CHECKSUM(pixel)   ((pixel) ^ xor_mask)
 

Enumerations

enum  { HASH_MD5SUM, HASH_CRC, HASH_CHECKSUM, HASH_LAST = HASH_CHECKSUM }
 

Functions

static void prng_shift (uint32_t *state)
 
static void init_slice_c (int8_t out[64][64], uint8_t h, uint8_t v, int16_t tmp[64][64])
 
static void init_slice (H274FilmGrainDatabase *database, uint8_t h, uint8_t v)
 
static uint16_t avg_8x8_c (const uint8_t *in, int in_stride)
 
static void synth_grain_8x8_c (int8_t *out, const int out_stride, const int16_t scale, const uint8_t shift, const int8_t *db)
 
static void deblock_8x8_c (int8_t *out, const int out_stride)
 
static av_always_inline void generate (int8_t *out, int out_stride, const uint8_t *in, int in_stride, H274FilmGrainDatabase *database, const AVFilmGrainH274Params *h274, int c, int invert, int deblock, int y_offset, int x_offset)
 
static void add_8x8_clip_c (uint8_t *out, const uint8_t *a, const int8_t *b, int n)
 
int ff_h274_apply_film_grain (AVFrame *out_frame, const AVFrame *in_frame, H274FilmGrainDatabase *database, const AVFilmGrainParams *params)
 
static int verify_plane_md5 (struct AVMD5 *ctx, const uint8_t *src, const int w, const int h, const int stride, const uint8_t *expected)
 
static int verify_plane_crc (const uint8_t *src, const int w, const int h, const int stride, uint16_t expected)
 
static int verify_plane_checksum (const uint8_t *src, const int w, const int h, const int stride, const int ps, uint32_t expected)
 
void ff_h274_hash_freep (H274HashContext **ctx)
 
int ff_h274_hash_init (H274HashContext **ctx, const int type)
 
int ff_h274_hash_verify (H274HashContext *c, const H274SEIPictureHash *hash, const AVFrame *frame, const int coded_width, const int coded_height)
 

Variables

static const int8_t Gaussian_LUT [2048+4]
 
static const uint32_t Seed_LUT [256]
 
static const int8_t R64T [64][64]
 

Detailed Description

H.274 film grain synthesis.

Author
Niklas Haas ffmpe.nosp@m.g@ha.nosp@m.asn.x.nosp@m.yz

Definition in file h274.c.

Macro Definition Documentation

◆ MD5_SIZE

#define MD5_SIZE   16

◆ CAL_CHECKSUM

#define CAL_CHECKSUM (   pixel)    ((pixel) ^ xor_mask)

Definition at line 836 of file h274.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
HASH_MD5SUM 
HASH_CRC 
HASH_CHECKSUM 
HASH_LAST 

Definition at line 859 of file h274.c.

Function Documentation

◆ prng_shift()

static void prng_shift ( uint32_t *  state)
static

Definition at line 41 of file h274.c.

Referenced by ff_h274_apply_film_grain(), and init_slice_c().

◆ init_slice_c()

static void init_slice_c ( int8_t  out[64][64],
uint8_t  h,
uint8_t  v,
int16_t  tmp[64][64] 
)
static

Definition at line 49 of file h274.c.

Referenced by init_slice().

◆ init_slice()

static void init_slice ( H274FilmGrainDatabase database,
uint8_t  h,
uint8_t  v 
)
static

Definition at line 108 of file h274.c.

Referenced by generate().

◆ avg_8x8_c()

static uint16_t avg_8x8_c ( const uint8_t *  in,
int  in_stride 
)
static

Definition at line 118 of file h274.c.

Referenced by generate().

◆ synth_grain_8x8_c()

static void synth_grain_8x8_c ( int8_t *  out,
const int  out_stride,
const int16_t  scale,
const uint8_t  shift,
const int8_t *  db 
)
static

Definition at line 133 of file h274.c.

Referenced by generate().

◆ deblock_8x8_c()

static void deblock_8x8_c ( int8_t *  out,
const int  out_stride 
)
static

Definition at line 147 of file h274.c.

Referenced by generate().

◆ generate()

static av_always_inline void generate ( int8_t *  out,
int  out_stride,
const uint8_t *  in,
int  in_stride,
H274FilmGrainDatabase database,
const AVFilmGrainH274Params h274,
int  c,
int  invert,
int  deblock,
int  y_offset,
int  x_offset 
)
static

Definition at line 160 of file h274.c.

Referenced by ff_h274_apply_film_grain().

◆ add_8x8_clip_c()

static void add_8x8_clip_c ( uint8_t *  out,
const uint8_t *  a,
const int8_t *  b,
int  n 
)
static

Definition at line 214 of file h274.c.

Referenced by ff_h274_apply_film_grain().

◆ ff_h274_apply_film_grain()

int ff_h274_apply_film_grain ( AVFrame out_frame,
const AVFrame in_frame,
H274FilmGrainDatabase database,
const AVFilmGrainParams params 
)

Definition at line 221 of file h274.c.

Referenced by ff_h264_field_end(), frame_end(), and hevc_frame_end().

◆ verify_plane_md5()

static int verify_plane_md5 ( struct AVMD5 ctx,
const uint8_t *  src,
const int  w,
const int  h,
const int  stride,
const uint8_t *  expected 
)
static

Definition at line 798 of file h274.c.

Referenced by ff_h274_hash_verify().

◆ verify_plane_crc()

static int verify_plane_crc ( const uint8_t *  src,
const int  w,
const int  h,
const int  stride,
uint16_t  expected 
)
static

Definition at line 817 of file h274.c.

Referenced by ff_h274_hash_verify().

◆ verify_plane_checksum()

static int verify_plane_checksum ( const uint8_t *  src,
const int  w,
const int  h,
const int  stride,
const int  ps,
uint32_t  expected 
)
static

Definition at line 837 of file h274.c.

Referenced by ff_h274_hash_verify().

◆ ff_h274_hash_freep()

void ff_h274_hash_freep ( H274HashContext **  ctx)

Definition at line 871 of file h274.c.

Referenced by vvc_decode_free().

◆ ff_h274_hash_init()

int ff_h274_hash_init ( H274HashContext **  ctx,
const int  type 
)

Definition at line 881 of file h274.c.

Referenced by frame_end().

◆ ff_h274_hash_verify()

int ff_h274_hash_verify ( H274HashContext c,
const H274SEIPictureHash hash,
const AVFrame frame,
const int  coded_width,
const int  coded_height 
)

Definition at line 912 of file h274.c.

Referenced by frame_end().

Variable Documentation

◆ Gaussian_LUT

static const int8_t Gaussian_LUT
static

Definition at line 37 of file h274.c.

Referenced by init_slice_c().

◆ Seed_LUT

static const uint32_t Seed_LUT
static

Definition at line 38 of file h274.c.

Referenced by ff_h274_apply_film_grain(), and init_slice_c().

◆ R64T

static const int8_t R64T
static

Definition at line 39 of file h274.c.

Referenced by init_slice_c().