os/linux-2.6-tag--devboard-R2_10-4/arch/cris/arch-v32/drivers/elphel/jpeghead.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  huffman_fpga_code_t
struct  jpeghead_pd
struct  huffman_pd

Defines

#define JPEG_HEADER_MAXSIZE   0x300

Functions

int qtables_create (struct interframe_params_t *params, unsigned char *buf)
 just copy two quantization tables for the current frame (for the RTP streamer)
int jpegheader_create (struct interframe_params_t *params, unsigned char *buf)
 create JPEG header for the frame acquired earlier
int jpeghead_open (struct inode *inode, struct file *filp)
loff_t jpeghead_lseek (struct file *file, loff_t offset, int orig)
ssize_t jpeghead_read (struct file *file, char *buf, size_t count, loff_t *off)
int huffman_open (struct inode *inode, struct file *filp)
int huffman_release (struct inode *inode, struct file *filp)
loff_t huffman_lseek (struct file *file, loff_t offset, int orig)
ssize_t huffman_read (struct file *file, char *buf, size_t count, loff_t *off)
ssize_t huffman_write (struct file *file, const char *buf, size_t count, loff_t *off)
void init_ccam_dma_buf_ptr (void)
 still used in autoexposure or something - why is in needed there?
int jpeg_htable_is_programmed (void)
 check if the FPGA is programmed to the new Huffman table
void jpeg_htable_init (void)
 Initialize Huffman tables with default data.
int jpeg_htable_fpga_encode (void)
 encode all 4 Huffman tables into FPGA format additionally calculates number of symbols in each table
void jpeg_htable_fpga_pgm (void)
 program FPGA Huffman table (fram static array)
int jpeg_prep_htable (struct huffman_encoded_t *htable, struct huffman_fpga_code_t *hcodes)
 Does it depend on no missing symbols?

Variables

unsigned long * ccam_dma_buf_ptr
 Without "static" system hangs after "Uncompressing Linux...


Define Documentation

#define JPEG_HEADER_MAXSIZE   0x300

Definition at line 23 of file jpeghead.h.


Function Documentation

loff_t huffman_lseek ( struct file *  file,
loff_t  offset,
int  orig 
)

================================================================= ! Overloading lseek with additional functionality ! with orig==SEEK_END , offset==LSEEK_HUFFMAN_DC0 - position at Huffman DC0 ! with orig==SEEK_END , offset==LSEEK_HUFFMAN_AC0 - position at Huffman DC0 ! with orig==SEEK_END , offset==LSEEK_HUFFMAN_DC1 - position at Huffman DC0 ! with orig==SEEK_END , offset==LSEEK_HUFFMAN_AC1 - position at Huffman DC0 ! with orig==SEEK_END , offset==LSEEK_HUFFMAN_FPGATAB - position at FPGA table ! with orig==SEEK_END , offset==LSEEK_HUFFMAN_DEFAULT - fill in default tables ! with orig==SEEK_END , offset==LSEEK_HUFFMAN_FPGACALC - calculate FPGA table ! with orig==SEEK_END , offset==LSEEK_HUFFMAN_FPGAPGM - program FPGA table ! those commands do not move the file pointer (return current), ! or negative in the case of error (calculate FPGA table) !================================================================

New functionality

Definition at line 491 of file jpeghead.c.

References huff_tables, jpeg_htable_fpga_encode(), jpeg_htable_fpga_pgm(), jpeg_htable_init(), LSEEK_HUFFMAN_AC0, LSEEK_HUFFMAN_AC1, LSEEK_HUFFMAN_DC0, LSEEK_HUFFMAN_DC1, LSEEK_HUFFMAN_DEFAULT, LSEEK_HUFFMAN_FPGACALC, LSEEK_HUFFMAN_FPGAPGM, LSEEK_HUFFMAN_FPGATAB, SEEK_CUR, SEEK_END, and SEEK_SET.

Referenced by circbuf_all_lseek().

int huffman_open ( struct inode *  inode,
struct file *  filp 
)

huffman_* file operations write, read Huffman tables, initialize tables to default ones, program FPGA with the Huffman tables file structure is the same as the struct huff_tables_t:

