Classes | Defines | Typedefs | Functions | Variables
utils.c File Reference
#include "luvcview/utils.h"
#include "luvcview/color.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <linux/types.h>
#include <string.h>
#include <fcntl.h>
#include <wait.h>
#include <time.h>
#include <limits.h>
#include "luvcview/huffman.h"
Include dependency graph for utils.c:

Go to the source code of this file.

Classes

struct  comp
struct  dec_hufftbl
union  hufftblp
struct  in
struct  jpeg_decdata
struct  jpginfo
struct  scan

Defines

#define __P(x)   x
#define C22   ((PREC)IFIX(2 * 0.923879532))
#define dec_huffac   (dhuff + 2)
#define dec_huffdc   (dhuff + 0)
#define DEC_REC(in, hu, r, i)
#define DECBITS   10 /* seems to be the optimum */
#define FOUR_TWO_TWO   2
#define GETBITS(in, n)
#define IC4   ((PREC)IFIX(1 / 0.707106781))
#define IFIX(a)   ((int)((a) * (1 << ISHIFT) + .5))
#define IMULT(a, b)   (((a) * (b)) >> ISHIFT)
#define ISHIFT   11
#define ITOINT(a)   ((a) >> ISHIFT)
#define LEBI_DCL   int le, bi
#define LEBI_GET(in)   (le = in->left, bi = in->bits)
#define LEBI_PUT(in)   (in->left = le, in->bits = bi)
#define M_APP0   0xe0
#define M_BADHUFF   -1
#define M_COM   0xfe
#define M_DHT   0xc4
#define M_DQT   0xdb
#define M_DRI   0xdd
#define M_EOF   0x80
#define M_EOI   0xd9
#define M_RST0   0xd0
#define M_SOF0   0xc0
#define M_SOI   0xd8
#define M_SOS   0xda
#define MAXCOMP   4
#define PREC   int
#define S22   ((PREC)IFIX(2 * 0.382683432))
#define UNGETBITS(in, n)

Typedefs

typedef void(* ftopict )(int *out, unsigned char *pic, int width)

Functions

static void decode_mcus __P ((struct in *, int *, int, struct scan *, int *))
static int dec_readmarker __P ((struct in *))
static void dec_makehuff __P ((struct dec_hufftbl *, int *, unsigned char *))
static void setinput __P ((struct in *, unsigned char *))
static void idctqtab __P ((unsigned char *, PREC *))
static int fillbits __P ((struct in *, int, unsigned int))
static int dec_rec2 __P ((struct in *, struct dec_hufftbl *, int *, int, int))
static int dec_checkmarker (void)
static void dec_initscans (void)
static void dec_makehuff (struct dec_hufftbl *hu, int *hufflen, unsigned char *huffvals)
static int dec_readmarker (struct in *in)
static int dec_rec2 (struct in *in, struct dec_hufftbl *hu, int *runp, int c, int i)
static void decode_mcus (struct in *in, int *dct, int n, struct scan *sc, int *maxp)
static int fillbits (struct in *in, int le, unsigned int bi)
int get_picture (unsigned char *buf, int size)
int get_pictureYV2 (unsigned char *buf, int width, int height)
static int getbyte (void)
static void getPictureName (char *Picture, int fmt)
static int getword (void)
static int huffman_init (void)
static void idct (int *in, int *out, int *quant, long off, int max)
static void idctqtab (unsigned char *qin, PREC *qout)
int is_huffman (unsigned char *buf)
int jpeg_decode (unsigned char **pic, unsigned char *buf, int *width, int *height)
void Pyuv422tobgr24 (unsigned char *input_ptr, unsigned char *output_ptr, unsigned int image_width, unsigned int image_height)
unsigned int Pyuv422togray8 (unsigned char *input_ptr, unsigned char *output_ptr, unsigned int image_width, unsigned int image_height)
unsigned int Pyuv422torgb24 (unsigned char *input_ptr, unsigned char *output_ptr, unsigned int image_width, unsigned int image_height)
static int readtables (int till, int *isDHT)
static void setinput (struct in *in, unsigned char *p)
static void yuv400pto422 (int *out, unsigned char *pic, int width)
static void yuv420pto422 (int *out, unsigned char *pic, int width)
static void yuv422pto422 (int *out, unsigned char *pic, int width)
static void yuv444pto422 (int *out, unsigned char *pic, int width)

Variables

static PREC aaidct [8]
static struct comp comps [MAXCOMP]
static unsigned char * datap
static struct dec_hufftbl dhuff [4]
static struct scan dscans [MAXCOMP]
static struct in in
static struct jpginfo info
static unsigned char quant [4][64]
static unsigned char zig [64]
static unsigned char zig2 [64]

Define Documentation

#define __P (   x)    x

Definition at line 42 of file utils.c.

#define C22   ((PREC)IFIX(2 * 0.923879532))

Definition at line 802 of file utils.c.

