#pragma warning restore SA1401 /// <summary> /// Initializes a new instance of the <see cref="YCbCrImage" /> class. /// </summary> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="ratio">The ratio.</param> public YCbCrImage(int width, int height, YCbCrSubsampleRatio ratio) { Size cSize = CalculateChrominanceSize(width, height, ratio); this.Ratio = ratio; this.YStride = width; this.CStride = cSize.Width; this.YChannel = JpegPixelArea.CreatePooled(width, height); this.CbChannel = JpegPixelArea.CreatePooled(cSize.Width, cSize.Height); this.CrChannel = JpegPixelArea.CreatePooled(cSize.Width, cSize.Height); }
/// <summary> /// Dequantize, perform the inverse DCT and store decodedBlock.Block to the into the corresponding <see cref="JpegPixelArea"/> instance. /// </summary> /// <param name="decoder">The <see cref="JpegDecoderCore"/></param> /// <param name="decodedBlock">The <see cref="DecodedBlock"/></param> private void ProcessBlockColors(JpegDecoderCore decoder, ref DecodedBlock decodedBlock) { this.data.Block = decodedBlock.Block; int qtIndex = decoder.ComponentArray[this.componentIndex].Selector; this.data.QuantiazationTable = decoder.QuantizationTables[qtIndex]; Block8x8F *b = this.pointers.Block; Block8x8F.UnZig(b, this.pointers.QuantiazationTable, this.pointers.Unzig); DCT.TransformIDCT(ref *b, ref *this.pointers.Temp1, ref *this.pointers.Temp2); JpegPixelArea destChannel = decoder.GetDestinationChannel(this.componentIndex); JpegPixelArea destArea = destChannel.GetOffsetedSubAreaForBlock(decodedBlock.Bx, decodedBlock.By); destArea.LoadColorsFrom(this.pointers.Temp1, this.pointers.Temp2); }