File: README

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 (174 lines) | stat: -rw-r--r-- 6,528 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
[release 0.1.2]

RTjpeg
(C) 1998 Justin Schoeman (justin@suntiger.ee.up.ac.za)

License+Disclaimer
==================
This code is distributed under GPLv2 (in other words, do what you like with
it, but don't sell it, and give credit if you use it).
THIS SOFTWARE IS IN NO WAY GUARANTEED TO WORK. IF YOU USE IT AND IT DOESN'T
WORK, OR MESSES UP YOUR COMPUTER, IT'S YOUR OWN PROBLEM.

General:
========
This is still a rather developmental real time compressor.  It is based on
the jpeg compressor by the IJG (see LICENSE.jpeg for license details).  The
only real difference is the encoder.  This compressor uses a home brew
redundant data coder (makes use of the fact that some co-efficients have a
limited range) to very quickly (but not that efficiently) encode the data.

Basic interframe coding (only coefficients that have varied significantly
are transmitted) is included.

This codec is currently real time at CIF resolutions on anything faster than
a pentium 200 (on most P133s too now).

Installation:
=============
A number of modules are avaliable (in the modules directory).  Some work
better on different architectures.  Select the module of your choice by
editing compose.sh .

Please benchmark these routines on various machines and send me your
compression/decompression rate (and machine type).

Applications:
=============
test: *out of date* captures from bttv0 and compresses to out.pgm (1
	image).

test2 <filename> <Q>: compresses <filename> to stdout with Q factor Q.
	The input file is a PPM with 2h2v subsapled Cr and Cb attached to
        the end.

test3 <Q> <M>: capture compressed stream to "ostr" with Q factor Q and
		motion threshold "M".

test3d: play "ostr" on X display.  Hard coded for 32bpp, change
	 Rtjpeg_yuvrgb32 to the conversion of your choice.

TC(subdir): experimental constrained rate encoder.
VS(subdir): experimental compressed Vstream version.

Using the library:
==================
(see below for function descriptions)

To compress single images:
1) RTjpeg_init_compress
2) (it is a good idea to save the tables with the image)
3) RTjpeg_compress
4) save result.

To decompress a single image:
1) Read saved tables (or call RTjpeg_init_compress with the same Q factor as
was used to compress the data) 
2) RTjpeg_init_decompress
3) store the YUV420 image, or
3) RTjpeg_yuvrgbXX where XX is the desired RGB depth (8 (grey) 16 (565) 24
and 32)
4) (possible) RTjpeg_doubleXX to double the image size.

To compress an image stream (with interframe coding):
As for single image except:
1) RTjpeg_init_mcompress AFTER RTjpeg_init compress.
2) Use RTjpeg_mcompress instead of RTjpeg_compress

To decompress an image stream (with interframe coding):
As for single frame except:
1) Initialise output buffer to 0's
2) do not modify the output buffer except by RTjpeg_decompress.

RTjpeg Functions:
=================
(some functions may not yet be implemented for all module types)

extern void RTjpeg_init_Q(__u8 Q);
----------------------------------
Change the quality factor for future compressions/decompressions to Q.
Q=255 ==> IJG jpeg 75% (max)
Q=128 ==> IJG jpeg 50%
Q=32 (min usable)
Q=1 (abstract art)

extern void RTjpeg_init_compress(__u32 *buf, int width, int height, __u8 Q);
----------------------------------------------------------------------------
Initialise the compressor.
  *buf is a pointer to 128 ints.  The de-quantizer values are stored in this
array.  It is best to save these with the image for reliable decompression
between versions (although it is probably not necessary).
  width is the width of the Y component of the image.
  height is the height of the Y component of the image.
  Q is the quality factor (see above)

extern void RTjpeg_init_decompress(__u32 *buf, int width, int height);
----------------------------------------------------------------------
Initialise decompressor (and color convertor).
  *buf is a pointer to the 128 ints produced by init_compress.
  width and height, as before.

extern int RTjpeg_compress(__s8 *sp, unsigned char *bp);
--------------------------------------------------------
Compress the image.
  *sp is a pointer to the output data (for safety, this buffer should be as 
    large as the uncompressed data).
  *bp is a pointer to the input data (YUV420P format).
  RETURN: the number of bytes actually used for the output stream.

extern void RTjpeg_decompress(__s8 *sp, __u8 *bp);
--------------------------------------------------
Decompress the image.
  as before (no RETURN).

extern void RTjpeg_init_mcompress(void);
----------------------------------------
Initialise interframe compression.

extern int RTjpeg_mcompress(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask);
-----------------------------------------------------------------------------------
Perform interframe compression.
 *sp, *bp as for compress
 lmask, cmask threshold value for change in quantized luma and chroma
   components before transmitting the block. NB works on quantized values,
   so use lower thresholds for lower Q values.

extern void RTjpeg_set_test(int i);
-----------------------------------
Enable test-compressions.
  i=0: disable test mode
  i=1: enable test mode
(In test mode interframe compression is performed WITHOUT updating the local
copy of the reference image.  This is used for constrained rate encoding to
test multiple compression factors for compressed block size. Remember to
call mcompress with test mode = 0 BEFORE transmitting an encoded block.)

extern void RTjpeg_yuvrgb(__u8 *buf, __u8 *rgb);
------------------------------------------------
Convert decompressed YUV420P data to RGB data
  *buf pointer to YUV420P data
  *rgb pointer to RGB data

extern void RTjpeg_yuvrgb32(__u8 *buf, __u8 *rgb);
--------------------------------------------------
convert to RGB32 data (display order)

extern void RTjpeg_yuvrgb24(__u8 *buf, __u8 *rgb);
--------------------------------------------------
convert to RGB24 (display order)

extern void RTjpeg_yuvrgb16(__u8 *buf, __u8 *rgb);
--------------------------------------------------
convert to RGB 565

extern void RTjpeg_yuvrgb8(__u8 *buf, __u8 *rgb);
-------------------------------------------------
convert to grey-scale (grin)

extern void RTjpeg_double32(__u32 *buf);
extern void RTjpeg_double24(__u8 *buf);
extern void RTjpeg_double16(__u16 *buf);
extern void RTjpeg_double8(__u8 *buf);
--------------------------------------
convert the image pointed to by *buf to double size (size is determined by
with and height from init_decompress).