Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JpegBlockPostProcessor"/> struct.
        /// </summary>
        public JpegBlockPostProcessor(IRawJpegData decoder, IJpegComponent component)
        {
            int qtIndex = component.QuantizationTableIndex;

            this.DequantiazationTable = ZigZag.CreateDequantizationTable(ref decoder.QuantizationTables[qtIndex]);
            this.subSamplingDivisors  = component.SubSamplingDivisors;

            this.SourceBlock     = default(Block8x8F);
            this.WorkspaceBlock1 = default(Block8x8F);
            this.WorkspaceBlock2 = default(Block8x8F);
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JpegBlockPostProcessor"/> struct.
        /// </summary>
        /// <param name="decoder">The raw jpeg data.</param>
        /// <param name="component">The raw component.</param>
        public JpegBlockPostProcessor(IRawJpegData decoder, IJpegComponent component)
        {
            int qtIndex = component.QuantizationTableIndex;

            this.DequantiazationTable = ZigZag.CreateDequantizationTable(ref decoder.QuantizationTables[qtIndex]);
            this.subSamplingDivisors  = component.SubSamplingDivisors;
            this.maximumValue         = (int)MathF.Pow(2, decoder.Precision) - 1;

            this.SourceBlock     = default;
            this.WorkspaceBlock1 = default;
            this.WorkspaceBlock2 = default;
        }
Beispiel #3
0
        public unsafe void ZigZag_CreateDequantizationTable_MultiplicationShouldQuantize(int seed)
        {
            Block8x8F original = CreateRandomFloatBlock(-500, 500, seed);
            Block8x8F qt       = CreateRandomFloatBlock(0, 10, seed + 42);

            var       unzig = ZigZag.CreateUnzigTable();
            Block8x8F zigQt = ZigZag.CreateDequantizationTable(ref qt);

            Block8x8F expected = original;
            Block8x8F actual   = original;

            ReferenceImplementations.DequantizeBlock(&expected, &qt, unzig.Data);

            actual.MultiplyInplace(ref zigQt);

            this.CompareBlocks(expected, actual, 0);
        }