BITMAP FILE & T-ENGINE

Preview:

DESCRIPTION

BITMAP FILE & T-ENGINE. Prepared by: HỒ HOÀNG NGUYÊN - 50701616 LÊ HỮU KHÔI NGUYÊN - 50701619. 2. 1. Bitmap’s structure. How to load a bitmap file on T-engine. Contents. 1. Bitmap’s structure. BITMAP FILE & T-ENGINE. Presented by Ho Hoang Nguyen. Bitmap’s Structure. - PowerPoint PPT Presentation

Citation preview

BITMAP FILE & T-ENGINE

Prepared by:HỒ HOÀNG NGUYÊN - 50701616LÊ HỮU KHÔI NGUYÊN - 50701619

Ứng dụng hệ thống nhúngNhóm 1 – Bitmap File

Contents

Bitmap’s structure1

How to load a bitmap file on T-engine2

Ứng dụng hệ thống nhúng

BITMAP FILE & T-ENGINE

Presented by Ho Hoang Nguyen

Nhóm 1 – File bitmap

Bitmap’s structure1

Bitmap’s Structure

Uncompressed standard image file format by Microsoft

Color depth of 1, 4, 8, 16, 24, 32, 48, or 64 bits per pixel

Little-endian.Có nhiều phiên bản định dạng BMP.Version 1.x, 2.x, 3.x

Nhóm 1 – Bitmap File Ứng dụng hệ thống nhúng

Ứng dụng hệ thống nhúng

Bitmap’s Structure

Nhóm 1 – File bitmap

File Header: 14 bytesBitmap Header: 40 bytesColor Palette:Bitmap Data:

File HeaderBitmap HeaderColor PaletteBitmap Data

Ứng dụng hệ thống nhúng

File Header(14 bytes)

Signature: 2 bytes, always ‘BM’ (4D42h)File size: 4 bytes Reserved: 4 bytes, always 0Data offset: 4 bytes, starting position of

image data in bytes

Nhóm 1 – File bitmap

Ứng dụng hệ thống nhúng

Bitmap Header

Size: 4 bytes, size of this header in bytesWidth: 4 bytes, image width in pixelsHeight: 4 bytes, image height in pixelsPlanes: 2 bytes, number of color planes

(usual 1) Bitcount: 2 bytes, number of bits per pixel.

Colours in Bitmap file = 2Bitcount

Nhóm 1 – File bitmap

Ứng dụng hệ thống nhúng

Bitmap Header(cont)

Compression: 4 bytes = 0: the data is uncompressed = 1: the 8-bit RLE(Run Length Encoding)

algorithm was used = 2: the 4-bit RLE algorithm was used

Image Size: the size of the stored bitmap in bytes. This value is typically zero when the bitmap

data is uncompressed

Nhóm 1 – File bitmap

Ứng dụng hệ thống nhúng

Bitmap Header(cont)

XpixelsPerM: 4 bytes horizontal resolutions of the bitmap in pixels per meter

YpixelsPerM: 4 bytes vertical resolutions of the bitmap in pixels per meter.

ColorsUsed: 4 bytes, the number of colors present in the palette

ColorsImportant: 4 bytes , the number of significant colors in the palette

Nhóm 1 – File bitmap

Ứng dụng hệ thống nhúng

Color Palette

When Bitcount ≤ 8 (256 colors), Arranged in order of importance of each

elementSize = 4 bytes * elements. Each element of the palette is three bytes

in length: Red: 1 byte Green: 1 byte Blue:1 byte Reserve: 1 byte, always 0

Nhóm 1 – File bitmap

Ứng dụng hệ thống nhúng

Bitmap Data

Depend on BitCount and bit compression.Pixels are stored from the bottom up and

from left to rightAdd 0 to be full in 32 bitsNo compression => each pixel’s line has

fix length. Màu Pixel’s line= 0 => 1st of Color PalettePixel’s line= 255 => 256th of Color PalettePixel’s line>255 => this bitmap file

doesn’t use Color PaletteNhóm 1 – File bitmap

Ứng dụng hệ thống nhúng

Bitmap Data(cont)

BitCount =1 and compression = 0 1 byte => 8 pixels 2 colors: black and white Add 3 bytes 0 => 32 bits

BitCount =4 and compression = 0 1 byte => 2 pixels 16 colors Add 3 bytes 0 =>32 bits

Nhóm 1 – File bitmap

Ứng dụng hệ thống nhúng

Bitmap Data(cont)

BitCount =8 and compression = 0 1 byte => 1 pixel 256 colors Add 3 bytes 0 => 32 bits

BitCount =24 and compression = 0 4 bytes => 1 pixel No color palette

Nhóm 1 – File bitmap

Ứng dụng hệ thống nhúng

Bitmap data(cont)

BitCount =4 và compression = 2

Nhóm 1 – File bitmap

Byte 1(n) Byte 2(c) Description

>0 Any Compress n pixelsPixel 1,3,5… = 4 highbit of cPixel 2,4,6… = 4 lowbit of c

0 0 End line

0 1 End file bitmap

0 2 The next 2 bytes mean move to right x pixels and up y pixels.

0 >=3 Next c bytes perform 2c pixelsAdd 0 => 16 bits

Ứng dụng hệ thống nhúng

Bitmap data(cont)Compression Data Non compression Data03 04 0 4 005 06 0 6 0 6 000 06 45 56 67 00 4 5 5 6 6 704 78 78 7800 02 05 01 Move to right 5 pixels and up 1

pixel

