File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -37,3 +37,12 @@ static_assertions = "1.1.0"
37
37
test-assembler = " 0.1.2"
38
38
env_logger = " 0.7.1"
39
39
walkdir = " 2.3.1"
40
+ criterion = " 0.3"
41
+
42
+ [[bench ]]
43
+ name = " avif_benchmark"
44
+ harness = false
45
+
46
+ # See https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options
47
+ [lib ]
48
+ bench = false
Original file line number Diff line number Diff line change
1
+ // This Source Code Form is subject to the terms of the Mozilla Public
2
+ // License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ // file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ extern crate criterion;
5
+ extern crate mp4parse as mp4;
6
+
7
+ use criterion:: { criterion_group, criterion_main, Criterion } ;
8
+ use std:: fs:: File ;
9
+
10
+ fn criterion_benchmark ( c : & mut Criterion ) {
11
+ c. bench_function ( "avif_largest" , |b| b. iter ( || avif_largest ( ) ) ) ;
12
+ }
13
+
14
+ criterion_group ! ( benches, criterion_benchmark) ;
15
+ criterion_main ! ( benches) ;
16
+
17
+ fn avif_largest ( ) {
18
+ let context = & mut mp4:: AvifContext :: new ( ) ;
19
+ let input = & mut File :: open (
20
+ "av1-avif/testFiles/Netflix/avif/cosmos_frame05000_yuv444_12bpc_bt2020_pq_qlossless.avif" ,
21
+ )
22
+ . expect ( "Unknown file" ) ;
23
+ assert ! ( mp4:: read_avif( input, context) . is_ok( ) ) ;
24
+ }
You can’t perform that action at this time.
0 commit comments