forked from len0rd/rockbox
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
This commit is contained in:
parent
b0b3f0339a
commit
76596deaf1
11 changed files with 3706 additions and 3436 deletions
|
@ -24,11 +24,6 @@ viewer.c
|
|||
lamp.c
|
||||
#endif /* HAVE_BACKLIGHT */
|
||||
|
||||
#ifdef OLYMPUS_MROBE_500
|
||||
/* remove these once the plugins before it are compileable */
|
||||
jpeg.c
|
||||
#endif
|
||||
|
||||
#ifndef OLYMPUS_MROBE_500
|
||||
|
||||
#if (CONFIG_CODEC == SWCODEC) || !defined(SIMULATOR)
|
||||
|
@ -62,7 +57,6 @@ ppmviewer.c
|
|||
|
||||
/* Plugins needing the grayscale lib on low-depth LCDs */
|
||||
fire.c
|
||||
jpeg.c
|
||||
mandelbrot.c
|
||||
plasma.c
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ rockboy
|
|||
/* For all targets with a bitmap display */
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
chessbox
|
||||
jpeg
|
||||
sudoku
|
||||
reversi
|
||||
#ifndef OLYMPUS_MROBE_500
|
||||
|
|
3430
apps/plugins/jpeg.c
3430
apps/plugins/jpeg.c
File diff suppressed because it is too large
Load diff
75
apps/plugins/jpeg/Makefile
Normal file
75
apps/plugins/jpeg/Makefile
Normal file
|
@ -0,0 +1,75 @@
|
|||
# __________ __ ___.
|
||||
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
# \/ \/ \/ \/ \/
|
||||
# $Id$
|
||||
#
|
||||
|
||||
INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
|
||||
-I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) \
|
||||
-I$(BUILDDIR)/pluginbitmaps -I$(APPSDIR)/plugins/lib
|
||||
CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(EXTRA_DEFINES) \
|
||||
-DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
|
||||
|
||||
ifdef APPEXTRA
|
||||
INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
|
||||
endif
|
||||
|
||||
LINKFILE := $(OBJDIR)/link.lds
|
||||
DEPFILE = $(OBJDIR)/dep-jpeg
|
||||
|
||||
# This sets up 'SRC' based on the files mentioned in SOURCES
|
||||
include $(TOOLSDIR)/makesrc.inc
|
||||
|
||||
SOURCES = $(SRC)
|
||||
OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
|
||||
DIRS = .
|
||||
|
||||
ifndef SIMVER
|
||||
LDS := ../plugin.lds
|
||||
OUTPUT = $(OUTDIR)/jpeg.rock
|
||||
else ## simulators
|
||||
OUTPUT = $(OUTDIR)/jpeg.rock
|
||||
endif
|
||||
|
||||
all: $(OUTPUT)
|
||||
|
||||
ifndef SIMVER
|
||||
$(OBJDIR)/jpeg.elf: $(OBJS) $(LINKFILE) $(BITMAPLIBS)
|
||||
$(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \
|
||||
$(LINKBITMAPS) -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/jpeg.map
|
||||
|
||||
$(OUTPUT): $(OBJDIR)/jpeg.elf
|
||||
$(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
|
||||
else
|
||||
###################################################
|
||||
# This is the SDL simulator version
|
||||
|
||||
$(OUTPUT): $(OBJS)
|
||||
$(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
|
||||
ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
|
||||
# 'x' must be kept or you'll have "Win32 error 5"
|
||||
# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
|
||||
# #define ERROR_ACCESS_DENIED 5L
|
||||
else
|
||||
@chmod -x $@
|
||||
endif
|
||||
|
||||
endif # end of simulator section
|
||||
|
||||
|
||||
include $(TOOLSDIR)/make.inc
|
||||
|
||||
# MEMORYSIZE should be passed on to this makefile with the chosen memory size
|
||||
# given in number of MB
|
||||
$(LINKFILE): $(LDS)
|
||||
$(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
|
||||
$(DEFINES) -E -P - >$@
|
||||
|
||||
clean:
|
||||
$(call PRINTS,cleaning jpeg)rm -rf $(OBJDIR)/jpeg
|
||||
$(SILENT)rm -f $(OBJDIR)/jpeg.* $(DEPFILE)
|
||||
|
||||
-include $(DEPFILE)
|
5
apps/plugins/jpeg/SOURCES
Normal file
5
apps/plugins/jpeg/SOURCES
Normal file
|
@ -0,0 +1,5 @@
|
|||
jpeg.c
|
||||
jpeg_decoder.c
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
yuv2rgb.c
|
||||
#endif
|
1235
apps/plugins/jpeg/jpeg.c
Normal file
1235
apps/plugins/jpeg/jpeg.c
Normal file
File diff suppressed because it is too large
Load diff
256
apps/plugins/jpeg/jpeg.h
Normal file
256
apps/plugins/jpeg/jpeg.h
Normal file
|
@ -0,0 +1,256 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* 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_H
|
||||
#define _JPEG_JPEG_H
|
||||
|
||||
#include "plugin.h"
|
||||
|
||||
/* variable button definitions */
|
||||
#if CONFIG_KEYPAD == RECORDER_PAD
|
||||
#define JPEG_ZOOM_IN BUTTON_PLAY
|
||||
#define JPEG_ZOOM_OUT BUTTON_ON
|
||||
#define JPEG_UP BUTTON_UP
|
||||
#define JPEG_DOWN BUTTON_DOWN
|
||||
#define JPEG_LEFT BUTTON_LEFT
|
||||
#define JPEG_RIGHT BUTTON_RIGHT
|
||||
#define JPEG_NEXT BUTTON_F3
|
||||
#define JPEG_PREVIOUS BUTTON_F2
|
||||
#define JPEG_MENU BUTTON_OFF
|
||||
|
||||
#elif CONFIG_KEYPAD == ARCHOS_AV300_PAD
|
||||
#define JPEG_ZOOM_IN BUTTON_SELECT
|
||||
#define JPEG_ZOOM_OUT BUTTON_ON
|
||||
#define JPEG_UP BUTTON_UP
|
||||
#define JPEG_DOWN BUTTON_DOWN
|
||||
#define JPEG_LEFT BUTTON_LEFT
|
||||
#define JPEG_RIGHT BUTTON_RIGHT
|
||||
#define JPEG_NEXT BUTTON_F3
|
||||
#define JPEG_PREVIOUS BUTTON_F2
|
||||
#define JPEG_MENU BUTTON_OFF
|
||||
|
||||
#elif CONFIG_KEYPAD == ONDIO_PAD
|
||||
#define JPEG_ZOOM_PRE BUTTON_MENU
|
||||
#define JPEG_ZOOM_IN (BUTTON_MENU | BUTTON_REL)
|
||||
#define JPEG_ZOOM_OUT (BUTTON_MENU | BUTTON_DOWN)
|
||||
#define JPEG_UP BUTTON_UP
|
||||
#define JPEG_DOWN BUTTON_DOWN
|
||||
#define JPEG_LEFT BUTTON_LEFT
|
||||
#define JPEG_RIGHT BUTTON_RIGHT
|
||||
#define JPEG_NEXT (BUTTON_MENU | BUTTON_RIGHT)
|
||||
#define JPEG_PREVIOUS (BUTTON_MENU | BUTTON_LEFT)
|
||||
#define JPEG_MENU BUTTON_OFF
|
||||
|
||||
#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
|
||||
(CONFIG_KEYPAD == IRIVER_H300_PAD)
|
||||
#define JPEG_ZOOM_IN BUTTON_SELECT
|
||||
#define JPEG_ZOOM_OUT BUTTON_MODE
|
||||
#define JPEG_UP BUTTON_UP
|
||||
#define JPEG_DOWN BUTTON_DOWN
|
||||
#define JPEG_LEFT BUTTON_LEFT
|
||||
#define JPEG_RIGHT BUTTON_RIGHT
|
||||
#if (CONFIG_KEYPAD == IRIVER_H100_PAD)
|
||||
#define JPEG_NEXT BUTTON_ON
|
||||
#define JPEG_PREVIOUS BUTTON_REC
|
||||
#else
|
||||
#define JPEG_NEXT BUTTON_REC
|
||||
#define JPEG_PREVIOUS BUTTON_ON
|
||||
#endif
|
||||
#define JPEG_MENU BUTTON_OFF
|
||||
#define JPEG_RC_MENU BUTTON_RC_STOP
|
||||
|
||||
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \
|
||||
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
|
||||
#define JPEG_ZOOM_IN BUTTON_SCROLL_FWD
|
||||
#define JPEG_ZOOM_OUT BUTTON_SCROLL_BACK
|
||||
#define JPEG_UP BUTTON_MENU
|
||||
#define JPEG_DOWN BUTTON_PLAY
|
||||
#define JPEG_LEFT BUTTON_LEFT
|
||||
#define JPEG_RIGHT BUTTON_RIGHT
|
||||
#define JPEG_MENU (BUTTON_SELECT | BUTTON_MENU)
|
||||
#define JPEG_NEXT (BUTTON_SELECT | BUTTON_RIGHT)
|
||||
#define JPEG_PREVIOUS (BUTTON_SELECT | BUTTON_LEFT)
|
||||
|
||||
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
|
||||
#define JPEG_ZOOM_PRE BUTTON_SELECT
|
||||
#define JPEG_ZOOM_IN (BUTTON_SELECT | BUTTON_REL)
|
||||
#define JPEG_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT)
|
||||
#define JPEG_UP BUTTON_UP
|
||||
#define JPEG_DOWN BUTTON_DOWN
|
||||
#define JPEG_LEFT BUTTON_LEFT
|
||||
#define JPEG_RIGHT BUTTON_RIGHT
|
||||
#define JPEG_MENU BUTTON_POWER
|
||||
#define JPEG_NEXT BUTTON_PLAY
|
||||
#define JPEG_PREVIOUS BUTTON_REC
|
||||
|
||||
#elif CONFIG_KEYPAD == GIGABEAT_PAD
|
||||
#define JPEG_ZOOM_IN BUTTON_VOL_UP
|
||||
#define JPEG_ZOOM_OUT BUTTON_VOL_DOWN
|
||||
#define JPEG_UP BUTTON_UP
|
||||
#define JPEG_DOWN BUTTON_DOWN
|
||||
#define JPEG_LEFT BUTTON_LEFT
|
||||
#define JPEG_RIGHT BUTTON_RIGHT
|
||||
#define JPEG_MENU BUTTON_MENU
|
||||
#define JPEG_NEXT (BUTTON_A | BUTTON_RIGHT)
|
||||
#define JPEG_PREVIOUS (BUTTON_A | BUTTON_LEFT)
|
||||
|
||||
#elif CONFIG_KEYPAD == SANSA_E200_PAD
|
||||
#define JPEG_ZOOM_PRE BUTTON_SELECT
|
||||
#define JPEG_ZOOM_IN (BUTTON_SELECT | BUTTON_REL)
|
||||
#define JPEG_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT)
|
||||
#define JPEG_UP BUTTON_UP
|
||||
#define JPEG_DOWN BUTTON_DOWN
|
||||
#define JPEG_LEFT BUTTON_LEFT
|
||||
#define JPEG_RIGHT BUTTON_RIGHT
|
||||
#define JPEG_MENU BUTTON_POWER
|
||||
#define JPEG_SLIDE_SHOW BUTTON_REC
|
||||
#define JPEG_NEXT BUTTON_SCROLL_FWD
|
||||
#define JPEG_NEXT_REPEAT (BUTTON_SCROLL_FWD|BUTTON_REPEAT)
|
||||
#define JPEG_PREVIOUS BUTTON_SCROLL_BACK
|
||||
#define JPEG_PREVIOUS_REPEAT (BUTTON_SCROLL_BACK|BUTTON_REPEAT)
|
||||
|
||||
#elif CONFIG_KEYPAD == SANSA_C200_PAD
|
||||
#define JPEG_ZOOM_PRE BUTTON_SELECT
|
||||
#define JPEG_ZOOM_IN (BUTTON_SELECT | BUTTON_REL)
|
||||
#define JPEG_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT)
|
||||
#define JPEG_UP BUTTON_UP
|
||||
#define JPEG_DOWN BUTTON_DOWN
|
||||
#define JPEG_LEFT BUTTON_LEFT
|
||||
#define JPEG_RIGHT BUTTON_RIGHT
|
||||
#define JPEG_MENU BUTTON_POWER
|
||||
#define JPEG_SLIDE_SHOW BUTTON_REC
|
||||
#define JPEG_NEXT BUTTON_VOL_UP
|
||||
#define JPEG_NEXT_REPEAT (BUTTON_VOL_UP|BUTTON_REPEAT)
|
||||
#define JPEG_PREVIOUS BUTTON_VOL_DOWN
|
||||
#define JPEG_PREVIOUS_REPEAT (BUTTON_VOL_DOWN|BUTTON_REPEAT)
|
||||
|
||||
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
|
||||
#define JPEG_ZOOM_PRE BUTTON_PLAY
|
||||
#define JPEG_ZOOM_IN (BUTTON_PLAY | BUTTON_REL)
|
||||
#define JPEG_ZOOM_OUT (BUTTON_PLAY | BUTTON_REPEAT)
|
||||
#define JPEG_UP BUTTON_SCROLL_UP
|
||||
#define JPEG_DOWN BUTTON_SCROLL_DOWN
|
||||
#define JPEG_LEFT BUTTON_LEFT
|
||||
#define JPEG_RIGHT BUTTON_RIGHT
|
||||
#define JPEG_MENU BUTTON_POWER
|
||||
#define JPEG_NEXT BUTTON_FF
|
||||
#define JPEG_PREVIOUS BUTTON_REW
|
||||
|
||||
#elif CONFIG_KEYPAD == MROBE500_PAD
|
||||
#define JPEG_ZOOM_IN BUTTON_RC_VOL_UP
|
||||
#define JPEG_ZOOM_OUT BUTTON_RC_VOL_DOWN
|
||||
#define JPEG_UP BUTTON_RC_PLAY
|
||||
#define JPEG_DOWN BUTTON_RC_DOWN
|
||||
#define JPEG_LEFT BUTTON_LEFT
|
||||
#define JPEG_RIGHT BUTTON_RIGHT
|
||||
#define JPEG_MENU BUTTON_POWER
|
||||
#define JPEG_NEXT BUTTON_RC_HEART
|
||||
#define JPEG_PREVIOUS BUTTON_RC_MODE
|
||||
|
||||
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD
|
||||
#define JPEG_ZOOM_IN BUTTON_VOL_UP
|
||||
#define JPEG_ZOOM_OUT BUTTON_VOL_DOWN
|
||||
#define JPEG_UP BUTTON_UP
|
||||
#define JPEG_DOWN BUTTON_DOWN
|
||||
#define JPEG_LEFT BUTTON_LEFT
|
||||
#define JPEG_RIGHT BUTTON_RIGHT
|
||||
#define JPEG_MENU BUTTON_MENU
|
||||
#define JPEG_NEXT BUTTON_NEXT
|
||||
#define JPEG_PREVIOUS BUTTON_PREV
|
||||
|
||||
#elif CONFIG_KEYPAD == MROBE100_PAD
|
||||
#define JPEG_ZOOM_IN BUTTON_SELECT
|
||||
#define JPEG_ZOOM_OUT BUTTON_PLAY
|
||||
#define JPEG_UP BUTTON_UP
|
||||
#define JPEG_DOWN BUTTON_DOWN
|
||||
#define JPEG_LEFT BUTTON_LEFT
|
||||
#define JPEG_RIGHT BUTTON_RIGHT
|
||||
#define JPEG_MENU BUTTON_MENU
|
||||
#define JPEG_NEXT (BUTTON_DISPLAY | BUTTON_RIGHT)
|
||||
#define JPEG_PREVIOUS (BUTTON_DISPLAY | BUTTON_LEFT)
|
||||
|
||||
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
|
||||
#define JPEG_ZOOM_PRE BUTTON_RC_PLAY
|
||||
#define JPEG_ZOOM_IN (BUTTON_RC_PLAY|BUTTON_REL)
|
||||
#define JPEG_ZOOM_OUT (BUTTON_RC_PLAY|BUTTON_REPEAT)
|
||||
#define JPEG_UP BUTTON_RC_VOL_UP
|
||||
#define JPEG_DOWN BUTTON_RC_VOL_DOWN
|
||||
#define JPEG_LEFT BUTTON_RC_REW
|
||||
#define JPEG_RIGHT BUTTON_RC_FF
|
||||
#define JPEG_MENU BUTTON_RC_REC
|
||||
#define JPEG_NEXT BUTTON_RC_MODE
|
||||
#define JPEG_PREVIOUS BUTTON_RC_MENU
|
||||
|
||||
#elif CONFIG_KEYPAD == COWOND2_PAD
|
||||
|
||||
#elif CONFIG_KEYPAD == IAUDIO67_PAD
|
||||
#define JPEG_ZOOM_IN BUTTON_VOLUP
|
||||
#define JPEG_ZOOM_OUT BUTTON_VOLDOWN
|
||||
#define JPEG_UP BUTTON_STOP
|
||||
#define JPEG_DOWN BUTTON_PLAY
|
||||
#define JPEG_LEFT BUTTON_LEFT
|
||||
#define JPEG_RIGHT BUTTON_RIGHT
|
||||
#define JPEG_MENU BUTTON_MENU
|
||||
#define JPEG_NEXT (BUTTON_PLAY|BUTTON_VOLUP)
|
||||
#define JPEG_PREVIOUS (BUTTON_PLAY|BUTTON_VOLDOWN)
|
||||
|
||||
#else
|
||||
#error No keymap defined!
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
#ifndef JPEG_UP
|
||||
#define JPEG_UP BUTTON_TOPMIDDLE
|
||||
#endif
|
||||
#ifndef JPEG_DOWN
|
||||
#define JPEG_DOWN BUTTON_BOTTOMMIDDLE
|
||||
#endif
|
||||
#ifndef JPEG_LEFT
|
||||
#define JPEG_LEFT BUTTON_MIDLEFT
|
||||
#endif
|
||||
#ifndef JPEG_RIGHT
|
||||
#define JPEG_RIGHT BUTTON_MIDRIGHT
|
||||
#endif
|
||||
#ifndef JPEG_ZOOM_IN
|
||||
#define JPEG_ZOOM_IN BUTTON_TOPRIGHT
|
||||
#endif
|
||||
#ifndef JPEG_ZOOM_OUT
|
||||
#define JPEG_ZOOM_OUT BUTTON_TOPLEFT
|
||||
#endif
|
||||
#ifndef JPEG_MENU
|
||||
#define JPEG_MENU (BUTTON_CENTER|BUTTON_REL)
|
||||
#endif
|
||||
#ifndef JPEG_NEXT
|
||||
#define JPEG_NEXT BUTTON_BOTTOMRIGHT
|
||||
#endif
|
||||
#ifndef JPEG_PREVIOUS
|
||||
#define JPEG_PREVIOUS BUTTON_BOTTOMLEFT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _JPEG_JPEG_H */
|
1540
apps/plugins/jpeg/jpeg_decoder.c
Normal file
1540
apps/plugins/jpeg/jpeg_decoder.c
Normal file
File diff suppressed because it is too large
Load diff
142
apps/plugins/jpeg/jpeg_decoder.h
Normal file
142
apps/plugins/jpeg/jpeg_decoder.h
Normal file
|
@ -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<<HUFF_LOOKAHEAD]; /* # bits, or 0 if too long */
|
||||
unsigned char look_sym[1<<HUFF_LOOKAHEAD]; /* symbol, or unused */
|
||||
};
|
||||
|
||||
#define QUANT_TABLE_LENGTH 64
|
||||
|
||||
/* for type of Huffman table */
|
||||
#define DC_LEN 28
|
||||
#define AC_LEN 178
|
||||
|
||||
struct huffman_table
|
||||
{ /* length and code according to JFIF format */
|
||||
int huffmancodes_dc[DC_LEN];
|
||||
int huffmancodes_ac[AC_LEN];
|
||||
};
|
||||
|
||||
struct frame_component
|
||||
{
|
||||
int ID;
|
||||
int horizontal_sampling;
|
||||
int vertical_sampling;
|
||||
int quanttable_select;
|
||||
};
|
||||
|
||||
struct scan_component
|
||||
{
|
||||
int ID;
|
||||
int DC_select;
|
||||
int AC_select;
|
||||
};
|
||||
|
||||
struct bitstream
|
||||
{
|
||||
unsigned long get_buffer; /* current bit-extraction buffer */
|
||||
int bits_left; /* # of unused bits in it */
|
||||
unsigned char* next_input_byte;
|
||||
unsigned char* input_end; /* upper limit +1 */
|
||||
};
|
||||
|
||||
struct jpeg
|
||||
{
|
||||
int x_size, y_size; /* size of image (can be less than block boundary) */
|
||||
int x_phys, y_phys; /* physical size, block aligned */
|
||||
int x_mbl; /* x dimension of MBL */
|
||||
int y_mbl; /* y dimension of MBL */
|
||||
int blocks; /* blocks per MB */
|
||||
int restart_interval; /* number of MCUs between RSTm markers */
|
||||
int store_pos[4]; /* for Y block ordering */
|
||||
|
||||
unsigned char* p_entropy_data;
|
||||
unsigned char* p_entropy_end;
|
||||
|
||||
int quanttable[4][QUANT_TABLE_LENGTH]; /* raw quantization tables 0-3 */
|
||||
int qt_idct[2][QUANT_TABLE_LENGTH]; /* quantization tables for IDCT */
|
||||
|
||||
struct huffman_table hufftable[2]; /* Huffman tables */
|
||||
struct derived_tbl dc_derived_tbls[2]; /* Huffman-LUTs */
|
||||
struct derived_tbl ac_derived_tbls[2];
|
||||
|
||||
struct frame_component frameheader[3]; /* Component descriptor */
|
||||
struct scan_component scanheader[3]; /* currently not used */
|
||||
|
||||
int mcu_membership[6]; /* info per block */
|
||||
int tab_membership[6];
|
||||
int subsample_x[3]; /* info per component */
|
||||
int subsample_y[3];
|
||||
};
|
||||
|
||||
|
||||
/* possible return flags for process_markers() */
|
||||
#define HUFFTAB 0x0001 /* with huffman table */
|
||||
#define QUANTTAB 0x0002 /* with quantization table */
|
||||
#define APP0_JFIF 0x0004 /* with APP0 segment following JFIF standard */
|
||||
#define FILL_FF 0x0008 /* with 0xFF padding bytes at begin/end */
|
||||
#define SOF0 0x0010 /* with SOF0-Segment */
|
||||
#define DHT 0x0020 /* with Definition of huffman tables */
|
||||
#define SOS 0x0040 /* with Start-of-Scan segment */
|
||||
#define DQT 0x0080 /* with definition of quantization table */
|
||||
|
||||
/* various helper functions */
|
||||
void default_huff_tbl(struct jpeg* p_jpeg);
|
||||
void build_lut(struct jpeg* p_jpeg);
|
||||
int process_markers(unsigned char* p_src, long size, struct jpeg* p_jpeg);
|
||||
|
||||
/* the main decode function */
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
int jpeg_decode(struct jpeg* p_jpeg, unsigned char* p_pixel[3],
|
||||
int downscale, void (*pf_progress)(int current, int total));
|
||||
#else
|
||||
int jpeg_decode(struct jpeg* p_jpeg, unsigned char* p_pixel[1], int downscale,
|
||||
void (*pf_progress)(int current, int total));
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _JPEG_JPEG_DECODER_H */
|
401
apps/plugins/jpeg/yuv2rgb.c
Normal file
401
apps/plugins/jpeg/yuv2rgb.c
Normal file
|
@ -0,0 +1,401 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "plugin.h"
|
||||
#include "yuv2rgb.h"
|
||||
|
||||
/* Needed for memset and rb->lcd_framebuffer */
|
||||
extern const struct plugin_api* rb;
|
||||
|
||||
/*
|
||||
* Conversion of full 0-255 range YCrCb to RGB:
|
||||
* |R| |1.000000 -0.000001 1.402000| |Y'|
|
||||
* |G| = |1.000000 -0.334136 -0.714136| |Pb|
|
||||
* |B| |1.000000 1.772000 0.000000| |Pr|
|
||||
* Scaled (yields s15-bit output):
|
||||
* |R| |128 0 179| |Y |
|
||||
* |G| = |128 -43 -91| |Cb - 128|
|
||||
* |B| |128 227 0| |Cr - 128|
|
||||
*/
|
||||
#define YFAC 128
|
||||
#define RVFAC 179
|
||||
#define GUFAC (-43)
|
||||
#define GVFAC (-91)
|
||||
#define BUFAC 227
|
||||
#define YUV_WHITE (255*YFAC)
|
||||
#define NODITHER_DELTA (127*YFAC)
|
||||
#define COMPONENT_SHIFT 15
|
||||
#define MATRIX_SHIFT 7
|
||||
|
||||
static inline int clamp_component(int x)
|
||||
{
|
||||
if ((unsigned)x > YUV_WHITE)
|
||||
x = x < 0 ? 0 : YUV_WHITE;
|
||||
return x;
|
||||
}
|
||||
|
||||
static inline int clamp_component_bits(int x, int bits)
|
||||
{
|
||||
if ((unsigned)x > (1u << bits) - 1)
|
||||
x = x < 0 ? 0 : (1 << bits) - 1;
|
||||
return x;
|
||||
}
|
||||
|
||||
static inline int component_to_lcd(int x, int bits, int delta)
|
||||
{
|
||||
/* Formula used in core bitmap loader. */
|
||||
return (((1 << bits) - 1)*x + (x >> (8 - bits)) + delta) >> COMPONENT_SHIFT;
|
||||
}
|
||||
|
||||
static inline int lcd_to_component(int x, int bits, int delta)
|
||||
{
|
||||
/* Reasonable, approximate reversal to get a full range back from the
|
||||
quantized value. */
|
||||
return YUV_WHITE*x / ((1 << bits) - 1);
|
||||
(void)delta;
|
||||
}
|
||||
|
||||
#define RED 0
|
||||
#define GRN 1
|
||||
#define BLU 2
|
||||
|
||||
struct rgb_err
|
||||
{
|
||||
int16_t errbuf[LCD_WIDTH+2]; /* Error record for line below */
|
||||
} rgb_err_buffers[3];
|
||||
|
||||
struct rgb_pixel
|
||||
{
|
||||
int r, g, b; /* Current pixel components in s16.0 */
|
||||
int inc; /* Current line increment (-1 or 1) */
|
||||
int row; /* Current row in source image */
|
||||
int col; /* Current column in source image */
|
||||
int ce[3]; /* Errors to apply to current pixel */
|
||||
struct rgb_err *e; /* RED, GRN, BLU */
|
||||
int epos; /* Current position in error record */
|
||||
};
|
||||
|
||||
struct rgb_pixel *pixel;
|
||||
|
||||
/** round and truncate to lcd depth **/
|
||||
static fb_data pixel_to_lcd_colour(void)
|
||||
{
|
||||
struct rgb_pixel *p = pixel;
|
||||
int r, g, b;
|
||||
|
||||
r = component_to_lcd(p->r, LCD_RED_BITS, NODITHER_DELTA);
|
||||
r = clamp_component_bits(r, LCD_RED_BITS);
|
||||
|
||||
g = component_to_lcd(p->g, LCD_GREEN_BITS, NODITHER_DELTA);
|
||||
g = clamp_component_bits(g, LCD_GREEN_BITS);
|
||||
|
||||
b = component_to_lcd(p->b, LCD_BLUE_BITS, NODITHER_DELTA);
|
||||
b = clamp_component_bits(b, LCD_BLUE_BITS);
|
||||
|
||||
return LCD_RGBPACK_LCD(r, g, b);
|
||||
}
|
||||
|
||||
/** write a monochrome pixel to the colour LCD **/
|
||||
static fb_data pixel_to_lcd_gray(void)
|
||||
{
|
||||
int r, g, b;
|
||||
|
||||
g = clamp_component(pixel->g);
|
||||
r = component_to_lcd(g, LCD_RED_BITS, NODITHER_DELTA);
|
||||
b = component_to_lcd(g, LCD_BLUE_BITS, NODITHER_DELTA);
|
||||
g = component_to_lcd(g, LCD_GREEN_BITS, NODITHER_DELTA);
|
||||
|
||||
return LCD_RGBPACK_LCD(r, g, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bayer ordered dithering - swiped from the core bitmap loader.
|
||||
*/
|
||||
static fb_data pixel_odither_to_lcd(void)
|
||||
{
|
||||
/* canonical ordered dither matrix */
|
||||
static const unsigned char dither_matrix[16][16] = {
|
||||
{ 0,192, 48,240, 12,204, 60,252, 3,195, 51,243, 15,207, 63,255 },
|
||||
{ 128, 64,176,112,140, 76,188,124,131, 67,179,115,143, 79,191,127 },
|
||||
{ 32,224, 16,208, 44,236, 28,220, 35,227, 19,211, 47,239, 31,223 },
|
||||
{ 160, 96,144, 80,172,108,156, 92,163, 99,147, 83,175,111,159, 95 },
|
||||
{ 8,200, 56,248, 4,196, 52,244, 11,203, 59,251, 7,199, 55,247 },
|
||||
{ 136, 72,184,120,132, 68,180,116,139, 75,187,123,135, 71,183,119 },
|
||||
{ 40,232, 24,216, 36,228, 20,212, 43,235, 27,219, 39,231, 23,215 },
|
||||
{ 168,104,152, 88,164,100,148, 84,171,107,155, 91,167,103,151, 87 },
|
||||
{ 2,194, 50,242, 14,206, 62,254, 1,193, 49,241, 13,205, 61,253 },
|
||||
{ 130, 66,178,114,142, 78,190,126,129, 65,177,113,141, 77,189,125 },
|
||||
{ 34,226, 18,210, 46,238, 30,222, 33,225, 17,209, 45,237, 29,221 },
|
||||
{ 162, 98,146, 82,174,110,158, 94,161, 97,145, 81,173,109,157, 93 },
|
||||
{ 10,202, 58,250, 6,198, 54,246, 9,201, 57,249, 5,197, 53,245 },
|
||||
{ 138, 74,186,122,134, 70,182,118,137, 73,185,121,133, 69,181,117 },
|
||||
{ 42,234, 26,218, 38,230, 22,214, 41,233, 25,217, 37,229, 21,213 },
|
||||
{ 170,106,154, 90,166,102,150, 86,169,105,153, 89,165,101,149, 85 }
|
||||
};
|
||||
|
||||
struct rgb_pixel *p = pixel;
|
||||
int r, g, b, delta;
|
||||
|
||||
delta = dither_matrix[p->col & 15][p->row & 15] << MATRIX_SHIFT;
|
||||
|
||||
r = component_to_lcd(p->r, LCD_RED_BITS, delta);
|
||||
r = clamp_component_bits(r, LCD_RED_BITS);
|
||||
|
||||
g = component_to_lcd(p->g, LCD_GREEN_BITS, delta);
|
||||
g = clamp_component_bits(g, LCD_GREEN_BITS);
|
||||
|
||||
b = component_to_lcd(p->b, LCD_BLUE_BITS, delta);
|
||||
b = clamp_component_bits(b, LCD_BLUE_BITS);
|
||||
|
||||
p->col += p->inc;
|
||||
|
||||
return LCD_RGBPACK_LCD(r, g, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Floyd/Steinberg dither to lcd depth.
|
||||
*
|
||||
* Apply filter to each component in serpentine pattern. Kernel shown for
|
||||
* L->R scan. Kernel is reversed for R->L.
|
||||
* * 7
|
||||
* 3 5 1 (1/16)
|
||||
*/
|
||||
static inline void distribute_error(int *ce, struct rgb_err *e,
|
||||
int err, int epos, int inc)
|
||||
{
|
||||
*ce = (7*err >> 4) + e->errbuf[epos+inc];
|
||||
e->errbuf[epos+inc] = err >> 4;
|
||||
e->errbuf[epos] += 5*err >> 4;
|
||||
e->errbuf[epos-inc] += 3*err >> 4;
|
||||
}
|
||||
|
||||
static fb_data pixel_fsdither_to_lcd(void)
|
||||
{
|
||||
struct rgb_pixel *p = pixel;
|
||||
int rc, gc, bc, r, g, b;
|
||||
int inc, epos;
|
||||
|
||||
/* Full components with error terms */
|
||||
rc = p->r + p->ce[RED];
|
||||
r = component_to_lcd(rc, LCD_RED_BITS, 0);
|
||||
r = clamp_component_bits(r, LCD_RED_BITS);
|
||||
|
||||
gc = p->g + p->ce[GRN];
|
||||
g = component_to_lcd(gc, LCD_GREEN_BITS, 0);
|
||||
g = clamp_component_bits(g, LCD_GREEN_BITS);
|
||||
|
||||
bc = p->b + p->ce[BLU];
|
||||
b = component_to_lcd(bc, LCD_BLUE_BITS, 0);
|
||||
b = clamp_component_bits(b, LCD_BLUE_BITS);
|
||||
|
||||
/* Get pixel errors */
|
||||
rc -= lcd_to_component(r, LCD_RED_BITS, 0);
|
||||
gc -= lcd_to_component(g, LCD_GREEN_BITS, 0);
|
||||
bc -= lcd_to_component(b, LCD_BLUE_BITS, 0);
|
||||
|
||||
/* Spead error to surrounding pixels. */
|
||||
inc = p->inc;
|
||||
epos = p->epos;
|
||||
p->epos += inc;
|
||||
|
||||
distribute_error(&p->ce[RED], &p->e[RED], rc, epos, inc);
|
||||
distribute_error(&p->ce[GRN], &p->e[GRN], gc, epos, inc);
|
||||
distribute_error(&p->ce[BLU], &p->e[BLU], bc, epos, inc);
|
||||
|
||||
/* Pack and return pixel */
|
||||
return LCD_RGBPACK_LCD(r, g, b);
|
||||
}
|
||||
|
||||
/* Functions for each output mode, colour then grayscale. */
|
||||
static fb_data (* const pixel_funcs[COLOUR_NUM_MODES][DITHER_NUM_MODES])(void) =
|
||||
{
|
||||
[COLOURMODE_COLOUR] =
|
||||
{
|
||||
[DITHER_NONE] = pixel_to_lcd_colour,
|
||||
[DITHER_ORDERED] = pixel_odither_to_lcd,
|
||||
[DITHER_DIFFUSION] = pixel_fsdither_to_lcd,
|
||||
},
|
||||
[COLOURMODE_GRAY] =
|
||||
{
|
||||
[DITHER_NONE] = pixel_to_lcd_gray,
|
||||
[DITHER_ORDERED] = pixel_odither_to_lcd,
|
||||
[DITHER_DIFFUSION] = pixel_fsdither_to_lcd,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Draw a partial YUV colour bitmap
|
||||
*
|
||||
* Runs serpentine pattern when dithering is DITHER_DIFFUSION, else scan is
|
||||
* always L->R.
|
||||
*/
|
||||
void yuv_bitmap_part(unsigned char *src[3], int csub_x, int csub_y,
|
||||
int src_x, int src_y, int stride,
|
||||
int x, int y, int width, int height,
|
||||
int colour_mode, int dither_mode)
|
||||
{
|
||||
fb_data *dst, *dst_end;
|
||||
fb_data (*pixel_func)(void);
|
||||
struct rgb_pixel px;
|
||||
|
||||
if (x + width > LCD_WIDTH)
|
||||
width = LCD_WIDTH - x; /* Clip right */
|
||||
if (x < 0)
|
||||
width += x, x = 0; /* Clip left */
|
||||
if (width <= 0)
|
||||
return; /* nothing left to do */
|
||||
|
||||
if (y + height > LCD_HEIGHT)
|
||||
height = LCD_HEIGHT - y; /* Clip bottom */
|
||||
if (y < 0)
|
||||
height += y, y = 0; /* Clip top */
|
||||
if (height <= 0)
|
||||
return; /* nothing left to do */
|
||||
|
||||
pixel = &px;
|
||||
|
||||
dst = rb->lcd_framebuffer + LCD_WIDTH * y + x;
|
||||
dst_end = dst + LCD_WIDTH * height;
|
||||
|
||||
if (colour_mode == COLOURMODE_GRAY)
|
||||
csub_y = 0; /* Ignore Cb, Cr */
|
||||
|
||||
pixel_func = pixel_funcs[colour_mode]
|
||||
[dither_mode];
|
||||
|
||||
if (dither_mode == DITHER_DIFFUSION)
|
||||
{
|
||||
/* Reset error terms. */
|
||||
px.e = rgb_err_buffers;
|
||||
px.ce[RED] = px.ce[GRN] = px.ce[BLU] = 0;
|
||||
rb->memset(px.e, 0, 3*sizeof (struct rgb_err));
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
fb_data *dst_row, *row_end;
|
||||
const unsigned char *ysrc;
|
||||
px.inc = 1;
|
||||
|
||||
if (dither_mode == DITHER_DIFFUSION)
|
||||
{
|
||||
/* Use R->L scan on odd lines */
|
||||
px.inc -= (src_y & 1) << 1;
|
||||
px.epos = x + 1;
|
||||
|
||||
if (px.inc < 0)
|
||||
px.epos += width - 1;
|
||||
}
|
||||
|
||||
if (px.inc == 1)
|
||||
{
|
||||
/* Scan is L->R */
|
||||
dst_row = dst;
|
||||
row_end = dst_row + width;
|
||||
px.col = src_x;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Scan is R->L */
|
||||
row_end = dst - 1;
|
||||
dst_row = row_end + width;
|
||||
px.col = src_x + width - 1;
|
||||
}
|
||||
|
||||
ysrc = src[0] + stride * src_y + px.col;
|
||||
px.row = src_y;
|
||||
|
||||
/* Do one row of pixels */
|
||||
if (csub_y) /* colour */
|
||||
{
|
||||
/* upsampling, YUV->RGB conversion and reduction to RGB565 in one go */
|
||||
const unsigned char *usrc, *vsrc;
|
||||
|
||||
usrc = src[1] + (stride/csub_x) * (src_y/csub_y)
|
||||
+ (px.col/csub_x);
|
||||
vsrc = src[2] + (stride/csub_x) * (src_y/csub_y)
|
||||
+ (px.col/csub_x);
|
||||
int xphase = px.col % csub_x;
|
||||
int xphase_reset = px.inc * csub_x;
|
||||
int y, v, u, rv, guv, bu;
|
||||
|
||||
v = *vsrc - 128;
|
||||
vsrc += px.inc;
|
||||
u = *usrc - 128;
|
||||
usrc += px.inc;
|
||||
rv = RVFAC*v;
|
||||
guv = GUFAC*u + GVFAC*v;
|
||||
bu = BUFAC*u;
|
||||
|
||||
while (1)
|
||||
{
|
||||
y = YFAC*(*ysrc);
|
||||
ysrc += px.inc;
|
||||
px.r = y + rv;
|
||||
px.g = y + guv;
|
||||
px.b = y + bu;
|
||||
|
||||
*dst_row = pixel_func();
|
||||
dst_row += px.inc;
|
||||
|
||||
if (dst_row == row_end)
|
||||
break;
|
||||
|
||||
xphase += px.inc;
|
||||
if ((unsigned)xphase < (unsigned)csub_x)
|
||||
continue;
|
||||
|
||||
/* fetch new chromas */
|
||||
v = *vsrc - 128;
|
||||
vsrc += px.inc;
|
||||
u = *usrc - 128;
|
||||
usrc += px.inc;
|
||||
rv = RVFAC*v;
|
||||
guv = GUFAC*u + GVFAC*v;
|
||||
bu = BUFAC*u;
|
||||
|
||||
xphase -= xphase_reset;
|
||||
}
|
||||
}
|
||||
else /* monochrome */
|
||||
{
|
||||
do
|
||||
{
|
||||
/* Set all components the same for dithering purposes */
|
||||
px.g = px.r = px.b = YFAC*(*ysrc);
|
||||
*dst_row = pixel_func();
|
||||
ysrc += px.inc;
|
||||
dst_row += px.inc;
|
||||
}
|
||||
while (dst_row != row_end);
|
||||
}
|
||||
|
||||
src_y++;
|
||||
dst += LCD_WIDTH;
|
||||
}
|
||||
while (dst < dst_end);
|
||||
}
|
51
apps/plugins/jpeg/yuv2rgb.h
Normal file
51
apps/plugins/jpeg/yuv2rgb.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* 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_YUV2RGB_H
|
||||
#define _JPEG_YUV2RGB_H
|
||||
|
||||
enum color_modes
|
||||
{
|
||||
COLOURMODE_COLOUR = 0,
|
||||
COLOURMODE_GRAY,
|
||||
COLOUR_NUM_MODES
|
||||
};
|
||||
|
||||
enum dither_modes
|
||||
{
|
||||
DITHER_NONE = 0, /* No dithering */
|
||||
DITHER_ORDERED, /* Bayer ordered */
|
||||
DITHER_DIFFUSION, /* Floyd/Steinberg error diffusion */
|
||||
DITHER_NUM_MODES
|
||||
};
|
||||
|
||||
void yuv_bitmap_part(unsigned char *src[3], int csub_x, int csub_y,
|
||||
int src_x, int src_y, int stride,
|
||||
int x, int y, int width, int height,
|
||||
int colour_mode, int dither_mode);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue