util: fix code style

This commit is contained in:
Ivan Molodetskikh 2017-06-20 20:47:11 +03:00 committed by meh
parent 62739b803d
commit 1dd672546d
2 changed files with 8 additions and 12 deletions

View File

@ -299,13 +299,10 @@ unsafe impl Sync for Descriptor {}
impl Pixel { impl Pixel {
pub fn descriptor(self) -> Option<Descriptor> { pub fn descriptor(self) -> Option<Descriptor> {
let ptr = unsafe { av_pix_fmt_desc_get(self.into()) }; unsafe {
let ptr = av_pix_fmt_desc_get(self.into());
if ptr.is_null() { ptr.as_ref().map(|ptr| Descriptor { ptr })
None
}
else {
Some(Descriptor { ptr })
} }
} }
} }

View File

@ -256,12 +256,11 @@ impl Video {
return self.height(); return self.height();
} }
match self.format().descriptor() { if let Some(desc) = self.format().descriptor() {
None => self.height(), let s = desc.log2_chroma_h();
Some(desc) => { (self.height() + (1 << s) - 1) >> s
let s = desc.log2_chroma_h(); } else {
(self.height() + (1 << s) - 1) >> s self.height()
}
} }
} }