Пример #1
0
    def _test(self, input_symbols):
        """
        Test one round trip.

        :param input_symbols:
        :return: none
        """
        (transformed_symbols) = (gabac.transform_diff_coding(input_symbols))

        (decoded_symbols) = (
            gabac.inverse_transform_diff_coding(transformed_symbols))

        self.assertTrue(np.array_equal(decoded_symbols, input_symbols))

        gabac.release(transformed_symbols)
        gabac.release(decoded_symbols)
Пример #2
0
    def _test(self,
              input_symbols,
              binarization_id,
              binarization_parameters,
              context_selection_id):
        """
        Test single configuration.

        :param self:
        :param input_symbols:
        :param binarization_id:
        :param binarization_parameters:
        :param context_selection_id:
        :return:
        """
        log.info(
            "binarization_id: {}, "
            "binarization_parameters: {}, "
            "context_selection_id: {}".format(
                binarization_id,
                binarization_parameters,
                context_selection_id
            )
        )

        (bitstream) = gabac.encode(
            input_symbols,
            binarization_id,
            binarization_parameters,
            context_selection_id
        )

        (decoded_symbols) = gabac.decode(
            bitstream,
            binarization_id,
            binarization_parameters,
            context_selection_id
        )

        self.assertTrue(np.array_equal(decoded_symbols, input_symbols))

        gabac.release(bitstream)
        gabac.release(decoded_symbols)
    def _test(self, input_symbols):
        """
        Test one round trip.

        :param input_symbols:
        :return: none
        """
        global g_window_sizes

        for window_size in g_window_sizes:
            (pointers, lengths, raw_values) = (gabac.transform_match_coding(
                input_symbols, window_size))

            (decoded_symbols) = (gabac.inverse_transform_match_coding(
                pointers, lengths, raw_values))

            self.assertTrue(np.array_equal(decoded_symbols, input_symbols))

            gabac.release(pointers)
            gabac.release(lengths)
            gabac.release(raw_values)
            gabac.release(decoded_symbols)
Пример #4
0
    def _test(self, input_symbols):
        """
        Test one round trip.

        :param input_symbols:
        :return:
        """
        guard = 100
        (raw_values, lengths) = (
            gabac.transform_rle_coding(input_symbols, guard)
        )

        (decoded_symbols) = (
            gabac.inverse_transform_rle_coding(raw_values, lengths, guard)
        )

        self.assertTrue(np.array_equal(decoded_symbols, input_symbols))

        gabac.release(raw_values)
        gabac.release(lengths)
        gabac.release(decoded_symbols)