JPEG header tools.
More...
Go to the source code of this file.
Classes |
struct | jpeg_dma_buffer |
| structure that can hold header & data of a JPEG image. To be used with create_jpeg_dma_buffer() More...
|
Defines |
#define | BYTESTUFF_EANBLE false |
#define | COLOR_ENABLE false |
#define | QTAB_DIV_2 1 |
#define | QTAB_DIV_3 0 |
#define | QTAB_MUL_2 3 |
#define | QTAB_QUALITY_EXCELLENT QTAB_DIV_3 |
#define | QTAB_QUALITY_GOOD QTAB_DIV_2 |
#define | QTAB_QUALITY_LOW QTAB_MUL_2 |
#define | QTAB_QUALITY_MEDIUM QTAB_STD |
#define | QTAB_STD 2 |
Typedefs |
typedef struct jpeg_dma_buffer | jpeg_dma_buffer_type |
| structure that can hold header & data of a JPEG image. To be used with create_jpeg_dma_buffer()
|
Functions |
int | convert_to_jpeg (unsigned char *img, int size, unsigned char **jpeg_buf, int *jpeg_size, int width, int height, int qtab_sel, bool hw_bytestuff_en=BYTESTUFF_EANBLE, bool color=COLOR_ENABLE) |
| Adds JPEG(JFIF) file header to an JPEG data stream (from the FPGA HW-coder).
|
int | create_jpeg_dma_buffer (jpeg_dma_buffer_type *jpeg_buffer, int width, int height, int qtab_sel, bool color) |
| Creates a structure of type jpeg_dma_buffer_type with the following properties: The structure is able to hold one JPEG image consisting of it's header & data.
|
int | create_jpeg_header (unsigned char *hdr, int width, int height, int qtab_sel) |
| Create a greyscale JPEG header in an existing buffer.
|
int | create_jpeg_header_ycbcr (unsigned char *hdr, int width, int height, int qtab_sel) |
| Create a color JPEG header in an existing buffer.
|
int | update_jpeg_header (jpeg_dma_buffer_type *jpeg_buffer, int width, int height) |
| This function allows to update width & height of the JPEG header in an jpeg_dma_buffer structure created width create_jpeg_dma_buffer().
|
int | write_jpeg_file (unsigned char *img, int size, char *filename, int width, int height, int qtab_sel, bool color=COLOR_ENABLE, bool hw_bytestuff_en=BYTESTUFF_EANBLE) |
| Adds JPEG(JFIF) file-header to an JPEG data stream (from the FPGA HW-coder) and writes the resulting JPEG-Image into a file.
|
Detailed Description
JPEG header tools.
Jpconf.h contains functions needed for creating JFIF(JPEG)-file headers used with FPGA JPEG compression.
- Author:
- Rene Smodic
- Date:
- 2009/06/22
Define Documentation
#define BYTESTUFF_EANBLE false |
#define COLOR_ENABLE false |
#define QTAB_QUALITY_EXCELLENT QTAB_DIV_3 |
#define QTAB_QUALITY_GOOD QTAB_DIV_2 |
#define QTAB_QUALITY_LOW QTAB_MUL_2 |
#define QTAB_QUALITY_MEDIUM QTAB_STD |
Typedef Documentation
Function Documentation
int convert_to_jpeg |
( |
unsigned char * |
img, |
|
|
int |
size, |
|
|
unsigned char ** |
jpeg_buf, |
|
|
int * |
jpeg_size, |
|
|
int |
width, |
|
|
int |
height, |
|
|
int |
qtab_sel, |
|
|
bool |
hw_bytestuff_en = BYTESTUFF_EANBLE , |
|
|
bool |
color = COLOR_ENABLE | |
|
) |
| | |
Adds JPEG(JFIF) file header to an JPEG data stream (from the FPGA HW-coder).
- Parameters:
-
| *img | pointer to buffer hoalding the JPEG-stream |
| *size | length of the JPEG-stream in bytes |
| **jpeg_buf | output buffer (allocation is done by this function!) |
| *jpeg_size | resulting output buffer length |
| width | width of the image |
| height | height of the image |
| qtab_sel | used quantisation table. (QTAB_QUALITY_EXCELLENT|_GOOD|_MEDIUM|_LOW) |
| color | true if the JPEG-stream contains a color-image; false for greyscale |
| hw_bytestuff_en | true if the 0xFF bytestuffing is done by the FPGA. |
- Returns:
- 0 on success
int create_jpeg_dma_buffer |
( |
jpeg_dma_buffer_type * |
jpeg_buffer, |
|
|
int |
width, |
|
|
int |
height, |
|
|
int |
qtab_sel, |
|
|
bool |
color | |
|
) |
| | |
Creates a structure of type jpeg_dma_buffer_type with the following properties: The structure is able to hold one JPEG image consisting of it's header & data.
The allocated stream buffer is 32 Byte alligned and therefore can be accessed directly by DMA (e.g ReadImageRAM(), etc.) It's size is width*height. The jpeg_dma_buffer structure allows to create the header once and exchange the image data stream. Header and data are alligned linear, so the jpeg_start pointer of the jpeg_dma_buffer structure allows access to the complete JPEG-Image. When using this function hardware bytestuffing must be enabled in SetJPEG()!
- Parameters:
-
| *jpeg_buffer | returned pointer to the created structure |
| width | width of the image |
| height | height of the image |
| qtab_sel | used quantisation table. (QTAB_QUALITY_EXCELLENT|_GOOD|_MEDIUM|_LOW) |
| color | true if the JPEG-stream contains a color-image; false for greyscale |
- Returns:
- 0 on success
int create_jpeg_header |
( |
unsigned char * |
hdr, |
|
|
int |
width, |
|
|
int |
height, |
|
|
int |
qtab_sel | |
|
) |
| | |
Create a greyscale JPEG header in an existing buffer.
- Parameters:
-
| *hdr | pointer to the buffer where the header should be created |
| width | width of the image |
| height | height of the image |
| qtab_sel | used quantisation table. (QTAB_QUALITY_EXCELLENT|_GOOD|_MEDIUM|_LOW) |
- Returns:
- number of bytes written into the buffer on success
int create_jpeg_header_ycbcr |
( |
unsigned char * |
hdr, |
|
|
int |
width, |
|
|
int |
height, |
|
|
int |
qtab_sel | |
|
) |
| | |
Create a color JPEG header in an existing buffer.
- Parameters:
-
| *hdr | pointer to the buffer where the header should be created |
| width | width of the image |
| height | height of the image |
| qtab_sel | used quantisation table. (QTAB_QUALITY_EXCELLENT|_GOOD|_MEDIUM|_LOW) |
- Returns:
- number of bytes written into the buffer on success
This function allows to update width & height of the JPEG header in an jpeg_dma_buffer structure created width create_jpeg_dma_buffer().
- Parameters:
-
| jpeg_buffer | pointer to structure that should be updated |
| width | width of the image |
| height | height of the image |
- Returns:
- 0 on success
int write_jpeg_file |
( |
unsigned char * |
img, |
|
|
int |
size, |
|
|
char * |
filename, |
|
|
int |
width, |
|
|
int |
height, |
|
|
int |
qtab_sel, |
|
|
bool |
color = COLOR_ENABLE , |
|
|
bool |
hw_bytestuff_en = BYTESTUFF_EANBLE | |
|
) |
| | |
Adds JPEG(JFIF) file-header to an JPEG data stream (from the FPGA HW-coder) and writes the resulting JPEG-Image into a file.
- Parameters:
-
| *img | pointer to buffer hoalding the JPEG-stream |
| *size | length of the JPEG-stream in bytes |
| *filename | output file name |
| width | width of the image |
| height | height of the image |
| qtab_sel | used quantisation table. (QTAB_QUALITY_EXCELLENT|_GOOD|_MEDIUM|_LOW) |
| color | true if the JPEG-stream contains a color-image; false for greyscale |
| hw_bytestuff_en | true if the 0xFF bytestuffing is done by the FPGA. |
- Returns:
- 0 on success