#define dec_huffac   (dhuff + 2)

Definition at line 174 of file utils.c.

#define dec_huffdc   (dhuff + 0)

Definition at line 173 of file utils.c.

#define DEC_REC (   in,
  hu,
  r,
  i 
)
Value:
(       \
  r = GETBITS(in, DECBITS),             \
  i = hu->llvals[r],                    \
  i & 128 ?                             \
    (                                   \
      UNGETBITS(in, i & 127),           \
      r = i >> 8 & 15,                  \
      i >> 16                           \
    )                                   \
  :                                     \
    (                                   \
      LEBI_PUT(in),                     \
      i = dec_rec2(in, hu, &r, r, i),   \
      LEBI_GET(in),                     \
      i                                 \
    )                                   \
)

Definition at line 690 of file utils.c.

#define DECBITS   10 /* seems to be the optimum */

Definition at line 87 of file utils.c.

#define FOUR_TWO_TWO   2

Definition at line 962 of file utils.c.

#define GETBITS (   in,
 
)
Value:
(                                       \
  (le < (n) ? le = fillbits(in, le, bi), bi = in->bits : 0),    \
  (le -= (n)),                                                  \
  bi >> le & ((1 << (n)) - 1)                                   \
)

Definition at line 643 of file utils.c.

#define IC4   ((PREC)IFIX(1 / 0.707106781))

Definition at line 803 of file utils.c.

#define IFIX (   a)    ((int)((a) * (1 << ISHIFT) + .5))

Definition at line 39 of file utils.c.

#define IMULT (   a,
 
)    (((a) * (b)) >> ISHIFT)

Definition at line 798 of file utils.c.

#define ISHIFT   11

Definition at line 37 of file utils.c.

#define ITOINT (   a)    ((a) >> ISHIFT)

Definition at line 799 of file utils.c.

#define LEBI_DCL   int le, bi

Definition at line 639 of file utils.c.

#define LEBI_GET (   in)    (le = in->left, bi = in->bits)

Definition at line 640 of file utils.c.

#define LEBI_PUT (   in)    (in->left = le, in->bits = bi)

Definition at line 641 of file utils.c.

#define M_APP0   0xe0

Definition at line 124 of file utils.c.

#define M_BADHUFF   -1

Definition at line 46 of file utils.c.

#define M_COM   0xfe

Definition at line 132 of file utils.c.

#define M_DHT   0xc4

Definition at line 127 of file utils.c.

#define M_DQT   0xdb

Definition at line 125 of file utils.c.

#define M_DRI   0xdd

Definition at line 128 of file utils.c.

#define M_EOF   0x80

Definition at line 47 of file utils.c.

#define M_EOI   0xd9

Definition at line 131 of file utils.c.

#define M_RST0   0xd0

Definition at line 130 of file utils.c.

#define M_SOF0   0xc0

Definition at line 126 of file utils.c.

#define M_SOI   0xd8

Definition at line 123 of file utils.c.

#define M_SOS   0xda

Definition at line 129 of file utils.c.

#define MAXCOMP   4

Definition at line 155 of file utils.c.

#define PREC   int

Definition at line 106 of file utils.c.

#define S22   ((PREC)IFIX(2 * 0.382683432))

Definition at line 801 of file utils.c.

#define UNGETBITS (   in,
 
)
Value:
(       \
  le += (n)                     \
)

Definition at line 649 of file utils.c.


Typedef Documentation

typedef void(* ftopict)(int *out, unsigned char *pic, int width)

Definition at line 120 of file utils.c.


Function Documentation

static void decode_mcus __P ( (struct in *, int *, int, struct scan *, int *)  ) [static]
static int dec_readmarker __P ( (struct in *)  ) [static]
static void dec_makehuff __P ( (struct dec_hufftbl *, int *, unsigned char *)  ) [static]
static void setinput __P ( (struct in *, unsigned char *)  ) [static]
static void idctqtab __P ( (unsigned char *, PREC *)  ) [static]
static int fillbits __P ( (struct in *, int, unsigned int)  ) [static]
static int dec_rec2 __P ( (struct in *, struct dec_hufftbl *, int *, int, int)  ) [static]
static int dec_checkmarker ( void  ) [static]

Definition at line 268 of file utils.c.

static void dec_initscans ( void  ) [static]

Definition at line 258 of file utils.c.

static void dec_makehuff ( struct dec_hufftbl hu,
int *  hufflen,
unsigned char *  huffvals 
) [static]

Definition at line 744 of file utils.c.

static int dec_readmarker ( struct in in) [static]

Definition at line 626 of file utils.c.

static int dec_rec2 ( struct in in,
struct dec_hufftbl hu,
int *  runp,
int  c,
int  i 
) [static]

Definition at line 654 of file utils.c.

static void decode_mcus ( struct in in,
int *  dct,
int  n,
struct scan sc,
int *  maxp 
) [static]

Definition at line 708 of file utils.c.

