@@ -567,14 +567,14 @@ private void WriteStartOfFrame(int width, int height, int componentCount, ReadOn
567
567
// This uses a C#'s compiler optimization that refers to the static data segment of the assembly,
568
568
// and doesn't incur any allocation at all.
569
569
// "default" to 4:2:0
570
- ReadOnlySpan < byte > subsamples = stackalloc byte [ ]
570
+ ReadOnlySpan < byte > subsamples = new byte [ ]
571
571
{
572
572
0x22 ,
573
573
0x11 ,
574
574
0x11
575
575
} ;
576
576
577
- ReadOnlySpan < byte > chroma = stackalloc byte [ ]
577
+ ReadOnlySpan < byte > chroma = new byte [ ]
578
578
{
579
579
0x00 ,
580
580
0x01 ,
@@ -583,7 +583,7 @@ private void WriteStartOfFrame(int width, int height, int componentCount, ReadOn
583
583
584
584
if ( this . colorType == JpegColorType . Luminance )
585
585
{
586
- subsamples = stackalloc byte [ ]
586
+ subsamples = new byte [ ]
587
587
{
588
588
0x11 ,
589
589
0x00 ,
@@ -596,7 +596,7 @@ private void WriteStartOfFrame(int width, int height, int componentCount, ReadOn
596
596
{
597
597
case JpegColorType . YCbCrRatio444 :
598
598
case JpegColorType . Rgb :
599
- subsamples = stackalloc byte [ ]
599
+ subsamples = new byte [ ]
600
600
{
601
601
0x11 ,
602
602
0x11 ,
@@ -605,7 +605,7 @@ private void WriteStartOfFrame(int width, int height, int componentCount, ReadOn
605
605
606
606
if ( this . colorType == JpegColorType . Rgb )
607
607
{
608
- chroma = stackalloc byte [ ]
608
+ chroma = new byte [ ]
609
609
{
610
610
0x00 ,
611
611
0x00 ,
@@ -615,7 +615,7 @@ private void WriteStartOfFrame(int width, int height, int componentCount, ReadOn
615
615
616
616
break ;
617
617
case JpegColorType . YCbCrRatio420 :
618
- subsamples = stackalloc byte [ ]
618
+ subsamples = new byte [ ]
619
619
{
620
620
0x22 ,
621
621
0x11 ,
@@ -658,7 +658,7 @@ private void WriteStartOfScan(int componentCount, ReadOnlySpan<byte> componentId
658
658
{
659
659
// This uses a C#'s compiler optimization that refers to the static data segment of the assembly,
660
660
// and doesn't incur any allocation at all.
661
- ReadOnlySpan < byte > huffmanId = stackalloc byte [ ]
661
+ ReadOnlySpan < byte > huffmanId = new byte [ ]
662
662
{
663
663
0x00 ,
664
664
0x11 ,
@@ -668,7 +668,7 @@ private void WriteStartOfScan(int componentCount, ReadOnlySpan<byte> componentId
668
668
// Use the same DC/AC tables for all channels for RGB.
669
669
if ( this . colorType == JpegColorType . Rgb )
670
670
{
671
- huffmanId = stackalloc byte [ ]
671
+ huffmanId = new byte [ ]
672
672
{
673
673
0x00 ,
674
674
0x00 ,
0 commit comments