private void Clear() { ExposedRomTables.Clear(); ExposedRamTables.Clear(); BaseRomTables.Clear(); BaseRamTables.Clear(); ScalingList.Clear(); inheritList.Clear(); }
public void initialize(ScalingList source) { for (byte size = 0; size < 3; size++) { for (byte matrix = 0; matrix < 6; matrix++) { update(source, size, matrix); } } enabled = true; }
private static void ReadScalingListMatrix(BitStreamReader bitReader, ref ScalingMatrix matrix) { matrix = new ScalingMatrix(); for (int i = 0; i < 8; i++) { bool seqScalingListPresentFlag = bitReader.ReadBool(); if (seqScalingListPresentFlag) { matrix.ScalingList4x4 = new ScalingList[8]; matrix.ScalingList8x8 = new ScalingList[8]; if (i < 6) { matrix.ScalingList4x4[i] = ScalingList.Read(bitReader, 16); } else { matrix.ScalingList8x8[i - 6] = ScalingList.Read(bitReader, 64); } } } }
public static ScalingList Read(BitStreamReader bitReader, int sizeOfScalingList) { ScalingList sl = new ScalingList(); sl.scalingList = new int[sizeOfScalingList]; int lastScale = 8; int nextScale = 8; for (int j = 0; j < sizeOfScalingList; j++) { if (nextScale != 0) { int deltaScale = bitReader.ReadSE(); nextScale = (lastScale + deltaScale + 256) % 256; sl.useDefaultScalingMatrixFlag = (j == 0 && nextScale == 0); } sl.scalingList[j] = nextScale == 0 ? lastScale : nextScale; lastScale = sl.scalingList[j]; } return(sl); }
void update <S>(ScalingList source, byte sizeID, byte matrixID, S s) where S : struct, iSizeID { Span <byte> span = MemoryMarshal.Cast <uint, byte>(scalingListData.AsSpan()); int indexOffset = scalingFactorOffsets[sizeID, matrixID]; int blockSize = 4 << sizeID; for (int x = 0; x < blockSize; x++) { for (int y = 0; y < blockSize; y++) { int destIdx = indexOffset + x + y * blockSize; int sourceIdx = s.computeIndex(x, y); span[destIdx] = source.scalingList[sizeID, matrixID, sourceIdx]; } } if (sizeID > 1) { span[indexOffset] = source.dcCoeffs[sizeID - 2, matrixID]; } }
void update(ScalingList source, byte sizeID, byte matrixID) { switch (sizeID) { case 0: update(source, sizeID, matrixID, new Size0()); break; case 1: update(source, sizeID, matrixID, new Size1()); break; case 2: update(source, sizeID, matrixID, new Size2()); break; case 3: update(source, sizeID, matrixID, new Size3()); break; default: throw new ArgumentOutOfRangeException(); } }