This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dither(self, img, dither_mask, pixel_loc): | |
nvtx.range_push("Dithering") | |
# Determine amount of padding | |
p = math.ceil(max(dither_mask.shape)/2) | |
# print("Padding with: ",p) | |
# Pad image (same amount in all directions, can be more efficient, but easy for now) | |
out = Func.pad(img, (p,p,p,p), "replicate") | |
# mini-batch size, channels, heigth, width | |
F, C, H, W = out.size() | |
m,n = dither_mask.shape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* minimal code example showing how to call the zfp (de)compressor */ | |
#ifdef DOUBLE_DT | |
typedef double md; | |
#else | |
typedef float md; | |
#endif | |
#include <math.h> | |
#include <stdio.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* minimal code example showing how to call the zfp (de)compressor */ | |
#ifdef DOUBLE_DT | |
typedef double md; | |
#else | |
typedef float md; | |
#endif | |
#include <math.h> | |
#include <stdio.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* minimal code example showing how to call the zfp (de)compressor */ | |
#include <math.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <zfp.h> | |
/* fill grid with a floating point value */ | |
static inline void |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef double lr; | |
lr ***lr_3D_matrix(int m, int n, int o)/** \brief create a 3D matrix with size [m, n,o] of type lr*/ | |
{ | |
lr ***matrix; | |
int i, j; | |
matrix = malloc(m * sizeof(lr **)); //allocate first dimension | |
matrix[0] = malloc(m * n * sizeof(lr *)); //allocate continous memory block for all elements | |
matrix[0][0] = malloc(m * n * o * sizeof(lr)); //allocate memory for the whole matrix |