@@ -837,12 +837,10 @@ impl<W: io::Write> UncompressedHeader for BitWriter<W, BigEndian> {
837
837
fn write_max_frame_size < T : Pixel > (
838
838
& mut self , fi : & FrameInvariants < T > ,
839
839
) -> io:: Result < ( ) > {
840
- // width_bits and height_bits will have to be moved to the sequence header OBU
841
- // when we add support for it.
842
- let width = fi. width - 1 ;
843
- let height = fi. height - 1 ;
844
- let width_bits = log_in_base_2 ( width as u32 ) as u32 + 1 ;
845
- let height_bits = log_in_base_2 ( height as u32 ) as u32 + 1 ;
840
+ let width = fi. sequence . max_frame_width - 1 ;
841
+ let height = fi. sequence . max_frame_height - 1 ;
842
+ let width_bits = fi. sequence . num_bits_width ;
843
+ let height_bits = fi. sequence . num_bits_height ;
846
844
assert ! ( width_bits <= 16 ) ;
847
845
assert ! ( height_bits <= 16 ) ;
848
846
self . write ( 4 , width_bits - 1 ) ?;
@@ -858,14 +856,12 @@ impl<W: io::Write> UncompressedHeader for BitWriter<W, BigEndian> {
858
856
// width_bits and height_bits will have to be moved to the sequence header OBU
859
857
// when we add support for it.
860
858
if fi. frame_size_override_flag {
861
- let width = fi. width - 1 ;
862
- let height = fi. height - 1 ;
863
- let width_bits = log_in_base_2 ( width as u32 ) as u32 + 1 ;
864
- let height_bits = log_in_base_2 ( height as u32 ) as u32 + 1 ;
859
+ let width_bits = fi. sequence . num_bits_width ;
860
+ let height_bits = fi. sequence . num_bits_height ;
865
861
assert ! ( width_bits <= 16 ) ;
866
862
assert ! ( height_bits <= 16 ) ;
867
- self . write ( width_bits, width as u16 ) ?;
868
- self . write ( height_bits, height as u16 ) ?;
863
+ self . write ( width_bits, ( fi . width - 1 ) as u16 ) ?;
864
+ self . write ( height_bits, ( fi . height - 1 ) as u16 ) ?;
869
865
}
870
866
if fi. sequence . enable_superres {
871
867
unimplemented ! ( ) ;
0 commit comments