00 00 End line09 1E 1 E 1 E 1 E 1 E 100 01 End file bitmap

Nhóm 1 – File bitmap

Ứng dụng hệ thống nhúng

Bitmap data(cont)

BitCount =8 và compression = 1

Nhóm 1 – File bitmap

Byte 1(n) Byte 2(c) Description

>0 Any n pixels with color c

0 0 End line

0 1 End file bitmap

0 2 The next 2 bytes mean move to right x pixels and up y pixels

0 >=3 Next c byte perform c pixelAdd 0 => 16 bits

Ứng dụng hệ thống nhúng

Bitmap data(cont)

Nhóm 1 – File bitmap

Compression Data Non compression Data03 04 04 04 0405 06 06 06 06 06 0600 06 45 56 67 00 45 56 6704 78 78 78 78 7800 02 05 01 Move to right 5 pixels and up 1

pixel

00 00 End line09 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E00 01 End file bitmap

Ứng dụng hệ thống nhúng

BITMAP FILE & T-ENGINE

Presented by Le Huu Khoi Nguyen

Nhóm 1 – File bitmap

How to load a bitmap file on T-engine2

How to load a bitmap file on T-Engine

Analyses: Subsystem UNIX Emulator (provided by

T-Kernel Extension) devotes specific functions for browsing and reading files in CF card (SYSDISK).

The main task (bmp_task) will be responsible for controlling the SCREEN device and initializing bmpialization screen.

Nhóm 1 – File bitmap Ứng dụng hệ thống nhúng

How to load a bitmap file on T-Engine

Flowchart:

Nhóm 1 – File bitmap Ứng dụng hệ thống nhúng

Ứng dụng hệ thống nhúng

bmp_task

Nhóm 1 – File bitmap

Ứng dụng hệ thống nhúng

bmp_task

Nhóm 1 – File bitmap

Open SCREEN device

Ứng dụng hệ thống nhúng

bmp_task

Nhóm 1 – File bitmap

Read device in specific image area

Ứng dụng hệ thống nhúng

bmp_task

Nhóm 1 – File bitmap

Color map setting

Ứng dụng hệ thống nhúng

bmp_task

Nhóm 1 – File bitmap

Init bmpialize screen

bmp_task

Nhóm 1 – File bitmap Ứng dụng hệ thống nhúng

Close SCREEN device

Terminate & delete bmp_task

How to load a bitmap file on T-Engine

So far, we learnt about the structure of a bitmap file: Bitmap File Header Bitmap Infor Header Colour Pallette (Optional) Data Image

• Certainly, we need to define some structures for future use.

Nhóm 1 – File bitmap Ứng dụng hệ thống nhúng

How to load a bitmap file on T-Engine

Bitmap File Header

Ứng dụng hệ thống nhúngNhóm 1 – File bitmap

How to load a bitmap file on T-Engine

Bitmap Info Header

Ứng dụng hệ thống nhúngNhóm 1 – File bitmap

Major functions for reading and loading a bitmap file

int charArray2Int:

Ứng dụng hệ thống nhúngNhóm 1 – File bitmap

Major functions for reading and loading a bitmap file

void show_BMP:

Ứng dụng hệ thống nhúngNhóm 1 – File bitmap

Major functions for reading and loading a bitmap file

unsigned long ** read_BMP:

Ứng dụng hệ thống nhúngNhóm 1 – File bitmap

unsigned long ** read_BMP

Open File:

Ứng dụng hệ thống nhúngNhóm 1 – File bitmap

unsigned long ** read_BMP

Read BMFH:

Ứng dụng hệ thống nhúngNhóm 1 – File bitmap

unsigned long ** read_BMP

Read BMIH:

Ứng dụng hệ thống nhúngNhóm 1 – File bitmap

unsigned long ** read_BMP

Calculate the pad based on bitcount:

Ứng dụng hệ thống nhúngNhóm 1 – File bitmap

unsigned long ** read_BMP

Calculate the pad based on bitcount:

Ứng dụng hệ thống nhúngNhóm 1 – File bitmap

unsigned long ** read_BMP

Calculate the pad based on bitcount:

Ứng dụng hệ thống nhúngNhóm 1 – File bitmap

unsigned long ** read_BMP

Update pixels’ value:

Ứng dụng hệ thống nhúngNhóm 1 – File bitmap

unsigned long ** read_BMP

Update pixels’ value:

Ứng dụng hệ thống nhúngNhóm 1 – File bitmap

unsigned long ** read_BMP

Update pixels’ value:

Ứng dụng hệ thống nhúngNhóm 1 – File bitmap

How to load a bitmap file on T-Engine

How about GIF, JPEG format??

Ứng dụng hệ thống nhúngNhóm 1 – File bitmap

REFERENCE

T-Engine/SH7760 Development Kit, T-Kernel specification. T-Engine/ SH7760 Development Kit, Device driver manager. T-Engine/ SH7760 Development Kit Manual. Personal Media Corporation: Sample Programs Nguyên Hoang Anh, Vu Tuân Thanh, Nguyên Pham Anh

Khoa, “Tim hiêu va phat triên ưng dung trên thiêt bi T-Enigne SH7760”, Luân Văn Đai Hoc.

Nguyên Thi Thanh Truc, “Hiên thưc chương trinh Paint trên thiêt bi T-Engine SH7760”, Luân Văn Đai Hoc.

http://www.t-engine.org http://tronweb.super-nova.co.jp http://www.personal-media.co.jp/te/en/tekit.html

Ứng dụng hệ thống nhúngNhóm 1 – File bitmap

Recommended