Go to the source code of this file.
|
static av_always_inline uint32_t | lowpass (int prev, int cur, int16_t *coef, int depth) |
|
static av_always_inline void | denoise_temporal (uint8_t *src, uint8_t *dst, uint16_t *frame_ant, int w, int h, int sstride, int dstride, int16_t *temporal, int depth) |
|
static av_always_inline void | denoise_spatial (HQDN3DContext *s, uint8_t *src, uint8_t *dst, uint16_t *line_ant, uint16_t *frame_ant, int w, int h, int sstride, int dstride, int16_t *spatial, int16_t *temporal, int depth) |
|
static av_always_inline int | denoise_depth (HQDN3DContext *s, uint8_t *src, uint8_t *dst, uint16_t *line_ant, uint16_t **frame_ant_ptr, int w, int h, int sstride, int dstride, int16_t *spatial, int16_t *temporal, int depth) |
|
static void | precalc_coefs (double dist25, int depth, int16_t *ct) |
|
static av_cold int | init (AVFilterContext *ctx) |
|
static av_cold void | uninit (AVFilterContext *ctx) |
|
static int | query_formats (AVFilterContext *ctx) |
|
static void | calc_coefs (AVFilterContext *ctx) |
|
static int | config_input (AVFilterLink *inlink) |
|
static int | do_denoise (AVFilterContext *ctx, void *data, int job_nr, int n_jobs) |
|
static int | filter_frame (AVFilterLink *inlink, AVFrame *in) |
|
static int | process_command (AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags) |
|
| AVFILTER_DEFINE_CLASS (hqdn3d) |
|
high quality 3d video denoiser, ported from MPlayer libmpcodecs/vf_hqdn3d.c.
Definition in file vf_hqdn3d.c.
◆ LUT_BITS
#define LUT_BITS (depth==16 ? 8 : 4) |
◆ LOAD
Value:
+ (((1 << (16 - depth)) - 1) >> 1))
Definition at line 45 of file vf_hqdn3d.c.
◆ STORE
Value: (depth == 8 ? dst[x] = (
val) >> (16 - depth) : \
AV_WN16A(dst + (x) * 2, (
val) >> (16 - depth)))
Definition at line 47 of file vf_hqdn3d.c.
◆ denoise
Value: do { \
} \
} \
} while (0)
Definition at line 156 of file vf_hqdn3d.c.
◆ PARAM1_DEFAULT
#define PARAM1_DEFAULT 4.0 |
◆ PARAM2_DEFAULT
#define PARAM2_DEFAULT 3.0 |
◆ PARAM3_DEFAULT
#define PARAM3_DEFAULT 6.0 |
◆ OFFSET
◆ FLAGS
◆ lowpass()
◆ denoise_temporal()
◆ denoise_spatial()
static av_always_inline void denoise_spatial |
( |
HQDN3DContext * |
s, |
|
|
uint8_t * |
src, |
|
|
uint8_t * |
dst, |
|
|
uint16_t * |
line_ant, |
|
|
uint16_t * |
frame_ant, |
|
|
int |
w, |
|
|
int |
h, |
|
|
int |
sstride, |
|
|
int |
dstride, |
|
|
int16_t * |
spatial, |
|
|
int16_t * |
temporal, |
|
|
int |
depth |
|
) |
| |
|
static |
◆ denoise_depth()
static av_always_inline int denoise_depth |
( |
HQDN3DContext * |
s, |
|
|
uint8_t * |
src, |
|
|
uint8_t * |
dst, |
|
|
uint16_t * |
line_ant, |
|
|
uint16_t ** |
frame_ant_ptr, |
|
|
int |
w, |
|
|
int |
h, |
|
|
int |
sstride, |
|
|
int |
dstride, |
|
|
int16_t * |
spatial, |
|
|
int16_t * |
temporal, |
|
|
int |
depth |
|
) |
| |
|
static |
◆ precalc_coefs()
static void precalc_coefs |
( |
double |
dist25, |
|
|
int |
depth, |
|
|
int16_t * |
ct |
|
) |
| |
|
static |
◆ init()
◆ uninit()
◆ query_formats()
◆ calc_coefs()
◆ config_input()
◆ do_denoise()
◆ filter_frame()
◆ process_command()
static int process_command |
( |
AVFilterContext * |
ctx, |
|
|
const char * |
cmd, |
|
|
const char * |
args, |
|
|
char * |
res, |
|
|
int |
res_len, |
|
|
int |
flags |
|
) |
| |
|
static |
◆ AVFILTER_DEFINE_CLASS()
AVFILTER_DEFINE_CLASS |
( |
hqdn3d |
| ) |
|
◆ hqdn3d_options
◆ avfilter_vf_hqdn3d_inputs
Initial value:= {
{
.name = "default",
},
}
Definition at line 382 of file vf_hqdn3d.c.
◆ avfilter_vf_hqdn3d_outputs
Initial value:= {
{
.name = "default",
},
}
Definition at line 393 of file vf_hqdn3d.c.
◆ ff_vf_hqdn3d
Initial value:= {
.name = "hqdn3d",
.priv_class = &hqdn3d_class,
}
Definition at line 401 of file vf_hqdn3d.c.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
static av_always_inline int denoise_depth(HQDN3DContext *s, uint8_t *src, uint8_t *dst, uint16_t *line_ant, uint16_t **frame_ant_ptr, int w, int h, int sstride, int dstride, int16_t *spatial, int16_t *temporal, int depth)