Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rav1e-import-test
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
87
Issues
87
List
Boards
Labels
Milestones
Merge Requests
19
Merge Requests
19
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
Marvin Scholz
rav1e-import-test
Commits
64c55950
Commit
64c55950
authored
May 10, 2019
by
Luca Barbato
Committed by
Luca Barbato
May 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the context inner allocation
parent
fdbdb227
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
33 deletions
+40
-33
src/api.rs
src/api.rs
+40
-33
No files found.
src/api.rs
View file @
64c55950
...
...
@@ -481,14 +481,6 @@ impl Config {
pub
fn
new_context
<
T
:
Pixel
>
(
&
self
)
->
Context
<
T
>
{
assert
!
(
8
*
std
::
mem
::
size_of
::
<
T
>
()
>=
self
.enc.bit_depth
,
"The Pixel u{} does not match the Config bit_depth {}"
,
8
*
std
::
mem
::
size_of
::
<
T
>
(),
self
.enc.bit_depth
);
// initialize with temporal delimiter
let
packet_data
=
TEMPORAL_DELIMITER
.to_vec
();
let
maybe_ac_qi_max
=
if
self
.enc.quantizer
<
255
{
Some
(
self
.enc.quantizer
as
u8
)
}
else
{
None
};
let
pool
=
rayon
::
ThreadPoolBuilder
::
new
()
.num_threads
(
self
.threads
)
.build
()
.unwrap
();
...
...
@@ -507,32 +499,10 @@ impl Config {
config
.speed_settings.rdo_tx_decision
=
false
;
}
let
inner
=
ContextInner
::
new
(
&
config
);
Context
{
inner
:
ContextInner
{
frame_count
:
0
,
limit
:
0
,
idx
:
0
,
frames_processed
:
0
,
frame_q
:
BTreeMap
::
new
(),
frame_invariants
:
BTreeMap
::
new
(),
keyframes
:
BTreeSet
::
new
(),
packet_data
,
segment_start_idx
:
0
,
segment_start_frame
:
0
,
keyframe_detector
:
SceneChangeDetector
::
new
(
self
.enc.bit_depth
),
config
:
self
.enc
.clone
(),
rc_state
:
RCState
::
new
(
self
.enc.width
as
i32
,
self
.enc.height
as
i32
,
self
.enc.time_base.num
as
i64
,
self
.enc.time_base.den
as
i64
,
self
.enc.bitrate
,
maybe_ac_qi_max
,
self
.enc.max_key_frame_interval
as
i32
),
maybe_prev_log_base_q
:
None
,
first_pass_data
:
FirstPassData
{
frames
:
Vec
::
new
()
},
},
inner
,
pool
,
config
}
...
...
@@ -677,6 +647,43 @@ impl<T: Pixel> Context<T> {
impl
<
T
:
Pixel
>
ContextInner
<
T
>
{
pub
fn
new
(
enc
:
&
EncoderConfig
)
->
Self
{
// initialize with temporal delimiter
let
packet_data
=
TEMPORAL_DELIMITER
.to_vec
();
let
maybe_ac_qi_max
=
if
enc
.quantizer
<
255
{
Some
(
enc
.quantizer
as
u8
)
}
else
{
None
};
ContextInner
{
frame_count
:
0
,
limit
:
0
,
idx
:
0
,
frames_processed
:
0
,
frame_q
:
BTreeMap
::
new
(),
frame_invariants
:
BTreeMap
::
new
(),
keyframes
:
BTreeSet
::
new
(),
packet_data
,
segment_start_idx
:
0
,
segment_start_frame
:
0
,
keyframe_detector
:
SceneChangeDetector
::
new
(
enc
.bit_depth
),
config
:
enc
.clone
(),
rc_state
:
RCState
::
new
(
enc
.width
as
i32
,
enc
.height
as
i32
,
enc
.time_base.num
as
i64
,
enc
.time_base.den
as
i64
,
enc
.bitrate
,
maybe_ac_qi_max
,
enc
.max_key_frame_interval
as
i32
),
maybe_prev_log_base_q
:
None
,
first_pass_data
:
FirstPassData
{
frames
:
Vec
::
new
()
},
}
}
pub
fn
send_frame
<
F
>
(
&
mut
self
,
frame
:
F
)
->
Result
<
(),
EncoderStatus
>
where
F
:
Into
<
Option
<
Arc
<
Frame
<
T
>>>>
...
...
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