protected void StartBitFromBlock() { //DEBUG int i = 0; //DEBUG if (options.cellCount == 1) { while ((Input.Count > 0) | (Input.IsOpen)) // pipe have data or not closed { if(token.token) { break; } PlainTransformBitsFromBlock(); } } else { block = new DFFrameBlock(dctarray); while ((Input.Count > 0) | (Input.IsOpen)) // pipe have data or not closed { if (token.token) { break; } DCTTransformBitsFromBlock(); } block.Free(); } Output.Complete(); //Console.WriteLine(Debug.i.ToString()); }
protected void StartBitsToBlock() { //DEBUG int cnt = 0; if (options.density == 1) { int a = 89; } //DEBUG if (options.cellCount == 1) { while ((Input.Count > 0) | (Input.IsOpen)) // pipe have data or not closed { //DEBUG if (cnt > 1878540) if (cnt % 1 == 0) // Console.WriteLine(cnt); cnt += 1; //DEBUG PlainTransformBitsToBlock(); } } else { block = new DFFrameBlock(dctarray); while ((Input.Count > 0) | (Input.IsOpen)) // pipe have data or not closed { DCTTransformBitsToBlock(); } block.Free(); } Output.Complete(); }
private void DCTTransformBitsFromBlock() { byte[] temp = Input.Take(64); DFFrameBlock blok = new DFFrameBlock(temp); Mat mat = new Mat(); blok.Body.ConvertTo(mat, MatType.CV_32FC1); mat = mat.Dct(); mat.CopyTo(block.Body); for (int i = 1; i < options.cellCount + 1; i++) { Output.Add(BitsFromCell(SnakeArrayGet(dctarray, i))); } mat.Dispose(); blok.Free(); }
private void DCTTransformBitsToBlock() { int i; dctarray[0, 0] = 1024; for (i = 1; i < options.cellCount + 1; i++) { byte[] temp = Input.Take(options.density); SnakeArraySet(dctarray, i, BitsToCell(temp)); } for (i = (options.cellCount) + 1; i < 64; i++) { SnakeArraySet(dctarray, i, 0); } byte[] ar = new byte[64]; DFFrameBlock blok = new DFFrameBlock(ar); Mat mat = block.Body.Idct(); mat.ConvertTo(blok.Body, MatType.CV_8U); mat.Dispose(); Output.Add(blok.ToArray()); blok.Free(); }