@@ -74,7 +74,7 @@ impl<'a> Decoder for SrwDecoder<'a> {
74
74
75
75
impl < ' a > SrwDecoder < ' a > {
76
76
pub fn decode_srw1 ( buf : & [ u8 ] , loffsets : & [ u8 ] , width : usize , height : usize ) -> Vec < u16 > {
77
- let mut out: Vec < u16 > = vec ! [ 0 ; width* height] ;
77
+ let mut out: Vec < u16 > = alloc_image ! ( width, height) ;
78
78
79
79
for row in 0 ..height {
80
80
let mut len: [ u32 ; 4 ] = [ if row < 2 { 7 } else { 4 } ; 4 ] ;
@@ -141,7 +141,7 @@ impl<'a> SrwDecoder<'a> {
141
141
}
142
142
143
143
pub fn decode_srw2 ( buf : & [ u8 ] , width : usize , height : usize ) -> Vec < u16 > {
144
- let mut out: Vec < u16 > = vec ! [ 0 ; width* height] ;
144
+ let mut out: Vec < u16 > = alloc_image ! ( width, height) ;
145
145
146
146
// This format has a variable length encoding of how many bits are needed
147
147
// to encode the difference between pixels, we use a table to process it
@@ -213,7 +213,7 @@ impl<'a> SrwDecoder<'a> {
213
213
// and Loring von Palleske (Samsung) for pointing to the open-source code of
214
214
// Samsung's DNG converter at http://opensource.samsung.com/
215
215
216
- let mut out: Vec < u16 > = vec ! [ 0 ; width* height] ;
216
+ let mut out: Vec < u16 > = alloc_image ! ( width, height) ;
217
217
let mut pump = BitPumpMSB32 :: new ( buf) ;
218
218
219
219
// Process the initial metadata bits, we only really use initVal, width and
0 commit comments