@@ -567,14 +567,14 @@ private void WriteStartOfFrame(int width, int height, int componentCount, ReadOn
567567 // This uses a C#'s compiler optimization that refers to the static data segment of the assembly,
568568 // and doesn't incur any allocation at all.
569569 // "default" to 4:2:0
570- ReadOnlySpan < byte > subsamples = stackalloc byte [ ]
570+ ReadOnlySpan < byte > subsamples = new byte [ ]
571571 {
572572 0x22 ,
573573 0x11 ,
574574 0x11
575575 } ;
576576
577- ReadOnlySpan < byte > chroma = stackalloc byte [ ]
577+ ReadOnlySpan < byte > chroma = new byte [ ]
578578 {
579579 0x00 ,
580580 0x01 ,
@@ -583,7 +583,7 @@ private void WriteStartOfFrame(int width, int height, int componentCount, ReadOn
583583
584584 if ( this . colorType == JpegColorType . Luminance )
585585 {
586- subsamples = stackalloc byte [ ]
586+ subsamples = new byte [ ]
587587 {
588588 0x11 ,
589589 0x00 ,
@@ -596,7 +596,7 @@ private void WriteStartOfFrame(int width, int height, int componentCount, ReadOn
596596 {
597597 case JpegColorType . YCbCrRatio444 :
598598 case JpegColorType . Rgb :
599- subsamples = stackalloc byte [ ]
599+ subsamples = new byte [ ]
600600 {
601601 0x11 ,
602602 0x11 ,
@@ -605,7 +605,7 @@ private void WriteStartOfFrame(int width, int height, int componentCount, ReadOn
605605
606606 if ( this . colorType == JpegColorType . Rgb )
607607 {
608- chroma = stackalloc byte [ ]
608+ chroma = new byte [ ]
609609 {
610610 0x00 ,
611611 0x00 ,
@@ -615,7 +615,7 @@ private void WriteStartOfFrame(int width, int height, int componentCount, ReadOn
615615
616616 break ;
617617 case JpegColorType . YCbCrRatio420 :
618- subsamples = stackalloc byte [ ]
618+ subsamples = new byte [ ]
619619 {
620620 0x22 ,
621621 0x11 ,
@@ -658,7 +658,7 @@ private void WriteStartOfScan(int componentCount, ReadOnlySpan<byte> componentId
658658 {
659659 // This uses a C#'s compiler optimization that refers to the static data segment of the assembly,
660660 // and doesn't incur any allocation at all.
661- ReadOnlySpan < byte > huffmanId = stackalloc byte [ ]
661+ ReadOnlySpan < byte > huffmanId = new byte [ ]
662662 {
663663 0x00 ,
664664 0x11 ,
@@ -668,7 +668,7 @@ private void WriteStartOfScan(int componentCount, ReadOnlySpan<byte> componentId
668668 // Use the same DC/AC tables for all channels for RGB.
669669 if ( this . colorType == JpegColorType . Rgb )
670670 {
671- huffmanId = stackalloc byte [ ]
671+ huffmanId = new byte [ ]
672672 {
673673 0x00 ,
674674 0x00 ,
0 commit comments