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
b942e6b1
Commit
b942e6b1
authored
6 years ago
by
Luca Barbato
Committed by
Luca Barbato
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Update the decode tests to the current user api
parent
f593320a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test_encode_decode.rs
+20
-25
20 additions, 25 deletions
src/test_encode_decode.rs
with
20 additions
and
25 deletions
src/test_encode_decode.rs
+
20
−
25
View file @
b942e6b1
...
...
@@ -57,24 +57,28 @@ use std::sync::Arc;
}
fn
setup_encoder
(
w
:
usize
,
h
:
usize
,
speed
:
usize
,
quantizer
:
usize
,
bit_depth
:
usize
,
chroma_sampling
:
ChromaSampling
)
->
(
FrameInvariants
,
Sequence
)
{
bit_depth
:
usize
,
chroma_sampling
:
ChromaSampling
)
->
Context
{
unsafe
{
av1_rtcd
();
aom_dsp_rtcd
();
}
let
config
=
EncoderConfig
{
let
enc
=
EncoderConfig
{
quantizer
:
quantizer
,
speed
:
speed
,
..
Default
::
default
()
};
let
mut
fi
=
FrameInvariants
::
new
(
w
,
h
,
config
);
fi
.use_reduced_tx_set
=
true
;
// fi.min_partition_size =
let
seq
=
Sequence
::
new
(
w
,
h
,
bit_depth
,
chroma_sampling
);
let
cfg
=
Config
{
width
:
w
,
height
:
h
,
bit_depth
,
chroma_sampling
,
timebase
:
Ratio
::
new
(
1
,
1000
),
enc
,
};
(
fi
,
seq
)
cfg
.new_context
(
)
}
// TODO: support non-multiple-of-16 dimensions
...
...
@@ -208,7 +212,7 @@ use std::sync::Arc;
let
mut
ra
=
ChaChaRng
::
from_seed
([
0
;
32
]);
let
mut
dec
=
setup_decoder
(
w
,
h
);
let
(
mut
fi
,
mut
seq
)
=
setup_encoder
(
w
,
h
,
speed
,
quantizer
,
bit_depth
,
ChromaSampling
::
Cs420
);
let
mut
ctx
=
setup_encoder
(
w
,
h
,
speed
,
quantizer
,
bit_depth
,
ChromaSampling
::
Cs420
);
println!
(
"Encoding {}x{} speed {} quantizer {}"
,
w
,
h
,
speed
,
quantizer
);
...
...
@@ -217,27 +221,20 @@ use std::sync::Arc;
let
mut
rec_fifo
=
VecDeque
::
new
();
for
_
in
0
..
limit
{
let
mut
fs
=
fi
.new_frame_state
();
fill_frame
(
&
mut
ra
,
Arc
::
get_mut
(
&
mut
fs
.input
)
.unwrap
());
fi
.frame_type
=
if
fi
.number
%
30
==
0
{
FrameType
::
KEY
}
else
{
FrameType
::
INTER
};
fi
.refresh_frame_flags
=
if
fi
.frame_type
==
FrameType
::
KEY
{
ALL_REF_FRAMES_MASK
}
else
{
1
};
let
mut
input
=
ctx
.new_frame
();
fill_frame
(
&
mut
ra
,
Arc
::
get_mut
(
&
mut
input
)
.unwrap
());
fi
.intra_only
=
fi
.frame_type
==
FrameType
::
KEY
||
fi
.frame_type
==
FrameType
::
INTRA_ONLY
;
fi
.use_prev_frame_mvs
=
!
(
fi
.intra_only
||
fi
.error_resilient
);
println!
(
"Encoding frame {}"
,
fi
.number
);
let
packet
=
encode_frame
(
&
mut
seq
,
&
mut
fi
,
&
mut
fs
);
println!
(
"Encoded."
);
let
_
=
ctx
.send_frame
(
input
);
let
pkt
=
ctx
.receive_packet
()
.unwrap
();
println!
(
"Encoded packet {}"
,
pkt
.number
);
fs
.rec
.pad
(
);
rec_fifo
.push_back
(
pkt
.rec
.clone
()
);
rec_fifo
.push_back
(
fs
.rec
.clone
());
update_rec_buffer
(
&
mut
fi
,
fs
);
let
packet
=
pkt
.data
;
let
mut
corrupted_count
=
0
;
unsafe
{
println!
(
"Decoding frame {}"
,
fi
.number
);
println!
(
"Decoding frame {}"
,
pkt
.number
);
let
ret
=
aom_codec_decode
(
&
mut
dec
.dec
,
packet
.as_ptr
(),
packet
.len
(),
ptr
::
null_mut
());
println!
(
"Decoded. -> {}"
,
ret
);
if
ret
!=
0
{
...
...
@@ -276,7 +273,5 @@ use std::sync::Arc;
}
assert_eq!
(
corrupted_count
,
0
);
fi
.number
+=
1
;
}
}
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