File: RTjpeg.xs

package info (click to toggle)
libvideo-capture-v4l-perl 0.902-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 644 kB
  • ctags: 323
  • sloc: perl: 2,749; ansic: 1,494; sh: 22; makefile: 2
file content (116 lines) | stat: -rw-r--r-- 2,628 bytes parent folder | download | duplicates (8)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include <sys/types.h>
#include <unistd.h>
#include <sys/mman.h>

#include "../gppport.h"

#include "codec/RTjpeg.h"

static int fwidth, fheight;

MODULE = Video::RTjpeg		PACKAGE = Video::RTjpeg		PREFIX = RTjpeg_

PROTOTYPES: ENABLE

SV *
RTjpeg_init_compress(width,height,Q)
	int	width
        int	height
        U8	Q
        CODE:
        fwidth = width;
        fheight = height;
        RETVAL = newSVpv ("", 0);
        SvGROW (RETVAL, sizeof (RTjpeg_tables));
        SvCUR_set (RETVAL, sizeof (RTjpeg_tables));
        RTjpeg_init_compress ((u32 *)SvPV_nolen (RETVAL), width, height, Q);
	OUTPUT:
        RETVAL

void
RTjpeg_init_decompress(tables,width,height)
	SV *	tables
	int	width
        int	height
        CODE:
        fwidth = width;
        fheight = height;
        RTjpeg_init_decompress ((u32 *)SvPV_nolen (tables), width, height);

SV *
RTjpeg_compress(YCrCb422_data)
	SV *	YCrCb422_data
        CODE:
        RETVAL = newSVpv ("", 0);
        SvGROW (RETVAL, (fwidth * fheight * 3 + 2) / 2);
        SvCUR_set (RETVAL, RTjpeg_compress (SvPV_nolen (RETVAL), SvPV_nolen (YCrCb422_data)));
	OUTPUT:
        RETVAL
        
SV *
RTjpeg_decompress(RTjpeg_data)
	SV *	RTjpeg_data
        CODE:
        RETVAL = newSVpv ("", 0);
        SvGROW (RETVAL, fwidth * fheight * 2);
        SvCUR_set (RETVAL, fwidth * fheight * 2);
        RTjpeg_decompress (SvPV_nolen (RTjpeg_data), SvPV_nolen (RETVAL));
	OUTPUT:
        RETVAL

void
RTjpeg_init_mcompress()
        
SV *
RTjpeg_mcompress(YCrCb422_data,lmask,cmask=(lmask)>>1,x=0,y=0,w=fwidth,h=fheight)
	SV *	YCrCb422_data
        U16	lmask
        U16	cmask
        int	x
        int	y
        int	w
        int	h
        CODE:
        RETVAL = newSVpv ("", 0);
        SvGROW (RETVAL, (fwidth * fheight * 3 + 2) / 2);
        SvCUR_set (RETVAL, RTjpeg_mcompress (SvPV_nolen (RETVAL), SvPV_nolen (YCrCb422_data), lmask, cmask,
                                             x, y, w, h));
	OUTPUT:
        RETVAL
        
SV *
RTjpeg_yuvrgb(yuv_data)
	SV *	yuv_data
        CODE:
        RETVAL = newSVpv ("", 0);
        SvGROW (RETVAL, fwidth * fheight * 3);
        SvCUR_set (RETVAL, fwidth * fheight * 3);
        RTjpeg_yuvrgb (SvPV_nolen (yuv_data), SvPV_nolen (RETVAL));
	OUTPUT:
        RETVAL

void
_exit(retcode=0)
  	int retcode
	CODE:
        _exit (retcode);
        
void
fdatasync(fd)
  	int	fd
	CODE:
#ifdef _POSIX_SYNCHRONIZED_IO
        fdatasync (fd);
#endif
        
BOOT:
{
	HV *stash = gv_stashpvn("Video::RTjpeg", 13, TRUE);

	//newCONSTSUB(stash,"VBI_VT",	newSViv(VBI_VT));
}