@ -13,15 +13,15 @@ internal sealed unsafe partial class JpegEncoderCore
{
private static JpegFrameConfig [ ] CreateFrameConfigs ( )
{
var defaultLuminanceHuffmanDC = new JpegHuffmanTableConfig ( @class : 0 , destIndex : 0 , HuffmanSpec . LuminanceDC ) ;
var defaultLuminanceHuffmanAC = new JpegHuffmanTableConfig ( @class : 1 , destIndex : 0 , HuffmanSpec . LuminanceAC ) ;
var defaultChrominanceHuffmanDC = new JpegHuffmanTableConfig ( @class : 0 , destIndex : 1 , HuffmanSpec . ChrominanceDC ) ;
var defaultChrominanceHuffmanAC = new JpegHuffmanTableConfig ( @class : 1 , destIndex : 1 , HuffmanSpec . ChrominanceAC ) ;
JpegHuffmanTableConfig defaultLuminanceHuffmanDC = new ( @class : 0 , destIndex : 0 , HuffmanSpec . LuminanceDC ) ;
JpegHuffmanTableConfig defaultLuminanceHuffmanAC = new ( @class : 1 , destIndex : 0 , HuffmanSpec . LuminanceAC ) ;
JpegHuffmanTableConfig defaultChrominanceHuffmanDC = new ( @class : 0 , destIndex : 1 , HuffmanSpec . ChrominanceDC ) ;
JpegHuffmanTableConfig defaultChrominanceHuffmanAC = new ( @class : 1 , destIndex : 1 , HuffmanSpec . ChrominanceAC ) ;
var defaultLuminanceQuantTable = new JpegQuantizationTableConfig ( 0 , Quantization . LuminanceTable ) ;
var defaultChrominanceQuantTable = new JpegQuantizationTableConfig ( 1 , Quantization . ChrominanceTable ) ;
JpegQuantizationTableConfig defaultLuminanceQuantTable = new ( 0 , Quantization . LuminanceTable ) ;
JpegQuantizationTableConfig defaultChrominanceQuantTable = new ( 1 , Quantization . ChrominanceTable ) ;
var yCbCrHuffmanConfigs = new JpegHuffmanTableConfig [ ]
JpegHuffmanTableConfig [ ] yCbCrHuffmanConfigs = new JpegHuffmanTableConfig [ ]
{
defaultLuminanceHuffmanDC ,
defaultLuminanceHuffmanAC ,
@ -29,7 +29,7 @@ internal sealed unsafe partial class JpegEncoderCore
defaultChrominanceHuffmanAC ,
} ;
var yCbCrQuantTableConfigs = new JpegQuantizationTableConfig [ ]
JpegQuantizationTableConfig [ ] yCbCrQuantTableConfigs = new JpegQuantizationTableConfig [ ]
{
defaultLuminanceQuantTable ,
defaultChrominanceQuantTable ,
@ -38,77 +38,77 @@ internal sealed unsafe partial class JpegEncoderCore
return new JpegFrameConfig [ ]
{
// YCbCr 4:4:4
new JpegFrameConfig (
new (
JpegColorSpace . YCbCr ,
JpegColorType . YCbCrRatio444 ,
new JpegComponentConfig [ ]
{
new JpegComponentConfig ( id : 1 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new JpegComponentConfig ( id : 2 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
new JpegComponentConfig ( id : 3 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
new ( id : 1 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new ( id : 2 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
new ( id : 3 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
} ,
yCbCrHuffmanConfigs ,
yCbCrQuantTableConfigs ) ,
// YCbCr 4:2:2
new JpegFrameConfig (
new (
JpegColorSpace . YCbCr ,
JpegColorType . YCbCrRatio422 ,
new JpegComponentConfig [ ]
{
new JpegComponentConfig ( id : 1 , hsf : 2 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new JpegComponentConfig ( id : 2 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
new JpegComponentConfig ( id : 3 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
new ( id : 1 , hsf : 2 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new ( id : 2 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
new ( id : 3 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
} ,
yCbCrHuffmanConfigs ,
yCbCrQuantTableConfigs ) ,
// YCbCr 4:2:0
new JpegFrameConfig (
new (
JpegColorSpace . YCbCr ,
JpegColorType . YCbCrRatio420 ,
new JpegComponentConfig [ ]
{
new JpegComponentConfig ( id : 1 , hsf : 2 , vsf : 2 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new JpegComponentConfig ( id : 2 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
new JpegComponentConfig ( id : 3 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
new ( id : 1 , hsf : 2 , vsf : 2 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new ( id : 2 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
new ( id : 3 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
} ,
yCbCrHuffmanConfigs ,
yCbCrQuantTableConfigs ) ,
// YCbCr 4:1:1
new JpegFrameConfig (
new (
JpegColorSpace . YCbCr ,
JpegColorType . YCbCrRatio411 ,
new JpegComponentConfig [ ]
{
new JpegComponentConfig ( id : 1 , hsf : 4 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new JpegComponentConfig ( id : 2 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
new JpegComponentConfig ( id : 3 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
new ( id : 1 , hsf : 4 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new ( id : 2 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
new ( id : 3 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
} ,
yCbCrHuffmanConfigs ,
yCbCrQuantTableConfigs ) ,
// YCbCr 4:1:0
new JpegFrameConfig (
new (
JpegColorSpace . YCbCr ,
JpegColorType . YCbCrRatio410 ,
new JpegComponentConfig [ ]
{
new JpegComponentConfig ( id : 1 , hsf : 4 , vsf : 2 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new JpegComponentConfig ( id : 2 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
new JpegComponentConfig ( id : 3 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
new ( id : 1 , hsf : 4 , vsf : 2 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new ( id : 2 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
new ( id : 3 , hsf : 1 , vsf : 1 , quantIndex : 1 , dcIndex : 1 , acIndex : 1 ) ,
} ,
yCbCrHuffmanConfigs ,
yCbCrQuantTableConfigs ) ,
// Luminance
new JpegFrameConfig (
new (
JpegColorSpace . Grayscale ,
JpegColorType . Luminance ,
new JpegComponentConfig [ ]
{
new JpegComponentConfig ( id : 0 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new ( id : 0 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
} ,
new JpegHuffmanTableConfig [ ]
{
@ -121,14 +121,14 @@ internal sealed unsafe partial class JpegEncoderCore
} ) ,
// Rgb
new JpegFrameConfig (
new (
JpegColorSpace . RGB ,
JpegColorType . Rgb ,
new JpegComponentConfig [ ]
{
new JpegComponentConfig ( id : 8 2 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new JpegComponentConfig ( id : 7 1 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new JpegComponentConfig ( id : 6 6 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new ( id : 8 2 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new ( id : 7 1 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new ( id : 6 6 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
} ,
new JpegHuffmanTableConfig [ ]
{
@ -144,15 +144,15 @@ internal sealed unsafe partial class JpegEncoderCore
} ,
// Cmyk
new JpegFrameConfig (
new (
JpegColorSpace . Cmyk ,
JpegColorType . Cmyk ,
new JpegComponentConfig [ ]
{
new JpegComponentConfig ( id : 1 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new JpegComponentConfig ( id : 2 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new JpegComponentConfig ( id : 3 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new JpegComponentConfig ( id : 4 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new ( id : 1 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new ( id : 2 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new ( id : 3 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new ( id : 4 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
} ,
new JpegHuffmanTableConfig [ ]
{
@ -168,15 +168,15 @@ internal sealed unsafe partial class JpegEncoderCore
} ,
// YccK
new JpegFrameConfig (
new (
JpegColorSpace . Ycck ,
JpegColorType . Ycck ,
new JpegComponentConfig [ ]
{
new JpegComponentConfig ( id : 1 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new JpegComponentConfig ( id : 2 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new JpegComponentConfig ( id : 3 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new JpegComponentConfig ( id : 4 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new ( id : 1 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new ( id : 2 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new ( id : 3 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
new ( id : 4 , hsf : 1 , vsf : 1 , quantIndex : 0 , dcIndex : 0 , acIndex : 0 ) ,
} ,
new JpegHuffmanTableConfig [ ]
{