static int fillbits ( struct in in,
int  le,
unsigned int  bi 
) [static]

Definition at line 595 of file utils.c.

int get_picture ( unsigned char *  buf,
int  size 
)

Definition at line 1254 of file utils.c.

int get_pictureYV2 ( unsigned char *  buf,
int  width,
int  height 
)

Definition at line 1285 of file utils.c.

static int getbyte ( void  ) [static]

Definition at line 136 of file utils.c.

static void getPictureName ( char *  Picture,
int  fmt 
) [static]

Definition at line 1237 of file utils.c.

static int getword ( void  ) [static]

Definition at line 141 of file utils.c.

static int huffman_init ( void  ) [static]

Definition at line 552 of file utils.c.

static void idct ( int *  in,
int *  out,
int *  quant,
long  off,
int  max 
) [inline, static]

Definition at line 816 of file utils.c.

static void idctqtab ( unsigned char *  qin,
PREC qout 
) [static]

Definition at line 1208 of file utils.c.

int is_huffman ( unsigned char *  buf)

Definition at line 1222 of file utils.c.

int jpeg_decode ( unsigned char **  pic,
unsigned char *  buf,
int *  width,
int *  height 
)

Definition at line 282 of file utils.c.

void Pyuv422tobgr24 ( unsigned char *  input_ptr,
unsigned char *  output_ptr,
unsigned int  image_width,
unsigned int  image_height 
)

Definition at line 1008 of file utils.c.

unsigned int Pyuv422togray8 ( unsigned char *  input_ptr,
unsigned char *  output_ptr,
unsigned int  image_width,
unsigned int  image_height 
)

Definition at line 968 of file utils.c.

unsigned int Pyuv422torgb24 ( unsigned char *  input_ptr,
unsigned char *  output_ptr,
unsigned int  image_width,
unsigned int  image_height 
)

Definition at line 982 of file utils.c.

static int readtables ( int  till,
int *  isDHT 
) [static]

Definition at line 178 of file utils.c.

static void setinput ( struct in in,
unsigned char *  p 
) [static]

Definition at line 585 of file utils.c.

static void yuv400pto422 ( int *  out,
unsigned char *  pic,
int  width 
) [static]

Definition at line 1158 of file utils.c.

static void yuv420pto422 ( int *  out,
unsigned char *  pic,
int  width 
) [static]

Definition at line 1032 of file utils.c.

static void yuv422pto422 ( int *  out,
unsigned char *  pic,
int  width 
) [static]

Definition at line 1075 of file utils.c.

static void yuv444pto422 ( int *  out,
unsigned char *  pic,
int  width 
) [static]

Definition at line 1120 of file utils.c.


Variable Documentation

PREC aaidct[8] [static]
Initial value:
 {
    IFIX(0.3535533906), IFIX(0.4903926402),
    IFIX(0.4619397663), IFIX(0.4157348062),
    IFIX(0.3535533906), IFIX(0.2777851165),
    IFIX(0.1913417162), IFIX(0.0975451610)
}

Definition at line 1200 of file utils.c.

struct comp comps[MAXCOMP] [static]

Definition at line 165 of file utils.c.

unsigned char* datap [static]

Definition at line 134 of file utils.c.

struct dec_hufftbl dhuff[4] [static]

Definition at line 171 of file utils.c.

struct scan dscans[MAXCOMP] [static]

Definition at line 167 of file utils.c.

struct in in [static]

Definition at line 176 of file utils.c.

struct jpginfo info [static]

Definition at line 164 of file utils.c.

unsigned char quant[4][64] [static]

Definition at line 169 of file utils.c.

unsigned char zig[64] [static]
Initial value:
 {
    0, 1, 5, 6, 14, 15, 27, 28,
    2, 4, 7, 13, 16, 26, 29, 42,
    3, 8, 12, 17, 25, 30, 41, 43,
    9, 11, 18, 24, 31, 40, 44, 53,
    10, 19, 23, 32, 39, 45, 52, 54,
    20, 22, 33, 38, 46, 51, 55, 60,
    21, 34, 37, 47, 50, 56, 59, 61,
    35, 36, 48, 49, 57, 58, 62, 63
}

Definition at line 1189 of file utils.c.

unsigned char zig2[64] [static]
Initial value:
 {
    0, 2, 3, 9, 10, 20, 21, 35,
    14, 16, 25, 31, 39, 46, 50, 57,
    5, 7, 12, 18, 23, 33, 37, 48,
    27, 29, 41, 44, 52, 55, 59, 62,
    15, 26, 30, 40, 45, 51, 56, 58,
    1, 4, 8, 11, 19, 22, 34, 36,
    28, 42, 43, 53, 54, 60, 61, 63,
    6, 13, 17, 24, 32, 38, 47, 49
}

Definition at line 805 of file utils.c.



v4r_uvc
Author(s):
autogenerated on Wed Aug 26 2015 16:41:35