Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
8c747d46
Commit
8c747d46
authored
Feb 25, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vf_hqdn3d: switch to an AVOptions-based system.
parent
7ed833d7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
49 deletions
+40
-49
filters.texi
doc/filters.texi
+0
-1
vf_hqdn3d.c
libavfilter/vf_hqdn3d.c
+32
-48
vf_hqdn3d.h
libavfilter/vf_hqdn3d.h
+8
-0
No files found.
doc/filters.texi
View file @
8c747d46
...
...
@@ -1216,7 +1216,6 @@ image noise producing smooth images and making still images really
still. It should enhance compressibility.
It accepts the following optional parameters:
@var{luma_spatial}:@var{chroma_spatial}:@var{luma_tmp}:@var{chroma_tmp}
@table @option
@item luma_spatial
...
...
libavfilter/vf_hqdn3d.c
View file @
8c747d46
...
...
@@ -26,10 +26,14 @@
* libmpcodecs/vf_hqdn3d.c.
*/
#include <float.h>
#include "config.h"
#include "libavutil/common.h"
#include "libavutil/pixdesc.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
...
...
@@ -180,57 +184,19 @@ static int16_t *precalc_coefs(double dist25, int depth)
static
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
{
HQDN3DContext
*
hqdn3d
=
ctx
->
priv
;
double
lum_spac
,
lum_tmp
,
chrom_spac
,
chrom_tmp
;
double
param1
,
param2
,
param3
,
param4
;
lum_spac
=
PARAM1_DEFAULT
;
chrom_spac
=
PARAM2_DEFAULT
;
lum_tmp
=
PARAM3_DEFAULT
;
chrom_tmp
=
lum_tmp
*
chrom_spac
/
lum_spac
;
if
(
args
)
{
switch
(
sscanf
(
args
,
"%lf:%lf:%lf:%lf"
,
&
param1
,
&
param2
,
&
param3
,
&
param4
))
{
case
1
:
lum_spac
=
param1
;
chrom_spac
=
PARAM2_DEFAULT
*
param1
/
PARAM1_DEFAULT
;
lum_tmp
=
PARAM3_DEFAULT
*
param1
/
PARAM1_DEFAULT
;
chrom_tmp
=
lum_tmp
*
chrom_spac
/
lum_spac
;
break
;
case
2
:
lum_spac
=
param1
;
chrom_spac
=
param2
;
lum_tmp
=
PARAM3_DEFAULT
*
param1
/
PARAM1_DEFAULT
;
chrom_tmp
=
lum_tmp
*
chrom_spac
/
lum_spac
;
break
;
case
3
:
lum_spac
=
param1
;
chrom_spac
=
param2
;
lum_tmp
=
param3
;
chrom_tmp
=
lum_tmp
*
chrom_spac
/
lum_spac
;
break
;
case
4
:
lum_spac
=
param1
;
chrom_spac
=
param2
;
lum_tmp
=
param3
;
chrom_tmp
=
param4
;
break
;
}
}
hqdn3d
->
strength
[
0
]
=
lum_spac
;
hqdn3d
->
strength
[
1
]
=
lum_tmp
;
hqdn3d
->
strength
[
2
]
=
chrom_spac
;
hqdn3d
->
strength
[
3
]
=
chrom_tmp
;
if
(
!
hqdn3d
->
strength
[
LUMA_SPATIAL
])
hqdn3d
->
strength
[
LUMA_SPATIAL
]
=
PARAM1_DEFAULT
;
if
(
!
hqdn3d
->
strength
[
CHROMA_SPATIAL
])
hqdn3d
->
strength
[
CHROMA_SPATIAL
]
=
PARAM2_DEFAULT
*
hqdn3d
->
strength
[
LUMA_SPATIAL
]
/
PARAM1_DEFAULT
;
if
(
!
hqdn3d
->
strength
[
LUMA_TMP
])
hqdn3d
->
strength
[
LUMA_TMP
]
=
PARAM3_DEFAULT
*
hqdn3d
->
strength
[
LUMA_SPATIAL
]
/
PARAM1_DEFAULT
;
if
(
!
hqdn3d
->
strength
[
CHROMA_TMP
])
hqdn3d
->
strength
[
CHROMA_TMP
]
=
hqdn3d
->
strength
[
LUMA_TMP
]
*
hqdn3d
->
strength
[
CHROMA_SPATIAL
]
/
hqdn3d
->
strength
[
LUMA_SPATIAL
];
av_log
(
ctx
,
AV_LOG_VERBOSE
,
"ls:%f cs:%f lt:%f ct:%f
\n
"
,
lum_spac
,
chrom_spac
,
lum_tmp
,
chrom_tmp
);
if
(
lum_spac
<
0
||
chrom_spac
<
0
||
isnan
(
chrom_tmp
))
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid negative value for luma or chroma spatial strength, "
"or resulting value for chroma temporal strength is nan.
\n
"
);
return
AVERROR
(
EINVAL
);
}
hqdn3d
->
strength
[
LUMA_SPATIAL
],
hqdn3d
->
strength
[
CHROMA_SPATIAL
],
hqdn3d
->
strength
[
LUMA_TMP
],
hqdn3d
->
strength
[
CHROMA_TMP
]);
return
0
;
}
...
...
@@ -343,6 +309,23 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
return
ff_filter_frame
(
outlink
,
out
);
}
#define OFFSET(x) offsetof(HQDN3DContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM
static
const
AVOption
options
[]
=
{
{
"luma_spatial"
,
"spatial luma strength"
,
OFFSET
(
strength
[
LUMA_SPATIAL
]),
AV_OPT_TYPE_DOUBLE
,
{
.
dbl
=
0
.
0
},
0
,
DBL_MAX
,
FLAGS
},
{
"chroma_spatial"
,
"spatial chroma strength"
,
OFFSET
(
strength
[
CHROMA_SPATIAL
]),
AV_OPT_TYPE_DOUBLE
,
{
.
dbl
=
0
.
0
},
0
,
DBL_MAX
,
FLAGS
},
{
"luma_tmp"
,
"temporal luma strength"
,
OFFSET
(
strength
[
LUMA_TMP
]),
AV_OPT_TYPE_DOUBLE
,
{
.
dbl
=
0
.
0
},
0
,
DBL_MAX
,
FLAGS
},
{
"chroma_tmp"
,
"temporal chroma strength"
,
OFFSET
(
strength
[
CHROMA_TMP
]),
AV_OPT_TYPE_DOUBLE
,
{
.
dbl
=
0
.
0
},
0
,
DBL_MAX
,
FLAGS
},
{
NULL
},
};
static
const
AVClass
hqdn3d_class
=
{
.
class_name
=
"hqdn3d"
,
.
item_name
=
av_default_item_name
,
.
option
=
options
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
static
const
AVFilterPad
avfilter_vf_hqdn3d_inputs
[]
=
{
{
.
name
=
"default"
,
...
...
@@ -366,6 +349,7 @@ AVFilter avfilter_vf_hqdn3d = {
.
description
=
NULL_IF_CONFIG_SMALL
(
"Apply a High Quality 3D Denoiser."
),
.
priv_size
=
sizeof
(
HQDN3DContext
),
.
priv_class
=
&
hqdn3d_class
,
.
init
=
init
,
.
uninit
=
uninit
,
.
query_formats
=
query_formats
,
...
...
libavfilter/vf_hqdn3d.h
View file @
8c747d46
...
...
@@ -22,7 +22,10 @@
#include <stddef.h>
#include <stdint.h>
#include "libavutil/opt.h"
typedef
struct
{
const
AVClass
*
class
;
int16_t
*
coefs
[
4
];
uint16_t
*
line
;
uint16_t
*
frame_prev
[
3
];
...
...
@@ -32,6 +35,11 @@ typedef struct {
void
(
*
denoise_row
[
17
])(
uint8_t
*
src
,
uint8_t
*
dst
,
uint16_t
*
line_ant
,
uint16_t
*
frame_ant
,
ptrdiff_t
w
,
int16_t
*
spatial
,
int16_t
*
temporal
);
}
HQDN3DContext
;
#define LUMA_SPATIAL 0
#define LUMA_TMP 1
#define CHROMA_SPATIAL 2
#define CHROMA_TMP 3
void
ff_hqdn3d_init_x86
(
HQDN3DContext
*
hqdn3d
);
#endif
/* AVFILTER_VF_HQDN3D_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment