ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/Video-Capture-V4l/RTjpeg/codec/modules/RTb2s.c
Revision: 1.2
Committed: Thu Jul 24 20:55:20 2008 UTC (18 years, 3 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rel-0_902, HEAD
Changes since 1.1: +1 -1 lines
Log Message:
0.902

File Contents

# Content
1 int RTjpeg_b2s(s16 *data, s8 *strm, u8 bt8)
2 {
3 int ci=1, co=1, tmp;
4
5 strm[0]=(u8)(data[RTjpeg_ZZ[0]]>254) ? 254:((data[RTjpeg_ZZ[0]]<0)?0:data[RTjpeg_ZZ[0]]);
6
7 for(ci=1; ci<=bt8; ci++)
8 if(data[RTjpeg_ZZ[ci]]>0)
9 {
10 strm[co++]=(s8)(data[RTjpeg_ZZ[ci]]>127)?127:data[RTjpeg_ZZ[ci]];
11 } else
12 {
13 strm[co++]=(s8)(data[RTjpeg_ZZ[ci]]<-128)?-128:data[RTjpeg_ZZ[ci]];
14 }
15 for(; ci<64; ci++)
16 if(data[RTjpeg_ZZ[ci]]>0)
17 {
18 strm[co++]=(s8)(data[RTjpeg_ZZ[ci]]>63)?63:data[RTjpeg_ZZ[ci]];
19 } else if(data[RTjpeg_ZZ[ci]]<0)
20 {
21 strm[co++]=(s8)(data[RTjpeg_ZZ[ci]]<-64)?-64:data[RTjpeg_ZZ[ci]];
22 } else /* compress zeros */
23 {
24 tmp=ci;
25 do
26 {
27 ci++;
28 } while((ci<64)&&(data[RTjpeg_ZZ[ci]]==0));
29 strm[co++]=(s8)(63+(ci-tmp));
30 ci--;
31 }
32 return (int)co;
33 }