xine-lib: xine-lib-1.2.13/src/post/planar/noise.c File Reference

xine-lib 1.2.13-20230125hg15249

Data Structures | Macros | Typedefs | Functions | Variables
noise.c File Reference
`#include "planar.h"`
`#include <xine/xine_internal.h>`
`#include <xine/post.h>`
`#include <xine/xineutils.h>`
`#include <math.h>`
`#include <pthread.h>`

## Data Structures
struct | noise_param_t
struct | noise_parameters_s

## Macros
#define | MAX_NOISE 4096
#define | MAX_SHIFT 1024
#define | MAX_RES (MAX_NOISE-MAX_SHIFT)
#define | RAND_N(range) ((int) ((double)range*rand()/(RAND_MAX+1.0)))

## Typedefs
typedef struct noise_param_t | noise_param_t
typedef struct post_plugin_noise_s | post_plugin_noise_t
typedef struct noise_parameters_s | noise_parameters_t

## Functions
static int8_t * | initNoise (noise_param_t *fp)
static void | lineNoise_C (uint8_t *dst, const uint8_t *src, const int8_t *noise, int len, int shift)
static void | lineNoiseAvg_C (uint8_t *dst, const uint8_t *src, int len, int8_t **shift)
static void | noise (uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int width, int height, noise_param_t *fp)
| PARAM_ITEM (PARAM_ITEM(POST_PARAM_TYPE_INT, luma_strength, PARAM_ITEM(NULL, PARAM_ITEM(0, PARAM_ITEM(100, PARAM_ITEM(0, "Amount of noise to add to luma channel")
static int | set_parameters (xine_post_t *this_gen, const void *param_gen)
static int | get_parameters (xine_post_t *this_gen, void *param_gen)
static xine_post_api_descr_t * | get_param_descr (void)
static char * | get_help (void)
static void | noise_dispose (post_plugin_t *this_gen)
static int | noise_intercept_frame (post_video_port_t *port, vo_frame_t *frame)
static int | noise_draw (vo_frame_t *frame, xine_stream_t *stream)
static post_plugin_t * | noise_open_plugin (post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target)
void * | noise_init_plugin (xine_t *xine, const void *data)

## Variables
static int | nonTempRandShift [(4096 - 1024)] = {-1}
static const int | patt [4]
static const char *const | enum_types [] = {"uniform", "gaussian", NULL}
static const char *const | enum_quality [] = {"fixed", "temporal", "averaged temporal", NULL}

## Macro Definition Documentation

## ◆ MAX_NOISE

#define MAX_NOISE 4096

Referenced by initNoise().

## ◆ MAX_RES

#define MAX_RES (MAX_NOISE-MAX_SHIFT)

Referenced by initNoise().

## ◆ MAX_SHIFT

#define MAX_SHIFT 1024

Referenced by initNoise(), and noise().

## ◆ RAND_N

#define RAND_N | ( |  | range | ) | ((int) ((double)range*rand()/(RAND_MAX+1.0)))

Referenced by initNoise().

## Typedef Documentation

## ◆ noise_param_t

typedef struct noise_param_t noise_param_t

## ◆ noise_parameters_t

typedef struct noise_parameters_s noise_parameters_t

## ◆ post_plugin_noise_t

typedef struct post_plugin_noise_s post_plugin_noise_t

## Function Documentation

## ◆ get_help()

static char * get_help | ( | void |  | ) |
| static

References _.

Referenced by noise_open_plugin().

## ◆ get_param_descr()

static xine_post_api_descr_t * get_param_descr | ( | void |  | ) |
| static

Referenced by noise_open_plugin().

## ◆ get_parameters()

static int get_parameters | ( | xine_post_t * | this_gen,
|  | void * | param_gen )
| static

References noise_parameters_s::chroma_strength, noise_parameters_s::luma_strength, noise_parameters_s::pattern, noise_parameters_s::quality, and noise_parameters_s::type.

Referenced by noise_open_plugin().

## ◆ initNoise()

static int8_t * initNoise | ( | noise_param_t * | fp | ) |
| static

References noise_param_t::averaged, MAX_NOISE, MAX_RES, MAX_SHIFT, noise(), noise_param_t::noise, nonTempRandShift, patt, noise_param_t::pattern, noise_param_t::prev_shift, RAND_N, noise_param_t::shiftptr, noise_param_t::strength, noise_param_t::uniform, and xine_mallocz_aligned().

Referenced by set_parameters().

## ◆ lineNoise_C()

static void lineNoise_C | ( | uint8_t * | dst,
|  | const uint8_t * | src,
|  | const int8_t * | noise,
|  | int | len,
|  | int | shift )
| inlinestatic

References noise(), and v.

Referenced by noise_open_plugin().

## ◆ lineNoiseAvg_C()

static void lineNoiseAvg_C | ( | uint8_t * | dst,
|  | const uint8_t * | src,
|  | int | len,
|  | int8_t ** | shift )
| inlinestatic

Referenced by noise_open_plugin().

## ◆ noise()

static void noise | ( | uint8_t * | dst,
|  | const uint8_t * | src,
|  | int | dstStride,
|  | int | srcStride,
|  | int | width,
|  | int | height,
|  | noise_param_t * | fp )
| static

References noise_param_t::averaged, height, noise_param_t::lineNoise, noise_param_t::lineNoiseAvg, MAX_SHIFT, noise(), noise_param_t::noise, nonTempRandShift, noise_param_t::prev_shift, noise_param_t::quality, noise_param_t::shiftptr, noise_param_t::temporal, and width.

Referenced by initNoise(), lineNoise_C(), lineNoise_MMX(), lineNoise_MMX2(), noise(), noise_dispose(), noise_draw(), vdpau_get_property(), vdpau_open_plugin(), vdpau_set_property(), and vdpau_update_prop().

## ◆ noise_dispose()

static void noise_dispose | ( | post_plugin_t * | this_gen | ) |
| static

References _x_post_dispose(), noise(), and xine_freep_aligned.

Referenced by noise_open_plugin().

## ◆ noise_draw()

static int noise_draw | ( | vo_frame_t * | frame,
|  | xine_stream_t * | stream )
| static

References _x_post_frame_copy_down(), _x_post_frame_copy_up(), vo_frame_s::bad_frame, vo_frame_s::base, vo_frame_s::draw, vo_frame_s::flags, vo_frame_s::format, vo_frame_s::free, xine_video_port_s::get_frame, vo_frame_s::height, vo_frame_s::lock, MM_ACCEL_X86_MMX, MM_ACCEL_X86_MMXEXT, vo_frame_s::next, noise(), post_video_port_s::original_port, vo_frame_s::pitches, vo_frame_s::port, post_video_port_s::post, vo_frame_s::ratio, VO_BOTH_FIELDS, vo_frame_s::width, XINE_IMGFMT_YV12, and xine_mm_accel().

Referenced by noise_open_plugin().

## ◆ noise_init_plugin()

void * noise_init_plugin | ( | xine_t * | xine,
|  | const void * | data )

References post_plugin_s::dispose, N_, noise_open_plugin(), NULL, and post_class_s::open_plugin.

## ◆ noise_intercept_frame()

static int noise_intercept_frame | ( | post_video_port_t * | port,
|  | vo_frame_t * | frame )
| static

References vo_frame_s::format, XINE_IMGFMT_YUY2, and XINE_IMGFMT_YV12.

Referenced by noise_open_plugin().

## ◆ noise_open_plugin()

static post_plugin_t * noise_open_plugin | ( | post_class_t * | class_gen,
|  | int | inputs,
|  | xine_audio_port_t ** | audio_target,
|  | xine_video_port_t ** | video_target )
| static

References _x_post_init(), _x_post_intercept_video_port(), vo_frame_s::draw, get_help(), get_param_descr(), get_parameters(), input(), post_video_port_s::intercept_frame, lineNoise_C(), lineNoise_MMX(), lineNoise_MMX2(), lineNoiseAvg_C(), lineNoiseAvg_MMX(), noise_parameters_s::luma_strength, MM_ACCEL_X86_MMX, MM_ACCEL_X86_MMXEXT, xine_post_in_s::name, xine_post_out_s::name, post_video_port_s::new_frame, post_video_port_s::new_port, noise_dispose(), noise_draw(), noise_intercept_frame(), NULL, set_parameters(), xine_post_api_t::set_parameters, xine_list_push_back(), xine_mm_accel(), post_out_s::xine_out, and XINE_POST_DATA_PARAMETERS.

Referenced by noise_init_plugin().

## ◆ PARAM_ITEM()

PARAM_ITEM | ( | PARAM_ITEM( | POST_PARAM_TYPE_INT,
|  | luma_strength | ,
|  | PARAM_ITEM( | NULL,
|  | PARAM_ITEM( | 0,
|  | PARAM_ITEM( | 100,
|  | PARAM_ITEM( | 0,
|  | "Amount of noise to add to luma channel" | )

## ◆ set_parameters()

static int set_parameters | ( | xine_post_t * | this_gen,
|  | const void * | param_gen )
| static

References noise_parameters_s::chroma_strength, initNoise(), noise_parameters_s::luma_strength, noise_parameters_s::pattern, noise_parameters_s::quality, and noise_parameters_s::type.

Referenced by noise_open_plugin().

## Variable Documentation

## ◆ enum_quality

const char* const enum_quality[] = {"fixed", "temporal", "averaged temporal", NULL}
| static

## ◆ enum_types

const char* const enum_types[] = {"uniform", "gaussian", NULL}
| static

## ◆ nonTempRandShift

int nonTempRandShift[(4096 - 1024)] = {-1}
| static

Referenced by initNoise(), and noise().

## ◆ patt

const int patt[4]
| static

Initial value:
= {
-1,0,1,0
}

Referenced by initNoise().