示例#1
0
 private void DecodeScanBaseline(
     PdfJsHuffmanTables dcHuffmanTables,
     PdfJsHuffmanTables acHuffmanTables,
     PdfJsFrameComponent[] components,
     int componentsLength,
     int mcusPerLine,
     int mcuToRead,
     ref int mcu,
     Stream stream)
 {
     if (componentsLength == 1)
     {
         PdfJsFrameComponent   component      = components[this.compIndex];
         ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId];
         ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId];
示例#2
0
        private void ParseBaselineDataInterleaved()
        {
            // Interleaved
            int mcu           = 0;
            int mcusPerColumn = this.frame.McusPerColumn;
            int mcusPerLine   = this.frame.McusPerLine;

            for (int j = 0; j < mcusPerColumn; j++)
            {
                for (int i = 0; i < mcusPerLine; i++)
                {
                    // Scan an interleaved mcu... process components in order
                    for (int k = 0; k < this.componentsLength; k++)
                    {
                        PdfJsFrameComponent component = this.components[k];

                        ref PdfJsHuffmanTable dcHuffmanTable = ref this.dcHuffmanTables[component.DCHuffmanTableId];
                        ref PdfJsHuffmanTable acHuffmanTable = ref this.acHuffmanTables[component.ACHuffmanTableId];
                        ref short             fastACRef      = ref this.fastACTables.GetAcTableReference(component);
                        int h = component.HorizontalSamplingFactor;
                        int v = component.VerticalSamplingFactor;

                        // Scan out an mcu's worth of this component; that's just determined
                        // by the basic H and V specified for the component
                        for (int y = 0; y < v; y++)
                        {
                            for (int x = 0; x < h; x++)
                            {
                                if (this.eof)
                                {
                                    return;
                                }

                                int mcuRow   = mcu / mcusPerLine;
                                int mcuCol   = mcu % mcusPerLine;
                                int blockRow = (mcuRow * v) + y;
                                int blockCol = (mcuCol * h) + x;

                                this.DecodeBlockBaseline(
                                    component,
                                    blockRow,
                                    blockCol,
                                    ref dcHuffmanTable,
                                    ref acHuffmanTable,
                                    ref fastACRef);
                            }
                        }
                    }