diff --git a/CNNImageCodec.py b/CNNImageCodec.py new file mode 100644 index 0000000000000000000000000000000000000000..05111383287ac82a2b6f03b95d006b3777088ebb --- /dev/null +++ b/CNNImageCodec.py @@ -0,0 +1,264 @@ +#This code is the simplest example of image compression based on neural networks +#Comparison with JPEG is provided as well +#It is a demonstation for Information Theory course +#Written by Evgeny Belyaev, February 2024. +import os +import math +import numpy +from matplotlib import pyplot as plt +from PIL import Image +import imghdr +import tensorflow +from tensorflow import keras +from tensorflow.keras import layers +from tensorflow.keras.models import Model +from keras import backend as K + +#import C-implementation of Witten&Neal&Cleary-1987 arithmetic coding as a external module +from EntropyCodec import * + +#source folder with test images +testfolder = './test/' +#source folder with train images +trainfolder = './train/' +#size of test and train images +w=128 +h=128 +#If 0, then the training will be started, otherwise the model will be readed from a file +LoadModel = 1 +#Training parameters +batch_size = 10 +#Number of bits for representation of the layers sample in the training process +bt = 3 +epochs = 3000 +#epochs = 100 +#Model parameters +n1=128 +n2=32 +n3=16 + +#Number of images to be compressed and shown from the test folder +NumImagesToShow = 5 + +#Number of bits for representation of the layers sample +b = 3 + +#Compute PSNR in RGB domain +def PSNR_RGB(image1,image2): + width, height = image1.size + I1 = numpy.array(image1.getdata()).reshape(image1.size[0], image1.size[1], 3) + I2 = numpy.array(image2.getdata()).reshape(image2.size[0], image2.size[1], 3) + I1 = numpy.reshape(I1, width * height * 3) + I2 = numpy.reshape(I2, width * height * 3) + I1 = I1.astype(float) + I2 = I2.astype(float) + mse = numpy.mean((I1 - I2) ** 2) + if (mse == 0): # MSE is zero means no noise is present in the signal . + psnr=100.0 + else: + max_pixel = 255.0 + psnr = 20 * math.log10(max_pixel / math.sqrt(mse)) + #print("PSNR = %5.2f dB" % psnr) + return psnr + +#Compute PSNR between two vectors +def PSNR(y_true, y_pred): + max_pixel = 1.0 + return 10.0 * (1.0 / math.log(10)) * K.log((max_pixel ** 2) / (K.mean(K.square(y_pred - y_true)))) + +#reads all images from folder and puts them into x array +def LoadImagesFromFolder (foldername): + dir_list = os.listdir(foldername) + N = 0 + Nmax = 0 + for name in dir_list: + fullname = foldername + name + filetype = imghdr.what(fullname) + if filetype is None: + print('') + else: + Nmax = Nmax + 1 + + x = numpy.zeros([Nmax, w, h, 3]) + N = 0 + for name in dir_list: + fullname = foldername + name + filetype = imghdr.what(fullname) + if filetype is None: + print('Unknown image format for file: ', name) + else: + print('Progress: N = %i' % N) + image = Image.open(fullname) + I1 = numpy.array(image.getdata()).reshape(image.size[0], image.size[1], 3) + x[N, :, :, :] = I1 + N = N + 1 + return x + +#Model training function +def ImageCodecModel(trainfolder): + input = layers.Input(shape=(w, h, 3)) + # Encoder + e1 = layers.Conv2D(n1, (7, 7), activation="relu", padding="same")(input) + e1 = layers.MaxPooling2D((2, 2), padding="same")(e1) + e2 = layers.Conv2D(n2, (5, 5), activation="relu", padding="same")(e1) + e2 = layers.MaxPooling2D((2, 2), padding="same")(e2) + e3 = layers.Conv2D(n3, (3, 3), activation="relu", padding="same")(e2) + e3 = layers.MaxPooling2D((2, 2), padding="same")(e3) + #add noise during training (needed for layer quantinzation) + e3 = e3 + tensorflow.random.uniform(tensorflow.shape(e3), 0, tensorflow.math.reduce_max(e3)/pow(2, bt+1)) + + # Decoder + x = layers.Conv2DTranspose(n3, (3, 3), strides=2, activation="relu", padding="same")(e3) + x = layers.Conv2DTranspose(n2, (5, 5), strides=2, activation="relu", padding="same")(x) + x = layers.Conv2DTranspose(n1, (7, 7), strides=2, activation="relu", padding="same")(x) + x = layers.Conv2D(3, (3, 3), activation="sigmoid", padding="same")(x) + + # Autoencoder + encoder = Model(input, e3) + decoder = Model(e3, x) + autoencoder = Model(input, x) + autoencoder.compile(optimizer="adam", loss='mean_squared_error') + autoencoder.summary() + + if LoadModel == 0: + xtrain = LoadImagesFromFolder(trainfolder) + xtrain = xtrain / 255 + autoencoder.fit(xtrain, xtrain, epochs=epochs, batch_size=batch_size,shuffle=True) + autoencoder.save('autoencodertemp.mdl') + encoder.save('encoder.mdl') + decoder.save('decoder.mdl') + else: + autoencoder = keras.models.load_model('autoencodertemp.mdl') + encoder = keras.models.load_model('encoder.mdl') + decoder = keras.models.load_model('decoder.mdl') + return encoder,decoder + +#Compresses input layer by multi-alphabet arithmetic coding using memoryless source model +def EntropyEncoder (filename,enclayers,size_z,size_h,size_w): + temp = numpy.zeros((size_z, size_h, size_w), numpy.uint8, 'C') + for z in range(size_z): + for h in range(size_h): + for w in range(size_w): + temp[z][h][w] = enclayers[z][h][w] + maxbinsize = (size_h * size_w * size_z) + bitstream = numpy.zeros(maxbinsize, numpy.uint8, 'C') + StreamSize = numpy.zeros(1, numpy.int32, 'C') + HiddenLayersEncoder(temp, size_w, size_h, size_z, bitstream, StreamSize) + name = filename + path = './' + fp = open(os.path.join(path, name), 'wb') + out = bitstream[0:StreamSize[0]] + out.astype('uint8').tofile(fp) + fp.close() + +#Decompresses input layer by multi-alphabet arithmetic coding using memoryless source model +def EntropyDecoder (filename,size_z,size_h,size_w): + fp = open(filename, 'rb') + bitstream = fp.read() + fp.close() + bitstream = numpy.frombuffer(bitstream, dtype=numpy.uint8) + declayers = numpy.zeros((size_z, size_h, size_w), numpy.uint8, 'C') + FrameOffset = numpy.zeros(1, numpy.int32, 'C') + FrameOffset[0] = 0 + HiddenLayersDecoder(declayers, size_w, size_h, size_z, bitstream, FrameOffset) + return declayers + +#This function is searching for the JPEG quality factor (QF) +#which provides neares compression to TargetBPP +def JPEGRDSingleImage(X,TargetBPP,i): + X = X*255 + image = Image.fromarray(X.astype('uint8'), 'RGB') + width, height = image. size + realbpp = 0 + realpsnr = 0 + realQ = 0 + for Q in range(101): + image.save('test.jpeg', "JPEG", quality=Q) + image_dec = Image.open('test.jpeg') + bytesize = os.path.getsize('test.jpeg') + bpp = bytesize*8/(width*height) + psnr = PSNR_RGB(image, image_dec) + if abs(realbpp-TargetBPP)>abs(bpp-TargetBPP): + realbpp=bpp + realpsnr=psnr + realQ = Q + JPEGfilename = 'image%i.jpeg' % i + image.save(JPEGfilename, "JPEG", quality=realQ) + return realQ, realbpp, realpsnr + +# Main function +if __name__ == '__main__': + #Load test images + xtest = LoadImagesFromFolder(testfolder) + xtest = xtest / 255 + + #Train the model + encoder, decoder = ImageCodecModel(trainfolder) + + #Run the model for first NumImagesToShow images from the test set + encoded_layers = encoder.predict(xtest, batch_size=NumImagesToShow) + max_encoded_layers = numpy.zeros(NumImagesToShow, numpy.float16, 'C') + + #normalization the layer to interval [0,1) + for i in range(NumImagesToShow): + max_encoded_layers[i] = numpy.max(encoded_layers[i]) + encoded_layers[i] = encoded_layers[i] / max_encoded_layers[i] + + #Quantization of layer to b bits + encoded_layers1 = numpy.clip(encoded_layers, 0, 0.9999999) + encoded_layers1 = K.cast(encoded_layers1*pow(2, b), "int32") + + #Encoding and decoding of each quantized layer by arithmetic coding + bpp = numpy.zeros(NumImagesToShow, numpy.float16, 'C') + declayers = numpy.zeros((NumImagesToShow,16, 16, 16), numpy.uint8, 'C') + for i in range(NumImagesToShow): + binfilename = 'image%i.bin' % i + EntropyEncoder(binfilename, encoded_layers1[i], 16, 16, 16) + bytesize = os.path.getsize(binfilename) + bpp[i] = bytesize * 8 / (w * h) + declayers[i] = EntropyDecoder(binfilename, 16, 16, 16) + + #Dequantization and denormalization of each layer + print(bpp) + shift = 1.0/pow(2, b+1) + declayers = K.cast(declayers, "float32") / pow(2, b) + declayers = declayers + shift + encoded_layers_quantized = numpy.zeros((NumImagesToShow, 16, 16, 16), numpy.double, 'C') + for i in range(NumImagesToShow): + encoded_layers_quantized[i] = K.cast(declayers[i]*max_encoded_layers[i], "float32") + encoded_layers[i] = K.cast(encoded_layers[i] * max_encoded_layers[i], "float32") + decoded_imgs = decoder.predict(encoded_layers, batch_size=NumImagesToShow) + decoded_imgsQ = decoder.predict(encoded_layers_quantized, batch_size=NumImagesToShow) + + #Shows NumImagesToShow images from the test set + #For each image the following results are presented + #Original image + #Image, represented by the model (without quantization) + #Image, represented by the model with quantization and compression of the layers samples + #Corresponding JPEG image at the same compression level + for i in range(NumImagesToShow): + title = '' + plt.subplot(4, NumImagesToShow, i + 1).set_title(title, fontsize=10) + plt.imshow(xtest[i, :, :, :], interpolation='nearest') + plt.axis(False) + for i in range(NumImagesToShow): + psnr = PSNR(xtest[i, :, :, :], decoded_imgs[i, :, :, :]) + title = '%2.2f' % psnr + plt.subplot(4, NumImagesToShow, NumImagesToShow + i + 1).set_title(title, fontsize=10) + plt.imshow(decoded_imgs[i, :, :, :], interpolation='nearest') + plt.axis(False) + for i in range(NumImagesToShow): + psnr = PSNR(xtest[i, :, :, :], decoded_imgsQ[i, :, :, :]) + title = '%2.2f %2.2f' % (psnr, bpp[i]) + plt.subplot(4, NumImagesToShow, 2*NumImagesToShow + i + 1).set_title(title, fontsize=10) + plt.imshow(decoded_imgsQ[i, :, :, :], interpolation='nearest') + plt.axis(False) + for i in range(NumImagesToShow): + JPEGQP,JPEGrealbpp, JPEGrealpsnr = JPEGRDSingleImage(xtest[i, :, :, :], bpp[i],i) + JPEGfilename = 'image%i.jpeg' % i + JPEGimage = Image.open(JPEGfilename) + title = '%2.2f %2.2f' % (JPEGrealpsnr,JPEGrealbpp) + plt.subplot(4, NumImagesToShow, 3*NumImagesToShow + i + 1).set_title(title, fontsize=10) + plt.imshow(JPEGimage, interpolation='nearest') + plt.axis(False) + plt.show() \ No newline at end of file diff --git a/EntropyCodec.cp39-win_amd64.pyd b/EntropyCodec.cp39-win_amd64.pyd new file mode 100644 index 0000000000000000000000000000000000000000..e39fa1f9f162a011272700fb8bed0396f0539bf1 Binary files /dev/null and b/EntropyCodec.cp39-win_amd64.pyd differ diff --git a/EntropyCompile.bat b/EntropyCompile.bat new file mode 100644 index 0000000000000000000000000000000000000000..a696bb581ee6413aa20de2c70fcd507d813a6bbe --- /dev/null +++ b/EntropyCompile.bat @@ -0,0 +1,4 @@ +del EntropyCodec.cp39-win_amd64.pyd +del ..\EntropyCodec.cp39-win_amd64.pyd +python.exe EntropySetup.py build_ext --inplace +pause \ No newline at end of file diff --git a/EntropySetup.py b/EntropySetup.py new file mode 100644 index 0000000000000000000000000000000000000000..2b5d4d765adfc75da729d2ec7fb6ff8a0d8fded3 --- /dev/null +++ b/EntropySetup.py @@ -0,0 +1,12 @@ +from setuptools import setup, Extension +import os +import pybind11 + +functions_module = Extension( + name='EntropyCodec', + sources=['wrapper.cpp'], + include_dirs=[os.path.join(os.getenv('PYTHON_DIR'), 'include'), + os.path.join(pybind11.__path__[0], 'include')] +) + +setup(ext_modules=[functions_module], options={"build_ext": {"build_lib": ".."}}) diff --git a/ImageCoder.cpp b/ImageCoder.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c708b73e9ea8e46bbd3ac68e2578fdc61822f4e4 --- /dev/null +++ b/ImageCoder.cpp @@ -0,0 +1,78 @@ +// ImageCodec.cpp : This file contains the 'main' function. Program execution begins and ends there. +// +#define _CRT_SECURE_NO_WARNINGS +#include +#include +#include +#include +#include + +#include "mcoder.h" + +int BitPlaneEncoder(unsigned char *obuffer, unsigned char *layer1, int w1, int h1, int z1, int *bitsize) +{ + BiContextType bin_ctx; + int code_len = 0; + EncodingEnvironmentPtr eep; + unsigned char *bufptr = obuffer; + + eep = arienco_create_encoding_environment(); + arienco_start_encoding(eep, bufptr, &code_len); + biari_init_context(&bin_ctx, "ctx"); + + for (int z = 0;z < z1;z++) + { + for (int i = 0;i < h1;i++) + { + for (int j = 0;j < w1;j++) + { + biari_encode_symbol(eep, layer1[z*h1*w1+i*w1+j], &bin_ctx); + } + } + } + + biari_encode_symbol(eep, 0, &bin_ctx); + biari_encode_symbol(eep, 1, &bin_ctx); + biari_encode_symbol(eep, 0, &bin_ctx); + biari_encode_symbol(eep, 1, &bin_ctx); + + arienco_done_encoding(eep); + arienco_delete_encoding_environment(eep); + *bitsize = code_len / 8; + + return code_len / 8; +} + +int BitPlaneDecoder(unsigned char *obuffer, unsigned char *layer1, int w1, int h1, int z1, int *offset) +{ + BiContextType bin_ctx; + int code_len = 0; + DecodingEnvironmentPtr dep; + unsigned char *bufptr = obuffer; + + bufptr += (*offset); + dep = arideco_create_decoding_environment(); + arideco_start_decoding(dep, bufptr, 0, &code_len); + biari_init_context(&bin_ctx, "ctx"); + + for (int z = 0;z < z1;z++) + { + for (int i = 0;i < h1;i++) + { + for (int j = 0;j < w1;j++) + { + layer1[z*h1*w1 + i * w1 + j] = biari_decode_symbol(dep, &bin_ctx); + } + } + } + *offset = code_len; + arideco_delete_decoding_environment(dep); + + return 0; +} + +int main(int argc, char* argv[]) +{ + + return 0; +} \ No newline at end of file diff --git a/ac_dec.cpp b/ac_dec.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2465f9a0bdc19ba23f09e9b3f8eff94473fd775d --- /dev/null +++ b/ac_dec.cpp @@ -0,0 +1,130 @@ +#include +#include +#include "mcoder.h" +#include + + +/*! + ************************************************************************ + * \brief + * Allocates memory for the DecodingEnvironment struct + * \return DecodingContextPtr + * allocates memory + ************************************************************************ + */ +DecodingEnvironmentPtr arideco_create_decoding_environment() +{ + DecodingEnvironmentPtr dep; + + if ((dep = (DecodingEnvironmentPtr)calloc(1,sizeof(DecodingEnvironment))) == NULL) + printf("arideco_create_decoding_environment: dep"); + return dep; +} + + +/*! + *********************************************************************** + * \brief + * Frees memory of the DecodingEnvironment struct + *********************************************************************** + */ +void arideco_delete_decoding_environment(DecodingEnvironmentPtr dep) +{ + free(dep); +} + + +/*! + ************************************************************************ + * \brief + * Initializes the DecodingEnvironment for the arithmetic coder + ************************************************************************ + */ +void arideco_start_decoding(DecodingEnvironmentPtr dep, unsigned char *cpixcode, + int firstbyte, int *cpixcode_len ) +{ + register unsigned int bbit = 0; + + int value = 0; + dep->Dcodestrm = cpixcode; + dep->Dcodestrm_len = (unsigned int*)cpixcode_len; + dep->Dvalue = 0; + for (int i = 1; i <= BITS_IN_REGISTER; i++) + { + Get1Bit(dep->Dcodestrm, *dep->Dcodestrm_len, bbit); + dep->Dvalue = 2 * dep->Dvalue + bbit; + } + dep->Dlow = 0; + dep->Drange = HALF-2; +} + +unsigned int biari_decode_symbol(DecodingEnvironmentPtr dep, BiContextTypePtr bi_ct) +{ + int bbit; + register unsigned int low = dep->Dlow; + register unsigned int value = dep->Dvalue; + register unsigned int range = dep->Drange; + unsigned int symbol; + + unsigned int cum = (int)((((long) (value - low) + 1) * bi_ct->freq_all - 1) / range); + for (int i=0;icum_freq [i] > cum) + { + break; + } + symbol = i; + } + + low = low + (range * bi_ct->cum_freq [symbol]) / bi_ct->freq_all; + range = (range*bi_ct->freq [symbol])/bi_ct->freq_all; + range = max(1,range); + + bi_ct->freq[symbol]++; + bi_ct->freq_all++; + if (bi_ct->freq_all>16384) + { + bi_ct->freq_all=0; + for (int i=0;ifreq[i]=max(1,bi_ct->freq[i]>>1); + bi_ct->freq_all+=bi_ct->freq[i]; + } + } + bi_ct->cum_freq[0]=0; + for (int i=1;i<=ALPHABET_SIZE;i++) + { + bi_ct->cum_freq[i] = bi_ct->cum_freq[i-1]+bi_ct->freq[i-1]; + } + + while (range < QUARTER) + { + if (low >= HALF) + { + low -= HALF; + value -= HALF; + } + else + if (low < QUARTER) + { + } + else + { + low -= QUARTER; + value -= QUARTER; + } + // Double range + range <<= 1; + low <<= 1; + Get1Bit(dep->Dcodestrm, *dep->Dcodestrm_len, bbit); + value = (value << 1) | bbit; + } + + dep->Drange = range; + dep->Dvalue = value; + dep->Dlow = low; + + return(symbol); +} + + diff --git a/ac_enc.cpp b/ac_enc.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e67d9685bef98e774e315485a304627b62e8c155 --- /dev/null +++ b/ac_enc.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include "mcoder.h" + +/*! + ************************************************************************ + * \brief + * Initializes a given context with some pre-defined probability state + ************************************************************************ + */ +void biari_init_context +( + BiContextTypePtr ctx, + char* name +) +{ + ctx->freq_all = 0; + for (int i=0;ifreq[i] = 1; + ctx->freq_all+=ctx->freq[i]; + } + + ctx->cum_freq[0]=0; + for (int i=1;i<=ALPHABET_SIZE;i++) + { + ctx->cum_freq[i] = ctx->cum_freq[i-1]+ctx->freq[i-1]; + } +} + +/*! + ************************************************************************ + * \brief + * Allocates memory for the EncodingEnvironment struct + ************************************************************************ + */ +EncodingEnvironmentPtr arienco_create_encoding_environment() +{ + EncodingEnvironmentPtr eep; + + if ( (eep = (EncodingEnvironmentPtr) calloc(1,sizeof(EncodingEnvironment))) == NULL) + printf("arienco_create_encoding_environment: eep"); + + return eep; +} + +/*! + ************************************************************************ + * \brief + * Frees memory of the EncodingEnvironment struct + ************************************************************************ + */ +void arienco_delete_encoding_environment(EncodingEnvironmentPtr eep) +{ + if (eep != NULL) + { + free(eep); + } +} + +/*! + ************************************************************************ + * \brief + * Initializes the EncodingEnvironment for the arithmetic coder + ************************************************************************ + */ +void arienco_start_encoding(EncodingEnvironmentPtr eep, + unsigned char *code_buffer, + int *code_len ) +{ + eep->Elow = 0; + eep->Erange = HALF-2; + eep->Ebits_to_follow = 0; + eep->Ecodestrm = code_buffer; + eep->Ecodestrm_len = (unsigned int*)code_len; +} + +/*! + ************************************************************************ + * \brief + * Terminates the arithmetic codeword, writes stop bit and stuffing bytes (if any) + ************************************************************************ + */ + +void arienco_done_encoding(EncodingEnvironmentPtr eep) +{ + if((eep->Elow >> (BITS_IN_REGISTER-1)) & 1) + { + put_one_bit_1_plus_outstanding; + } + else + { + put_one_bit_0_plus_outstanding; + } + + Put1Bit(eep->Ecodestrm, *eep->Ecodestrm_len, (eep->Elow >> (BITS_IN_REGISTER-2))&1); + Put1Bit(eep->Ecodestrm, *eep->Ecodestrm_len, 1); + *eep->Ecodestrm_len = (*eep->Ecodestrm_len+7) & ~7; +} + + + +void biari_encode_symbol(EncodingEnvironmentPtr eep, signed int symbol, BiContextTypePtr bi_ct) +{ + register unsigned int range = eep->Erange; + register unsigned int low = eep->Elow; + + low = low + (range * bi_ct->cum_freq [symbol]) / bi_ct->freq_all; + range = (range*bi_ct->freq [symbol])/bi_ct->freq_all; + range=max(1,range); + + bi_ct->freq[symbol]++; + bi_ct->freq_all++; + if (bi_ct->freq_all>16384) + { + bi_ct->freq_all=0; + for (int i=0;ifreq[i]=max(1,bi_ct->freq[i]>>1); + bi_ct->freq_all+=bi_ct->freq[i]; + } + } + bi_ct->cum_freq[0]=0; + for (int i=1;i<=ALPHABET_SIZE;i++) + { + bi_ct->cum_freq[i] = bi_ct->cum_freq[i-1]+bi_ct->freq[i-1]; + } + + // renormalization + while (range < QUARTER) + { + if (low >= HALF) + { + put_one_bit_1_plus_outstanding; + low -= HALF; + } + else + if (low < QUARTER) + { + put_one_bit_0_plus_outstanding; + } + else + { + eep->Ebits_to_follow++; + low -= QUARTER; + } + low <<= 1; + range <<= 1; + } + + eep->Erange = range; + eep->Elow = low; + + bi_ct->freq_stat[symbol]++; +} + diff --git a/decoder.mdl/fingerprint.pb b/decoder.mdl/fingerprint.pb new file mode 100644 index 0000000000000000000000000000000000000000..f13120e004dff7717e44fa8e27eeba74094b1844 --- /dev/null +++ b/decoder.mdl/fingerprint.pb @@ -0,0 +1 @@ +ގœ浂* ȾG(e2 \ No newline at end of file diff --git a/decoder.mdl/keras_metadata.pb b/decoder.mdl/keras_metadata.pb new file mode 100644 index 0000000000000000000000000000000000000000..3008aaf6985d325df8c96dedae80522b4f52ae18 --- /dev/null +++ b/decoder.mdl/keras_metadata.pb @@ -0,0 +1,15 @@ + +Aroot"_tf_keras_network*A{"name": "model_1", "trainable": true, "expects_training_arg": true, "dtype": "float32", "batch_input_shape": null, "must_restore_from_config": false, "preserve_input_structure_in_config": false, "autocast": false, "class_name": "Functional", "config": {"name": "model_1", "trainable": true, "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": {"class_name": "__tuple__", "items": [null, 16, 16, 16]}, "dtype": "float32", "sparse": false, "ragged": false, "name": "input_2"}, "name": "input_2", "inbound_nodes": []}, {"class_name": "Conv2DTranspose", "config": {"name": "conv2d_transpose", "trainable": true, "dtype": "float32", "filters": 16, "kernel_size": {"class_name": "__tuple__", "items": [3, 3]}, "strides": {"class_name": "__tuple__", "items": [2, 2]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null, "output_padding": null}, "name": "conv2d_transpose", "inbound_nodes": [[["input_2", 0, 0, {}]]]}, {"class_name": "Conv2DTranspose", "config": {"name": "conv2d_transpose_1", "trainable": true, "dtype": "float32", "filters": 32, "kernel_size": {"class_name": "__tuple__", "items": [5, 5]}, "strides": {"class_name": "__tuple__", "items": [2, 2]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null, "output_padding": null}, "name": "conv2d_transpose_1", "inbound_nodes": [[["conv2d_transpose", 0, 0, {}]]]}, {"class_name": "Conv2DTranspose", "config": {"name": "conv2d_transpose_2", "trainable": true, "dtype": "float32", "filters": 128, "kernel_size": {"class_name": "__tuple__", "items": [7, 7]}, "strides": {"class_name": "__tuple__", "items": [2, 2]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null, "output_padding": null}, "name": "conv2d_transpose_2", "inbound_nodes": [[["conv2d_transpose_1", 0, 0, {}]]]}, {"class_name": "Conv2D", "config": {"name": "conv2d_3", "trainable": true, "dtype": "float32", "filters": 3, "kernel_size": {"class_name": "__tuple__", "items": [3, 3]}, "strides": {"class_name": "__tuple__", "items": [1, 1]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "sigmoid", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "name": "conv2d_3", "inbound_nodes": [[["conv2d_transpose_2", 0, 0, {}]]]}], "input_layers": [["input_2", 0, 0]], "output_layers": [["conv2d_3", 0, 0]]}, "shared_object_id": 13, "input_spec": [{"class_name": "InputSpec", "config": {"dtype": null, "shape": {"class_name": "__tuple__", "items": [null, 16, 16, 16]}, "ndim": 4, "max_ndim": null, "min_ndim": null, "axes": {}}}], "build_input_shape": {"class_name": "TensorShape", "items": [null, 16, 16, 16]}, "is_graph_network": true, "full_save_spec": {"class_name": "__tuple__", "items": [[{"class_name": "TypeSpec", "type_spec": "tf.TensorSpec", "serialized": [{"class_name": "TensorShape", "items": [null, 16, 16, 16]}, "float32", null]}], {}]}, "save_spec": {"class_name": "TypeSpec", "type_spec": "tf.TensorSpec", "serialized": [{"class_name": "TensorShape", "items": [null, 16, 16, 16]}, "float32", null]}, "keras_version": "2.15.0", "backend": "tensorflow", "model_config": {"class_name": "Functional", "config": {"name": "model_1", "trainable": true, "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": {"class_name": "__tuple__", "items": [null, 16, 16, 16]}, "dtype": "float32", "sparse": false, "ragged": false, "name": "input_2"}, "name": "input_2", "inbound_nodes": [], "shared_object_id": 0}, {"class_name": "Conv2DTranspose", "config": {"name": "conv2d_transpose", "trainable": true, "dtype": "float32", "filters": 16, "kernel_size": {"class_name": "__tuple__", "items": [3, 3]}, "strides": {"class_name": "__tuple__", "items": [2, 2]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 1}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 2}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null, "output_padding": null}, "name": "conv2d_transpose", "inbound_nodes": [[["input_2", 0, 0, {}]]], "shared_object_id": 3}, {"class_name": "Conv2DTranspose", "config": {"name": "conv2d_transpose_1", "trainable": true, "dtype": "float32", "filters": 32, "kernel_size": {"class_name": "__tuple__", "items": [5, 5]}, "strides": {"class_name": "__tuple__", "items": [2, 2]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 4}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 5}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null, "output_padding": null}, "name": "conv2d_transpose_1", "inbound_nodes": [[["conv2d_transpose", 0, 0, {}]]], "shared_object_id": 6}, {"class_name": "Conv2DTranspose", "config": {"name": "conv2d_transpose_2", "trainable": true, "dtype": "float32", "filters": 128, "kernel_size": {"class_name": "__tuple__", "items": [7, 7]}, "strides": {"class_name": "__tuple__", "items": [2, 2]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 7}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 8}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null, "output_padding": null}, "name": "conv2d_transpose_2", "inbound_nodes": [[["conv2d_transpose_1", 0, 0, {}]]], "shared_object_id": 9}, {"class_name": "Conv2D", "config": {"name": "conv2d_3", "trainable": true, "dtype": "float32", "filters": 3, "kernel_size": {"class_name": "__tuple__", "items": [3, 3]}, "strides": {"class_name": "__tuple__", "items": [1, 1]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "sigmoid", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 10}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 11}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "name": "conv2d_3", "inbound_nodes": [[["conv2d_transpose_2", 0, 0, {}]]], "shared_object_id": 12}], "input_layers": [["input_2", 0, 0]], "output_layers": [["conv2d_3", 0, 0]]}}}2 + root.layer-0"_tf_keras_input_layer*{"class_name": "InputLayer", "name": "input_2", "dtype": "float32", "sparse": false, "ragged": false, "batch_input_shape": {"class_name": "__tuple__", "items": [null, 16, 16, 16]}, "config": {"batch_input_shape": {"class_name": "__tuple__", "items": [null, 16, 16, 16]}, "dtype": "float32", "sparse": false, "ragged": false, "name": "input_2"}}2 + +root.layer_with_weights-0"_tf_keras_layer* +{"name": "conv2d_transpose", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "preserve_input_structure_in_config": false, "autocast": true, "class_name": "Conv2DTranspose", "config": {"name": "conv2d_transpose", "trainable": true, "dtype": "float32", "filters": 16, "kernel_size": {"class_name": "__tuple__", "items": [3, 3]}, "strides": {"class_name": "__tuple__", "items": [2, 2]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 1}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 2}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null, "output_padding": null}, "inbound_nodes": [[["input_2", 0, 0, {}]]], "shared_object_id": 3, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": 4, "max_ndim": null, "min_ndim": null, "axes": {"-1": 16}}, "shared_object_id": 15}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 16, 16, 16]}}2 + +root.layer_with_weights-1"_tf_keras_layer* +{"name": "conv2d_transpose_1", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "preserve_input_structure_in_config": false, "autocast": true, "class_name": "Conv2DTranspose", "config": {"name": "conv2d_transpose_1", "trainable": true, "dtype": "float32", "filters": 32, "kernel_size": {"class_name": "__tuple__", "items": [5, 5]}, "strides": {"class_name": "__tuple__", "items": [2, 2]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 4}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 5}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null, "output_padding": null}, "inbound_nodes": [[["conv2d_transpose", 0, 0, {}]]], "shared_object_id": 6, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": 4, "max_ndim": null, "min_ndim": null, "axes": {"-1": 16}}, "shared_object_id": 16}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 32, 32, 16]}}2 + +root.layer_with_weights-2"_tf_keras_layer* +{"name": "conv2d_transpose_2", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "preserve_input_structure_in_config": false, "autocast": true, "class_name": "Conv2DTranspose", "config": {"name": "conv2d_transpose_2", "trainable": true, "dtype": "float32", "filters": 128, "kernel_size": {"class_name": "__tuple__", "items": [7, 7]}, "strides": {"class_name": "__tuple__", "items": [2, 2]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 7}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 8}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null, "output_padding": null}, "inbound_nodes": [[["conv2d_transpose_1", 0, 0, {}]]], "shared_object_id": 9, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": 4, "max_ndim": null, "min_ndim": null, "axes": {"-1": 32}}, "shared_object_id": 17}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 64, 64, 32]}}2 + +root.layer_with_weights-3"_tf_keras_layer* +{"name": "conv2d_3", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "preserve_input_structure_in_config": false, "autocast": true, "class_name": "Conv2D", "config": {"name": "conv2d_3", "trainable": true, "dtype": "float32", "filters": 3, "kernel_size": {"class_name": "__tuple__", "items": [3, 3]}, "strides": {"class_name": "__tuple__", "items": [1, 1]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "sigmoid", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 10}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 11}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "inbound_nodes": [[["conv2d_transpose_2", 0, 0, {}]]], "shared_object_id": 12, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 4, "axes": {"-1": 128}}, "shared_object_id": 18}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 128, 128, 128]}}2 \ No newline at end of file diff --git a/decoder.mdl/saved_model.pb b/decoder.mdl/saved_model.pb new file mode 100644 index 0000000000000000000000000000000000000000..3da87b71fa1fd722da2ecdc8fd50624f5c81c197 Binary files /dev/null and b/decoder.mdl/saved_model.pb differ diff --git a/decoder.mdl/variables/variables.data-00000-of-00001 b/decoder.mdl/variables/variables.data-00000-of-00001 new file mode 100644 index 0000000000000000000000000000000000000000..2ef8593c4e44ec65036a6ba25f37d4ca02fc00f8 Binary files /dev/null and b/decoder.mdl/variables/variables.data-00000-of-00001 differ diff --git a/decoder.mdl/variables/variables.index b/decoder.mdl/variables/variables.index new file mode 100644 index 0000000000000000000000000000000000000000..e96a27e29e8b1b8ec42dc4188dbb3c8b409335b2 Binary files /dev/null and b/decoder.mdl/variables/variables.index differ diff --git a/encoder.mdl/fingerprint.pb b/encoder.mdl/fingerprint.pb new file mode 100644 index 0000000000000000000000000000000000000000..77d77b1e652f50e19405ab7920a473339c80e85d --- /dev/null +++ b/encoder.mdl/fingerprint.pb @@ -0,0 +1 @@ +Ֆ֯i ǹL(Ͳ2 \ No newline at end of file diff --git a/encoder.mdl/keras_metadata.pb b/encoder.mdl/keras_metadata.pb new file mode 100644 index 0000000000000000000000000000000000000000..c5b4d4b32540dfe2d19ca7fde38f4458d1b928fb --- /dev/null +++ b/encoder.mdl/keras_metadata.pb @@ -0,0 +1,20 @@ + +Xroot"_tf_keras_network*X{"name": "model", "trainable": true, "expects_training_arg": true, "dtype": "float32", "batch_input_shape": null, "must_restore_from_config": false, "preserve_input_structure_in_config": false, "autocast": false, "class_name": "Functional", "config": {"name": "model", "trainable": true, "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": {"class_name": "__tuple__", "items": [null, 128, 128, 3]}, "dtype": "float32", "sparse": false, "ragged": false, "name": "input_1"}, "name": "input_1", "inbound_nodes": []}, {"class_name": "Conv2D", "config": {"name": "conv2d", "trainable": true, "dtype": "float32", "filters": 128, "kernel_size": {"class_name": "__tuple__", "items": [7, 7]}, "strides": {"class_name": "__tuple__", "items": [1, 1]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "name": "conv2d", "inbound_nodes": [[["input_1", 0, 0, {}]]]}, {"class_name": "MaxPooling2D", "config": {"name": "max_pooling2d", "trainable": true, "dtype": "float32", "pool_size": {"class_name": "__tuple__", "items": [2, 2]}, "padding": "same", "strides": {"class_name": "__tuple__", "items": [2, 2]}, "data_format": "channels_last"}, "name": "max_pooling2d", "inbound_nodes": [[["conv2d", 0, 0, {}]]]}, {"class_name": "Conv2D", "config": {"name": "conv2d_1", "trainable": true, "dtype": "float32", "filters": 32, "kernel_size": {"class_name": "__tuple__", "items": [5, 5]}, "strides": {"class_name": "__tuple__", "items": [1, 1]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "name": "conv2d_1", "inbound_nodes": [[["max_pooling2d", 0, 0, {}]]]}, {"class_name": "MaxPooling2D", "config": {"name": "max_pooling2d_1", "trainable": true, "dtype": "float32", "pool_size": {"class_name": "__tuple__", "items": [2, 2]}, "padding": "same", "strides": {"class_name": "__tuple__", "items": [2, 2]}, "data_format": "channels_last"}, "name": "max_pooling2d_1", "inbound_nodes": [[["conv2d_1", 0, 0, {}]]]}, {"class_name": "Conv2D", "config": {"name": "conv2d_2", "trainable": true, "dtype": "float32", "filters": 16, "kernel_size": {"class_name": "__tuple__", "items": [3, 3]}, "strides": {"class_name": "__tuple__", "items": [1, 1]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "name": "conv2d_2", "inbound_nodes": [[["max_pooling2d_1", 0, 0, {}]]]}, {"class_name": "MaxPooling2D", "config": {"name": "max_pooling2d_2", "trainable": true, "dtype": "float32", "pool_size": {"class_name": "__tuple__", "items": [2, 2]}, "padding": "same", "strides": {"class_name": "__tuple__", "items": [2, 2]}, "data_format": "channels_last"}, "name": "max_pooling2d_2", "inbound_nodes": [[["conv2d_2", 0, 0, {}]]]}, {"class_name": "TFOpLambda", "config": {"name": "tf.math.reduce_max", "trainable": true, "dtype": "float32", "function": "math.reduce_max"}, "name": "tf.math.reduce_max", "inbound_nodes": [["max_pooling2d_2", 0, 0, {}]]}, {"class_name": "TFOpLambda", "config": {"name": "tf.compat.v1.shape", "trainable": true, "dtype": "float32", "function": "compat.v1.shape"}, "name": "tf.compat.v1.shape", "inbound_nodes": [["max_pooling2d_2", 0, 0, {"name": null, "out_type": "int32"}]]}, {"class_name": "TFOpLambda", "config": {"name": "tf.math.truediv", "trainable": true, "dtype": "float32", "function": "math.truediv"}, "name": "tf.math.truediv", "inbound_nodes": [["tf.math.reduce_max", 0, 0, {"y": 16, "name": null}]]}, {"class_name": "TFOpLambda", "config": {"name": "tf.random.uniform", "trainable": true, "dtype": "float32", "function": "random.uniform"}, "name": "tf.random.uniform", "inbound_nodes": [["tf.compat.v1.shape", 0, 0, {"minval": 0, "maxval": ["tf.math.truediv", 0, 0]}]]}, {"class_name": "TFOpLambda", "config": {"name": "tf.__operators__.add", "trainable": true, "dtype": "float32", "function": "__operators__.add"}, "name": "tf.__operators__.add", "inbound_nodes": [["max_pooling2d_2", 0, 0, {"y": ["tf.random.uniform", 0, 0], "name": null}]]}], "input_layers": [["input_1", 0, 0]], "output_layers": [["tf.__operators__.add", 0, 0]]}, "shared_object_id": 18, "input_spec": [{"class_name": "InputSpec", "config": {"dtype": null, "shape": {"class_name": "__tuple__", "items": [null, 128, 128, 3]}, "ndim": 4, "max_ndim": null, "min_ndim": null, "axes": {}}}], "build_input_shape": {"class_name": "TensorShape", "items": [null, 128, 128, 3]}, "is_graph_network": true, "full_save_spec": {"class_name": "__tuple__", "items": [[{"class_name": "TypeSpec", "type_spec": "tf.TensorSpec", "serialized": [{"class_name": "TensorShape", "items": [null, 128, 128, 3]}, "float32", "input_1"]}], {}]}, "save_spec": {"class_name": "TypeSpec", "type_spec": "tf.TensorSpec", "serialized": [{"class_name": "TensorShape", "items": [null, 128, 128, 3]}, "float32", "input_1"]}, "keras_version": "2.15.0", "backend": "tensorflow", "model_config": {"class_name": "Functional", "config": {"name": "model", "trainable": true, "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": {"class_name": "__tuple__", "items": [null, 128, 128, 3]}, "dtype": "float32", "sparse": false, "ragged": false, "name": "input_1"}, "name": "input_1", "inbound_nodes": [], "shared_object_id": 0}, {"class_name": "Conv2D", "config": {"name": "conv2d", "trainable": true, "dtype": "float32", "filters": 128, "kernel_size": {"class_name": "__tuple__", "items": [7, 7]}, "strides": {"class_name": "__tuple__", "items": [1, 1]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 1}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 2}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "name": "conv2d", "inbound_nodes": [[["input_1", 0, 0, {}]]], "shared_object_id": 3}, {"class_name": "MaxPooling2D", "config": {"name": "max_pooling2d", "trainable": true, "dtype": "float32", "pool_size": {"class_name": "__tuple__", "items": [2, 2]}, "padding": "same", "strides": {"class_name": "__tuple__", "items": [2, 2]}, "data_format": "channels_last"}, "name": "max_pooling2d", "inbound_nodes": [[["conv2d", 0, 0, {}]]], "shared_object_id": 4}, {"class_name": "Conv2D", "config": {"name": "conv2d_1", "trainable": true, "dtype": "float32", "filters": 32, "kernel_size": {"class_name": "__tuple__", "items": [5, 5]}, "strides": {"class_name": "__tuple__", "items": [1, 1]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 5}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 6}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "name": "conv2d_1", "inbound_nodes": [[["max_pooling2d", 0, 0, {}]]], "shared_object_id": 7}, {"class_name": "MaxPooling2D", "config": {"name": "max_pooling2d_1", "trainable": true, "dtype": "float32", "pool_size": {"class_name": "__tuple__", "items": [2, 2]}, "padding": "same", "strides": {"class_name": "__tuple__", "items": [2, 2]}, "data_format": "channels_last"}, "name": "max_pooling2d_1", "inbound_nodes": [[["conv2d_1", 0, 0, {}]]], "shared_object_id": 8}, {"class_name": "Conv2D", "config": {"name": "conv2d_2", "trainable": true, "dtype": "float32", "filters": 16, "kernel_size": {"class_name": "__tuple__", "items": [3, 3]}, "strides": {"class_name": "__tuple__", "items": [1, 1]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 9}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 10}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "name": "conv2d_2", "inbound_nodes": [[["max_pooling2d_1", 0, 0, {}]]], "shared_object_id": 11}, {"class_name": "MaxPooling2D", "config": {"name": "max_pooling2d_2", "trainable": true, "dtype": "float32", "pool_size": {"class_name": "__tuple__", "items": [2, 2]}, "padding": "same", "strides": {"class_name": "__tuple__", "items": [2, 2]}, "data_format": "channels_last"}, "name": "max_pooling2d_2", "inbound_nodes": [[["conv2d_2", 0, 0, {}]]], "shared_object_id": 12}, {"class_name": "TFOpLambda", "config": {"name": "tf.math.reduce_max", "trainable": true, "dtype": "float32", "function": "math.reduce_max"}, "name": "tf.math.reduce_max", "inbound_nodes": [["max_pooling2d_2", 0, 0, {}]], "shared_object_id": 13}, {"class_name": "TFOpLambda", "config": {"name": "tf.compat.v1.shape", "trainable": true, "dtype": "float32", "function": "compat.v1.shape"}, "name": "tf.compat.v1.shape", "inbound_nodes": [["max_pooling2d_2", 0, 0, {"name": null, "out_type": "int32"}]], "shared_object_id": 14}, {"class_name": "TFOpLambda", "config": {"name": "tf.math.truediv", "trainable": true, "dtype": "float32", "function": "math.truediv"}, "name": "tf.math.truediv", "inbound_nodes": [["tf.math.reduce_max", 0, 0, {"y": 16, "name": null}]], "shared_object_id": 15}, {"class_name": "TFOpLambda", "config": {"name": "tf.random.uniform", "trainable": true, "dtype": "float32", "function": "random.uniform"}, "name": "tf.random.uniform", "inbound_nodes": [["tf.compat.v1.shape", 0, 0, {"minval": 0, "maxval": ["tf.math.truediv", 0, 0]}]], "shared_object_id": 16}, {"class_name": "TFOpLambda", "config": {"name": "tf.__operators__.add", "trainable": true, "dtype": "float32", "function": "__operators__.add"}, "name": "tf.__operators__.add", "inbound_nodes": [["max_pooling2d_2", 0, 0, {"y": ["tf.random.uniform", 0, 0], "name": null}]], "shared_object_id": 17}], "input_layers": [["input_1", 0, 0]], "output_layers": [["tf.__operators__.add", 0, 0]]}}}2 + root.layer-0"_tf_keras_input_layer*{"class_name": "InputLayer", "name": "input_1", "dtype": "float32", "sparse": false, "ragged": false, "batch_input_shape": {"class_name": "__tuple__", "items": [null, 128, 128, 3]}, "config": {"batch_input_shape": {"class_name": "__tuple__", "items": [null, 128, 128, 3]}, "dtype": "float32", "sparse": false, "ragged": false, "name": "input_1"}}2 + +root.layer_with_weights-0"_tf_keras_layer* {"name": "conv2d", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "preserve_input_structure_in_config": false, "autocast": true, "class_name": "Conv2D", "config": {"name": "conv2d", "trainable": true, "dtype": "float32", "filters": 128, "kernel_size": {"class_name": "__tuple__", "items": [7, 7]}, "strides": {"class_name": "__tuple__", "items": [1, 1]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 1}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 2}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "inbound_nodes": [[["input_1", 0, 0, {}]]], "shared_object_id": 3, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 4, "axes": {"-1": 3}}, "shared_object_id": 20}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 128, 128, 3]}}2 + root.layer-2"_tf_keras_layer*{"name": "max_pooling2d", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "preserve_input_structure_in_config": false, "autocast": true, "class_name": "MaxPooling2D", "config": {"name": "max_pooling2d", "trainable": true, "dtype": "float32", "pool_size": {"class_name": "__tuple__", "items": [2, 2]}, "padding": "same", "strides": {"class_name": "__tuple__", "items": [2, 2]}, "data_format": "channels_last"}, "inbound_nodes": [[["conv2d", 0, 0, {}]]], "shared_object_id": 4, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": 4, "max_ndim": null, "min_ndim": null, "axes": {}}, "shared_object_id": 21}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 128, 128, 128]}}2 + +root.layer_with_weights-1"_tf_keras_layer* +{"name": "conv2d_1", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "preserve_input_structure_in_config": false, "autocast": true, "class_name": "Conv2D", "config": {"name": "conv2d_1", "trainable": true, "dtype": "float32", "filters": 32, "kernel_size": {"class_name": "__tuple__", "items": [5, 5]}, "strides": {"class_name": "__tuple__", "items": [1, 1]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 5}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 6}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "inbound_nodes": [[["max_pooling2d", 0, 0, {}]]], "shared_object_id": 7, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 4, "axes": {"-1": 128}}, "shared_object_id": 22}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 64, 64, 128]}}2 + root.layer-4"_tf_keras_layer*{"name": "max_pooling2d_1", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "preserve_input_structure_in_config": false, "autocast": true, "class_name": "MaxPooling2D", "config": {"name": "max_pooling2d_1", "trainable": true, "dtype": "float32", "pool_size": {"class_name": "__tuple__", "items": [2, 2]}, "padding": "same", "strides": {"class_name": "__tuple__", "items": [2, 2]}, "data_format": "channels_last"}, "inbound_nodes": [[["conv2d_1", 0, 0, {}]]], "shared_object_id": 8, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": 4, "max_ndim": null, "min_ndim": null, "axes": {}}, "shared_object_id": 23}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 64, 64, 32]}}2 + +root.layer_with_weights-2"_tf_keras_layer* +{"name": "conv2d_2", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "preserve_input_structure_in_config": false, "autocast": true, "class_name": "Conv2D", "config": {"name": "conv2d_2", "trainable": true, "dtype": "float32", "filters": 16, "kernel_size": {"class_name": "__tuple__", "items": [3, 3]}, "strides": {"class_name": "__tuple__", "items": [1, 1]}, "padding": "same", "data_format": "channels_last", "dilation_rate": {"class_name": "__tuple__", "items": [1, 1]}, "groups": 1, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 9}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 10}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "inbound_nodes": [[["max_pooling2d_1", 0, 0, {}]]], "shared_object_id": 11, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 4, "axes": {"-1": 32}}, "shared_object_id": 24}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 32, 32, 32]}}2 + root.layer-6"_tf_keras_layer*{"name": "max_pooling2d_2", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "preserve_input_structure_in_config": false, "autocast": true, "class_name": "MaxPooling2D", "config": {"name": "max_pooling2d_2", "trainable": true, "dtype": "float32", "pool_size": {"class_name": "__tuple__", "items": [2, 2]}, "padding": "same", "strides": {"class_name": "__tuple__", "items": [2, 2]}, "data_format": "channels_last"}, "inbound_nodes": [[["conv2d_2", 0, 0, {}]]], "shared_object_id": 12, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": 4, "max_ndim": null, "min_ndim": null, "axes": {}}, "shared_object_id": 25}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 32, 32, 16]}}2 + root.layer-7"_tf_keras_layer*{"name": "tf.math.reduce_max", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": true, "preserve_input_structure_in_config": true, "autocast": false, "class_name": "TFOpLambda", "config": {"name": "tf.math.reduce_max", "trainable": true, "dtype": "float32", "function": "math.reduce_max"}, "inbound_nodes": [["max_pooling2d_2", 0, 0, {}]], "shared_object_id": 13, "build_input_shape": {"class_name": "TensorShape", "items": [null, 16, 16, 16]}}2 +  root.layer-8"_tf_keras_layer*{"name": "tf.compat.v1.shape", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": true, "preserve_input_structure_in_config": true, "autocast": false, "class_name": "TFOpLambda", "config": {"name": "tf.compat.v1.shape", "trainable": true, "dtype": "float32", "function": "compat.v1.shape"}, "inbound_nodes": [["max_pooling2d_2", 0, 0, {"name": null, "out_type": "int32"}]], "shared_object_id": 14, "build_input_shape": {"class_name": "TensorShape", "items": [null, 16, 16, 16]}}2 + + root.layer-9"_tf_keras_layer*{"name": "tf.math.truediv", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": true, "preserve_input_structure_in_config": true, "autocast": false, "class_name": "TFOpLambda", "config": {"name": "tf.math.truediv", "trainable": true, "dtype": "float32", "function": "math.truediv"}, "inbound_nodes": [["tf.math.reduce_max", 0, 0, {"y": 16, "name": null}]], "shared_object_id": 15, "build_input_shape": {"class_name": "TensorShape", "items": []}}2 +  root.layer-10"_tf_keras_layer*{"name": "tf.random.uniform", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": true, "preserve_input_structure_in_config": true, "autocast": false, "class_name": "TFOpLambda", "config": {"name": "tf.random.uniform", "trainable": true, "dtype": "float32", "function": "random.uniform"}, "inbound_nodes": [["tf.compat.v1.shape", 0, 0, {"minval": 0, "maxval": ["tf.math.truediv", 0, 0]}]], "shared_object_id": 16, "build_input_shape": {"class_name": "TensorShape", "items": [4]}}2 +  root.layer-11"_tf_keras_layer*{"name": "tf.__operators__.add", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": true, "preserve_input_structure_in_config": true, "autocast": false, "class_name": "TFOpLambda", "config": {"name": "tf.__operators__.add", "trainable": true, "dtype": "float32", "function": "__operators__.add"}, "inbound_nodes": [["max_pooling2d_2", 0, 0, {"y": ["tf.random.uniform", 0, 0], "name": null}]], "shared_object_id": 17, "build_input_shape": {"class_name": "TensorShape", "items": [null, 16, 16, 16]}}2 \ No newline at end of file diff --git a/encoder.mdl/saved_model.pb b/encoder.mdl/saved_model.pb new file mode 100644 index 0000000000000000000000000000000000000000..11b0da1df81e84a4a96ce63f85a957134367c7c0 Binary files /dev/null and b/encoder.mdl/saved_model.pb differ diff --git a/encoder.mdl/variables/variables.data-00000-of-00001 b/encoder.mdl/variables/variables.data-00000-of-00001 new file mode 100644 index 0000000000000000000000000000000000000000..b6acb8b3dd032853071106e49ea687ef6c7325ee Binary files /dev/null and b/encoder.mdl/variables/variables.data-00000-of-00001 differ diff --git a/encoder.mdl/variables/variables.index b/encoder.mdl/variables/variables.index new file mode 100644 index 0000000000000000000000000000000000000000..1863ff968a94556bcacfc4c8a8665e41da4d5ae7 Binary files /dev/null and b/encoder.mdl/variables/variables.index differ diff --git a/mcoder.h b/mcoder.h new file mode 100644 index 0000000000000000000000000000000000000000..f5dea9c5ba13e4ed36056ad114897b3d74c9787a --- /dev/null +++ b/mcoder.h @@ -0,0 +1,130 @@ +#ifndef MCODER_H +#define MCODER_H + +#include "stream.h" +#include + +//new parameters + +#define BITS_IN_REGISTER 16 +#define TOP_VALUE (((long) 1 << BITS_IN_REGISTER) - 1) +#define QUARTER (TOP_VALUE / 4 + 1) +#define FIRST_QTR (TOP_VALUE / 4 + 1) +#define HALF (2 * FIRST_QTR) +#define THIRD_QTR (3 * FIRST_QTR) + +#define ALPHABET_SIZE 256 +#define max(a,b) (((a) > (b)) ? (a) : (b)) + +typedef struct +{ + unsigned long freq[ALPHABET_SIZE+1]; + unsigned long freq_all; + unsigned long cum_freq[ALPHABET_SIZE+1]; + unsigned long freq_stat[ALPHABET_SIZE+1]; +} BiContextType; + +typedef BiContextType *BiContextTypePtr; + +#define putLogToFile(fname,...) { \ + FILE *fp = fopen(fname,"at"); \ + fprintf(fp,__VA_ARGS__); \ + fclose(fp); \ +} + + + +#define SIGN_TO_ENCODE(x) ((x) >= 0 ? 0 : 1) +#define CABAC_ABS(x) ((x) > 0 ? (x) : -(x)) +#define MAX_BITS_IN_SERIE 25 +/// 25 MAXIMUM + #define PutZeros(nbits) {\ + unsigned int iii;\ + for(iii = 0; iii<(nbits); iii++ )\ + {\ + Put1Bit(eep->Ecodestrm, *eep->Ecodestrm_len, 0);\ + }\ + } + + #define put_one_bit_1_plus_outstanding { \ + Put1Bit(eep->Ecodestrm, *eep->Ecodestrm_len, 1); \ + PutZeros(eep->Ebits_to_follow);\ + eep->Ebits_to_follow = 0;\ + } + + #define PutLongOnes(nbits) {\ + unsigned int i1=0xFFFFFFFF;\ + int bits1;\ + int main = (nbits)/MAX_BITS_IN_SERIE;\ + int tail = (nbits)%MAX_BITS_IN_SERIE;\ + for(bits1 = 0; bits1Ecodestrm, *eep->Ecodestrm_len,i1,MAX_BITS_IN_SERIE);\ + }\ + PutBits(eep->Ecodestrm, *eep->Ecodestrm_len,i1,tail);\ + } + + #define put_one_bit_0_plus_outstanding { \ + Put1Bit(eep->Ecodestrm, *eep->Ecodestrm_len, 0); \ + if( eep->Ebits_to_follow > MAX_BITS_IN_SERIE ) \ + { \ + PutLongOnes(eep->Ebits_to_follow);\ + }\ + else \ + {\ + PutBitsOnes(eep->Ecodestrm, *eep->Ecodestrm_len, eep->Ebits_to_follow);\ + }\ + eep->Ebits_to_follow = 0;\ + } + + +//! struct to characterize the state of the arithmetic coding engine +typedef struct +{ + unsigned int Elow, Erange, Ehigh; + unsigned int Ebits_to_follow; + unsigned char *Ecodestrm; + unsigned int *Ecodestrm_len; +} EncodingEnvironment; + +typedef EncodingEnvironment *EncodingEnvironmentPtr; + +// cabac_enc.c +void biari_init_context +( + BiContextTypePtr ctx, + char* name +); + + +EncodingEnvironmentPtr arienco_create_encoding_environment(); +void arienco_delete_encoding_environment(EncodingEnvironmentPtr eep); +void arienco_start_encoding(EncodingEnvironmentPtr eep, + unsigned char *code_buffer, + int *code_len ); +void arienco_done_encoding(EncodingEnvironmentPtr eep); + +void biari_encode_symbol(EncodingEnvironmentPtr eep, int symbol, BiContextTypePtr bi_ct); + + +//! struct to characterize the state of the arithmetic coding engine +typedef struct +{ + unsigned int Dlow, Drange, Dhigh; + unsigned int Dvalue; + unsigned int Dbuffer; + int Dbits_to_go; + unsigned char *Dcodestrm; + unsigned int *Dcodestrm_len; +} DecodingEnvironment; + +typedef DecodingEnvironment *DecodingEnvironmentPtr; + +// cabac_dec.c +DecodingEnvironmentPtr arideco_create_decoding_environment(); +void arideco_delete_decoding_environment(DecodingEnvironmentPtr dep); +void arideco_start_decoding(DecodingEnvironmentPtr dep, unsigned char *cpixcode, + int firstbyte, int *cpixcode_len ); +int arideco_bits_read(DecodingEnvironmentPtr dep); +void arideco_done_decoding(DecodingEnvironmentPtr dep); +unsigned int biari_decode_symbol(DecodingEnvironmentPtr dep, BiContextTypePtr bi_ct); +#endif // !MCODER_H \ No newline at end of file diff --git a/stream.h b/stream.h new file mode 100644 index 0000000000000000000000000000000000000000..98d650e49cebffaf86d7a3d6cb681171b9660eeb --- /dev/null +++ b/stream.h @@ -0,0 +1,136 @@ +#ifndef _STREAM_H +#define _STREAM_H + +// **************************************************** +// * Bits Order (w/o swap): * +// * the 1st bit in a bitstream is 0th bit (not 7th) * +// **************************************************** + +#define mask(y,nb) ((unsigned int)((int)(y) & ((1L<<(nb)) - 1))) + +#ifdef TMS +#define UINT32P(x) _mem4(x) +#else +#define UINT32P(x) (*((unsigned int*)(x))) +#endif + +#define UINT32(x) ((unsigned int)(x)) +#define UCHAR(x) ((unsigned char)(x)) +#define UCHARP(x) ((unsigned char*)(x)) + +//----------------------------------------------- +#define PutBitsAC(stream, bitptr, x, nbits) \ +{ \ + UINT32P(&(UCHARP(stream)[(bitptr)>>3])) |= \ + UINT32(x) << ((bitptr)&0x7); \ + bitptr += nbits; \ +} \ +//----------------------------------------------- +//------------------------------------------------------------------- +#define Put1BitAC(stream, bitptr, x) \ +{ \ + if(x) UCHARP(stream)[(bitptr)>>3] |= UCHAR(1L<<((bitptr)&0x7)); \ + (bitptr)++; \ +} \ +//------------------------------------------------------------------- + +//--------------------------------------------------- +#define PutBits(stream, bitptr, x, nbits) \ +{ \ + UINT32P(&(UCHARP(stream)[((bitptr)+7)>>3])) = 0; \ + UINT32P(&(UCHARP(stream)[(bitptr)>>3])) |= \ + UINT32(mask(x,nbits) << ((bitptr)&0x7)); \ + bitptr += nbits; \ +} \ +//--------------------------------------------------- + +//--------------------------------------------------- +#define PutBitsOnes(stream, bitptr, nbits) \ +{ \ + UINT32P(&(UCHARP(stream)[((bitptr)+7)>>3])) = 0; \ + UINT32P(&(UCHARP(stream)[(bitptr)>>3])) |= \ + UINT32(mask(0xFFFFFFFF,nbits) << ((bitptr)&0x7)); \ + bitptr += nbits; \ +} \ +//--------------------------------------------------- +//--------------------------------------------------- +#define PutBitsZeros(stream, bitptr, nbits) \ +{ \ + UINT32P(&(UCHARP(stream)[((bitptr)+7)>>3])) = 0; \ + bitptr += nbits; \ +} \ +//--------------------------------------------------- + +//------------------------------------------------------------------ +#define ShiftBitPtr(bitptr, nbits) bitptr += nbits; +//------------------------------------------------------------------ + +// ********************************************* +// * Put a bit into the bitstream. * +// * x can be any value; * +// * only if x~=0, the current bit is set to 1 * +// ********************************************* +//--------------------------------------------------------------- +#define Put1Bit(stream, bitptr, x) \ +{ \ + UINT32P(&(UCHARP(stream)[((bitptr)+7)>>3]) ) = 0; \ + if((x)!=0) UINT32P(&(UCHARP(stream)[(bitptr)>>3])) |= \ + UINT32(1L << ((bitptr)&0x7)); \ + (bitptr)++; \ +} \ +//--------------------------------------------------------------- + +//------------------------------------------------------- +#define Put1BitOne(stream, bitptr) \ +{ \ + UINT32P(&(UCHARP(stream)[((bitptr)+7)>>3]) ) = 0; \ + UINT32P(&(UCHARP(stream)[(bitptr)>>3]) ) |= \ + UINT32(1L << ((bitptr)&0x7)); \ + (bitptr)++; \ +} \ +//------------------------------------------------------- +//------------------------------------------------------- +#define Put1BitZero(stream, bitptr) \ +{ \ + UINT32P(&(UCHARP(stream)[((bitptr)+7)>>3]) ) = 0; \ + (bitptr)++; \ +} \ +//------------------------------------------------------- + +//------------------------------------------------------- +#define Get1BitCABAC(stream, bitptr, x) \ +{ \ + x = (stream)[(bitptr)>>3]; \ + x >>= (bitptr) & 0x7 ; \ + x &= 1; \ + (bitptr)++; \ +} + +//------------------------------------------------------- +#define GetBits(stream, bitptr, x, nbits) \ +{ \ + x = UINT32P(&(UCHARP(stream)[(bitptr)>>3])); \ + x >>= (bitptr) & 0x7 ; \ + bitptr += nbits; \ +} \ +//------------------------------------------------------- + + +//------------------------------------------------------- +#define Get1Bit(stream, bitptr, x) \ +{ \ + x = UINT32P(&(UCHARP(stream)[(bitptr)>>3])); \ + x >>= (bitptr) & 0x7 ; \ + x &= 1; \ + (bitptr)++; \ +} \ +//------------------------------------------------------- +#define Get1BitCABAC(stream, bitptr, x) \ +{ \ + x = (stream)[(bitptr)>>3]; \ + x >>= (bitptr) & 0x7 ; \ + x &= 1; \ + (bitptr)++; \ +} + +#endif // _STREAM_H diff --git a/test/1.png b/test/1.png new file mode 100644 index 0000000000000000000000000000000000000000..c9a173422f37f19d9ecf9110eb8a133301d7d446 Binary files /dev/null and b/test/1.png differ diff --git a/test/10.png b/test/10.png new file mode 100644 index 0000000000000000000000000000000000000000..aa127925f20dd1d6fe25936c0d8d93a1490be2a9 Binary files /dev/null and b/test/10.png differ diff --git a/test/11.png b/test/11.png new file mode 100644 index 0000000000000000000000000000000000000000..c20818ef3b7feb33d435a2d22281c113ea74af04 Binary files /dev/null and b/test/11.png differ diff --git a/test/12.png b/test/12.png new file mode 100644 index 0000000000000000000000000000000000000000..848429e142b8636144e025062e8a2a2a170992d7 Binary files /dev/null and b/test/12.png differ diff --git a/test/13.png b/test/13.png new file mode 100644 index 0000000000000000000000000000000000000000..4950c4d726f8cc3a64670d11b14caac11e1aa0a2 Binary files /dev/null and b/test/13.png differ diff --git a/test/14.png b/test/14.png new file mode 100644 index 0000000000000000000000000000000000000000..f3aa3d4396efe3f52663bf12e31c7f2152278fa5 Binary files /dev/null and b/test/14.png differ diff --git a/test/15.png b/test/15.png new file mode 100644 index 0000000000000000000000000000000000000000..ced0e97aa656dad283badaa54ad1f596d708be56 Binary files /dev/null and b/test/15.png differ diff --git a/test/16.png b/test/16.png new file mode 100644 index 0000000000000000000000000000000000000000..07a26d2cc79d85994f380185f39a75fee5738d8c Binary files /dev/null and b/test/16.png differ diff --git a/test/17.png b/test/17.png new file mode 100644 index 0000000000000000000000000000000000000000..2b33a91e1e94a1f5534f7c99e8ba1f2b4cc78823 Binary files /dev/null and b/test/17.png differ diff --git a/test/18.png b/test/18.png new file mode 100644 index 0000000000000000000000000000000000000000..368aa5875991b31173003439009599d6b03f12e3 Binary files /dev/null and b/test/18.png differ diff --git a/test/19.png b/test/19.png new file mode 100644 index 0000000000000000000000000000000000000000..eba3c3a9d6fd1d9001816eba982ee85979b6cf2b Binary files /dev/null and b/test/19.png differ diff --git a/test/2.png b/test/2.png new file mode 100644 index 0000000000000000000000000000000000000000..162330965ad61f0153404e559a32d502b68cb891 Binary files /dev/null and b/test/2.png differ diff --git a/test/20.png b/test/20.png new file mode 100644 index 0000000000000000000000000000000000000000..4e7b8e025548f00ed62f9deeb56feb6bf72653b6 Binary files /dev/null and b/test/20.png differ diff --git a/test/21.png b/test/21.png new file mode 100644 index 0000000000000000000000000000000000000000..8a08937d9f4a6c9517d4b4545cd793316ed608c3 Binary files /dev/null and b/test/21.png differ diff --git a/test/3.png b/test/3.png new file mode 100644 index 0000000000000000000000000000000000000000..1cbd477a04fd8e6609b6eaf374ed7b8df1d33058 Binary files /dev/null and b/test/3.png differ diff --git a/test/4.png b/test/4.png new file mode 100644 index 0000000000000000000000000000000000000000..fe894709daf4aeeb646915fa571f03826cc07106 Binary files /dev/null and b/test/4.png differ diff --git a/test/5.png b/test/5.png new file mode 100644 index 0000000000000000000000000000000000000000..67e59caa687a2eb9f736fe794dedf9c1ffc5dd8d Binary files /dev/null and b/test/5.png differ diff --git a/test/6.png b/test/6.png new file mode 100644 index 0000000000000000000000000000000000000000..891bf96f46cae7aaeee1a9c1069f2e3abca28d01 Binary files /dev/null and b/test/6.png differ diff --git a/test/7.png b/test/7.png new file mode 100644 index 0000000000000000000000000000000000000000..244da63f9079e4ff3a5b0527a9321db54120d777 Binary files /dev/null and b/test/7.png differ diff --git a/test/8.png b/test/8.png new file mode 100644 index 0000000000000000000000000000000000000000..e69b9fba9f17f2ee334e987a8fe79f36d58636fa Binary files /dev/null and b/test/8.png differ diff --git a/test/9.png b/test/9.png new file mode 100644 index 0000000000000000000000000000000000000000..6aedbc7d857943a660b6b565d780ef52ff3cb6c3 Binary files /dev/null and b/test/9.png differ diff --git a/train/100.png b/train/100.png new file mode 100644 index 0000000000000000000000000000000000000000..65ea548d6d214bfe18177ee6ab10c0c22b3f0005 Binary files /dev/null and b/train/100.png differ diff --git a/train/101.png b/train/101.png new file mode 100644 index 0000000000000000000000000000000000000000..3b58696502d4e560b3b1781aa47b852a80938e37 Binary files /dev/null and b/train/101.png differ diff --git a/train/102.png b/train/102.png new file mode 100644 index 0000000000000000000000000000000000000000..034163028f52dace5a3f82819946bac404bdb1ab Binary files /dev/null and b/train/102.png differ diff --git a/train/103.png b/train/103.png new file mode 100644 index 0000000000000000000000000000000000000000..f82dfbe44aae7bce702449daa44fc37a41d63bc5 Binary files /dev/null and b/train/103.png differ diff --git a/train/104.png b/train/104.png new file mode 100644 index 0000000000000000000000000000000000000000..cdee332b2ce326b9819c13413d09c024736f6ff6 Binary files /dev/null and b/train/104.png differ diff --git a/train/105.png b/train/105.png new file mode 100644 index 0000000000000000000000000000000000000000..cc1da320d4466913f0d1feac4571283912612ab4 Binary files /dev/null and b/train/105.png differ diff --git a/train/106.png b/train/106.png new file mode 100644 index 0000000000000000000000000000000000000000..58481408ae9a3e9588044ced15a8bd8a5c36b6f2 Binary files /dev/null and b/train/106.png differ diff --git a/train/107.png b/train/107.png new file mode 100644 index 0000000000000000000000000000000000000000..d1d3966bf37344d2aaaa6d2895e75bdf17fe5a16 Binary files /dev/null and b/train/107.png differ diff --git a/train/108.png b/train/108.png new file mode 100644 index 0000000000000000000000000000000000000000..f65f66a1703256ff8aa30b4133b40ebf71ccd85a Binary files /dev/null and b/train/108.png differ diff --git a/train/109.png b/train/109.png new file mode 100644 index 0000000000000000000000000000000000000000..2ff15792ce7c01871ee2ca27429e6809b2252eff Binary files /dev/null and b/train/109.png differ diff --git a/train/110.png b/train/110.png new file mode 100644 index 0000000000000000000000000000000000000000..be7f23df2416db8b45071bd3039c79ac9f8b3355 Binary files /dev/null and b/train/110.png differ diff --git a/train/111.png b/train/111.png new file mode 100644 index 0000000000000000000000000000000000000000..6b721d9f9d30e221539d354fada1060b67f98152 Binary files /dev/null and b/train/111.png differ diff --git a/train/112.png b/train/112.png new file mode 100644 index 0000000000000000000000000000000000000000..c87de39adad67c0838ef0db017755eeeb4d537e0 Binary files /dev/null and b/train/112.png differ diff --git a/train/113.png b/train/113.png new file mode 100644 index 0000000000000000000000000000000000000000..305c5d100e9bfc4e6b961a0aae0a78697b91e308 Binary files /dev/null and b/train/113.png differ diff --git a/train/114.png b/train/114.png new file mode 100644 index 0000000000000000000000000000000000000000..362e03ac31142946e3687b3723004a24e4ae4049 Binary files /dev/null and b/train/114.png differ diff --git a/train/115.png b/train/115.png new file mode 100644 index 0000000000000000000000000000000000000000..b6e2224d88420cd84bfae2d48917a758c90447ea Binary files /dev/null and b/train/115.png differ diff --git a/train/116.png b/train/116.png new file mode 100644 index 0000000000000000000000000000000000000000..07f1db8a60bc1a4a28975398076313cf2723cc64 Binary files /dev/null and b/train/116.png differ diff --git a/train/117.png b/train/117.png new file mode 100644 index 0000000000000000000000000000000000000000..4fe9fe59294ff210c51b4790bf073186fcccab65 Binary files /dev/null and b/train/117.png differ diff --git a/train/118.png b/train/118.png new file mode 100644 index 0000000000000000000000000000000000000000..1f56a9eb33e6af48b42ce1388d47bd061f532f4a Binary files /dev/null and b/train/118.png differ diff --git a/train/119.png b/train/119.png new file mode 100644 index 0000000000000000000000000000000000000000..f6eb5b7b7fb309a9b044669670c141eb01bcbfcb Binary files /dev/null and b/train/119.png differ diff --git a/train/120.png b/train/120.png new file mode 100644 index 0000000000000000000000000000000000000000..273a5dff44650f55805dfc86c7173d80bea9ca62 Binary files /dev/null and b/train/120.png differ diff --git a/train/121.png b/train/121.png new file mode 100644 index 0000000000000000000000000000000000000000..fb67769e46ca976bec8b41e145b9612047f842be Binary files /dev/null and b/train/121.png differ diff --git a/train/122.png b/train/122.png new file mode 100644 index 0000000000000000000000000000000000000000..e1c1fdc420674272bfaf318c17e552713e290e4a Binary files /dev/null and b/train/122.png differ diff --git a/train/123.png b/train/123.png new file mode 100644 index 0000000000000000000000000000000000000000..4b2ccf82553e89df2d64be0c0172153c508a3dd5 Binary files /dev/null and b/train/123.png differ diff --git a/train/124.png b/train/124.png new file mode 100644 index 0000000000000000000000000000000000000000..3d9e9df7ee0355cf3a54b45cac215536cf5406ec Binary files /dev/null and b/train/124.png differ diff --git a/train/125.png b/train/125.png new file mode 100644 index 0000000000000000000000000000000000000000..63861752970ee17ac439e6c0d7c5dfff13a0fac3 Binary files /dev/null and b/train/125.png differ diff --git a/train/126.png b/train/126.png new file mode 100644 index 0000000000000000000000000000000000000000..dcd567f52aa1cc85b92cb8f3454ec907ff2732af Binary files /dev/null and b/train/126.png differ diff --git a/train/127.png b/train/127.png new file mode 100644 index 0000000000000000000000000000000000000000..3ec39f81eb46d154e3999ce5d3b8b18ed01237c9 Binary files /dev/null and b/train/127.png differ diff --git a/train/128.png b/train/128.png new file mode 100644 index 0000000000000000000000000000000000000000..75671f0846be1f5e110763ac32c2ba5a6c190566 Binary files /dev/null and b/train/128.png differ diff --git a/train/129.png b/train/129.png new file mode 100644 index 0000000000000000000000000000000000000000..95ccf0e78637ebafe4ea19576a97b5c36a2be3f5 Binary files /dev/null and b/train/129.png differ diff --git a/train/130.png b/train/130.png new file mode 100644 index 0000000000000000000000000000000000000000..6f4be16659612a5ee6cf111a6b5532cfb8378c36 Binary files /dev/null and b/train/130.png differ diff --git a/train/131.png b/train/131.png new file mode 100644 index 0000000000000000000000000000000000000000..7238d85ce6252e4903ef80987094a44d9d7b2449 Binary files /dev/null and b/train/131.png differ diff --git a/train/132.png b/train/132.png new file mode 100644 index 0000000000000000000000000000000000000000..049976d71bd2b7a95ed8e727c2b92578da41d0de Binary files /dev/null and b/train/132.png differ diff --git a/train/133.png b/train/133.png new file mode 100644 index 0000000000000000000000000000000000000000..751a1eab4c80fec4c9adb04bf18cba983e4edb28 Binary files /dev/null and b/train/133.png differ diff --git a/train/134.png b/train/134.png new file mode 100644 index 0000000000000000000000000000000000000000..8b7e9e83f775e3fb967726eac90a8fdb9328b8f9 Binary files /dev/null and b/train/134.png differ diff --git a/train/135.png b/train/135.png new file mode 100644 index 0000000000000000000000000000000000000000..8f2857d08e4feb65c4067d74db950f034d175a89 Binary files /dev/null and b/train/135.png differ diff --git a/train/136.png b/train/136.png new file mode 100644 index 0000000000000000000000000000000000000000..bf92e251e6bcc8e6ccd2f182533ef317844850aa Binary files /dev/null and b/train/136.png differ diff --git a/train/137.png b/train/137.png new file mode 100644 index 0000000000000000000000000000000000000000..fbafcfbc29f6c7de7d44eaefbf0e2a8afd3edfa2 Binary files /dev/null and b/train/137.png differ diff --git a/train/138.png b/train/138.png new file mode 100644 index 0000000000000000000000000000000000000000..8a789021864d1e821e9a8cb166e2649312d0eae0 Binary files /dev/null and b/train/138.png differ diff --git a/train/139.png b/train/139.png new file mode 100644 index 0000000000000000000000000000000000000000..a0f4351d481cdfaa5a5301fad38e7f2a326fb726 Binary files /dev/null and b/train/139.png differ diff --git a/train/140.png b/train/140.png new file mode 100644 index 0000000000000000000000000000000000000000..4599bf47fd40e60a7ebcaf407ba25ff34aad6a22 Binary files /dev/null and b/train/140.png differ diff --git a/train/141.png b/train/141.png new file mode 100644 index 0000000000000000000000000000000000000000..21be2c3aba3378ffaff2a8b764f658266fc3b18c Binary files /dev/null and b/train/141.png differ diff --git a/train/142.png b/train/142.png new file mode 100644 index 0000000000000000000000000000000000000000..5b8e4269babc79177ce6a4e8bb2434b9393ea9c9 Binary files /dev/null and b/train/142.png differ diff --git a/train/143.png b/train/143.png new file mode 100644 index 0000000000000000000000000000000000000000..bfd887b06cb3989acc9076ab15a0b621e966b967 Binary files /dev/null and b/train/143.png differ diff --git a/train/144.png b/train/144.png new file mode 100644 index 0000000000000000000000000000000000000000..d718256f22581287ba4e41e40c327ae19e15ef9c Binary files /dev/null and b/train/144.png differ diff --git a/train/145.png b/train/145.png new file mode 100644 index 0000000000000000000000000000000000000000..60e85633fee4d8d5a8057338cc3cc308582f9ad0 Binary files /dev/null and b/train/145.png differ diff --git a/train/146.png b/train/146.png new file mode 100644 index 0000000000000000000000000000000000000000..afdb8196bfbecfcccc95464fdfbd5a823c9353aa Binary files /dev/null and b/train/146.png differ diff --git a/train/147.png b/train/147.png new file mode 100644 index 0000000000000000000000000000000000000000..901178895441b7771a9ae3d066830898e10cdfda Binary files /dev/null and b/train/147.png differ diff --git a/train/148.png b/train/148.png new file mode 100644 index 0000000000000000000000000000000000000000..f1fae9df7541b336a2d95a895c1913adebdda001 Binary files /dev/null and b/train/148.png differ diff --git a/train/149.png b/train/149.png new file mode 100644 index 0000000000000000000000000000000000000000..6853bec87133e47ba99479f667af593727d36306 Binary files /dev/null and b/train/149.png differ diff --git a/train/150.png b/train/150.png new file mode 100644 index 0000000000000000000000000000000000000000..44957bb17294a22b2c9ae924742e8466fc1686d3 Binary files /dev/null and b/train/150.png differ diff --git a/train/151.png b/train/151.png new file mode 100644 index 0000000000000000000000000000000000000000..7205fd25d5ae0545e10784b37e9cb585f577af13 Binary files /dev/null and b/train/151.png differ diff --git a/train/152.png b/train/152.png new file mode 100644 index 0000000000000000000000000000000000000000..8164afc90f29ea9978e4505cf02d79c97cf56484 Binary files /dev/null and b/train/152.png differ diff --git a/train/153.png b/train/153.png new file mode 100644 index 0000000000000000000000000000000000000000..6cb886990c31bd2e07633f9ec80a7c33594bb5fe Binary files /dev/null and b/train/153.png differ diff --git a/train/154.png b/train/154.png new file mode 100644 index 0000000000000000000000000000000000000000..381e1981a2c4eda3605c7d783c10e9f03adedf23 Binary files /dev/null and b/train/154.png differ diff --git a/train/155.png b/train/155.png new file mode 100644 index 0000000000000000000000000000000000000000..1d55a2327c85cd8ac0db7b49edc8f5b715f11aa4 Binary files /dev/null and b/train/155.png differ diff --git a/train/156.png b/train/156.png new file mode 100644 index 0000000000000000000000000000000000000000..48428f81531eddb1df6211ee9e3d60049bb1ac40 Binary files /dev/null and b/train/156.png differ diff --git a/train/157.png b/train/157.png new file mode 100644 index 0000000000000000000000000000000000000000..24891051e703562d5e6e440284786c21e412e720 Binary files /dev/null and b/train/157.png differ diff --git a/train/158.png b/train/158.png new file mode 100644 index 0000000000000000000000000000000000000000..18cb282a141a4b2cae1fe778178e7c5c0f8bdd5d Binary files /dev/null and b/train/158.png differ diff --git a/train/159.png b/train/159.png new file mode 100644 index 0000000000000000000000000000000000000000..f60f25a8fc9c2b7a6057530541b591c13b1639e6 Binary files /dev/null and b/train/159.png differ diff --git a/train/160.png b/train/160.png new file mode 100644 index 0000000000000000000000000000000000000000..be9909e0368d04ae71da2f23fb35a653186cf028 Binary files /dev/null and b/train/160.png differ diff --git a/train/161.png b/train/161.png new file mode 100644 index 0000000000000000000000000000000000000000..073a36048e53eab140954c69fea93f3b950312bf Binary files /dev/null and b/train/161.png differ diff --git a/train/162.png b/train/162.png new file mode 100644 index 0000000000000000000000000000000000000000..997cb091eeccbe1878649e7ddd3387fdea0b1672 Binary files /dev/null and b/train/162.png differ diff --git a/train/163.png b/train/163.png new file mode 100644 index 0000000000000000000000000000000000000000..4dbb3d54cdad9d814d85244f15f9ba3b88ff91e3 Binary files /dev/null and b/train/163.png differ diff --git a/train/164.png b/train/164.png new file mode 100644 index 0000000000000000000000000000000000000000..1e462cc1589a458d61c71482a8b0c185e98c00b5 Binary files /dev/null and b/train/164.png differ diff --git a/train/165.png b/train/165.png new file mode 100644 index 0000000000000000000000000000000000000000..0553a5839cca028835a471ac54bae0e41891e91d Binary files /dev/null and b/train/165.png differ diff --git a/train/166.png b/train/166.png new file mode 100644 index 0000000000000000000000000000000000000000..a4032108645e970c736996fb3e5db786e029af33 Binary files /dev/null and b/train/166.png differ diff --git a/train/167.png b/train/167.png new file mode 100644 index 0000000000000000000000000000000000000000..3f64b6306355c4723e78337bb34e94e777a08dac Binary files /dev/null and b/train/167.png differ diff --git a/train/168.png b/train/168.png new file mode 100644 index 0000000000000000000000000000000000000000..c1061567052aecd20a15e0f914df23d941b6e880 Binary files /dev/null and b/train/168.png differ diff --git a/train/169.png b/train/169.png new file mode 100644 index 0000000000000000000000000000000000000000..b51f9b293adac5c365555d68ab3966c79e4f0dd7 Binary files /dev/null and b/train/169.png differ diff --git a/train/170.png b/train/170.png new file mode 100644 index 0000000000000000000000000000000000000000..75025ef1f0c5aec0c116746ed12a51c7eb1dbd9c Binary files /dev/null and b/train/170.png differ diff --git a/train/171.png b/train/171.png new file mode 100644 index 0000000000000000000000000000000000000000..50015a175fd485c2f80bf2f30d2f7ec4b19bf092 Binary files /dev/null and b/train/171.png differ diff --git a/train/172.png b/train/172.png new file mode 100644 index 0000000000000000000000000000000000000000..47c5866fd4b8679436ca6a1397c453642c0c5b47 Binary files /dev/null and b/train/172.png differ diff --git a/train/173.png b/train/173.png new file mode 100644 index 0000000000000000000000000000000000000000..f08543c9b17303131133879757a93e570d1a882c Binary files /dev/null and b/train/173.png differ diff --git a/train/174.png b/train/174.png new file mode 100644 index 0000000000000000000000000000000000000000..143834de97e661cfae72150dd3e2390d9eece901 Binary files /dev/null and b/train/174.png differ diff --git a/train/175.png b/train/175.png new file mode 100644 index 0000000000000000000000000000000000000000..1c96a1888088d9c08eb695519771d80264ad4a41 Binary files /dev/null and b/train/175.png differ diff --git a/train/176.png b/train/176.png new file mode 100644 index 0000000000000000000000000000000000000000..e51468f087e9c74bb32d671b933945ceb8b18726 Binary files /dev/null and b/train/176.png differ diff --git a/train/177.png b/train/177.png new file mode 100644 index 0000000000000000000000000000000000000000..7a539066305d69ea586d59afe4fd1699f65a0b85 Binary files /dev/null and b/train/177.png differ diff --git a/train/178.png b/train/178.png new file mode 100644 index 0000000000000000000000000000000000000000..958f23b7df4c5a8499b330cb69b733fa1f1a3226 Binary files /dev/null and b/train/178.png differ diff --git a/train/179.png b/train/179.png new file mode 100644 index 0000000000000000000000000000000000000000..74b7990bdb90c89fab74ca0a660b1045a13c8048 Binary files /dev/null and b/train/179.png differ diff --git a/train/180.png b/train/180.png new file mode 100644 index 0000000000000000000000000000000000000000..3a5ab61778517fdb64a98726c2a2df9bd5548269 Binary files /dev/null and b/train/180.png differ diff --git a/train/181.png b/train/181.png new file mode 100644 index 0000000000000000000000000000000000000000..a9a49e0c46377e4baf670cb76c380392a392b56f Binary files /dev/null and b/train/181.png differ diff --git a/train/182.png b/train/182.png new file mode 100644 index 0000000000000000000000000000000000000000..b8086f884e4b5d28aed7f93b240141b3528ff531 Binary files /dev/null and b/train/182.png differ diff --git a/train/183.png b/train/183.png new file mode 100644 index 0000000000000000000000000000000000000000..e35c4a4045a26e64e85b14637744184a8b4f42bd Binary files /dev/null and b/train/183.png differ diff --git a/train/184.png b/train/184.png new file mode 100644 index 0000000000000000000000000000000000000000..3951d190288a45341217e9cdf8495e170ba67fc1 Binary files /dev/null and b/train/184.png differ diff --git a/train/185.png b/train/185.png new file mode 100644 index 0000000000000000000000000000000000000000..a41a8d57cad3844ac5b60cf2d8fa918c16b31ea8 Binary files /dev/null and b/train/185.png differ diff --git a/train/186.png b/train/186.png new file mode 100644 index 0000000000000000000000000000000000000000..22e0137de0365945b23b746f23c16b8992fa3690 Binary files /dev/null and b/train/186.png differ diff --git a/train/187.png b/train/187.png new file mode 100644 index 0000000000000000000000000000000000000000..b459e4559fc00e219a63661afea1978308937a31 Binary files /dev/null and b/train/187.png differ diff --git a/train/188.png b/train/188.png new file mode 100644 index 0000000000000000000000000000000000000000..fb5925ba5a1ed65ed222162d45674fa7c57c0390 Binary files /dev/null and b/train/188.png differ diff --git a/train/189.png b/train/189.png new file mode 100644 index 0000000000000000000000000000000000000000..4d6a4290ee012e27a35ce33b71fd5f7d91d7bcfd Binary files /dev/null and b/train/189.png differ diff --git a/train/190.png b/train/190.png new file mode 100644 index 0000000000000000000000000000000000000000..0e63054b20216219f6942a19599c1e4fc6d84e83 Binary files /dev/null and b/train/190.png differ diff --git a/train/191.png b/train/191.png new file mode 100644 index 0000000000000000000000000000000000000000..8cbafd7d292d900694818313fc4a74519d74b94d Binary files /dev/null and b/train/191.png differ diff --git a/train/192.png b/train/192.png new file mode 100644 index 0000000000000000000000000000000000000000..9fe1e42fa52dcfb9dd4d351bc84dc2e9c06a7edf Binary files /dev/null and b/train/192.png differ diff --git a/train/193.png b/train/193.png new file mode 100644 index 0000000000000000000000000000000000000000..91573daf90c2d6e13533aa02e63ddd2efafe5989 Binary files /dev/null and b/train/193.png differ diff --git a/train/194.png b/train/194.png new file mode 100644 index 0000000000000000000000000000000000000000..ec74ef002fc8cef5ad573e8178376bfff7b019b6 Binary files /dev/null and b/train/194.png differ diff --git a/train/195.png b/train/195.png new file mode 100644 index 0000000000000000000000000000000000000000..053d76945bb63863b3c1d0f4fe73b6a27cfd62e5 Binary files /dev/null and b/train/195.png differ diff --git a/train/196.png b/train/196.png new file mode 100644 index 0000000000000000000000000000000000000000..9105a3561b40e7a96481607040ca99605b6da215 Binary files /dev/null and b/train/196.png differ diff --git a/train/197.png b/train/197.png new file mode 100644 index 0000000000000000000000000000000000000000..a684b06d68e665d104d1c495ce50e8bba34aec08 Binary files /dev/null and b/train/197.png differ diff --git a/train/198.png b/train/198.png new file mode 100644 index 0000000000000000000000000000000000000000..6eb25bc5430fe21eaa9f96323ae3d6cbcbe0083a Binary files /dev/null and b/train/198.png differ diff --git a/train/199.png b/train/199.png new file mode 100644 index 0000000000000000000000000000000000000000..d4cc72e0d558fb703e3294d20bf38989611a9e73 Binary files /dev/null and b/train/199.png differ diff --git a/train/200.png b/train/200.png new file mode 100644 index 0000000000000000000000000000000000000000..fbccddc487f5575090c4bd04d4e29a78c1bf08cc Binary files /dev/null and b/train/200.png differ diff --git a/train/201.png b/train/201.png new file mode 100644 index 0000000000000000000000000000000000000000..796c34c0a9eaab4513999c7394591a8d0b5cadfe Binary files /dev/null and b/train/201.png differ diff --git a/train/202.png b/train/202.png new file mode 100644 index 0000000000000000000000000000000000000000..8d741ffbe044090ad9ab6ca53e3964dd4e91a3e6 Binary files /dev/null and b/train/202.png differ diff --git a/train/203.png b/train/203.png new file mode 100644 index 0000000000000000000000000000000000000000..cd190bd3e580278df3a9c091b49e7883d28f27ab Binary files /dev/null and b/train/203.png differ diff --git a/train/204.png b/train/204.png new file mode 100644 index 0000000000000000000000000000000000000000..4b665dbba644129ddac6fe792a6bea1986652744 Binary files /dev/null and b/train/204.png differ diff --git a/train/205.png b/train/205.png new file mode 100644 index 0000000000000000000000000000000000000000..b64ad8cfcde326527c2ebcfd95fd6a8e5a9e6e60 Binary files /dev/null and b/train/205.png differ diff --git a/train/206.png b/train/206.png new file mode 100644 index 0000000000000000000000000000000000000000..f7fd99b92edef0408239681feea918be507c56d8 Binary files /dev/null and b/train/206.png differ diff --git a/train/207.png b/train/207.png new file mode 100644 index 0000000000000000000000000000000000000000..0e93bcefc77d2f5f47b693a14b459a58bb5b68ff Binary files /dev/null and b/train/207.png differ diff --git a/train/208.png b/train/208.png new file mode 100644 index 0000000000000000000000000000000000000000..8cbb3c00e5767d922265cdd2d85aceff2e92dbae Binary files /dev/null and b/train/208.png differ diff --git a/train/209.png b/train/209.png new file mode 100644 index 0000000000000000000000000000000000000000..9d7a430dcc0b285368171a35a62753edd4aff3bd Binary files /dev/null and b/train/209.png differ diff --git a/train/210.png b/train/210.png new file mode 100644 index 0000000000000000000000000000000000000000..e066740f4dae51c621217c16d61fbffc4cc945cc Binary files /dev/null and b/train/210.png differ diff --git a/train/211.png b/train/211.png new file mode 100644 index 0000000000000000000000000000000000000000..3436dddb5b3f3bdc6f88fcd2fc68033fefe960d9 Binary files /dev/null and b/train/211.png differ diff --git a/train/212.png b/train/212.png new file mode 100644 index 0000000000000000000000000000000000000000..3cd31a7d1d8d0cfb44c690867661fe47224cad40 Binary files /dev/null and b/train/212.png differ diff --git a/train/213.png b/train/213.png new file mode 100644 index 0000000000000000000000000000000000000000..c055892b3158285b2558632cf14061a95cad5a88 Binary files /dev/null and b/train/213.png differ diff --git a/train/214.png b/train/214.png new file mode 100644 index 0000000000000000000000000000000000000000..cacf49db9fb5bcd65b9b75d831ac69361c7eb34b Binary files /dev/null and b/train/214.png differ diff --git a/train/215.png b/train/215.png new file mode 100644 index 0000000000000000000000000000000000000000..b75b9d61fe8f79791b739db8b267a761c9e7bab6 Binary files /dev/null and b/train/215.png differ diff --git a/train/216.png b/train/216.png new file mode 100644 index 0000000000000000000000000000000000000000..c8b5a479af3817e73c0dfad80332e32cf3220a0a Binary files /dev/null and b/train/216.png differ diff --git a/train/217.png b/train/217.png new file mode 100644 index 0000000000000000000000000000000000000000..52aee05747347bdabb8cba7686f87b15db89a39d Binary files /dev/null and b/train/217.png differ diff --git a/train/218.png b/train/218.png new file mode 100644 index 0000000000000000000000000000000000000000..dd5abbed53792463b90d8f47988252d662f70525 Binary files /dev/null and b/train/218.png differ diff --git a/train/219.png b/train/219.png new file mode 100644 index 0000000000000000000000000000000000000000..ad5e8f6e092b0951ecc43fa1caa343a30aad6bb2 Binary files /dev/null and b/train/219.png differ diff --git a/train/22.png b/train/22.png new file mode 100644 index 0000000000000000000000000000000000000000..d85c90c8b4b168535b0b63c53b4d0ba6a31384a9 Binary files /dev/null and b/train/22.png differ diff --git a/train/220.png b/train/220.png new file mode 100644 index 0000000000000000000000000000000000000000..6508b315aa8fd2da54b27834a6bfb6a25586f243 Binary files /dev/null and b/train/220.png differ diff --git a/train/221.png b/train/221.png new file mode 100644 index 0000000000000000000000000000000000000000..384c2b69c6520f56b44037b13b4e4e3d8b7890f0 Binary files /dev/null and b/train/221.png differ diff --git a/train/222.png b/train/222.png new file mode 100644 index 0000000000000000000000000000000000000000..fba17674f90c496f21424226fcbecffe67697bfc Binary files /dev/null and b/train/222.png differ diff --git a/train/223.png b/train/223.png new file mode 100644 index 0000000000000000000000000000000000000000..9b7a7783231e9934fe26b05a019f37afd72a9cdb Binary files /dev/null and b/train/223.png differ diff --git a/train/224.png b/train/224.png new file mode 100644 index 0000000000000000000000000000000000000000..ab45f38181f0e915ba5a8842ce1631a87ce39c18 Binary files /dev/null and b/train/224.png differ diff --git a/train/225.png b/train/225.png new file mode 100644 index 0000000000000000000000000000000000000000..e8927c61de8b7a00fa97c09c4a324959ccdec115 Binary files /dev/null and b/train/225.png differ diff --git a/train/23.png b/train/23.png new file mode 100644 index 0000000000000000000000000000000000000000..10c2b124de0f8fa64dcbcdc18a46b740806ee04a Binary files /dev/null and b/train/23.png differ diff --git a/train/24.png b/train/24.png new file mode 100644 index 0000000000000000000000000000000000000000..7d205359ad565c89490ea0f86c5aa4da7986a205 Binary files /dev/null and b/train/24.png differ diff --git a/train/25.png b/train/25.png new file mode 100644 index 0000000000000000000000000000000000000000..7fe3060307154bf0a87a75f80e743fa895b3527b Binary files /dev/null and b/train/25.png differ diff --git a/train/26.png b/train/26.png new file mode 100644 index 0000000000000000000000000000000000000000..c74a995dc1a7d654d850c8ad0fb33a262330e292 Binary files /dev/null and b/train/26.png differ diff --git a/train/27.png b/train/27.png new file mode 100644 index 0000000000000000000000000000000000000000..70d07979ad3206bf78d98425981aed67064e4532 Binary files /dev/null and b/train/27.png differ diff --git a/train/28.png b/train/28.png new file mode 100644 index 0000000000000000000000000000000000000000..81aa65b072144875f9ea7c70933390ba5556d8ac Binary files /dev/null and b/train/28.png differ diff --git a/train/29.png b/train/29.png new file mode 100644 index 0000000000000000000000000000000000000000..71c3dcf820c40f677b3d9afa3fc88940a882e3ab Binary files /dev/null and b/train/29.png differ diff --git a/train/30.png b/train/30.png new file mode 100644 index 0000000000000000000000000000000000000000..cdebdcab17f88152ade462265cf2b785929eb259 Binary files /dev/null and b/train/30.png differ diff --git a/train/31.png b/train/31.png new file mode 100644 index 0000000000000000000000000000000000000000..b1666da9a08f37aa7edc13ee1581e5e785437d3c Binary files /dev/null and b/train/31.png differ diff --git a/train/32.png b/train/32.png new file mode 100644 index 0000000000000000000000000000000000000000..7916c7223a62b0701521887d21c4751168d299c6 Binary files /dev/null and b/train/32.png differ diff --git a/train/33.png b/train/33.png new file mode 100644 index 0000000000000000000000000000000000000000..7fdf87a7cbcf497565d66361e446227c30ffa5ae Binary files /dev/null and b/train/33.png differ diff --git a/train/34.png b/train/34.png new file mode 100644 index 0000000000000000000000000000000000000000..58a53901a2632591520f942908b4018b91bc5e4f Binary files /dev/null and b/train/34.png differ diff --git a/train/35.png b/train/35.png new file mode 100644 index 0000000000000000000000000000000000000000..f216d1a841d015f70271c0ed81079dabf9f61631 Binary files /dev/null and b/train/35.png differ diff --git a/train/36.png b/train/36.png new file mode 100644 index 0000000000000000000000000000000000000000..8c9974bb06fb5ded2484d0cf8a559e9b77c0a108 Binary files /dev/null and b/train/36.png differ diff --git a/train/37.png b/train/37.png new file mode 100644 index 0000000000000000000000000000000000000000..f36d9377aec7b80d34cdbd9af12df5caf58fcf44 Binary files /dev/null and b/train/37.png differ diff --git a/train/38.png b/train/38.png new file mode 100644 index 0000000000000000000000000000000000000000..1142e762d84965a07063346f5b363fd3b70f57e7 Binary files /dev/null and b/train/38.png differ diff --git a/train/39.png b/train/39.png new file mode 100644 index 0000000000000000000000000000000000000000..b3b30dd90e54bed7ca67a9fece5fa78980b155d1 Binary files /dev/null and b/train/39.png differ diff --git a/train/40.png b/train/40.png new file mode 100644 index 0000000000000000000000000000000000000000..81ec312fb00410df0c6ee35e32de4ca7998b7345 Binary files /dev/null and b/train/40.png differ diff --git a/train/41.png b/train/41.png new file mode 100644 index 0000000000000000000000000000000000000000..3bd21908701a3008fcf265bd41fb20d11b4d39d6 Binary files /dev/null and b/train/41.png differ diff --git a/train/42.png b/train/42.png new file mode 100644 index 0000000000000000000000000000000000000000..db9460a454739195ee8f673b7ba8a32eb9b9bf51 Binary files /dev/null and b/train/42.png differ diff --git a/train/43.png b/train/43.png new file mode 100644 index 0000000000000000000000000000000000000000..23a789ce2f277f65933d26d49393d5a15c5851fb Binary files /dev/null and b/train/43.png differ diff --git a/train/44.png b/train/44.png new file mode 100644 index 0000000000000000000000000000000000000000..e01a801d4f9ccf7ce09ff9e812ca57064be25eee Binary files /dev/null and b/train/44.png differ diff --git a/train/45.png b/train/45.png new file mode 100644 index 0000000000000000000000000000000000000000..b5e3a325fe55be4ab12197c8ae66e5643b8e9ec7 Binary files /dev/null and b/train/45.png differ diff --git a/train/46.png b/train/46.png new file mode 100644 index 0000000000000000000000000000000000000000..941499a6a4542572ea22005a67256114086b8bca Binary files /dev/null and b/train/46.png differ diff --git a/train/47.png b/train/47.png new file mode 100644 index 0000000000000000000000000000000000000000..75f5c506271aee1361e7247b044f1c849984251b Binary files /dev/null and b/train/47.png differ diff --git a/train/48.png b/train/48.png new file mode 100644 index 0000000000000000000000000000000000000000..f78d6d237bbba6b8bf1e3995354d7930d90aac57 Binary files /dev/null and b/train/48.png differ diff --git a/train/49.png b/train/49.png new file mode 100644 index 0000000000000000000000000000000000000000..6d95c53d3733adeec811da7856dcb7079ca655f4 Binary files /dev/null and b/train/49.png differ diff --git a/train/50.png b/train/50.png new file mode 100644 index 0000000000000000000000000000000000000000..d7a3dcd84055210793d1e41fe6af0b61d7feb705 Binary files /dev/null and b/train/50.png differ diff --git a/train/51.png b/train/51.png new file mode 100644 index 0000000000000000000000000000000000000000..8c33c49b0818100983a632b939ee47860557c045 Binary files /dev/null and b/train/51.png differ diff --git a/train/52.png b/train/52.png new file mode 100644 index 0000000000000000000000000000000000000000..f950db63e893a37a9978336e6501facff85f8079 Binary files /dev/null and b/train/52.png differ diff --git a/train/53.png b/train/53.png new file mode 100644 index 0000000000000000000000000000000000000000..68fdc45a14a029bd8a21f16d43e7aa7c956effa5 Binary files /dev/null and b/train/53.png differ diff --git a/train/54.png b/train/54.png new file mode 100644 index 0000000000000000000000000000000000000000..a19742922db6c7ff9ac8001515419eeb48d3f923 Binary files /dev/null and b/train/54.png differ diff --git a/train/55.png b/train/55.png new file mode 100644 index 0000000000000000000000000000000000000000..489b190f3525f59e4c20c7a427a021a9318d7dd9 Binary files /dev/null and b/train/55.png differ diff --git a/train/56.png b/train/56.png new file mode 100644 index 0000000000000000000000000000000000000000..92250386d324cf137e97d7b66c2d2761145830e0 Binary files /dev/null and b/train/56.png differ diff --git a/train/57.png b/train/57.png new file mode 100644 index 0000000000000000000000000000000000000000..f726d7b9fa8d484104e967b4e71235f361be09c5 Binary files /dev/null and b/train/57.png differ diff --git a/train/58.png b/train/58.png new file mode 100644 index 0000000000000000000000000000000000000000..96f190ba19c42ae54b7a7e8dabb669da8ba5de1c Binary files /dev/null and b/train/58.png differ diff --git a/train/59.png b/train/59.png new file mode 100644 index 0000000000000000000000000000000000000000..01e8afdb19ddaaf22ebb7c87c49e3da55553e52f Binary files /dev/null and b/train/59.png differ diff --git a/train/60.png b/train/60.png new file mode 100644 index 0000000000000000000000000000000000000000..40d672d845e70aca8fae114eac7cc7edd4abd8d3 Binary files /dev/null and b/train/60.png differ diff --git a/train/61.png b/train/61.png new file mode 100644 index 0000000000000000000000000000000000000000..758668655817c7799cdbff53fe5f7d5664537659 Binary files /dev/null and b/train/61.png differ diff --git a/train/62.png b/train/62.png new file mode 100644 index 0000000000000000000000000000000000000000..5085c63f4ac07fe744fad97744e5b33fd7b1f5e0 Binary files /dev/null and b/train/62.png differ diff --git a/train/63.png b/train/63.png new file mode 100644 index 0000000000000000000000000000000000000000..c0139b500c4c22b569dacf439f33d637b552e242 Binary files /dev/null and b/train/63.png differ diff --git a/train/64.png b/train/64.png new file mode 100644 index 0000000000000000000000000000000000000000..c1175d8a345dfcbe1f6b3094409492ce0875baca Binary files /dev/null and b/train/64.png differ diff --git a/train/65.png b/train/65.png new file mode 100644 index 0000000000000000000000000000000000000000..ac8c27ec6eb0b336290fec90dba901f56eb52a8a Binary files /dev/null and b/train/65.png differ diff --git a/train/66.png b/train/66.png new file mode 100644 index 0000000000000000000000000000000000000000..15cb7fc4b0ae6a52fe4955f2ae65492a14c2f0dc Binary files /dev/null and b/train/66.png differ diff --git a/train/67.png b/train/67.png new file mode 100644 index 0000000000000000000000000000000000000000..dc26d38b85ca534f8b02bd57320333fb448e931b Binary files /dev/null and b/train/67.png differ diff --git a/train/68.png b/train/68.png new file mode 100644 index 0000000000000000000000000000000000000000..8e7744f44db3f2104b05f0cdbd6ebf25b907d3d8 Binary files /dev/null and b/train/68.png differ diff --git a/train/69.png b/train/69.png new file mode 100644 index 0000000000000000000000000000000000000000..18499ef53325254424ea78f438924ec9cbdfe9c9 Binary files /dev/null and b/train/69.png differ diff --git a/train/70.png b/train/70.png new file mode 100644 index 0000000000000000000000000000000000000000..662ce91903780c68fc05ea2e23edb899248bd290 Binary files /dev/null and b/train/70.png differ diff --git a/train/71.png b/train/71.png new file mode 100644 index 0000000000000000000000000000000000000000..ed03d310aff8de065f2a6a951cb43b67b7ff1305 Binary files /dev/null and b/train/71.png differ diff --git a/train/72.png b/train/72.png new file mode 100644 index 0000000000000000000000000000000000000000..5f479ca0889d709aad0e60de0fd8121d30a0935e Binary files /dev/null and b/train/72.png differ diff --git a/train/73.png b/train/73.png new file mode 100644 index 0000000000000000000000000000000000000000..619c236aa116d0b63c7160ebad1426ac611cf11f Binary files /dev/null and b/train/73.png differ diff --git a/train/74.png b/train/74.png new file mode 100644 index 0000000000000000000000000000000000000000..47a39dcfb2d04f7d014e9b0dad6c587bd18aa205 Binary files /dev/null and b/train/74.png differ diff --git a/train/75.png b/train/75.png new file mode 100644 index 0000000000000000000000000000000000000000..adaade8ae35bd46d3cf4044bfdbfd7831dcc4b7b Binary files /dev/null and b/train/75.png differ diff --git a/train/76.png b/train/76.png new file mode 100644 index 0000000000000000000000000000000000000000..35a67b5131bcd0d85b2ed9ac76f17648ec10688c Binary files /dev/null and b/train/76.png differ diff --git a/train/77.png b/train/77.png new file mode 100644 index 0000000000000000000000000000000000000000..f8841b3f4c9b850c20800bf95a8dde954f3da8dd Binary files /dev/null and b/train/77.png differ diff --git a/train/78.png b/train/78.png new file mode 100644 index 0000000000000000000000000000000000000000..2fb22165fb1223086b429a6b9294b32d9f501759 Binary files /dev/null and b/train/78.png differ diff --git a/train/79.png b/train/79.png new file mode 100644 index 0000000000000000000000000000000000000000..976290a9e242ede29b7029c7c346feb003d7c3e0 Binary files /dev/null and b/train/79.png differ diff --git a/train/80.png b/train/80.png new file mode 100644 index 0000000000000000000000000000000000000000..88012ca37667aabc8cc21250c517f66c796a3cf9 Binary files /dev/null and b/train/80.png differ diff --git a/train/81.png b/train/81.png new file mode 100644 index 0000000000000000000000000000000000000000..950cca809b2de6858848fba436ad67821c1e58c1 Binary files /dev/null and b/train/81.png differ diff --git a/train/82.png b/train/82.png new file mode 100644 index 0000000000000000000000000000000000000000..a0ac25be3b60cb9299e5e4f1a30715af7435e9ed Binary files /dev/null and b/train/82.png differ diff --git a/train/83.png b/train/83.png new file mode 100644 index 0000000000000000000000000000000000000000..4383bfed78c7b10e542dbae19ae23bd23c1a3a6c Binary files /dev/null and b/train/83.png differ diff --git a/train/84.png b/train/84.png new file mode 100644 index 0000000000000000000000000000000000000000..41c18a00e2e0da6eb26f3dcf8ba405f266608ccd Binary files /dev/null and b/train/84.png differ diff --git a/train/85.png b/train/85.png new file mode 100644 index 0000000000000000000000000000000000000000..b8c6c3f7c1fcce6f9717f65a323a4df81430a19f Binary files /dev/null and b/train/85.png differ diff --git a/train/86.png b/train/86.png new file mode 100644 index 0000000000000000000000000000000000000000..1b9e850abe992084f8e1f16450478d31c46f52a5 Binary files /dev/null and b/train/86.png differ diff --git a/train/87.png b/train/87.png new file mode 100644 index 0000000000000000000000000000000000000000..25a18cefb6bdad5dc38caa42b9f449b195092272 Binary files /dev/null and b/train/87.png differ diff --git a/train/88.png b/train/88.png new file mode 100644 index 0000000000000000000000000000000000000000..a074fc734e95e91c0d66d8980d059a3d0e2d9104 Binary files /dev/null and b/train/88.png differ diff --git a/train/89.png b/train/89.png new file mode 100644 index 0000000000000000000000000000000000000000..51093eeac6357f6b3da7b434d22c3d5b0cf855ad Binary files /dev/null and b/train/89.png differ diff --git a/train/90.png b/train/90.png new file mode 100644 index 0000000000000000000000000000000000000000..564bbdb4c1c2076632d8fe75047a47e0a28b20a4 Binary files /dev/null and b/train/90.png differ diff --git a/train/91.png b/train/91.png new file mode 100644 index 0000000000000000000000000000000000000000..98fb98e564795729e4db6928aaff8ce09a6bdae7 Binary files /dev/null and b/train/91.png differ diff --git a/train/92.png b/train/92.png new file mode 100644 index 0000000000000000000000000000000000000000..6c448c3ebcb1ba571a4082961a792764912b95ff Binary files /dev/null and b/train/92.png differ diff --git a/train/93.png b/train/93.png new file mode 100644 index 0000000000000000000000000000000000000000..cbc4d89f02cb18a978341ef0f30c2d0545310638 Binary files /dev/null and b/train/93.png differ diff --git a/train/94.png b/train/94.png new file mode 100644 index 0000000000000000000000000000000000000000..145c1cd68c1039a08d61495a4dfc608a40be2d97 Binary files /dev/null and b/train/94.png differ diff --git a/train/95.png b/train/95.png new file mode 100644 index 0000000000000000000000000000000000000000..866e97812bbf411c07c7551abd6490356d4dca10 Binary files /dev/null and b/train/95.png differ diff --git a/train/96.png b/train/96.png new file mode 100644 index 0000000000000000000000000000000000000000..b8ab9ad62aa96f4de48384c5b26a646f3cf16a90 Binary files /dev/null and b/train/96.png differ diff --git a/train/97.png b/train/97.png new file mode 100644 index 0000000000000000000000000000000000000000..a751612bf422f439265a1e3bf5a11c16a3dc8409 Binary files /dev/null and b/train/97.png differ diff --git a/train/98.png b/train/98.png new file mode 100644 index 0000000000000000000000000000000000000000..d100aca89352a8d49b93f00c7127032c416f1e14 Binary files /dev/null and b/train/98.png differ diff --git a/train/99.png b/train/99.png new file mode 100644 index 0000000000000000000000000000000000000000..55a318f29b36158c486795c181bda4400b37188c Binary files /dev/null and b/train/99.png differ diff --git a/wrapper.cpp b/wrapper.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c7a4ec1eaeb560cb3f075482f2f6d65b45c11498 --- /dev/null +++ b/wrapper.cpp @@ -0,0 +1,46 @@ +#include +#include +#include + +#include "ImageCoder.cpp" +#include "ac_enc.cpp" +#include "ac_dec.cpp" + + +namespace py = pybind11; + +template +T*** from_py_array2(py::array_t& py_array) +{ + return (T***)py_array.data(); +} + +template +T* from_py_array(py::array_t& py_array) +{ + return (T*)py_array.data(); +} + + +PYBIND11_MODULE(EntropyCodec, m){ + m.def("HiddenLayersEncoder", [](py::array_t& layer1, int w1, int h1, int z1, + py::array_t& stream, py::array_t& bitsize) + { + auto l1 = from_py_array(layer1); + auto st = from_py_array(stream); + auto bs = from_py_array(bitsize); + + BitPlaneEncoder(st, l1, w1, h1, z1, bs); + }); + + m.def("HiddenLayersDecoder", [](py::array_t& layer1, int w1, int h1, int z1, + py::array_t& stream, py::array_t& offset) + { + auto l1 = from_py_array(layer1); + auto st = from_py_array(stream); + auto of = from_py_array(offset); + + BitPlaneDecoder(st, l1, w1, h1, z1, of); + }); +} +