From 76596deaf1c90f107d43542bf60c9bad1a7ffd68 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Tue, 21 Oct 2008 16:05:46 +0000 Subject: Move the monolithic jpeg viewer into its own subdirectory and split it into three (for now - maybe it should be split further) files - jpeg.c (the main plugin/viewer parts), jpeg_decoder.c (the actual decoder) and. for colour targets only, yuv2rgb.c. The intention of this commit is as a first step towards abstracting this viewer into a reusable jpeg decoder and a multi-format image viewer. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18853 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/jpeg/jpeg_decoder.h | 142 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 apps/plugins/jpeg/jpeg_decoder.h (limited to 'apps/plugins/jpeg/jpeg_decoder.h') diff --git a/apps/plugins/jpeg/jpeg_decoder.h b/apps/plugins/jpeg/jpeg_decoder.h new file mode 100644 index 0000000..f4dbeaa --- /dev/null +++ b/apps/plugins/jpeg/jpeg_decoder.h @@ -0,0 +1,142 @@ +/*************************************************************************** +* __________ __ ___. +* Open \______ \ ____ ____ | | _\_ |__ _______ ___ +* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +* \/ \/ \/ \/ \/ +* $Id$ +* +* JPEG image viewer +* (This is a real mess if it has to be coded in one single C file) +* +* File scrolling addition (C) 2005 Alexander Spyridakis +* Copyright (C) 2004 Jörg Hohensohn aka [IDC]Dragon +* Heavily borrowed from the IJG implementation (C) Thomas G. Lane +* Small & fast downscaling IDCT (C) 2002 by Guido Vollbeding JPEGclub.org +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +* KIND, either express or implied. +* +****************************************************************************/ + +#ifndef _JPEG_JPEG_DECODER_H +#define _JPEG_JPEG_DECODER_H + +#define HUFF_LOOKAHEAD 8 /* # of bits of lookahead */ + +struct derived_tbl +{ + /* Basic tables: (element [0] of each array is unused) */ + long mincode[17]; /* smallest code of length k */ + long maxcode[18]; /* largest code of length k (-1 if none) */ + /* (maxcode[17] is a sentinel to ensure huff_DECODE terminates) */ + int valptr[17]; /* huffval[] index of 1st symbol of length k */ + + /* Back link to public Huffman table (needed only in slow_DECODE) */ + int* pub; + + /* Lookahead tables: indexed by the next HUFF_LOOKAHEAD bits of + the input data stream. If the next Huffman code is no more + than HUFF_LOOKAHEAD bits long, we can obtain its length and + the corresponding symbol directly from these tables. */ + int look_nbits[1<