C# 以C为单位的libJPEG中的高度块#

C# 以C为单位的libJPEG中的高度块#,c#,jpeg,libjpeg,steganography,dct,C#,Jpeg,Libjpeg,Steganography,Dct,我需要访问DCT系数并应用LSB BitMiracle.LibJpeg.Classic.jvirt_array<BitMiracle.LibJpeg.Classic.JBLOCK>[] JBlock = oJpegDecompress.jpeg_read_coefficients(); 因为它是非公共变量 oJpegDecompress.Comp_info[1].Width_in_blocks 可以访问。那么现在,如果高度中没有块的数量,我如何迭代JBlock来处理系数呢?对于

我需要访问DCT系数并应用LSB

BitMiracle.LibJpeg.Classic.jvirt_array<BitMiracle.LibJpeg.Classic.JBLOCK>[] JBlock = oJpegDecompress.jpeg_read_coefficients();
因为它是非公共变量

oJpegDecompress.Comp_info[1].Width_in_blocks 

可以访问。那么现在,如果高度中没有块的数量,我如何迭代JBlock来处理系数呢?

对于彩色图像,JBlock中将有前3个数组,其中包含可用数据。wblocks0和hblocks0是前1个数组的宽度和高度。wblocks1和hblocks1是第2个和第3个数组的宽度和高度

        int calh = (int)Math.Ceiling(img.Height / 8.0);
        int calw = (int)Math.Ceiling(img.Width / 8.0);
        int wblocks0 = calw % 2 == 0 ? calw : calw + 1;
        int hblocks0 = calh % 2 == 0 ? calh : calh + 1;
        int wblocks1 = calw % 2 == 0 ? calw / 2 : (calw + 1) / 2;
        int hblocks1 = calh % 2 == 0 ? calh / 2 : (calh + 1) / 2;
        int calh = (int)Math.Ceiling(img.Height / 8.0);
        int calw = (int)Math.Ceiling(img.Width / 8.0);
        int wblocks0 = calw % 2 == 0 ? calw : calw + 1;
        int hblocks0 = calh % 2 == 0 ? calh : calh + 1;
        int wblocks1 = calw % 2 == 0 ? calw / 2 : (calw + 1) / 2;
        int hblocks1 = calh % 2 == 0 ? calh / 2 : (calh + 1) / 2;