Welcome to mirror list, hosted at ThFree Co, Russian Federation.

image.c - github.com/torch/image.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f559b9358fcc4fabf63d59a1b47e05bab49cccbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

#include <TH.h>
#include <luaT.h>

#define torch_(NAME) TH_CONCAT_3(torch_, Real, NAME)
#define torch_string_(NAME) TH_CONCAT_STRING_3(torch., Real, NAME)
#define image_(NAME) TH_CONCAT_3(image_, Real, NAME)

static const void* torch_FloatTensor_id = NULL;
static const void* torch_DoubleTensor_id = NULL;

#ifdef max
#undef max
#endif
#define max( a, b ) ( ((a) > (b)) ? (a) : (b) )

#ifdef min
#undef min
#endif
#define min( a, b ) ( ((a) < (b)) ? (a) : (b) )

#include "generic/image.c"
#include "THGenerateFloatTypes.h"

DLL_EXPORT int luaopen_libimage(lua_State *L)
{
  torch_FloatTensor_id = luaT_checktypename2id(L, "torch.FloatTensor");
  torch_DoubleTensor_id = luaT_checktypename2id(L, "torch.DoubleTensor");

  image_FloatMain_init(L);
  image_DoubleMain_init(L);

  luaL_register(L, "image.double", image_DoubleMain__); 
  luaL_register(L, "image.float", image_FloatMain__);

  return 1;
}