annotate DOCS/tech/osd.txt @ 9110:7924a60d833b

This is a simple patch to change the alpha blending code in bmovl to use integers instead of floating point. It speeds it up by about 400% meaning that it's now possible to apply alpha blending to a whole 1024x768 image on my 1266MHz PIII. Jonas Jensen <jbj@knef.dk>
author arpi
date Sun, 26 Jan 2003 17:42:24 +0000
parents 9243e8988e0f
children 6e35326c742f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5581
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
1 some draft of new osd engine:
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
2 =============================
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
3 written by A'rpi
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
4 including ideas from maillist from Jiri Svoboda, Tobias Diedrich, Artur Zaprzala
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
5 Michael Niedermayer, Felix Buenemann, LGB
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
6
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
7 requirements:
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
8 - be able to do partial rendering, within a given bounding box
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
9 usefull, when parts of osd are outside of teh image and has to be
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
10 updated only when osd changes, or even has different colorspace
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
11
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
12 - text should be rendered in 2-pass way: 1. alpha 2. pixels
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
13 so char's alpha won't overwrite previous char, and may be faster
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
14
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
15 - osd elements should be cached - so rendering once into the cache and
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
16 reuse this while it's unchanged
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
17
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
18 - colors support (csp could be YA, YUVA, RGB )
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
19
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
20 - change brightness, saturation, hue of chars ???
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
21
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
22 - way to disable alphablending, and use black outline (FAST_OSD now)
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
23
5591
9243e8988e0f Added aspect considerations.
atmos4
parents: 5581
diff changeset
24 - respect movie and monitor aspect, so osd is rendered/scaled correctly
9243e8988e0f Added aspect considerations.
atmos4
parents: 5581
diff changeset
25 eg. for svcd/anamorphic dvd with hardware scaling (now OSD is squashed)
9243e8988e0f Added aspect considerations.
atmos4
parents: 5581
diff changeset
26
5581
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
27 - develop some text-based apps: osdterm, osdzilla etc ;)
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
28
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
29 Ok. The basic idea of my design is using 'osd objects', a data structure
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
30 in a 1 (or 2?) way linked list.
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
31 There would be different object types, sharing type-dependent data in an
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
32 union. The basic types: box, text, symbol, progressbar, group.
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
33
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
34 Group would be a special type, grouping other osd objects together,
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
35 with a common x,y and boundingbox. usefull for grouping symbol+progrbar
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
36 or multiline subtitle text.
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
37
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
38 Each obj could have flags, for example:
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
39 - visible (set if we should display it)
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
40 - color (set if it's YUVA not YA)
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
41 - cached (set when there is a cached rendered variant)
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
42 - bbox updated (should be set when recalc bbox, reset when change params)
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
43 - several flags to control positioning. for example, x;y could be
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
44 absolute coord, or percent. flags to set left/center/right alignment...
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
45 - start and end timestamp, to automagically set/reset visible flag
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
46
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
47 ok, my first draft:
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
48
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
49 typedef struct mp_osd_obj_s {
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
50 struct mp_osd_obj_s* next;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
51 unsigned char type;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
52 unsigned char alignment; // 2 bits: x;y percents, 2 bits: x;y relative to parent; 2 bits: alignment left/right/center
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
53 unsigned short flags;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
54 int x,y; // coords
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
55 unsigned char color[4]; // YUVA
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
56 mp_osd_bbox_t bbox; // bounding box
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
57 unsigned int start,duration; // PTS
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
58 union {
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
59 struct {
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
60 int x1,y1,x2,y2;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
61 } line;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
62 struct {
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
63 int x,y,w,h;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
64 } rect;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
65 struct {
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
66 char* text;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
67 mp_font_t* font;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
68 } text;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
69 struct {
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
70 int symbol; // unicode
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
71 mp_font_t* font;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
72 } symbol;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
73 struct {
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
74 float value;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
75 mp_font_t* font;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
76 } pbar;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
77 struct {
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
78 int w,h;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
79 unsigned char* image;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
80 unsigned int* palette;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
81 } spu; // FIXME!
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
82 struct {
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
83 struct mp_osd_obj_s* children;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
84 } group;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
85 } params;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
86 } mp_osd_obj_t;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
87