include
include
include
include
include
//#include
define SCREENWIDTH 800
define SCREENHEIGHT 480
define CAMERA_DEV "/dev/video1"
define DEVFILE "/dev/input/event0"
define SCREENSIZE (SCREENWIDTH * SCREENHEIGHT * BYTES_PER_PIXCEL)
define RGB888(r, g, b) (((r) & 0xff) << 16 | \
((g) & 0xff) << 8 | \
((b) & 0xff))
pthread_mutex_t mutex;
extern char *jpeg_data;
extern int fd_LCD;
extern unsigned char *rgbdata;
extern unsigned char *pfb;
int main(void)
{
int index;
int x0, y0;
extern int x;
extern int y;
extern struct jpeg_decompress_struct cinfo;
extern struct jpeg_error_mgr jerr;
//FILE *infile;
int img;
extern int i, j;
int image;
int datasize,p;
extern int width;
extern int height;
//ミューテックス取得
pthread_mutex_lock(&mutex);
//jpegをRGBに伸長
// JPEGオブジェクトの初期化
cinfo.err = jpeg_std_error( &jerr );
jpeg_create_decompress( &cinfo );
// ファイルを開く
infile = fopen( "a.jpg", "rb" );
jpeg_stdio_src( &cinfo, infile );
// ヘッダの読み込み
jpeg_read_header( &cinfo, TRUE );
// 展開の開始
jpeg_start_decompress( &cinfo );
// 幅と高さの取得
width = cinfo.output_width;
height = cinfo.output_height;
// イメージを保持するメモリ領域の確保と初期化
img = (JSAMPARRAY)malloc( sizeof( JSAMPROW ) * height );
for ( i = 0; i < height; i++ ) {
img[i] = (JSAMPROW)calloc( sizeof( JSAMPLE ), 3 * width );
}
// 全イメージデータを取得
while( cinfo.output_scanline < cinfo.output_height ) {
jpeg_read_scanlines( &cinfo,
img + cinfo.output_scanline,
cinfo.output_height - cinfo.output_scanline
);
}
// JPEGオブジェクトの破棄
jpeg_destroy_decompress( &cinfo );
// RGB化して出力
//ミューテックス開放
pthread_mutex_unlock(&mutex);
//エラー判別
if(!(*jpeg_data = malloc(datasize))){
perror("read(file)");
return -1;
}
//LCDに画像表示
pfb[(y0 + y) * SCREENWIDTH + (x0 + x)] = *p++;
//エラー判別
return -1;
}