File: RTb2s.c

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 (33 lines) | stat: -rw-r--r-- 782 bytes parent folder | download | duplicates (7)
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
int RTjpeg_b2s(s16 *data, s8 *strm, u8 bt8)
{
 int ci=1, co=1, tmp;

 strm[0]=(u8)(data[RTjpeg_ZZ[0]]>254) ? 254:((data[RTjpeg_ZZ[0]]<0)?0:data[RTjpeg_ZZ[0]]);
 
 for(ci=1; ci<=bt8; ci++)
  if(data[RTjpeg_ZZ[ci]]>0)
  {
   strm[co++]=(s8)(data[RTjpeg_ZZ[ci]]>127)?127:data[RTjpeg_ZZ[ci]];
  } else
  {
   strm[co++]=(s8)(data[RTjpeg_ZZ[ci]]<-128)?-128:data[RTjpeg_ZZ[ci]];
  }
 for(; ci<64; ci++)
  if(data[RTjpeg_ZZ[ci]]>0)
  {
   strm[co++]=(s8)(data[RTjpeg_ZZ[ci]]>63)?63:data[RTjpeg_ZZ[ci]];
  } else if(data[RTjpeg_ZZ[ci]]<0)
  {
   strm[co++]=(s8)(data[RTjpeg_ZZ[ci]]<-64)?-64:data[RTjpeg_ZZ[ci]];
  } else /* compress zeros */
  {
   tmp=ci;
   do
   {
    ci++;
   } while((ci<64)&&(data[RTjpeg_ZZ[ci]]==0));
   strm[co++]=(s8)(63+(ci-tmp));
   ci--;
  }
 return (int)co;
}