Exemple #1
0
        /// <summary>
        /// Atliekami kodavimo, dekodavimo, siuntimo per kanalą ir konvertavimo veiksmai su vektoriumi
        /// </summary>
        /// <param name="_binaryVector">
        /// Vektorius, kurį reikia apdoroti
        /// </param>
        public void RunVector(string _binaryVector)
        {
            Queue <bool>         originalVectorQueue   = new Queue <bool>();
            Queue <bool>         encodedVectorQueue    = new Queue <bool>();
            Queue <bool>         decodedVectorQueue    = new Queue <bool>();
            Queue <bool>         vectorWithErrorsQueue = new Queue <bool>();
            ConvolutionalEncoder encoder = new ConvolutionalEncoder();
            ConvolutionalDecoder decoder = new ConvolutionalDecoder();

            originalVectorQueue = this.BinaryStringToQueue(_binaryVector);
            encoder.EncodeQueue(originalVectorQueue, encodedVectorQueue);
            vectorWithErrorsQueue = Channel.SendData(encodedVectorQueue);
            decodedVectorQueue    = decoder.DecodeQueue(vectorWithErrorsQueue);

            ErrorPositions       = Channel.ErrorPositions;
            EncodedVector        = this.BinaryQueueToString(encodedVectorQueue);
            EncodedAndSentVector = this.BinaryQueueToString(vectorWithErrorsQueue);
            DecodedVector        = this.BinaryQueueToString(decodedVectorQueue);
        }
Exemple #2
0
        /// <summary>
        /// Atliekami konvertavimo, dekodavimo ir siuntimo per kanalą veiksmai paveikslėliui.
        /// </summary>
        /// <param name="_image">
        /// Paveikslėlis, kurį reikia apdoroti
        /// </param>
        public void RunImage(Image _image)
        {
            Queue <bool>         originalImageQueue  = new Queue <bool>();
            Queue <bool>         encodedImageQueue   = new Queue <bool>();
            Queue <bool>         decodedImageQueue   = new Queue <bool>();
            Queue <bool>         imageWithErrorQueue = new Queue <bool>();
            ConvolutionalDecoder decoder             = new ConvolutionalDecoder();
            ConvolutionalEncoder encoder             = new ConvolutionalEncoder();

            originalImageQueue = this.BinaryStringToQueue(this.ImageToBinary(_image, _image.RawFormat));

            encoder.EncodeQueue(originalImageQueue, encodedImageQueue);
            imageWithErrorQueue = Channel.SendData(encodedImageQueue);
            decodedImageQueue   = decoder.DecodeQueue(imageWithErrorQueue);
            DecodedImage        = this.BinaryToImage(this.BinaryQueueToString(decodedImageQueue));

            imageWithErrorQueue = Channel.SendData(originalImageQueue);
            ImageWithErrors     = this.BinaryToImage(this.BinaryQueueToString(imageWithErrorQueue));
        }
Exemple #3
0
        /// <summary>
        /// Atliekami kodavimo, deodavimo, konvertavimo ir siuntimo per kanalą veiksmai su paprastu tekstu
        /// </summary>
        /// <param name="_input">
        /// Tekstas , kurį reikia apdoroti
        /// </param>
        public void RunString(string _input)
        {
            Queue <bool>         originalStringQueue   = new Queue <bool>();
            Queue <bool>         encodedStringQueue    = new Queue <bool>();
            Queue <bool>         decodedStringQueue    = new Queue <bool>();
            Queue <bool>         stringWithErrorsQueue = new Queue <bool>();
            ConvolutionalEncoder encoder = new ConvolutionalEncoder();
            ConvolutionalDecoder decoder = new ConvolutionalDecoder();

            originalStringQueue = this.BinaryStringToQueue(this.StringToBinary(_input));


            encoder.EncodeQueue(originalStringQueue, encodedStringQueue);
            stringWithErrorsQueue = Channel.SendData(encodedStringQueue);
            decodedStringQueue    = decoder.DecodeQueue(stringWithErrorsQueue);

            DecodedVector = this.BinaryToString(this.BinaryQueueToString(decodedStringQueue));

            stringWithErrorsQueue.Clear();
            stringWithErrorsQueue = Channel.SendData(originalStringQueue);
            EncodedAndSentVector  = this.BinaryToString(this.BinaryQueueToString(originalStringQueue));
        }