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
7748f395
Commit
7748f395
authored
Apr 04, 2018
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_select: use common scene sad functions
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
6c2a7a8e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
20 deletions
+8
-20
configure
configure
+1
-1
f_select.c
libavfilter/f_select.c
+7
-19
No files found.
configure
View file @
7748f395
...
...
@@ -3445,7 +3445,7 @@ sab_filter_deps="gpl swscale"
scale2ref_filter_deps
=
"swscale"
scale_filter_deps
=
"swscale"
scale_qsv_filter_deps
=
"libmfx"
select_filter_select
=
"
pixelutils
"
select_filter_select
=
"
scene_sad
"
sharpness_vaapi_filter_deps
=
"vaapi"
showcqt_filter_deps
=
"avcodec avformat swscale"
showcqt_filter_suggest
=
"libfontconfig libfreetype"
...
...
libavfilter/f_select.c
View file @
7748f395
...
...
@@ -28,12 +28,12 @@
#include "libavutil/fifo.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixelutils.h"
#include "avfilter.h"
#include "audio.h"
#include "formats.h"
#include "internal.h"
#include "video.h"
#include "scene_sad.h"
static
const
char
*
const
var_names
[]
=
{
"TB"
,
///< timebase
...
...
@@ -145,7 +145,7 @@ typedef struct SelectContext {
AVExpr
*
expr
;
double
var_values
[
VAR_VARS_NB
];
int
do_scene_detect
;
///< 1 if the expression requires scene detection variables, 0 otherwise
av_pixelutils_sad_fn
sad
;
///< Sum of the absolute difference function (scene detect only)
ff_scene_sad_fn
sad
;
///< Sum of the absolute difference function (scene detect only)
double
prev_mafd
;
///< previous MAFD (scene detect only)
AVFrame
*
prev_picref
;
///< previous frame (scene detect only)
double
select
;
...
...
@@ -242,7 +242,7 @@ static int config_input(AVFilterLink *inlink)
inlink
->
type
==
AVMEDIA_TYPE_AUDIO
?
inlink
->
sample_rate
:
NAN
;
if
(
select
->
do_scene_detect
)
{
select
->
sad
=
av_pixelutils_get_sad_fn
(
3
,
3
,
2
,
select
);
// 8x8 both sources aligned
select
->
sad
=
ff_scene_sad_get_fn
(
8
);
if
(
!
select
->
sad
)
return
AVERROR
(
EINVAL
);
}
...
...
@@ -258,24 +258,12 @@ static double get_scene_score(AVFilterContext *ctx, AVFrame *frame)
if
(
prev_picref
&&
frame
->
height
==
prev_picref
->
height
&&
frame
->
width
==
prev_picref
->
width
)
{
int
x
,
y
,
nb_sad
=
0
;
int64_t
sad
=
0
;
uint64_t
sad
;
double
mafd
,
diff
;
uint8_t
*
p1
=
frame
->
data
[
0
];
uint8_t
*
p2
=
prev_picref
->
data
[
0
];
const
int
p1_linesize
=
frame
->
linesize
[
0
];
const
int
p2_linesize
=
prev_picref
->
linesize
[
0
];
for
(
y
=
0
;
y
<
frame
->
height
-
7
;
y
+=
8
)
{
for
(
x
=
0
;
x
<
frame
->
width
*
3
-
7
;
x
+=
8
)
{
sad
+=
select
->
sad
(
p1
+
x
,
p1_linesize
,
p2
+
x
,
p2_linesize
);
nb_sad
+=
8
*
8
;
}
p1
+=
8
*
p1_linesize
;
p2
+=
8
*
p2_linesize
;
}
select
->
sad
(
prev_picref
->
data
[
0
],
prev_picref
->
linesize
[
0
],
frame
->
data
[
0
],
frame
->
linesize
[
0
],
frame
->
width
*
3
,
frame
->
height
,
&
sad
);
emms_c
();
mafd
=
nb_sad
?
(
double
)
sad
/
nb_sad
:
0
;
mafd
=
(
double
)
sad
/
(
frame
->
width
*
3
*
frame
->
height
)
;
diff
=
fabs
(
mafd
-
select
->
prev_mafd
);
ret
=
av_clipf
(
FFMIN
(
mafd
,
diff
)
/
100
.,
0
,
1
);
select
->
prev_mafd
=
mafd
;
...
...
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