Definition at line 466 of file jpeghead.c.

References GFP_KERNEL, huff_tables, kmalloc, and huffman_pd::minor.

Referenced by circbuf_all_open().

ssize_t huffman_read ( struct file *  file,
char *  buf,
size_t  count,
loff_t *  off 
)

Definition at line 538 of file jpeghead.c.

References huff_tables, MDF17, and printk.

Referenced by circbuf_all_read().

int huffman_release ( struct inode *  inode,
struct file *  filp 
)

ssize_t huffman_write ( struct file *  file,
const char *  buf,
size_t  count,
loff_t *  off 
)

Definition at line 553 of file jpeghead.c.

References huff_tables, MDF17, and printk.

Referenced by circbuf_all_write().

void init_ccam_dma_buf_ptr ( void   ) 

still used in autoexposure or something - why is in needed there?

Definition at line 243 of file circbuf.c.

References ccam_dma_buf.

Referenced by image_acq_init().

int jpeg_htable_fpga_encode ( void   ) 

encode all 4 Huffman tables into FPGA format additionally calculates number of symbols in each table

Returns:
OK - 0, -1 - too many symbols, -2 bad table, -3 - bad table number

length will be inserted later

mark FPGA table as needed to be programmed

Fill in the table headers:

all 4 headers (with zero length)

all but DC column

in FPGA DC use spare parts of AC table

Fill in the table headers:

2 length bytes, 1 type byte, 16 lengths bytes

first 16 bytes in each table number of symbols

high byte (usually 0)

low byte

Definition at line 643 of file jpeghead.c.

References a, huffman_encoded_t::bits, huff_tables_t::dht_all, huff_tables_t::fpga_huffman_table, huff_tables_t::header_huffman_tables, huff_tables, huffman_fpga_programmed, jpeg_prep_htable(), length, MDF17, memcpy(), memset(), and printk.

Referenced by huffman_lseek(), and jpeg_htable_init().

void jpeg_htable_fpga_pgm ( void   ) 

program FPGA Huffman table (fram static array)

Definition at line 696 of file jpeghead.c.

References CX313_FPGA_TABLES_HUFF, huff_tables_t::fpga_huffman_table, fpga_table_write_nice(), huff_tables, and huffman_fpga_programmed.

Referenced by huffman_lseek(), and pgm_compmode().

void jpeg_htable_init ( void   ) 

Initialize Huffman tables with default data.

. number of codes of each length 1..16 (12 total)

symbols encoded (12)

symbols encoded (0xa2)

Definition at line 570 of file jpeghead.c.

References huff_tables, jpeg_htable_fpga_encode(), MDF17, memcpy(), memset(), and printk.

Referenced by circbuf_all_init(), and huffman_lseek().

int jpeg_htable_is_programmed ( void   ) 

check if the FPGA is programmed to the new Huffman table

Returns:
1 - programmed, 0 - not programmed

Definition at line 689 of file jpeghead.c.

References huffman_fpga_programmed.

Referenced by pgm_compmode().

int jpeg_prep_htable ( struct huffman_encoded_t htable,
struct huffman_fpga_code_t hcodes 
)

Does it depend on no missing symbols?

Parameters:
htable encoded Huffman table - 16 length bytes followed by up to 256 symbols
hcodes combined (length<<16) | code table for each symbol
Returns:
OK- 0, -1 - too many symbols, -2 bad table

Figure C.1: make table of Huffman code length for each symbol

protect against table overrun

Figure C.2: generate the codes themselves We also validate that the counts represent a legal Huffman code tree.

htable->huffval[N] - N-th symbol value

Bad table

code is now 1 more than the last code used for codelength si; but it must still fit in si bits, since no code is allowed to be all ones.

Bad code

Definition at line 709 of file jpeghead.c.

References huffman_encoded_t::bits, ELP_KERR, huffman_encoded_t::huffval, huffman_fpga_code_t::length, MDF17, printk, and huffman_fpga_code_t::value.

Referenced by jpeg_htable_fpga_encode().

loff_t jpeghead_lseek ( struct file *  file,
loff_t  offset,
int  orig 
)

================================================================= ! Overloading lseek with additional functionality (to avoid ioctls) ! with orig==SEEK_END lseek will treat (offset>0) as a byte pointer ! in (char *)ccam_dma_buf_ptr of a frame pointer and use quality, ! width and height to regenerate header. ! frame pointers are 32-bytes aligned, so adding 1 to offest ! will make sure it is always >0 (as offset=0, orig=SEEK_END ! will just move pointer to the end and return file length. ! ! When called with orig==SEEK_END, offset>0 lseek will position ! file at the very beginning and return 0 if OK, -EINVAL if ! frame header is not found for the specified offset !================================================================

New functionality

32 bytes before the frame pointer, may roll-over to the end of ccam_dma_buf_ptr

signature is overwritten

acquisition of this frame is not done yet - length word high byte is non-zero

FIXME: pp_index=fp->past_index; /// unsigned short if (pp_index>=PASTPARS_SAVE_ENTRIES) return -EINVAL; /// wrong index privData->size= jpegheader_create( pastpars[pp_index].past_pars, privData->header);

just qunatization tables (128 bytes) - for the streamer

full JPEG header

error in header

it is 0

truncate position

Definition at line 384 of file jpeghead.c.

References ccam_dma_buf_ptr, fp, jpeghead_pd::header, jpegheader_create(), MDF17, printk, qtables_create(), rp, SEEK_CUR, SEEK_END, SEEK_SET, jpeghead_pd::size, X313_BUFFSUB, and X313_LENGTH_MASK.

Referenced by circbuf_all_lseek().

int jpeghead_open ( struct inode *  inode,
struct file *  filp 
)

make it blocking to use shared resource - jpeg header that may need re-calculation for different requests? or use individual header arrays?

undefined yet

not the actual size

Definition at line 358 of file jpeghead.c.

References GFP_KERNEL, JPEG_HEADER_MAXSIZE, kmalloc, jpeghead_pd::minor, and size.

Referenced by circbuf_all_open().

ssize_t jpeghead_read ( struct file *  file,
char *  buf,
size_t  count,
loff_t *  off 
)

Definition at line 439 of file jpeghead.c.

References jpeghead_pd::header, MDF17, printk, and jpeghead_pd::size.

Referenced by circbuf_all_read().

int jpegheader_create ( struct interframe_params_t params,
unsigned char *  buf 
)

create JPEG header for the frame acquired earlier

Parameters:
params pointer to an array of parameters stored for the frame
buf buffer to put the header to
Returns:
header length if successful, <0 - error

buffer pointer

pointer to length word in the buffer

start of SOS (varaible)

first constant part of the header - 0x19 bytes

SOI start of image

APP0

(16 bytes long)

JFIF null terminated

DQT (define quantization table)

0x43 bytes long

table number + (bytes-1)<<4 (0ne byte - 0, 2 bytes - 0x10)

second constant part of the header (starting from byte 0x59 - 0x5 bytes)

DQT (define quantization table)

0x43 bytes long

table number + (bytes-1)<<4 (0ne byte - 0, 2 bytes - 0x10)

id , freqx/freqy, q

id, hufftable_dc/htable_ac

id , freqx/freqy, q

id, hufftable_dc/htable_ac

id , freqx/freqy, q

id, hufftable_dc/htable_ac

id , freqx/freqy, q

id, hufftable_dc/htable_ac

id , freqx/freqy, q

id, hufftable_dc/htable_ac

will be adjusted to bayer shift, same for jp4hdr

id, hufftable_dc/htable_ac

buffer is not provided

including DQT0 header

DQT1 header

will copy both quantization tables

bad quality table

high byte length - always 0

save pointer to length (low byte)

8bpp

big endian height

big endian width

copy SOF0 (constants combined with bayer shift for jp4diff/jp4hdr)

monochrome, (4:2:0),

color, 4:2:0, 18x18(old)

color, 4:2:0, 20x20, middle of the tile (not yet implemented)

jp4, original (4:2:0)

monochrome, 4 blocks (but still with 2x2 macroblocks)

jp4, 4 blocks

jp4, dc -improved (4:2:0)

jp4, 4 blocks, dc -improved

jp4, 4 blocks, differential red := (R-G1), blue:=(B-G1), green=G1, green2 (G2-G1). G1 is defined by Bayer shift, any pixel can be used

jp4, 4 blocks, differential, divide differences by 2: red := (R-G1)/2, blue:=(B-G1)/2, green=G1, green2 (G2-G1)/2

set quantization table 0 for the "base color"

jp4, 4 blocks, differential HDR: red := (R-G1), blue:=(B-G1), green=G1, green2 (high gain)=G2) (G1 and G2 - diagonally opposite)

jp4, 4 blocks, differential HDR: red := (R-G1)/2, blue:=(B-G1)/2, green=G1, green2 (high gain)=G2)

same as for COLORMODE_JP4DIFF

set quantization table 0 for the "base color"

set quantization table 0 for the HDR color

Include 4 huffman tables

DHT DC0 header

table length itself, excluding 2 length bytes and type byte

DHT AC0 header

table length itself, excluding 2 length bytes and type byte

DHT DC1 header

table length itself, excluding 2 length bytes and type byte

DHT AC1 header

table length itself, excluding 2 length bytes and type byte

copy SOS0 (constants combined with bayer shift for jp4diff/jp4hdr)

SOS tag

high byte length - always 0

monochrome, (4:2:0),

color, 4:2:0, 18x18(old)

color, 4:2:0, 20x20, middle of the tile (not yet implemented)

jp4, original (4:2:0)

monochrome, 4 blocks (but still with 2x2 macroblocks)

jp4, 4 blocks

jp4, dc -improved (4:2:0)

jp4, 4 blocks, dc -improved

jp4, 4 blocks, differential red := (R-G1), blue:=(B-G1), green=G1, green2 (G2-G1). G1 is defined by Bayer shift, any pixel can be used

jp4, 4 blocks, differential, divide differences by 2: red := (R-G1)/2, blue:=(B-G1)/2, green=G1, green2 (G2-G1)/2

set huffman table 0 for the "base color"

jp4, 4 blocks, differential HDR: red := (R-G1), blue:=(B-G1), green=G1, green2 (high gain)=G2) (G1 and G2 - diagonally opposite)

jp4, 4 blocks, differential HDR: red := (R-G1)/2, blue:=(B-G1)/2, green=G1, green2 (high gain)=G2)

same as for COLORMODE_JP4DIFF

set huffman table 0 for the "base color"

set huffman table 0 for the HDR color

Spectral selection start

Spectral selection end

Successive approximation (2 values 0..13)

JPEG header length

Definition at line 162 of file jpeghead.c.

References COLORMODE_COLOR, COLORMODE_COLOR20, COLORMODE_JP4, COLORMODE_JP46, COLORMODE_JP46DC, COLORMODE_JP4DC, COLORMODE_JP4DIFF, COLORMODE_JP4DIFF2, COLORMODE_JP4HDR, COLORMODE_JP4HDR2, COLORMODE_MONO4, COLORMODE_MONO6, huff_tables_t::dht_ac0, huff_tables_t::dht_ac1, huff_tables_t::dht_dc0, huff_tables_t::dht_dc1, get_qtable(), HEADER_COPY_SOF, HEADER_COPY_SOS, huff_tables_t::header_huffman_tables, huff_tables, MDF17, MDF18, memcpy(), params, and printk.

Referenced by jpeghead_lseek().

int qtables_create ( struct interframe_params_t params,
unsigned char *  buf 
)

just copy two quantization tables for the current frame (for the RTP streamer)

Parameters:
params pointer to an array of parameters stored for the frame
buf buffer to put the header to
Returns:
header length if successful, <0 - error

will copy both quantization tables

bad quality table

Definition at line 150 of file jpeghead.c.

References get_qtable(), MDF18, params, and printk.

Referenced by jpeghead_lseek().


Variable Documentation

unsigned long* ccam_dma_buf_ptr

Without "static" system hangs after "Uncompressing Linux...

Definition at line 240 of file circbuf.c.


Generated on Fri Nov 28 00:08:06 2008 for elphel by  doxygen 1.5.1