summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <quaker66@gmail.com>2014-01-31 10:41:55 +0000
committerDaniel Kolesa <quaker66@gmail.com>2014-01-31 10:41:55 +0000
commit517fcebef050da5091075ac5f270ec6f7ac49649 (patch)
treec02074c94f4c36b2789c0a64eed5f9e1cbbaac00
parentc98561a32c01ad18514db731be731aca31f3caab (diff)
get rid of some ffi stuff
-rw-r--r--tests/image_data_ycbcr601pl.lua17
-rw-r--r--tests/image_data_ycbcr601pl_map_solid_rotate.lua17
-rw-r--r--tests/image_data_ycbcr601pl_wide_stride.lua17
3 files changed, 15 insertions, 36 deletions
diff --git a/tests/image_data_ycbcr601pl.lua b/tests/image_data_ycbcr601pl.lua
index c141613..52ec04c 100644
--- a/tests/image_data_ycbcr601pl.lua
+++ b/tests/image_data_ycbcr601pl.lua
@@ -3,13 +3,6 @@ local util = require("util")
3local C = ffi.C 3local C = ffi.C
4local levas = util.get_lib("evas") 4local levas = util.get_lib("evas")
5 5
6ffi.cdef [[
7 typedef void *FILE;
8 int fclose(FILE *f);
9 FILE *fopen (const char *fname, const char *mode);
10 size_t fread (void *ptr, size_t size, size_t n, FILE *stream);
11]]
12
13return function(ui) 6return function(ui)
14 local image 7 local image
15 local yp, up, vp 8 local yp, up, vp
@@ -36,14 +29,14 @@ return function(ui)
36 levas.evas_object_image_fill_set(image, 0, 0, 640, 480) 29 levas.evas_object_image_fill_set(image, 0, 0, 640, 480)
37 levas.evas_object_resize(image, 640, 480) 30 levas.evas_object_resize(image, 640, 480)
38 levas.evas_object_show(image) 31 levas.evas_object_show(image)
39 local f = C.fopen(util.build_path("tp.yuv"), "rb") 32 local f = io.open(util.build_path("tp.yuv"), "rb")
40 yp = ffi.new("unsigned char[?]", 640 * 480) 33 yp = ffi.new("unsigned char[?]", 640 * 480)
41 up = ffi.new("unsigned char[?]", 320 * 240) 34 up = ffi.new("unsigned char[?]", 320 * 240)
42 vp = ffi.new("unsigned char[?]", 320 * 240) 35 vp = ffi.new("unsigned char[?]", 320 * 240)
43 C.fread(yp, 640 * 480, 1, f) 36 ffi.copy(yp, f:read(640 * 480), 640 * 480)
44 C.fread(up, 320 * 240, 1, f) 37 ffi.copy(up, f:read(320 * 240), 320 * 240)
45 C.fread(vp, 320 * 240, 1, f) 38 ffi.copy(vp, f:read(320 * 240), 320 * 240)
46 C.fclose(f) 39 f:close()
47 local data = ffi.cast("unsigned char**", 40 local data = ffi.cast("unsigned char**",
48 levas.evas_object_image_data_get(image, 1)) 41 levas.evas_object_image_data_get(image, 1))
49 local lp = data 42 local lp = data
diff --git a/tests/image_data_ycbcr601pl_map_solid_rotate.lua b/tests/image_data_ycbcr601pl_map_solid_rotate.lua
index 54d037e..dfc9f75 100644
--- a/tests/image_data_ycbcr601pl_map_solid_rotate.lua
+++ b/tests/image_data_ycbcr601pl_map_solid_rotate.lua
@@ -3,13 +3,6 @@ local util = require("util")
3local C = ffi.C 3local C = ffi.C
4local levas = util.get_lib("evas") 4local levas = util.get_lib("evas")
5 5
6ffi.cdef [[
7 typedef void *FILE;
8 int fclose(FILE *f);
9 FILE *fopen (const char *fname, const char *mode);
10 size_t fread (void *ptr, size_t size, size_t n, FILE *stream);
11]]
12
13local names = { 6local names = {
14 "Image Data YCbCr 601 Pointer List Map Solid Rotate", 7 "Image Data YCbCr 601 Pointer List Map Solid Rotate",
15 "Image Data YCbCr 601 Pointer List Map Nearest Solid Rotate" 8 "Image Data YCbCr 601 Pointer List Map Nearest Solid Rotate"
@@ -47,14 +40,14 @@ return function(ui, variant)
47 levas.evas_object_image_smooth_scale_set(image, (variant == 2) 40 levas.evas_object_image_smooth_scale_set(image, (variant == 2)
48 and 0 or 1) 41 and 0 or 1)
49 levas.evas_object_show(image) 42 levas.evas_object_show(image)
50 local f = C.fopen(util.build_path("tp.yuv"), "rb") 43 local f = io.open(util.build_path("tp.yuv"), "rb")
51 yp = ffi.new("unsigned char[?]", 640 * 480) 44 yp = ffi.new("unsigned char[?]", 640 * 480)
52 up = ffi.new("unsigned char[?]", 320 * 240) 45 up = ffi.new("unsigned char[?]", 320 * 240)
53 vp = ffi.new("unsigned char[?]", 320 * 240) 46 vp = ffi.new("unsigned char[?]", 320 * 240)
54 C.fread(yp, 640 * 480, 1, f) 47 ffi.copy(yp, f:read(640 * 480), 640 * 480)
55 C.fread(up, 320 * 240, 1, f) 48 ffi.copy(up, f:read(320 * 240), 320 * 240)
56 C.fread(vp, 320 * 240, 1, f) 49 ffi.copy(vp, f:read(320 * 240), 320 * 240)
57 C.fclose(f) 50 f:close()
58 local data = ffi.cast("unsigned char**", 51 local data = ffi.cast("unsigned char**",
59 levas.evas_object_image_data_get(image, 1)) 52 levas.evas_object_image_data_get(image, 1))
60 local lp = data 53 local lp = data
diff --git a/tests/image_data_ycbcr601pl_wide_stride.lua b/tests/image_data_ycbcr601pl_wide_stride.lua
index d5d54bf..9b8f619 100644
--- a/tests/image_data_ycbcr601pl_wide_stride.lua
+++ b/tests/image_data_ycbcr601pl_wide_stride.lua
@@ -4,13 +4,6 @@ local util = require("util")
4local C = ffi.C 4local C = ffi.C
5local levas = util.get_lib("evas") 5local levas = util.get_lib("evas")
6 6
7ffi.cdef [[
8 typedef void *FILE;
9 int fclose(FILE *f);
10 FILE *fopen (const char *fname, const char *mode);
11 size_t fread (void *ptr, size_t size, size_t n, FILE *stream);
12]]
13
14local band, bnot = bit.band, bit.bnot 7local band, bnot = bit.band, bit.bnot
15 8
16return function(ui) 9return function(ui)
@@ -65,14 +58,14 @@ return function(ui)
65 levas.evas_object_image_fill_set(image, 0, 0, 640, 480) 58 levas.evas_object_image_fill_set(image, 0, 0, 640, 480)
66 levas.evas_object_resize(image, 640, 480) 59 levas.evas_object_resize(image, 640, 480)
67 levas.evas_object_show(image) 60 levas.evas_object_show(image)
68 local f = C.fopen(util.build_path("tp.yuv"), "rb") 61 local f = io.open(util.build_path("tp.yuv"), "rb")
69 yp = ffi.new("unsigned char[?]", 640 * 480) 62 yp = ffi.new("unsigned char[?]", 640 * 480)
70 up = ffi.new("unsigned char[?]", 320 * 240) 63 up = ffi.new("unsigned char[?]", 320 * 240)
71 vp = ffi.new("unsigned char[?]", 320 * 240) 64 vp = ffi.new("unsigned char[?]", 320 * 240)
72 C.fread(yp, 640 * 480, 1, f) 65 ffi.copy(yp, f:read(640 * 480), 640 * 480)
73 C.fread(up, 320 * 240, 1, f) 66 ffi.copy(up, f:read(320 * 240), 320 * 240)
74 C.fread(vp, 320 * 240, 1, f) 67 ffi.copy(vp, f:read(320 * 240), 320 * 240)
75 C.fclose(f) 68 f:close()
76 local data = ffi_cast("unsigned char**", 69 local data = ffi_cast("unsigned char**",
77 levas.evas_object_image_data_get(image, 1)) 70 levas.evas_object_image_data_get(image, 1))
78 local lp 71 local lp