ijg_example.c File Reference


Detailed Description

IJG JPEG decoder example.

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

Definition in file ijg_example.c.

#include "string.h"
#include "board.h"
#include "sdramc.h"
#include "intc.h"
#include "gpio.h"
#include "print_funcs.h"
#include "usart.h"
#include "et024006dhu.h"
#include "power_clocks_lib.h"
#include "delay.h"
#include "jpeg_decoder.h"
#include "jpegfile.h"

Go to the source code of this file.

Functions

int main (void)

Variables

pcl_freq_param_t pcl_freq_param
const U8 * stream_jpeg_src_ptr
U16 stream_src_size


Function Documentation

int main ( void   ) 

Definition at line 157 of file ijg_example.c.

References jpeg_lib_decode_ex(), jpeg_lib_exit(), jpeg_lib_init(), jpegdata, pcl_freq_param, stream_jpeg_src_ptr, and stream_src_size.

00158 {
00159     et024006_color_t const *picture_ptr;
00160 
00161     // Set CPU and PBA clock
00162     pcl_configure_clocks(&pcl_freq_param);
00163 
00164     // Initialize delay module
00165     delay_init(pcl_freq_param.cpu_f);
00166     
00167   // Initialize usart communication
00168     init_dbg_rs232(pcl_freq_param.pba_f);
00169     
00170   // Initialize TFT display
00171     et024006_Init( pcl_freq_param.cpu_f, pcl_freq_param.cpu_f );
00172 
00173     sdramc_init(pcl_freq_param.cpu_f);
00174 
00175     // Enable back-light
00176     #if BOARD == EVK1105
00177     /* PWM is fed by PBA bus clock which is by default the same
00178      * as the CPU speed. We set a 0 duty cycle and thus keep the
00179      * display black*/
00180     tft_bl_init();
00181         /* Lets do a nice fade in by increasing the duty cycle */
00182         while(pwm_channel6.cdty < pwm_channel6.cprd)
00183         {
00184           pwm_channel6.cdty++;
00185           pwm_channel6.cupd = pwm_channel6.cdty;
00186           //pwm_channel6.cdty--;
00187           pwm_async_update_channel(AVR32_PWM_ENA_CHID6, &pwm_channel6);
00188           delay_ms(10);
00189         }
00190     #elif BOARD == EVK1104 || BOARD == UC3C_EK 
00191     gpio_set_gpio_pin(ET024006DHU_BL_PIN);
00192     #endif
00193 
00194     // Clear the display: make it blue
00195     et024006_DrawFilledRect(0,0,ET024006_WIDTH,ET024006_HEIGHT,0x2458 );
00196 
00197     print_dbg("\x1B[2J\x1B[HDecoding JPEG image...\n");
00198 
00199     if (!jpeg_lib_init())                       // JPEG IJG lib initialization
00200     {
00201         print_dbg("\n\r Decoder Initialization failed");
00202         while (1);
00203     }
00204     // JPEG stream definition
00205     stream_jpeg_src_ptr = jpegdata;
00206     stream_src_size = sizeof jpegdata/sizeof jpegdata[0];
00207 
00208     // main decoder
00209     U16 width;
00210     U16 height;
00211 
00212     while(1)
00213     {
00214         width= 320;
00215         height= 240;
00216         picture_ptr = (et024006_color_t const *)jpeg_lib_decode_ex(0, &width, &height);
00217         et024006_PutPixmap( picture_ptr, 320, 0, 0, 0, 0, 320, 240 );
00218         delay_ms(2000);
00219         width= 160;
00220         height= 120;
00221         picture_ptr = (et024006_color_t const *)jpeg_lib_decode_ex(0, &width, &height);
00222         et024006_PutPixmap( picture_ptr, 160, 0, 0, 0, 0, 160,120 );
00223         et024006_PutPixmap( picture_ptr, 160, 0, 0, 160, 0, 160, 120 );
00224         et024006_PutPixmap( picture_ptr, 160, 0, 0, 0, 120, 160, 120 );
00225         et024006_PutPixmap( picture_ptr, 160, 0, 0, 160, 120, 160, 120 );
00226         delay_ms(500);
00227         et024006_PutPixmap( picture_ptr, 160, 0, 0, 80, 60, 160, 120 );
00228         delay_ms(2000);
00229     }
00230     jpeg_lib_exit();                            // JPEG IJG lib out
00231 }


Variable Documentation

pcl_freq_param_t pcl_freq_param

Initial value:

{
   .cpu_f  =       60000000         
,  .pba_f    =     60000000         
,  .osc0_f     =   FOSC0            
,  .osc0_startup = OSC0_STARTUP     
}

Definition at line 104 of file ijg_example.c.

Referenced by main().

Definition at line 101 of file ijg_example.c.

Referenced by main(), and stream_read().

Definition at line 102 of file ijg_example.c.

Referenced by main(), and stream_read().


Generated on Fri Feb 19 02:31:01 2010 for AVR32 - IJG JPEG Decoder Example by  doxygen 1.5.5