@@ -94,7 +94,7 @@ public void Encode<TPixel>(Image<TPixel> image, Stream stream, CancellationToken
9494
9595 // Compute number of components based on color type in options.
9696 int componentCount = ( this . colorType == JpegColorType . Luminance ) ? 1 : 3 ;
97- byte [ ] componentIds = this . GetComponentIds ( ) ;
97+ ReadOnlySpan < byte > componentIds = this . GetComponentIds ( ) ;
9898
9999 // TODO: Right now encoder writes both quantization tables for grayscale images - we shouldn't do that
100100 // Initialize the quantization tables.
@@ -154,7 +154,7 @@ public void Encode<TPixel>(Image<TPixel> image, Stream stream, CancellationToken
154154 /// For color space RGB this will be RGB as ASCII, otherwise 1, 2, 3.
155155 /// </summary>
156156 /// <returns>The component Ids.</returns>
157- private byte [ ] GetComponentIds ( )
157+ private ReadOnlySpan < byte > GetComponentIds ( )
158158 {
159159 if ( this . colorType == JpegColorType . Rgb )
160160 {
@@ -508,7 +508,7 @@ private void WriteProfiles(ImageMetadata metadata)
508508 /// <param name="height">The height of the image.</param>
509509 /// <param name="componentCount">The number of components in a pixel.</param>
510510 /// <param name="componentIds">The component Id's.</param>
511- private void WriteStartOfFrame ( int width , int height , int componentCount , byte [ ] componentIds )
511+ private void WriteStartOfFrame ( int width , int height , int componentCount , ReadOnlySpan < byte > componentIds )
512512 {
513513 // "default" to 4:2:0
514514 Span < byte > subsamples = stackalloc byte [ ]
@@ -586,7 +586,7 @@ private void WriteStartOfFrame(int width, int height, int componentCount, byte[]
586586 /// </summary>
587587 /// <param name="componentCount">The number of components in a pixel.</param>
588588 /// <param name="componentIds">The componentId's.</param>
589- private void WriteStartOfScan ( int componentCount , byte [ ] componentIds )
589+ private void WriteStartOfScan ( int componentCount , ReadOnlySpan < byte > componentIds )
590590 {
591591 Span < byte > huffmanId = stackalloc byte [ ]
592592 {
0 commit comments