Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions src/vp8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,13 +529,13 @@ impl<R: Read> Vp8Decoder<R> {
self.frame.width = w & 0x3FFF;
self.frame.height = h & 0x3FFF;

self.top = init_top_macroblocks(self.frame.width as usize);
// Almost always the first macro block, except when non exists (i.e. `width == 0`)
self.left = self.top.first().copied().unwrap_or_default();

self.mbwidth = self.frame.width.div_ceil(16);
self.mbheight = self.frame.height.div_ceil(16);

self.top = vec![MacroBlock::default(); self.mbwidth.into()];
// Almost always the first macro block, except when non exists (i.e. `width == 0`)
self.left = self.top.first().copied().unwrap_or_default();

self.frame.ybuf =
vec![0u8; usize::from(self.mbwidth) * 16 * usize::from(self.mbheight) * 16];
self.frame.ubuf = vec![0u8; usize::from(self.mbwidth) * 8 * usize::from(self.mbheight) * 8];
Expand Down Expand Up @@ -1291,19 +1291,6 @@ impl<R: Read> Vp8Decoder<R> {
}
}

fn init_top_macroblocks(width: usize) -> Vec<MacroBlock> {
let mb_width = width.div_ceil(16);

let mb = MacroBlock {
// Section 11.3 #3
bpred: [IntraMode::DC; 16],
luma_mode: LumaMode::DC,
..MacroBlock::default()
};

vec![mb; mb_width]
}

// set border
fn set_chroma_border(
left_border: &mut [u8],
Expand Down
Loading