#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"
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 dec_huffac (dhuff + 2) | 
| #define dec_huffdc (dhuff + 0) | 
| #define FOUR_TWO_TWO 2 | 
| typedef void(* ftopict)(int *out, unsigned char *pic, int width) | 
| 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 int dec_rec2 __P | ( | (struct in *, struct dec_hufftbl *, int *, int, int) | ) |  [static] | 
| static int dec_checkmarker | ( | void | ) |  [static] | 
| static void dec_initscans | ( | void | ) |  [static] | 
| static void dec_makehuff | ( | struct dec_hufftbl * | hu, | 
| int * | hufflen, | ||
| unsigned char * | huffvals | ||
| ) |  [static] | 
| static int dec_readmarker | ( | struct in * | in | ) |  [static] | 
| static int dec_rec2 | ( | struct in * | in, | 
| struct dec_hufftbl * | hu, | ||
| int * | runp, | ||
| int | c, | ||
| int | i | ||
| ) |  [static] | 
| static void decode_mcus | ( | struct in * | in, | 
| int * | dct, | ||
| int | n, | ||
| struct scan * | sc, | ||
| int * | maxp | ||
| ) |  [static] | 
| int get_picture | ( | unsigned char * | buf, | 
| int | size | ||
| ) | 
| int get_pictureYV2 | ( | unsigned char * | buf, | 
| int | width, | ||
| int | height | ||
| ) | 
| static void getPictureName | ( | char * | Picture, | 
| int | fmt | ||
| ) |  [static] | 
| static int huffman_init | ( | void | ) |  [static] | 
| static void idct | ( | int * | in, | 
| int * | out, | ||
| int * | quant, | ||
| long | off, | ||
| int | max | ||
| ) |  [inline, static] | 
| 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] | 
| static void yuv400pto422 | ( | int * | out, | 
| unsigned char * | pic, | ||
| int | width | ||
| ) |  [static] | 
| static void yuv420pto422 | ( | int * | out, | 
| unsigned char * | pic, | ||
| int | width | ||
| ) |  [static] | 
| static void yuv422pto422 | ( | int * | out, | 
| unsigned char * | pic, | ||
| int | width | ||
| ) |  [static] | 
| static void yuv444pto422 | ( | int * | out, | 
| unsigned char * | pic, | ||
| int | width | ||
| ) |  [static] | 
| struct dec_hufftbl dhuff[4]  [static] | 
| unsigned char zig[64]  [static] | 
 {
    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
}
| unsigned char zig2[64]  [static] | 
 {
    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
}