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
57ede2a5
Commit
57ede2a5
authored
Jan 13, 2015
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi: use ff_norm_qscale(), factorize
parent
b23a8668
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
40 deletions
+3
-40
vf_fspp.c
libavfilter/vf_fspp.c
+1
-13
vf_spp.c
libavfilter/vf_spp.c
+1
-13
vf_uspp.c
libavfilter/vf_uspp.c
+1
-14
No files found.
libavfilter/vf_fspp.c
View file @
57ede2a5
...
...
@@ -40,7 +40,6 @@
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "internal.h"
#include "libavcodec/avcodec.h" //for reference to FF_QSCALE_TYPE
#include "vf_fspp.h"
#define OFFSET(x) offsetof(FSPPContext, x)
...
...
@@ -80,17 +79,6 @@ static const short custom_threshold[64] = {
20
,
27
,
26
,
23
,
20
,
15
,
11
,
5
};
static
inline
int
norm_qscale
(
int
qscale
,
int
type
)
{
switch
(
type
)
{
case
FF_QSCALE_TYPE_MPEG1
:
return
qscale
;
case
FF_QSCALE_TYPE_MPEG2
:
return
qscale
>>
1
;
case
FF_QSCALE_TYPE_H264
:
return
qscale
>>
2
;
case
FF_QSCALE_TYPE_VP56
:
return
(
63
-
qscale
+
2
)
>>
2
;
}
return
qscale
;
}
//This func reads from 1 slice, 1 and clears 0 & 1
static
void
store_slice_c
(
uint8_t
*
dst
,
int16_t
*
src
,
ptrdiff_t
dst_stride
,
ptrdiff_t
src_stride
,
...
...
@@ -218,7 +206,7 @@ static void filter(FSPPContext *p, uint8_t *dst, uint8_t *src,
if
(
t
<
0
)
t
=
0
;
//t always < width-2
t
=
qp_store
[
qy
+
(
t
>>
qpsh
)];
t
=
norm_qscale
(
t
,
p
->
qscale_type
);
t
=
ff_
norm_qscale
(
t
,
p
->
qscale_type
);
if
(
t
!=
p
->
prev_q
)
p
->
prev_q
=
t
,
p
->
mul_thrmat
((
int16_t
*
)(
&
p
->
threshold_mtx_noq
[
0
]),
(
int16_t
*
)(
&
p
->
threshold_mtx
[
0
]),
t
);
p
->
column_fidct
((
int16_t
*
)(
&
p
->
threshold_mtx
[
0
]),
block
+
x
*
8
,
block3
+
x
*
8
,
8
);
//yes, this is a HOTSPOT
...
...
libavfilter/vf_spp.c
View file @
57ede2a5
...
...
@@ -229,18 +229,6 @@ static inline void add_block(uint16_t *dst, int linesize, const int16_t block[64
}
}
// XXX: export the function?
static
inline
int
norm_qscale
(
int
qscale
,
int
type
)
{
switch
(
type
)
{
case
FF_QSCALE_TYPE_MPEG1
:
return
qscale
;
case
FF_QSCALE_TYPE_MPEG2
:
return
qscale
>>
1
;
case
FF_QSCALE_TYPE_H264
:
return
qscale
>>
2
;
case
FF_QSCALE_TYPE_VP56
:
return
(
63
-
qscale
+
2
)
>>
2
;
}
return
qscale
;
}
static
void
filter
(
SPPContext
*
p
,
uint8_t
*
dst
,
uint8_t
*
src
,
int
dst_linesize
,
int
src_linesize
,
int
width
,
int
height
,
const
uint8_t
*
qp_table
,
int
qp_stride
,
int
is_luma
,
int
depth
)
...
...
@@ -284,7 +272,7 @@ static void filter(SPPContext *p, uint8_t *dst, uint8_t *src,
}
else
{
const
int
qps
=
3
+
is_luma
;
qp
=
qp_table
[(
FFMIN
(
x
,
width
-
1
)
>>
qps
)
+
(
FFMIN
(
y
,
height
-
1
)
>>
qps
)
*
qp_stride
];
qp
=
FFMAX
(
1
,
norm_qscale
(
qp
,
p
->
qscale_type
));
qp
=
FFMAX
(
1
,
ff_
norm_qscale
(
qp
,
p
->
qscale_type
));
}
for
(
i
=
0
;
i
<
count
;
i
++
)
{
const
int
x1
=
x
+
offset
[
i
+
count
-
1
][
0
];
...
...
libavfilter/vf_uspp.c
View file @
57ede2a5
...
...
@@ -32,7 +32,6 @@
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "internal.h"
#include "libavcodec/avcodec.h"
#include "avfilter.h"
#define MAX_LEVEL 8
/* quality levels */
...
...
@@ -181,18 +180,6 @@ static void store_slice_c(uint8_t *dst, const uint16_t *src,
}
}
static
inline
int
norm_qscale
(
int
qscale
,
int
type
)
{
switch
(
type
)
{
case
FF_QSCALE_TYPE_MPEG1
:
return
qscale
;
case
FF_QSCALE_TYPE_MPEG2
:
return
qscale
>>
1
;
case
FF_QSCALE_TYPE_H264
:
return
qscale
>>
2
;
case
FF_QSCALE_TYPE_VP56
:
return
(
63
-
qscale
+
2
)
>>
2
;
default:
av_assert0
(
0
);
}
return
qscale
;
}
static
void
filter
(
USPPContext
*
p
,
uint8_t
*
dst
[
3
],
uint8_t
*
src
[
3
],
int
dst_stride
[
3
],
int
src_stride
[
3
],
int
width
,
int
height
,
uint8_t
*
qp_store
,
int
qp_stride
)
...
...
@@ -237,7 +224,7 @@ static void filter(USPPContext *p, uint8_t *dst[3], uint8_t *src[3],
for
(
x
=
0
;
x
<
(
width
>>
4
);
x
++
)
qpsum
+=
qp_store
[
x
+
y
*
qp_stride
];
}
p
->
frame
->
quality
=
norm_qscale
((
qpsum
+
qpcount
/
2
)
/
qpcount
,
p
->
qscale_type
)
*
FF_QP2LAMBDA
;
p
->
frame
->
quality
=
ff_
norm_qscale
((
qpsum
+
qpcount
/
2
)
/
qpcount
,
p
->
qscale_type
)
*
FF_QP2LAMBDA
;
}
// init per MB qscale stuff FIXME
p
->
frame
->
height
=
height
;
...
...
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