### Convert some Vecs in RDO to ArrayVecs.

```These are fixed size and stack allocated rather than malloc()'ed,
hopefully improving speed and reducing memory fragmentation.

Vecs that are passed across functions have not been converted.```
parent fcb218d1
 ... ... @@ -39,6 +39,7 @@ scan_fmt = { version = "0.1.3", optional = true } ivf = { path = "ivf/", optional = true } rayon = "1.0" bincode = "=1.0.1" arrayvec = "0.4.10" [target.'cfg(target_arch = "x86_64")'.build-dependencies] nasm-rs = { git = "https://github.com/tdaede/nasm-rs", branch="msvc-OUT", optional = true } ... ...
 ... ... @@ -39,6 +39,7 @@ use std; use std::cmp; use std::vec::Vec; use crate::partition::PartitionType::*; use arrayvec::*; #[derive(Copy,Clone,PartialEq)] pub enum RDOType { ... ... @@ -461,9 +462,12 @@ pub fn rdo_mode_decision( let cw_checkpoint = cw.checkpoint(); let mut ref_frames_set = Vec::new(); let mut ref_slot_set = Vec::new(); let mut mvs_from_me = Vec::new(); // we can never have more than 7 reference frame sets let mut ref_frames_set = ArrayVec::<[_; 7]>::new(); // again, max of 7 ref slots let mut ref_slot_set = ArrayVec::<[_; 7]>::new(); // our implementation never returns more than 3 at the moment let mut mvs_from_me = ArrayVec::<[_; 3]>::new(); let mut fwdref = None; let mut bwdref = None; ... ... @@ -496,9 +500,9 @@ pub fn rdo_mode_decision( assert!(!ref_frames_set.is_empty()); } let mut mode_set: Vec<(PredictionMode, usize)> = Vec::new(); let mut mv_stacks = Vec::new(); let mut mode_contexts = Vec::new(); let mut mode_set = ArrayVec::<[(PredictionMode, usize); 20]>::new(); let mut mv_stacks = ArrayVec::<[_; 20]>::new(); let mut mode_contexts = ArrayVec::<[_; 7]>::new(); let motion_estimation = if fi.config.speed_settings.diamond_me { crate::me::DiamondSearch::motion_estimation ... ... @@ -777,7 +781,7 @@ pub fn rdo_mode_decision( let mut probs = intra_mode_set.iter().map(|&a| (a, probs_all[a as usize])).collect::>(); probs.sort_by_key(|a| !a.1); let mut modes = Vec::new(); let mut modes = ArrayVec::<[_;7]>::new(); probs .iter() .take(num_modes_rdo / 2) ... ...
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
{"ft_lang_label":"__label__en","ft_lang_prob":0.88317245,"math_prob":0.9804501,"size":290,"snap":"2019-51-2020-05","text_gpt3_token_len":62,"char_repetition_ratio":0.04895105,"word_repetition_ratio":0.0,"special_character_ratio":0.18620689,"punctuation_ratio":0.08163265,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98186433,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-12-10T12:58:03Z\",\"WARC-Record-ID\":\"<urn:uuid:bde2fb56-68a7-48c2-bf7b-899b4946dbc1>\",\"Content-Length\":\"118821\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:e7297f24-9ae9-4230-b145-ba8a9f05a6af>\",\"WARC-Concurrent-To\":\"<urn:uuid:13db1595-131f-442b-9d74-5ccba26002d6>\",\"WARC-IP-Address\":\"140.211.166.4\",\"WARC-Target-URI\":\"https://gitlab.xiph.org/ePirat/rav1e-import-test/commit/63f13f7742703fd7589a4c438d5ad9a189926ff8\",\"WARC-Payload-Digest\":\"sha1:XTRS22XSFJG6QRSBD3PM373V5BTEJQUG\",\"WARC-Block-Digest\":\"sha1:TBXTX4VTUDQT53VMTH2CTBMB6SCSQCL6\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-51/CC-MAIN-2019-51_segments_1575540527620.19_warc_CC-MAIN-20191210123634-20191210151634-00208.warc.gz\"}"}