-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
convert pic_jpeg interface to pure Lua/FFI solution
pic_jpeg had a wrapper lib before that was needed because of the libjpeg API which uses setjmp/longjmp error handling. By using the TurboJPEG API that comes with libjpeg-turbo, we can use a pure Lua/FFI based approach.
- Loading branch information
Showing
7 changed files
with
78 additions
and
149 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <turbojpeg.h> | ||
|
||
#include "ffi-cdecl.h" | ||
#include "ffi-cdecl-luajit.h" | ||
|
||
cdecl_type(tjhandle) | ||
|
||
cdecl_enum(TJPF) | ||
|
||
cdecl_func(tjDestroy) | ||
cdecl_func(tjInitDecompress) | ||
cdecl_func(tjDecompressHeader2) | ||
cdecl_func(tjDecompress2) | ||
cdecl_func(tjDecompressToYUV) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
local ffi = require("ffi") | ||
|
||
ffi.cdef[[ | ||
enum TJPF { | ||
TJPF_RGB = 0, | ||
TJPF_BGR = 1, | ||
TJPF_RGBX = 2, | ||
TJPF_BGRX = 3, | ||
TJPF_XBGR = 4, | ||
TJPF_XRGB = 5, | ||
TJPF_GRAY = 6, | ||
TJPF_RGBA = 7, | ||
TJPF_BGRA = 8, | ||
TJPF_ABGR = 9, | ||
TJPF_ARGB = 10, | ||
}; | ||
typedef void *tjhandle; | ||
int tjDestroy(tjhandle); | ||
tjhandle tjInitDecompress(void); | ||
int tjDecompressHeader2(tjhandle, unsigned char *, long unsigned int, int *, int *, int *); | ||
int tjDecompress2(tjhandle, unsigned char *, long unsigned int, unsigned char *, int, int, int, int, int); | ||
int tjDecompressToYUV(tjhandle, unsigned char *, long unsigned int, unsigned char *, int); | ||
]] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.