当前位置: 首页>>代码示例>>C#>>正文


C# Internal.ComponentBuffer类代码示例

本文整理汇总了C#中BitMiracle.LibJpeg.Classic.Internal.ComponentBuffer的典型用法代码示例。如果您正苦于以下问题:C# ComponentBuffer类的具体用法?C# ComponentBuffer怎么用?C# ComponentBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ComponentBuffer类属于BitMiracle.LibJpeg.Classic.Internal命名空间,在下文中一共展示了ComponentBuffer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: color_convert

        /// <summary>
        /// Convert some rows of samples to the output colorspace.
        /// 
        /// Note that we change from noninterleaved, one-plane-per-component format
        /// to interleaved-pixel format.  The output buffer is therefore three times
        /// as wide as the input buffer.
        /// A starting row offset is provided only for the input buffer.  The caller
        /// can easily adjust the passed output_buf value to accommodate any row
        /// offset required on that side.
        /// </summary>
        public void color_convert(ComponentBuffer[] input_buf, int[] perComponentOffsets, int input_row, byte[][] output_buf, int output_row, int num_rows)
        {
            m_perComponentOffsets = perComponentOffsets;

            switch (m_converter)
            {
                case ColorConverter.grayscale_converter:
                    grayscale_convert(input_buf, input_row, output_buf, output_row, num_rows);
                    break;
                case ColorConverter.ycc_rgb_converter:
                    ycc_rgb_convert(input_buf, input_row, output_buf, output_row, num_rows);
                    break;
                case ColorConverter.gray_rgb_converter:
                    gray_rgb_convert(input_buf, input_row, output_buf, output_row, num_rows);
                    break;
                case ColorConverter.null_converter:
                    null_convert(input_buf, input_row, output_buf, output_row, num_rows);
                    break;
                case ColorConverter.ycck_cmyk_converter:
                    ycck_cmyk_convert(input_buf, input_row, output_buf, output_row, num_rows);
                    break;
                default:
                    m_cinfo.ERREXIT(J_MESSAGE_CODE.JERR_CONVERSION_NOTIMPL);
                    break;
            }
        }
开发者ID:Ravivishnubhotla,项目名称:libtiff.net,代码行数:36,代码来源:jpeg_color_deconverter.cs

