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: a6783e91ef20193b599a0a30a38feaebaaa536a7 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

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

#if LUA_VERSION_NUM >= 503
#define luaL_checklong(L,n)     ((long)luaL_checkinteger(L, (n)))
#endif


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

#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 "font.c"

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

DLL_EXPORT int luaopen_libimage(lua_State *L)
{
  image_FloatMain_init(L);
  image_DoubleMain_init(L);
  image_ByteMain_init(L);

  lua_newtable(L);
  lua_pushvalue(L, -1);
  lua_setglobal(L, "image");

  lua_newtable(L);
  luaT_setfuncs(L, image_DoubleMain__, 0);
  lua_setfield(L, -2, "double");

  lua_newtable(L);
  luaT_setfuncs(L, image_FloatMain__, 0);
  lua_setfield(L, -2, "float");

  lua_newtable(L);
  luaT_setfuncs(L, image_ByteMain__, 0);
  lua_setfield(L, -2, "byte");

  return 1;
}