@@ -65,54 +65,54 @@ public static int DecompressYUY2(ReadOnlySpan<byte> input, int width, int height
6565 /// <summary>
6666 /// Decompress a YUY2 image
6767 /// </summary>
68- /// <typeparam name="TOutput "></typeparam>
69- /// <typeparam name="TOutputArg "></typeparam>
68+ /// <typeparam name="TOutputColor "></typeparam>
69+ /// <typeparam name="TOutputChannel "></typeparam>
7070 /// <param name="input">Input buffer containing the compressed image.</param>
7171 /// <param name="width">Pixel width of the image.</param>
7272 /// <param name="height">Pixel height of the image.</param>
7373 /// <param name="output">An output buffer. Must be at least width * height * pixelSize.</param>
7474 /// <returns>Number of bytes read from <paramref name="input"/></returns>
7575 [ MethodImpl ( MethodImplOptions . AggressiveInlining | MethodImplOptions . AggressiveOptimization ) ]
76- public static int DecompressYUY2 < TOutput , TOutputArg > ( ReadOnlySpan < byte > input , int width , int height , out byte [ ] output )
77- where TOutputArg : unmanaged
78- where TOutput : unmanaged, IColor < TOutputArg >
76+ public static int DecompressYUY2 < TOutputColor , TOutputChannel > ( ReadOnlySpan < byte > input , int width , int height , out byte [ ] output )
77+ where TOutputChannel : unmanaged
78+ where TOutputColor : unmanaged, IColor < TOutputChannel >
7979 {
80- output = new byte [ width * height * Unsafe . SizeOf < TOutput > ( ) ] ;
81- return DecompressYUY2 < TOutput , TOutputArg > ( input , width , height , output ) ;
80+ output = new byte [ width * height * Unsafe . SizeOf < TOutputColor > ( ) ] ;
81+ return DecompressYUY2 < TOutputColor , TOutputChannel > ( input , width , height , output ) ;
8282 }
8383
8484 /// <summary>
8585 /// Decompress a YUY2 image
8686 /// </summary>
87- /// <typeparam name="TOutput "></typeparam>
88- /// <typeparam name="TOutputArg "></typeparam>
87+ /// <typeparam name="TOutputColor "></typeparam>
88+ /// <typeparam name="TOutputChannel "></typeparam>
8989 /// <param name="input">Input buffer containing the compressed image.</param>
9090 /// <param name="width">Pixel width of the image.</param>
9191 /// <param name="height">Pixel height of the image.</param>
9292 /// <param name="output">An output buffer. Must be at least width * height * pixelSize.</param>
9393 /// <returns>Number of bytes read from <paramref name="input"/></returns>
9494 [ MethodImpl ( MethodImplOptions . AggressiveInlining | MethodImplOptions . AggressiveOptimization ) ]
95- public static int DecompressYUY2 < TOutput , TOutputArg > ( ReadOnlySpan < byte > input , int width , int height , Span < byte > output )
96- where TOutputArg : unmanaged
97- where TOutput : unmanaged, IColor < TOutputArg >
95+ public static int DecompressYUY2 < TOutputColor , TOutputChannel > ( ReadOnlySpan < byte > input , int width , int height , Span < byte > output )
96+ where TOutputChannel : unmanaged
97+ where TOutputColor : unmanaged, IColor < TOutputChannel >
9898 {
99- return DecompressYUY2 < TOutput , TOutputArg > ( input , width , height , MemoryMarshal . Cast < byte , TOutput > ( output ) ) ;
99+ return DecompressYUY2 < TOutputColor , TOutputChannel > ( input , width , height , MemoryMarshal . Cast < byte , TOutputColor > ( output ) ) ;
100100 }
101101
102102 /// <summary>
103103 /// Decompress a YUY2 image
104104 /// </summary>
105- /// <typeparam name="TOutput "></typeparam>
106- /// <typeparam name="TOutputArg "></typeparam>
105+ /// <typeparam name="TOutputColor "></typeparam>
106+ /// <typeparam name="TOutputChannel "></typeparam>
107107 /// <param name="input">Input buffer containing the compressed image.</param>
108108 /// <param name="width">Pixel width of the image.</param>
109109 /// <param name="height">Pixel height of the image.</param>
110110 /// <param name="output">An output buffer. Must be at least width * height.</param>
111111 /// <returns>Number of bytes read from <paramref name="input"/></returns>
112112 [ MethodImpl ( MethodImplOptions . AggressiveInlining | MethodImplOptions . AggressiveOptimization ) ]
113- public static int DecompressYUY2 < TOutput , TOutputArg > ( ReadOnlySpan < byte > input , int width , int height , Span < TOutput > output )
114- where TOutputArg : unmanaged
115- where TOutput : unmanaged, IColor < TOutputArg >
113+ public static int DecompressYUY2 < TOutputColor , TOutputChannel > ( ReadOnlySpan < byte > input , int width , int height , Span < TOutputColor > output )
114+ where TOutputChannel : unmanaged
115+ where TOutputColor : unmanaged, IColor < TOutputChannel >
116116 {
117117 ThrowHelper . ThrowIfNotEnoughSpace ( output . Length , width * height ) ;
118118
@@ -133,12 +133,12 @@ public static int DecompressYUY2<TOutput, TOutputArg>(ReadOnlySpan<byte> input,
133133 byte b0 = ClampByte ( ( 298 * c + 516 * d + 128 ) >> 8 ) ; // blue
134134 byte g0 = ClampByte ( ( 298 * c - 100 * d - 208 * e + 128 ) >> 8 ) ; // green
135135 byte r0 = ClampByte ( ( 298 * c + 409 * e + 128 ) >> 8 ) ; // red
136- output [ o ++ ] . SetConvertedChannels < TOutput , TOutputArg , byte > ( r0 , g0 , b0 , byte . MaxValue ) ;
136+ output [ o ++ ] . SetConvertedChannels < TOutputColor , TOutputChannel , byte > ( r0 , g0 , b0 , byte . MaxValue ) ;
137137 c = y1 - 16 ;
138138 byte b1 = ClampByte ( ( 298 * c + 516 * d + 128 ) >> 8 ) ; // blue
139139 byte g1 = ClampByte ( ( 298 * c - 100 * d - 208 * e + 128 ) >> 8 ) ; // green
140140 byte r1 = ClampByte ( ( 298 * c + 409 * e + 128 ) >> 8 ) ; // red
141- output [ o ++ ] . SetConvertedChannels < TOutput , TOutputArg , byte > ( r1 , g1 , b1 , byte . MaxValue ) ;
141+ output [ o ++ ] . SetConvertedChannels < TOutputColor , TOutputChannel , byte > ( r1 , g1 , b1 , byte . MaxValue ) ;
142142 }
143143 }
144144
0 commit comments