示例2: h2v2_fancy_upsample

        /// <summary>
        /// Fancy processing for the common case of 2:1 horizontal and 2:1 vertical.
        /// Again a triangle filter; see comments for h2v1 case, above.
        /// 
        /// It is OK for us to reference the adjacent input rows because we demanded
        /// context from the main buffer controller (see initialization code).
        /// </summary>
        private void h2v2_fancy_upsample(int downsampled_width, ref ComponentBuffer input_data)
        {
            ComponentBuffer output_data = m_color_buf[m_currentComponent];

            int inrow = m_upsampleRowOffset;
            int outrow = 0;
            while (outrow < m_cinfo.m_max_v_samp_factor)
            {
                for (int v = 0; v < 2; v++)
                {
                    // nearest input row index
                    int inIndex0 = 0;

                    //next nearest input row index
                    int inIndex1 = 0;
                    int inRow1 = -1;
                    if (v == 0)
                    {
                        /* next nearest is row above */
                        inRow1 = inrow - 1;
                    }
                    else
                    {
                        /* next nearest is row below */
                        inRow1 = inrow + 1;
                    }

                    int row = outrow;
                    int outIndex = 0;
                    outrow++;

                    /* Special case for first column */
                    int thiscolsum = (int)input_data[inrow][inIndex0] * 3 + (int)input_data[inRow1][inIndex1];
                    inIndex0++;
                    inIndex1++;

                    int nextcolsum = (int)input_data[inrow][inIndex0] * 3 + (int)input_data[inRow1][inIndex1];
                    inIndex0++;
                    inIndex1++;

                    output_data[row][outIndex] = (byte)((thiscolsum * 4 + 8) >> 4);
                    outIndex++;

                    output_data[row][outIndex] = (byte)((thiscolsum * 3 + nextcolsum + 7) >> 4);
                    outIndex++;

                    int lastcolsum = thiscolsum;
                    thiscolsum = nextcolsum;

                    for (int colctr = downsampled_width - 2; colctr > 0; colctr--)
                    {
                        /* General case: 3/4 * nearer pixel + 1/4 * further pixel in each */
                        /* dimension, thus 9/16, 3/16, 3/16, 1/16 overall */
                        nextcolsum = (int)input_data[inrow][inIndex0] * 3 + (int)input_data[inRow1][inIndex1];
                        inIndex0++;
                        inIndex1++;

                        output_data[row][outIndex] = (byte)((thiscolsum * 3 + lastcolsum + 8) >> 4);
                        outIndex++;

                        output_data[row][outIndex] = (byte)((thiscolsum * 3 + nextcolsum + 7) >> 4);
                        outIndex++;

                        lastcolsum = thiscolsum;
                        thiscolsum = nextcolsum;
                    }

                    /* Special case for last column */
                    output_data[row][outIndex] = (byte)((thiscolsum * 3 + lastcolsum + 8) >> 4);
                    outIndex++;
                    output_data[row][outIndex] = (byte)((thiscolsum * 4 + 7) >> 4);
                    outIndex++;
                }

                inrow++;
            }
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:84,代码来源:my_upsampler.cs

示例3: int_upsample

        /// <summary>
        /// This version handles any integral sampling ratios.
        /// This is not used for typical JPEG files, so it need not be fast.
        /// Nor, for that matter, is it particularly accurate: the algorithm is
        /// simple replication of the input pixel onto the corresponding output
        /// pixels.  The hi-falutin sampling literature refers to this as a
        /// "box filter".  A box filter tends to introduce visible artifacts,
        /// so if you are actually going to use 3:1 or 4:1 sampling ratios
        /// you would be well advised to improve this code.
        /// </summary>
        private void int_upsample(ref ComponentBuffer input_data)
        {
            ComponentBuffer output_data = m_color_buf[m_currentComponent];
            int h_expand = m_h_expand[m_currentComponent];
            int v_expand = m_v_expand[m_currentComponent];

            int inrow = 0;
            int outrow = 0;
            while (outrow < m_cinfo.m_max_v_samp_factor)
            {
                /* Generate one output row with proper horizontal expansion */
                int row = m_upsampleRowOffset + inrow;
                for (int col = 0; col < m_cinfo.m_output_width; col++)
                {
                    byte invalue = input_data[row][col]; /* don't need GETJSAMPLE() here */
                    int outIndex = 0;
                    for (int h = h_expand; h > 0; h--)
                    {
                        output_data[outrow][outIndex] = invalue;
                        outIndex++;
                    }
                }
                
                /* Generate any additional output rows by duplicating the first one */
                if (v_expand > 1)
                {
                    JpegUtils.jcopy_sample_rows(output_data, outrow, output_data, 
                        outrow + 1, v_expand - 1, m_cinfo.m_output_width);
                }

                inrow++;
                outrow += v_expand;
            }
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:44,代码来源:my_upsampler.cs

示例4: upsampleComponent

 private void upsampleComponent(ref ComponentBuffer input_data)
 {
     switch (m_upsampleMethods[m_currentComponent])
     {
         case ComponentUpsampler.noop_upsampler:
             noop_upsample();
             break;
         case ComponentUpsampler.fullsize_upsampler:
             fullsize_upsample(ref input_data);
             break;
         case ComponentUpsampler.h2v1_fancy_upsampler:
             h2v1_fancy_upsample(m_cinfo.Comp_info[m_currentComponent].downsampled_width, ref input_data);
             break;
         case ComponentUpsampler.h2v1_upsampler:
             h2v1_upsample(ref input_data);
             break;
         case ComponentUpsampler.h2v2_fancy_upsampler:
             h2v2_fancy_upsample(m_cinfo.Comp_info[m_currentComponent].downsampled_width, ref input_data);
             break;
         case ComponentUpsampler.h2v2_upsampler:
             h2v2_upsample(ref input_data);
             break;
         case ComponentUpsampler.int_upsampler:
             int_upsample(ref input_data);
             break;
         default:
             m_cinfo.ERREXIT(J_MESSAGE_CODE.JERR_NOTIMPL);
             break;
     }
 }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:30,代码来源:my_upsampler.cs

示例5: h2v1_fancy_upsample

        /// <summary>
        /// Fancy processing for the common case of 2:1 horizontal and 1:1 vertical.
        /// 
        /// The upsampling algorithm is linear interpolation between pixel centers,
        /// also known as a "triangle filter".  This is a good compromise between
        /// speed and visual quality.  The centers of the output pixels are 1/4 and 3/4
        /// of the way between input pixel centers.
        /// 
        /// A note about the "bias" calculations: when rounding fractional values to
        /// integer, we do not want to always round 0.5 up to the next integer.
        /// If we did that, we'd introduce a noticeable bias towards larger values.
        /// Instead, this code is arranged so that 0.5 will be rounded up or down at
        /// alternate pixel locations (a simple ordered dither pattern).
        /// </summary>
        private void h2v1_fancy_upsample(int downsampled_width, ref ComponentBuffer input_data)
        {
            ComponentBuffer output_data = m_color_buf[m_currentComponent];

            for (int inrow = 0; inrow < m_cinfo.m_max_v_samp_factor; inrow++)
            {
                int row = m_upsampleRowOffset + inrow;
                int inIndex = 0;

                int outIndex = 0;

                /* Special case for first column */
                int invalue = input_data[row][inIndex];
                inIndex++;

                output_data[inrow][outIndex] = (byte)invalue;
                outIndex++;
                output_data[inrow][outIndex] = (byte)((invalue * 3 + (int)input_data[row][inIndex] + 2) >> 2);
                outIndex++;

                for (int colctr = downsampled_width - 2; colctr > 0; colctr--)
                {
                    /* General case: 3/4 * nearer pixel + 1/4 * further pixel */
                    invalue = (int)input_data[row][inIndex] * 3;
                    inIndex++;

                    output_data[inrow][outIndex] = (byte)((invalue + (int)input_data[row][inIndex - 2] + 1) >> 2);
                    outIndex++;

                    output_data[inrow][outIndex] = (byte)((invalue + (int)input_data[row][inIndex] + 2) >> 2);
                    outIndex++;
                }

                /* Special case for last column */
                invalue = input_data[row][inIndex];
                output_data[inrow][outIndex] = (byte)((invalue * 3 + (int)input_data[row][inIndex - 1] + 1) >> 2);
                outIndex++;
                output_data[inrow][outIndex] = (byte)invalue;
                outIndex++;
            }
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:55,代码来源:my_upsampler.cs

示例6: decompress_data_ordinary

        /// <summary>
        /// Decompress and return some data in the multi-pass case.
        /// Always attempts to emit one fully interleaved MCU row ("iMCU" row).
        /// Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED.
        /// 
        /// NB: output_buf contains a plane for each component in image.
        /// </summary>
        private ReadResult decompress_data_ordinary(ComponentBuffer[] output_buf)
        {
            /* Force some input to be done if we are getting ahead of the input. */
            while (m_cinfo.m_input_scan_number < m_cinfo.m_output_scan_number ||
                   (m_cinfo.m_input_scan_number == m_cinfo.m_output_scan_number &&
                    m_cinfo.m_input_iMCU_row <= m_cinfo.m_output_iMCU_row))
            {
                if (m_cinfo.m_inputctl.consume_input() == ReadResult.JPEG_SUSPENDED)
                    return ReadResult.JPEG_SUSPENDED;
            }

            int last_iMCU_row = m_cinfo.m_total_iMCU_rows - 1;

            /* OK, output from the virtual arrays. */
            for (int ci = 0; ci < m_cinfo.m_num_components; ci++)
            {
                jpeg_component_info componentInfo = m_cinfo.Comp_info[ci];

                /* Don't bother to IDCT an uninteresting component. */
                if (!componentInfo.component_needed)
                    continue;

                /* Align the virtual buffer for this component. */
                JBLOCK[][] buffer = m_whole_image[ci].Access(m_cinfo.m_output_iMCU_row * componentInfo.V_samp_factor,
                    componentInfo.V_samp_factor);

                /* Count non-dummy DCT block rows in this iMCU row. */
                int block_rows;
                if (m_cinfo.m_output_iMCU_row < last_iMCU_row)
                    block_rows = componentInfo.V_samp_factor;
                else
                {
                    /* NB: can't use last_row_height here; it is input-side-dependent! */
                    block_rows = componentInfo.height_in_blocks % componentInfo.V_samp_factor;
                    if (block_rows == 0)
                        block_rows = componentInfo.V_samp_factor;
                }

                /* Loop over all DCT blocks to be processed. */
                int rowIndex = 0;
                for (int block_row = 0; block_row < block_rows; block_row++)
                {
                    int output_col = 0;
                    for (int block_num = 0; block_num < componentInfo.Width_in_blocks; block_num++)
                    {
                        m_cinfo.m_idct.inverse(componentInfo.Component_index,
                            buffer[block_row][block_num].data, output_buf[ci], rowIndex, output_col);

                        output_col += componentInfo.DCT_scaled_size;
                    }

                    rowIndex += componentInfo.DCT_scaled_size;
                }
            }

            m_cinfo.m_output_iMCU_row++;
            if (m_cinfo.m_output_iMCU_row < m_cinfo.m_total_iMCU_rows)
                return ReadResult.JPEG_ROW_COMPLETED;

            return ReadResult.JPEG_SCAN_COMPLETED;
        }
开发者ID:Daramkun,项目名称:Misty,代码行数:68,代码来源:jpeg_d_coef_controller.cs

示例7: decompress_smooth_data

        /// <summary>
        /// Variant of decompress_data for use when doing block smoothing.
        /// </summary>
        private ReadResult decompress_smooth_data(ComponentBuffer[] output_buf)
        {
            /* Force some input to be done if we are getting ahead of the input. */
            while (m_cinfo.m_input_scan_number <= m_cinfo.m_output_scan_number && !m_cinfo.m_inputctl.EOIReached())
            {
                if (m_cinfo.m_input_scan_number == m_cinfo.m_output_scan_number)
                {
                    /* If input is working on current scan, we ordinarily want it to
                     * have completed the current row.  But if input scan is DC,
                     * we want it to keep one row ahead so that next block row's DC
                     * values are up to date.
                     */
                    int delta = (m_cinfo.m_Ss == 0) ? 1 : 0;
                    if (m_cinfo.m_input_iMCU_row > m_cinfo.m_output_iMCU_row + delta)
                        break;
                }

                if (m_cinfo.m_inputctl.consume_input() == ReadResult.JPEG_SUSPENDED)
                    return ReadResult.JPEG_SUSPENDED;
            }

            int last_iMCU_row = m_cinfo.m_total_iMCU_rows - 1;

            /* OK, output from the virtual arrays. */
            for (int ci = 0; ci < m_cinfo.m_num_components; ci++)
            {
                jpeg_component_info componentInfo = m_cinfo.Comp_info[ci];

                /* Don't bother to IDCT an uninteresting component. */
                if (!componentInfo.component_needed)
                    continue;

                int block_rows;
                int access_rows;
                bool last_row;
                /* Count non-dummy DCT block rows in this iMCU row. */
                if (m_cinfo.m_output_iMCU_row < last_iMCU_row)
                {
                    block_rows = componentInfo.V_samp_factor;
                    access_rows = block_rows * 2; /* this and next iMCU row */
                    last_row = false;
                }
                else
                {
                    /* NB: can't use last_row_height here; it is input-side-dependent! */
                    block_rows = componentInfo.height_in_blocks % componentInfo.V_samp_factor;
                    if (block_rows == 0)
                        block_rows = componentInfo.V_samp_factor;
                    access_rows = block_rows; /* this iMCU row only */
                    last_row = true;
                }

                /* Align the virtual buffer for this component. */
                JBLOCK[][] buffer = null;
                bool first_row;
                int bufferRowOffset = 0;
                if (m_cinfo.m_output_iMCU_row > 0)
                {
                    access_rows += componentInfo.V_samp_factor; /* prior iMCU row too */
                    buffer = m_whole_image[ci].Access((m_cinfo.m_output_iMCU_row - 1) * componentInfo.V_samp_factor, access_rows);
                    bufferRowOffset = componentInfo.V_samp_factor; /* point to current iMCU row */
                    first_row = false;
                }
                else
                {
                    buffer = m_whole_image[ci].Access(0, access_rows);
                    first_row = true;
                }

                /* Fetch component-dependent info */
                int coefBitsOffset = ci * SAVED_COEFS;
                int Q00 = componentInfo.quant_table.quantval[0];
                int Q01 = componentInfo.quant_table.quantval[Q01_POS];
                int Q10 = componentInfo.quant_table.quantval[Q10_POS];
                int Q20 = componentInfo.quant_table.quantval[Q20_POS];
                int Q11 = componentInfo.quant_table.quantval[Q11_POS];
                int Q02 = componentInfo.quant_table.quantval[Q02_POS];
                int outputIndex = ci;

                /* Loop over all DCT blocks to be processed. */
                for (int block_row = 0; block_row < block_rows; block_row++)
                {
                    int bufferIndex = bufferRowOffset + block_row;

                    int prev_block_row = 0;
                    if (first_row && block_row == 0)
                        prev_block_row = bufferIndex;
                    else
                        prev_block_row = bufferIndex - 1;

                    int next_block_row = 0;
                    if (last_row && block_row == block_rows - 1)
                        next_block_row = bufferIndex;
                    else
                        next_block_row = bufferIndex + 1;

                    /* We fetch the surrounding DC values using a sliding-register approach.
//.........这里部分代码省略.........
开发者ID:Daramkun,项目名称:Misty,代码行数:101,代码来源:jpeg_d_coef_controller.cs

示例8: upsample

 public override void upsample(ComponentBuffer[] input_buf, ref int in_row_group_ctr, int in_row_groups_avail, byte[][] output_buf, ref int out_row_ctr, int out_rows_avail)
 {
     if (m_use_2v_upsample)
         merged_2v_upsample(input_buf, ref in_row_group_ctr, output_buf, ref out_row_ctr, out_rows_avail);
     else
         merged_1v_upsample(input_buf, ref in_row_group_ctr, output_buf, ref out_row_ctr);
 }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:7,代码来源:my_merged_upsampler.cs

示例9: merged_1v_upsample

        /// <summary>
        /// Control routine to do upsampling (and color conversion).
        /// The control routine just handles the row buffering considerations.
        /// 1:1 vertical sampling case: much easier, never need a spare row.
        /// </summary>
        private void merged_1v_upsample(ComponentBuffer[] input_buf, ref int in_row_group_ctr, byte[][] output_buf, ref int out_row_ctr)
        {
            /* Just do the upsampling. */
            h2v1_merged_upsample(input_buf, in_row_group_ctr, output_buf, out_row_ctr);

            /* Adjust counts */
            out_row_ctr++;
            in_row_group_ctr++;
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:14,代码来源:my_merged_upsampler.cs

示例10: grayscale_convert

 /// <summary>
 /// Color conversion for grayscale: just copy the data.
 /// This also works for YCbCr -> grayscale conversion, in which
 /// we just copy the Y (luminance) component and ignore chrominance.
 /// </summary>
 private void grayscale_convert(ComponentBuffer[] input_buf, int input_row, byte[][] output_buf, int output_row, int num_rows)
 {
     JpegUtils.jcopy_sample_rows(input_buf[0], input_row + m_perComponentOffsets[0], output_buf, output_row, num_rows, m_cinfo.m_output_width);
 }
开发者ID:Ravivishnubhotla,项目名称:libtiff.net,代码行数:9,代码来源:jpeg_color_deconverter.cs

示例11: null_convert

        /// <summary>
        /// Color conversion for no colorspace change: just copy the data,
        /// converting from separate-planes to interleaved representation.
        /// </summary>
        private void null_convert(ComponentBuffer[] input_buf, int input_row, byte[][] output_buf, int output_row, int num_rows)
        {
            for (int row = 0; row < num_rows; row++)
            {
                for (int ci = 0; ci < m_cinfo.m_num_components; ci++)
                {
                    int columnIndex = 0;
                    int componentOffset = 0;
                    int perComponentOffset = m_perComponentOffsets[ci];

                    for (int count = m_cinfo.m_output_width; count > 0; count--)
                    {
                        /* needn't bother with GETJSAMPLE() here */
                        output_buf[output_row + row][ci + componentOffset] = input_buf[ci][input_row + perComponentOffset][columnIndex];
                        componentOffset += m_cinfo.m_num_components;
                        columnIndex++;
                    }
                }

                input_row++;
            }
        }
开发者ID:Ravivishnubhotla,项目名称:libtiff.net,代码行数:26,代码来源:jpeg_color_deconverter.cs

示例12: gray_rgb_convert

        /// <summary>
        /// Convert grayscale to RGB: just duplicate the graylevel three times.
        /// This is provided to support applications that don't want to cope
        /// with grayscale as a separate case.
        /// </summary>
        private void gray_rgb_convert(ComponentBuffer[] input_buf, int input_row, byte[][] output_buf, int output_row, int num_rows)
        {
            int component0RowOffset = m_perComponentOffsets[0];
            int component1RowOffset = m_perComponentOffsets[1];
            int component2RowOffset = m_perComponentOffsets[2];

            int num_cols = m_cinfo.m_output_width;
            for (int row = 0; row < num_rows; row++)
            {
                int columnOffset = 0;
                for (int col = 0; col < num_cols; col++)
                {
                    /* We can dispense with GETJSAMPLE() here */
                    output_buf[output_row + row][columnOffset + JpegConstants.RGB_RED] = input_buf[0][input_row + component0RowOffset][col];
                    output_buf[output_row + row][columnOffset + JpegConstants.RGB_GREEN] = input_buf[0][input_row + component1RowOffset][col];
                    output_buf[output_row + row][columnOffset + JpegConstants.RGB_BLUE] = input_buf[0][input_row + component2RowOffset][col];
                    columnOffset += JpegConstants.RGB_PIXELSIZE;
                }

                input_row++;
            }
        }
开发者ID:Ravivishnubhotla,项目名称:libtiff.net,代码行数:27,代码来源:jpeg_color_deconverter.cs

示例13: ycck_cmyk_convert

        /**************** Cases other than YCbCr -> RGB **************/

        /// <summary>
        /// Adobe-style YCCK->CMYK conversion.
        /// We convert YCbCr to R=1-C, G=1-M, and B=1-Y using the same
        /// conversion as above, while passing K (black) unchanged.
        /// We assume build_ycc_rgb_table has been called.
        /// </summary>
        private void ycck_cmyk_convert(ComponentBuffer[] input_buf, int input_row, byte[][] output_buf, int output_row, int num_rows)
        {
            int component0RowOffset = m_perComponentOffsets[0];
            int component1RowOffset = m_perComponentOffsets[1];
            int component2RowOffset = m_perComponentOffsets[2];
            int component3RowOffset = m_perComponentOffsets[3];

            byte[] limit = m_cinfo.m_sample_range_limit;
            int limitOffset = m_cinfo.m_sampleRangeLimitOffset;

            int num_cols = m_cinfo.m_output_width;
            for (int row = 0; row < num_rows; row++)
            {
                int columnOffset = 0;
                for (int col = 0; col < num_cols; col++)
                {
                    int y = input_buf[0][input_row + component0RowOffset][col];
                    int cb = input_buf[1][input_row + component1RowOffset][col];
                    int cr = input_buf[2][input_row + component2RowOffset][col];

                    /* Range-limiting is essential due to noise introduced by DCT losses. */
                    output_buf[output_row + row][columnOffset] = limit[limitOffset + JpegConstants.MAXJSAMPLE - (y + m_Cr_r_tab[cr])]; /* red */
                    output_buf[output_row + row][columnOffset + 1] = limit[limitOffset + JpegConstants.MAXJSAMPLE - (y + JpegUtils.RIGHT_SHIFT(m_Cb_g_tab[cb] + m_Cr_g_tab[cr], SCALEBITS))]; /* green */
                    output_buf[output_row + row][columnOffset + 2] = limit[limitOffset + JpegConstants.MAXJSAMPLE - (y + m_Cb_b_tab[cb])]; /* blue */
                    
                    /* K passes through unchanged */
                    /* don't need GETJSAMPLE here */
                    output_buf[output_row + row][columnOffset + 3] = input_buf[3][input_row + component3RowOffset][col];
                    columnOffset += 4;
                }

                input_row++;
            }
        }
开发者ID:Ravivishnubhotla,项目名称:libtiff.net,代码行数:42,代码来源:jpeg_color_deconverter.cs

示例14: ycc_rgb_convert

        private void ycc_rgb_convert(ComponentBuffer[] input_buf, int input_row, byte[][] output_buf, int output_row, int num_rows)
        {
            int component0RowOffset = m_perComponentOffsets[0];
            int component1RowOffset = m_perComponentOffsets[1];
            int component2RowOffset = m_perComponentOffsets[2];

            byte[] limit = m_cinfo.m_sample_range_limit;
            int limitOffset = m_cinfo.m_sampleRangeLimitOffset;

            for (int row = 0; row < num_rows; row++)
            {
                int columnOffset = 0;
                for (int col = 0; col < m_cinfo.m_output_width; col++)
                {
                    int y = input_buf[0][input_row + component0RowOffset][col];
                    int cb = input_buf[1][input_row + component1RowOffset][col];
                    int cr = input_buf[2][input_row + component2RowOffset][col];

                    /* Range-limiting is essential due to noise introduced by DCT losses. */
                    output_buf[output_row + row][columnOffset + JpegConstants.RGB_RED] = limit[limitOffset + y + m_Cr_r_tab[cr]];
                    output_buf[output_row + row][columnOffset + JpegConstants.RGB_GREEN] = limit[limitOffset + y + JpegUtils.RIGHT_SHIFT(m_Cb_g_tab[cb] + m_Cr_g_tab[cr], SCALEBITS)];
                    output_buf[output_row + row][columnOffset + JpegConstants.RGB_BLUE] = limit[limitOffset + y + m_Cb_b_tab[cb]];
                    columnOffset += JpegConstants.RGB_PIXELSIZE;
                }

                input_row++;
            }
        }
开发者ID:Ravivishnubhotla,项目名称:libtiff.net,代码行数:28,代码来源:jpeg_color_deconverter.cs

示例15: inverse

 /* Inverse DCT (also performs dequantization) */
 public void inverse(int component_index, short[] coef_block, ComponentBuffer output_buf, int output_row, int output_col)
 {
     m_componentBuffer = output_buf;
     switch (m_inverse_DCT_method[component_index])
     {
         case InverseMethod.idct_1x1_method:
             jpeg_idct_1x1(component_index, coef_block, output_row, output_col);
             break;
         case InverseMethod.idct_2x2_method:
             jpeg_idct_2x2(component_index, coef_block, output_row, output_col);
             break;
         case InverseMethod.idct_4x4_method:
             jpeg_idct_4x4(component_index, coef_block, output_row, output_col);
             break;
         case InverseMethod.idct_islow_method:
             jpeg_idct_islow(component_index, coef_block, output_row, output_col);
             break;
         case InverseMethod.idct_ifast_method:
             jpeg_idct_ifast(component_index, coef_block, output_row, output_col);
             break;
         case InverseMethod.idct_float_method:
             jpeg_idct_float(component_index, coef_block, output_row, output_col);
             break;
         case InverseMethod.Unknown:
         default:
             m_cinfo.ERREXIT(J_MESSAGE_CODE.JERR_NOT_COMPILED);
             break;
     }
 }
开发者ID:ChillyFlashER,项目名称:Nine.Imaging,代码行数:30,代码来源:jpeg_inverse_dct.cs


注:本文中的BitMiracle.LibJpeg.Classic.Internal.ComponentBuffer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。