Title: Dal A Multimedia Software Library
1Dalí A Multimedia Software Library
- Wei Tsang Ooi
- Brian Smith, Hsi Haye Chan, Matthew Chiu, Sugata
Mukhopadhyay, Dan Rubinovitz, Jiesang Song, Steve
Weiss.
2Motivations
3Current Software Solution
4MPEG to RealVideo
OpenFile(f) GetNextFrame()
BlackBox
Real Video Encoder
RGB
MPEG
Real
5MPEG to RealVideo
OpenFile(f) GetNextFrame()
YUV to RGB
RGB to YUV
RGB
YUV
YUV
Decoder
Encoder
compressed data
Real
MPEG
6MPEG to RealVideo
YUV to RGB
RGB to YUV
YUV
Decoder
Encoder
compressed data
Real
MPEG
7Decode I-Frame only
OpenFile(f) GetNextFrame()
BlackBox
?
RGB
MPEG
8Decode I-Frame only
OpenFile(f) GetNextFrame()
?
YUV to RGB
RGB
YUV
Decoder
compressed data
MPEG
9Decode I-Frame only
?
YUV to RGB
RGB
Decoder
I-frames
I Frame filter
compressed data
MPEG
10Others Motivations..
BlackBox
- Read from network ?
- Tune I/O ?
- Run on handheld ?
11Current Software Solution
12Dalí is in between..
BlackBox
Dalí
C Source
13Example
14Example
- Process a subset of the gray scale version of
each I-frame
15MPEG structures
16What we want to do
17What we want to do
- parse sequence header
- while not eof do- find parse picture header
18What we want to do
- parse sequence header
- while not eof do- find parse picture header-
if it is an I-frame then - parse the picture
into DCT domain - IDCT into spatial domain
19What we want to do
- parse sequence header
- while not eof do- find parse picture header-
if it is an I-frame then - parse the picture
into DCT domain - IDCT into spatial domain -
take the gray scale version of the frame and
process it
20Abstractions
21Abstractions
- For input/output
- For representing elements in MPEG
- For storing images in DCT domain
- For storing images in spatial domain
22BitStream BitParser
BitStream
File
23 MPEG Headers
MpegGopHdr
MpegSeqHdr
MpegPicHdr
Picture Data
24 Find
MpegGopHdr
MpegSeqHdr
MpegPicHdr
Picture Data
25 Skip
MpegGopHdr
MpegSeqHdr
MpegPicHdr
Picture Data
26 Dump
MpegGopHdr
MpegSeqHdr
MpegPicHdr
Picture Data
MpegGopHdr
27Parse
MpegGopHdr
MpegSeqHdr
MpegPicHdr
Picture Data
width 320height 240pic rate 30 fps
etc
28 Encode
MpegSeqHdr
width 320height 240pic rate 30 fps
etc
29ScImage
ScBlock - short dc char
index63 int ac63
represents 8x8 pixels
30ByteImage
unsigned char 0..255
represents a pixel
31The Code
32Example
MpegSeqHdr seqHdr MpegSeqHdrNew () MpegPicHdr
picHdr MpegPicHdrNew () BitStream bs
BitStreamNew (65536)
BitStream
33Example
BitParser bp BitParserNew () BitParserAttach
(bp, bs)
BitStream
BitParser
34Example
BitStreamReadFromFile (bs, f, 0)
BitStream
File
BitParser
35Example
MpegSeqHdrFind (bp)
MpegSeqHdr
MpegGopHdr
MpegPicHdr
BitParser
36Example
MpegSeqHdrParse (bp, seqHdr) w (seqHdr-gtwidth
7)/8 h (seqHdr-gtheight 7)/8
MpegSeqHdr
MpegGopHdr
MpegPicHdr
BitParser
37Example
ScImage y ScNew (w, h) ScImage u ScNew
(w/2, h/2) ScImage v ScNew (w/2, h/2)
y
u
v
38Example
status MpegPicHdrFind (bp) while (status !
NOT_FOUND) MpegPicHdrParse (bp, picHdr)
status MpegPicHdrFind (bp)
39Example
status MpegPicHdrFind (bp) while (status !
NOT_FOUND) MpegPicHdrParse (bp, picHdr)
if (picHdr-gttype I_FRAME)
status MpegPicHdrFind (bp)
40Example
status MpegPicHdrFind (bp) while (status !
NOT_FOUND) MpegPicHdrParse (bp, picHdr)
if (picHdr-gttype I_FRAME)
MpegPicIParse ( bp,seqHdr,picHdr,
scy,scu,scv)
status MpegPicHdrFind (bp)
41Example
status MpegPicHdrFind (bp) while (status !
NOT_FOUND) MpegPicHdrParse (bp, picHdr)
if (picHdr-gttype I_FRAME)
MpegPicIParse ( bp,seqHdr,picHdr,
scy,scu,scv)
BitStreamFill(bp, f) status
MpegPicHdrFind (bp)
42Refill the BitStream
BitParser
43Refill the BitStream
BitParser
44Refill the BitStream
File
BitParser
45Memory Mapped BitStream
bs BitStreamMMapReadNew(tennis.mpg)
File
46Operate on a subset
47Physical ByteImage
width 8 height 6x 0y 0 parentWidth
8 isVirtual 0firstByte
48Virtual ByteImage
width 5 height 4x 1y 1 parentWidth
8 isVirtual 1firstByte
49Example
ScImage virt ScClip (y,6,2,20,20)
6
20 blocks
50Example
ScImage virt ScClip (y,6,2,20,20) ByteImage
byte ByteNew (160, 160) ScToByte (virt, byte)
6
20 blocks
51Implementation
52Implementation
- C library
- Tcl bindings available
53Organization
- Code are organized into packages
- Basic
- ByteImage, ScImage, etc.
- MPEG
- MPEG-1 Video/Audio/System
- Vision
- Useful vision routines
54Other Packages
55Availability
- http//www.cs.cornell.edu/dali
- open source
- binaries for linux/win32/sunos
- examples
- documentations
56The End