Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rav1e
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timothy B. Terriberry
rav1e
Commits
34c6cc9a
Commit
34c6cc9a
authored
6 years ago
by
Michael Bebenita
Browse files
Options
Downloads
Patches
Plain Diff
Format and disable cdef dist until we wire up the tune config param.
parent
71e29b68
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plane.rs
+1
-5
1 addition, 5 deletions
src/plane.rs
src/rdo.rs
+18
-10
18 additions, 10 deletions
src/rdo.rs
with
19 additions
and
15 deletions
src/plane.rs
+
1
−
5
View file @
34c6cc9a
...
...
@@ -85,11 +85,7 @@ impl<'a> PlaneSlice<'a> {
}
pub
fn
subslice
(
&
'a
self
,
xo
:
usize
,
yo
:
usize
)
->
PlaneSlice
<
'a
>
{
PlaneSlice
{
plane
:
self
.plane
,
x
:
self
.x
+
xo
,
y
:
self
.y
+
yo
}
PlaneSlice
{
plane
:
self
.plane
,
x
:
self
.x
+
xo
,
y
:
self
.y
+
yo
}
}
/// A slice starting i pixels above the current one.
...
...
This diff is collapsed.
Click to expand it.
src/rdo.rs
+
18
−
10
View file @
34c6cc9a
...
...
@@ -19,13 +19,13 @@ use plane::*;
use
predict
::{
RAV1E_INTRA_MODES
,
RAV1E_INTRA_MODES_MINIMAL
};
use
quantize
::
dc_q
;
use
std
;
use
std
::
f64
;
use
std
::
vec
::
Vec
;
use
write_tx_blocks
;
use
BlockSize
;
use
FrameInvariants
;
use
FrameState
;
use
FrameType
;
use
std
::
f64
;
#[derive(Clone)]
pub
struct
RDOOutput
{
...
...
@@ -43,6 +43,7 @@ pub struct RDOPartitionOutput {
pub
skip
:
bool
}
#[allow(unused)]
fn
cdef_dist_wxh_8x8
(
src1
:
&
PlaneSlice
,
src2
:
&
PlaneSlice
)
->
u64
{
//TODO: Handle high bit-depth here by setting coeff_shift
let
coeff_shift
=
0
;
...
...
@@ -57,24 +58,31 @@ fn cdef_dist_wxh_8x8(src1: &PlaneSlice, src2: &PlaneSlice) -> u64 {
let
d
=
src2
.p
(
i
,
j
)
as
i32
;
sum_s
+=
s
;
sum_d
+=
d
;
sum_s2
+=
(
s
*
s
)
as
i64
;
sum_d2
+=
(
d
*
d
)
as
i64
;
sum_sd
+=
(
s
*
d
)
as
i64
;
sum_s2
+=
(
s
*
s
)
as
i64
;
sum_d2
+=
(
d
*
d
)
as
i64
;
sum_sd
+=
(
s
*
d
)
as
i64
;
}
}
let
svar
=
(
sum_s2
-
((
sum_s
as
i64
*
sum_s
as
i64
+
32
)
>>
6
))
as
f64
;
let
dvar
=
(
sum_d2
-
((
sum_d
as
i64
*
sum_d
as
i64
+
32
)
>>
6
))
as
f64
;
let
sse
=
(
sum_d2
+
sum_s2
-
2
*
sum_sd
)
as
f64
;
//The two constants were tuned for CDEF, but can probably be better tuned for use in general RDO
let
ssim_boost
=
0.5_f64
*
(
svar
+
dvar
+
(
400
<<
2
*
coeff_shift
)
as
f64
)
/
f64
::
sqrt
((
20000
<<
4
*
coeff_shift
)
as
f64
+
svar
*
dvar
);
let
ssim_boost
=
0.5_f64
*
(
svar
+
dvar
+
(
400
<<
2
*
coeff_shift
)
as
f64
)
/
f64
::
sqrt
((
20000
<<
4
*
coeff_shift
)
as
f64
+
svar
*
dvar
);
(
sse
*
ssim_boost
+
0.5_f64
)
as
u64
}
fn
cdef_dist_wxh
(
src1
:
&
PlaneSlice
,
src2
:
&
PlaneSlice
,
w
:
usize
,
h
:
usize
)
->
u64
{
#[allow(unused)]
fn
cdef_dist_wxh
(
src1
:
&
PlaneSlice
,
src2
:
&
PlaneSlice
,
w
:
usize
,
h
:
usize
)
->
u64
{
let
mut
sum
:
u64
=
0
;
for
j
in
0
..
h
/
8
{
for
i
in
0
..
w
/
8
{
sum
+=
cdef_dist_wxh_8x8
(
&
src1
.subslice
(
i
*
8
,
j
*
8
),
&
src2
.subslice
(
i
*
8
,
j
*
8
))
for
j
in
0
..
h
/
8
{
for
i
in
0
..
w
/
8
{
sum
+=
cdef_dist_wxh_8x8
(
&
src1
.subslice
(
i
*
8
,
j
*
8
),
&
src2
.subslice
(
i
*
8
,
j
*
8
)
)
}
}
sum
...
...
@@ -109,7 +117,7 @@ fn compute_rd_cost(
// Compute distortion
let
po
=
bo
.plane_offset
(
&
fs
.input.planes
[
0
]
.cfg
);
let
mut
distortion
=
cdef_dist
_wxh
(
let
mut
distortion
=
sse
_wxh
(
&
fs
.input.planes
[
0
]
.slice
(
&
po
),
&
fs
.rec.planes
[
0
]
.slice
(
&
po
),
w_y
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment