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

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

Go to the source code of this file.

Functions

void init_qtable_head_cache (void)
 initialization of quantization tables (direct - JPEG header ones) cache
TODO: add init_qtable_head_cache to module initialization
int get_qtable (int quality2, unsigned char *y_tab, unsigned char *c_tab)
 calculates a pair of direct (JPEG header) tables for the specified quality (2-bytes )
void init_qtable_fpga (void)
 initialization of quantization tables (reverse, for the FPGA) cache
TODO: add init_qtable_fpga to module initialization
int set_qtable_fpga (int quality2)
 Finds an already programmed FPGA page or calculates (an programms FPGA with) a new one.
void reset_qtables (void)
 force (re-)initilaization of quantization tables cache and FPGA qunatization table (in FPGA) when next used.


Detailed Description

Definition in file quantization_tables.h.


Function Documentation

int get_qtable ( int  quality2,
unsigned char *  y_tab,
unsigned char *  c_tab 
)

calculates a pair of direct (JPEG header) tables for the specified quality (2-bytes )

Parameters:
quality2 single byte (standard) or a pair of bytes (see file header description)
y_tab caller-provided pointer to a 64-byte Y (intensity) quantization table (NULL - don't copy)
c_tab caller-provided pointer to a 64-byte C (color) quantization table (NULL - don't copy)
Returns:
0 - cache hit, 1 - cache miss (recalculated), -1 - invalid quality

look if such q value is already in cache

End of cache?

yes, re-use the LRE slot

no, hit or never used so far, and not the first - anyway use this slot

bypass this

this points to the old mre

this is now mre

is it a hit or a miss?

miss, calculate the table and save it to cache first

Safety limit on quality factor. Convert 0 to 1 to avoid zero divide.

The basic table is used as-is (scaling 100) for a quality of 50. Qualities 50..100 are converted to scaling percentage 200 - 2*Q; note that at Q=100 the scaling is 0, which will cause jpeg_add_quant_table to make all the table entries 1 (hence, minimum quantization loss). Qualities 1..50 are converted to scaling percentage 5000/Q.

limit the values to the valid range

now table pair is calculated and stored in cache

copy tables to the output

Definition at line 193 of file quantization_tables.c.

References D14, D1I, flags, init_qtable_head_cache(), local_irq_restore, local_irq_save, MDF14, MDF15, memcpy(), printk, qtable_cache, qtable_cache_initialized, qtable_cache_mre, qtable_cache_next, qtable_cache_values, QTABLE_HEAD_CACHE, QTABLE_SIZE, and std_quant_tbls.

Referenced by jpegheader_create(), and qtables_create().

void init_qtable_fpga ( void   ) 

initialization of quantization tables (reverse, for the FPGA) cache
TODO: add init_qtable_fpga to module initialization

needs to turn off IRQ

Definition at line 288 of file quantization_tables.c.

References D1I, flags, FPGA_NQTAB, local_irq_restore, local_irq_save, MDF14, printk, qtable_fpga_initialized, qtable_fpga_mre, qtable_fpga_next, and qtable_fpga_values.

Referenced by set_qtable_fpga().

void init_qtable_head_cache ( void   ) 

initialization of quantization tables (direct - JPEG header ones) cache
TODO: add init_qtable_head_cache to module initialization

needs to turn off IRQ

undefined

last value is invalid, but that's OK - it should not be used

Definition at line 171 of file quantization_tables.c.

References D1I, flags, local_irq_restore, local_irq_save, MDF, printk, qtable_cache_initialized, qtable_cache_mre, qtable_cache_next, qtable_cache_values, and QTABLE_HEAD_CACHE.

Referenced by get_qtable().

void reset_qtables ( void   ) 

force (re-)initilaization of quantization tables cache and FPGA qunatization table (in FPGA) when next used.

Definition at line 161 of file quantization_tables.c.

References qtable_cache_initialized, and qtable_fpga_initialized.

Referenced by image_acq_init().

int set_qtable_fpga ( int  quality2  ) 

Finds an already programmed FPGA page or calculates (an programms FPGA with) a new one.

Parameters:
quality2 single byte (standard) or a pair of bytes (see file header description)
Returns:
table page number used (0..7) or -1 - invalid q

look if such q value is already in cache

NOTE: never

End of cache?

yes, re-use the LRE slot

NOTE: never

no, hit or never used so far, and not the latest - anyway use this slot

bypass this

this points to the old mre

this is now mre

NOTE: never

is it a hit or miss?

miss, calculate the table and send it to the FPGA

Safety limit on quality factor. Convert 0 to 1 to avoid zero divide.

The basic table is used as-is (scaling 100) for a quality of 50. Qualities 50..100 are converted to scaling percentage 200 - 2*Q; note that at Q=100 the scaling is 0, which will cause jpeg_add_quant_table to make all the table entries 1 (hence, minimum quantization loss). Qualities 1..50 are converted to scaling percentage 5000/Q.

limit the values to the valid range

now table pair is calculated and stored in cache

copy tables to the FPGA

Definition at line 307 of file quantization_tables.c.

References CX313_FPGA_TABLES_QUANT, D14, D15, D1I, flags, FPGA_NQTAB, fpga_table_write_nice(), init_qtable_fpga(), local_irq_restore, local_irq_save, MDF14, MDF15, printk, qtable_fpga_initialized, qtable_fpga_mre, qtable_fpga_next, qtable_fpga_values, QTABLE_SIZE, and std_quant_tbls.

Referenced by pgm_quality().


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