rockbox/apps/plugins/imageviewer/image_decoder.h
Roman Artiukhin b8238f7b20 imageviewer: Initial support for JPEG progressive images. Add decoder
Added jpeg decoder jpegp.c using RAINBOW lib. Currently enabled only for pictures not supported by old decoder (as old decoder more optimized for low mem targets)

Someone TODO:
 * Old decoder has optimized downscale logic which new decoder doesn't have (it gives big difference in required memory and time for decoding). This logic should be ported/adapted if possible.

 * Add smooth downscaling.

 * Grayscale support

Change-Id: Ie96bc62848b51cc6a3942f8e069ec6ab02dc1c56
2024-10-14 09:19:34 -04:00

55 lines
1.6 KiB
C

/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* load image decoder.
*
* 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 _IMAGE_DECODER_H
#define _IMAGE_DECODER_H
#include "imageviewer.h"
enum image_type {
IMAGE_UNKNOWN = -1,
IMAGE_BMP = 0,
IMAGE_JPEG,
IMAGE_PNG,
#ifdef HAVE_LCD_COLOR
IMAGE_PPM,
#endif
IMAGE_GIF,
IMAGE_JPEG_PROGRESSIVE,
MAX_IMAGE_TYPES
};
struct loader_info {
enum image_type type;
const struct imgdec_api *iv;
unsigned char* buffer;
size_t size;
};
/* Check file type by magic number or file extension */
enum image_type get_image_type(const char *name, bool quiet);
/* Load image decoder */
const struct image_decoder *load_decoder(struct loader_info *loader_info);
/* Release the loaded decoder */
void release_decoder(void);
#endif /* _IMAGE_DECODER_H */