forge
Explore
Log in

Don't you dare go Hollow

The split census guard printed on every unarmed encode (then_some drops its argument)

Browse files at this commit

651e20788e4de5b08b1592e63b4f84d178691cd2Ahmet Kaan GümüşParent: c781f74
  • fix
    • the split census guard printed on every unarmed encode (then_some drops its argument)
Show full message
fix(av1): the split census guard printed on every unarmed encode (then_some drops its argument)
crates/ec-av1/src/encoder.rsmodified+4 -1
@@ -1389,7 +1389,10 @@ impl Av1Encoder {
1389 crate::encode::dump_split_census();1389 crate::encode::dump_split_census();
1390 }1390 }
1391 }1391 }
1392- let _census = crate::encode::split_census_on().then_some(SplitCensusDump);1392+ // `then_some` would CONSTRUCT the guard eagerly and drop it when the
1393+ // flag is off, which runs `Drop` -- and printed the census header on
1394+ // every unarmed encode. `then` builds it only when armed.
1395+ let _census = crate::encode::split_census_on().then(|| SplitCensusDump);
1393 if (picture.width, picture.height) != (self.config.width, self.config.height) {1396 if (picture.width, picture.height) != (self.config.width, self.config.height) {
1394 return Err(Error::unsupported(1397 return Err(Error::unsupported(
1395 "AV1 encode",1398 "AV1 encode",