1 / 33

OSD tutorial

OSD tutorial. Joshua, 2005.3.2. Outline. Introduction Bmp format, OSD, OSD header, palette, image data New OSD driver Five W, structure and functions overview Debug method Some programming issues Style, skills Summary. Introduction. An BMP file

natan
Download Presentation

OSD tutorial

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. OSD tutorial Joshua, 2005.3.2

  2. Outline • Introduction • Bmp format, OSD, OSD header, palette, image data • New OSD driver • Five W, structure and functions overview • Debug method • Some programming issues • Style, skills • Summary

  3. Introduction • An BMP file • An image format that only defines an image in terms of black and white.(one color) • A bitmapped image is also known as a 1-bit image.

  4. Introduction • Single color is not enough for us. (why many?) • 1-bit one pixel (1-color) • 2-bits one pixel (4-color) • 4-bits one pixel (16-color) • 8-bits one pixel (256-color) • 24-bits one pixel (true-color)

  5. Introduction • BMP file format • Header • File size and offset to image data(bytes) • Info header • Width, height, and color format • Optional palette • Color palette • Image data

  6. Introduction • An on-screen display(OSD) is a control panel on a screen of computer monitor, television or DVD player, that allows you to select viewing options or adjust components of the display, such as brightness, contrast, etc. • In DVD player, OSD Mainly used in • Show playback state • Title and track number & time • System menu( setup, program, eq … )

  7. OSD memory

  8. OSD header Link_data: 32-byte unit Link_next: 32-byte unit H_size: 32-bit unit V_size: pixel unit

  9. Color palette

  10. 1-color bitmap 1=>font color => __palette4F(0x0,0x0,0xff,0xff) 0=>background color =>__palette4F(0x0,0x0,0x0,0xff)

  11. 16-color bitmap

  12. 16-color bitmap 16-color format, 4 bits represent one color index of one pixel

  13. Outline • Introduction • Bmp format, OSD header, palette, bitmap • New OSD driver • Five W, structure and functions overview • Some programming issues • Style, skills • Summary

  14. New OSD driver • Why • Easy maintain, reuse-functions, code size • What • An interface to control OSD hardware • When • Check in VSS on Feb 4 2005 • Where • OSD folder • Who • Joshua

  15. New OSD driver • Structure overview OSD Osd3. c osd_customers.c Osd_hw.c Osd_palette.c Osd_draw.c osd_pal_rgb_32b.c Osd_api.h osd_pal_rgb_32b.h Osd_palette.h

  16. New OSD driver~How • In user_init.h, #define NEW_OSD_DRIVER • Functions review • int osd_set_region_position(); • int osd_draw_rectangle(); • int osd_draw_horizontal_line(); • int osd_draw_vertical_line(); • void osd_draw_rectangle_border(); • void osd_draw_button_border(); • void osd_draw_font_bitmap(); • int osd_draw_bmp();

  17. Functions review • Int osd_set_region_position (UINT8 region_index, UINT16 x, UINT16 y) • Purpose • 改變region在畫面中的位置 • Note • Y 是指interlace mode 中的Y座標 • 改變region位置後,如何知道region顯示順序?

  18. Functions review • Int osd_draw_rectangle (coordinate *start, dimension *in_dimension, UINT16 color, UINT8 region_index); • Purpose • 在某region中,畫一個長方形 • Note • 需傳入兩個位置,各別指向start, in_dimension這兩個結構變數

  19. Functions review • Int osd_draw_horizontal_line (UINT16 start_x, UINT16 end_x,UINT16 y, UINT16 color, UINT16 width, UINT8 region_index) • Purpose • 在某region中,畫一條直線 • Note • Width指直線的粗細 • osd_draw_vertical_line() is the same with this function

  20. Functions review • Int osd_draw_rectangle_border (coordinate *start, dimension *in_dimension, UINT16 line_width, UINT16 color, UINT8 region_index) • Purpose • 在某region中,畫某長方形的邊框 • Note • line_width指邊框的粗細

  21. Functions review • Int osd_draw_button_border (coordinate *start, coordinate *end, int bDown, unsigned mask, UINT8 region_index) • Purpose • 在某region中,畫某按鈕的邊框 • Note • bDown 判斷按鈕是否被按下 • Mask 判斷上下左右是否都要畫邊

  22. Functions review • Int osd_draw_font_bitmap (const UINT8* pFont, coordinate *start, dimension *in_dimension, font_palette *palette, UINT8 region_index) • Purpose • 在某region中,畫某字串 • Note • pFont 是指bmp array中image data的起頭 (需跳過前幾個byte) • 需傳入三個位置,各別指向start, in_dimension, palette 這三個結構變數

  23. Functions review • Int osd_draw_bmp (coordinate *start, const BYTE* bmp, BYTE region_index) • Purpose • 在某region中,畫某bmp圖檔 • Note • Bmp指的是此bmp array的始頭 (和osd_draw_font_bitmap不同) (第一個byte是指bmp長度,第二個byte是指bmp高度)

  24. Outline • Introduction • Bmp format, OSD header, palette, bitmap • New OSD driver • Five W, structure and functions overview • Debug method • Some programming issues • Style, skills • Summary

  25. Debug method • Osd • Check display-order of all regions • E.g. mon> osd • Region display-order is as follows: • Region[0]: (x,y)=( 26, 20) (width,height)=(608, 24) • Region[1]: (x,y)=( 32, 34) (width,height)=(576, 24) • Region[2]: (x,y)=( 32, 46) (width,height)=(576, 24)

  26. Debug method • Osd region %d • Check detail information of one region • E.g. mon> osd region 0 • header 0 => 81 (cu=1, ft=0, pr=0, md=1) • header 1 => FF (shade=15, blend=15) • header 2 => 68 (ct=1, rgb=1, swp=0,shd=1) • region x => 26 (pixel) • region y => 20 (pixel) • region width => 304 (byte) • region visible width => 608 (pixel) • region height => 24 (pixel)

  27. Debug method • Osd palette %d • Check palette of one region • E.g. mon> osd palette 0 • CLUT [G B R Alpha] • [ 0] [96 D2 8D E0] • [ 1] [ A A A FF] • [ 2] [F3 F3 F3 FF] • [ 3] [84 84 84 F0] • [ 4] [ A FF 16 FF] • [ 5] [A3 46 FF C0] • [ 6] [B3 FF 88 E0] • [ 7] [FF 0 FF FF] • [ 8] [B4 2B 15 FF] • [ 9] [B4 2C 8E FF] • [ 10] [FF FF FF FF] • [ 11] [ 0 46 0 FF] • [ 12] [1E 1E F5 FF] • [ 13] [D1 C9 2F E0] • [ 14] [C0 C0 C0 E0] • [ 15] [80 80 80 0]

  28. Outline • Introduction • Bmp format, OSD header, palette, bitmap • New OSD driver • Five W, structure and functions overview • Debug method • Some programming issues • Style, skills • Summary

  29. Some programming issues • Programming style • *.h files • It is created to be included by other files. • Using ( #ifndef ... #define ... #endif ) in .h file to avoid recursively including this .h file • Compile error, redefinition of “…” • Don’t put variable/function in *.h ( eg: osd_pal_32b.h) • put instances in *.c and references in *.h

  30. Some programming issues • An error example(osd_pal_32b.h) A include osd_pal_32b.h B include osd_pal_32b.h Multiple definition error(linking)

  31. Some programming issues • Programming style • *.c files • Don’t arbitrarily use keyword, extern, to access variable/function • Include *.h where necessary references are. • Using conditional #define to output debug message • For example, osd_draw.c

  32. Outline • Introduction • Bmp format, OSD header, palette, bitmap • New OSD driver • Why, what, when, where, how • Some programming issues • Style, skills • Summary

  33. Summary • Welcome to use OSD driver frequently. • Away from osd hardware • Reuse function and code size • Easy maintain • Focus on GUI program logics • Simple and clear equal to better

More Related