os/ossrv/genericopenlibs/liboil/tsrc/examples/jpeg/inc/jpeg_internal.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 
    18 #ifndef _JPEG_INTERNAL_H_
    19 #define _JPEG_INTERNAL_H_
    20 
    21 #include "jpeg.h"
    22 #include "jpeg_huffman.h"
    23 #include "jpeg_bits.h"
    24 #include "jpeg_debug.h"
    25 
    26 #ifndef TRUE
    27 #define TRUE 1
    28 #endif
    29 #ifndef FALSE
    30 #define FALSE 0
    31 #endif
    32 
    33 
    34 #define JPEG_MAX_COMPONENTS 256
    35 
    36 typedef struct _JpegScan JpegScan;
    37 typedef struct _JpegQuantTable JpegQuantTable;
    38 
    39 #define JPEG_ENTROPY_SEGMENT 0x0001
    40 #define JPEG_LENGTH 0x0002
    41 
    42 struct _JpegQuantTable {
    43   int pq;
    44   int16_t quantizer[64];
    45 };
    46 
    47 struct _JpegDecoder {
    48 	int width;
    49 	int height;
    50 	int depth;
    51 	int n_components;
    52 	JpegBits bits;
    53         int error;
    54         char *error_message;
    55 
    56         int sof_type;
    57 
    58 	int width_blocks;
    59 	int height_blocks;
    60 
    61 	int restart_interval;
    62 
    63 	unsigned char *data;
    64 	unsigned int data_len;
    65 
    66 	struct{
    67 		int id;
    68 		int h_sample;
    69 		int v_sample;
    70 		int quant_table;
    71 
    72 		int h_subsample;
    73 		int v_subsample;
    74 		unsigned char *image;
    75 		int rowstride;
    76 	} components[JPEG_MAX_COMPONENTS];
    77 
    78         JpegQuantTable quant_tables[4];
    79 	HuffmanTable dc_huff_table[4];
    80 	HuffmanTable ac_huff_table[4];
    81 
    82 	int scan_list_length;
    83 	struct{
    84 		int component_index;
    85 		int dc_table;
    86 		int ac_table;
    87 		int quant_table;
    88 		int x;
    89 		int y;
    90 		int offset;
    91 	}scan_list[10];
    92 	int scan_h_subsample;
    93 	int scan_v_subsample;
    94 
    95 	/* scan state */
    96 	int x,y;
    97 	int dc[4];
    98 };
    99 
   100 struct _JpegScan {
   101 	int length;
   102 	
   103 	int n_components;
   104 	struct {
   105 		int index;
   106 		int dc_table;
   107 		int ac_table;
   108 	}block_list[10];
   109 };
   110 
   111 
   112 /* jpeg.c */
   113 
   114 int jpeg_decoder_sof_baseline_dct(JpegDecoder *dec, JpegBits *bits);
   115 int jpeg_decoder_define_quant_table(JpegDecoder *dec, JpegBits *bits);
   116 int jpeg_decoder_define_huffman_table(JpegDecoder *dec, JpegBits *bits);
   117 int jpeg_decoder_sos(JpegDecoder *dec, JpegBits *bits);
   118 int jpeg_decoder_soi(JpegDecoder *dec, JpegBits *bits);
   119 int jpeg_decoder_eoi(JpegDecoder *dec, JpegBits *bits);
   120 int jpeg_decoder_application0(JpegDecoder *dec, JpegBits *bits);
   121 int jpeg_decoder_application_misc(JpegDecoder *dec, JpegBits *bits);
   122 int jpeg_decoder_comment(JpegDecoder *dec, JpegBits *bits);
   123 int jpeg_decoder_restart_interval(JpegDecoder *dec, JpegBits *bits);
   124 int jpeg_decoder_restart(JpegDecoder *dec, JpegBits *bits);
   125 void jpeg_decoder_decode_entropy_segment(JpegDecoder *dec);
   126 
   127 
   128 #endif
   129 
   130