560 likes | 656 Views
Dalí A Multimedia Software Library. Wei Tsang Ooi Brian Smith, Hsi Haye Chan, Matthew Chiu, Sugata Mukhopadhyay, Dan Rubinovitz, Jiesang Song, Steve Weiss. Motivations. Black Box. C Source. Current Software Solution. MPEG to RealVideo. OpenFile(f) GetNextFrame(). Black Box. Real
E N D
DalíA Multimedia Software Library Wei Tsang Ooi Brian Smith, Hsi Haye Chan, Matthew Chiu, Sugata Mukhopadhyay, Dan Rubinovitz, Jiesang Song, Steve Weiss.
BlackBox C Source Current Software Solution
MPEG to RealVideo OpenFile(f) GetNextFrame() BlackBox Real Video Encoder RGB MPEG Real
MPEG to RealVideo OpenFile(f) GetNextFrame() YUV to RGB RGB to YUV RGB YUV YUV Decoder Encoder compressed data MPEG Real
MPEG to RealVideo YUV to RGB RGB to YUV YUV Decoder Encoder compressed data MPEG Real
Decode I-Frame only OpenFile(f) GetNextFrame() BlackBox ? RGB MPEG
Decode I-Frame only OpenFile(f) GetNextFrame() ? YUV to RGB RGB YUV Decoder compressed data MPEG
Decode I-Frame only ? YUV to RGB RGB Decoder I-frames I Frame filter compressed data MPEG
Others Motivations.. • Read from network ? • Tune I/O ? • Run on handheld ? BlackBox
BlackBox C Source Current Software Solution
Dalí is in between.. BlackBox Dalí C Source
Example : • Process a subset of the gray scale version of each I-frame
sequence hdr GOP hdr picture picture pic hdr pic data MPEG structures
What we want to do parse sequence header
What we want to do parse sequence header while not eof do- find & parse picture header
What 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
What 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
Abstractions • For input/output • For representing elements in MPEG • For storing images in DCT domain • For storing images in spatial domain
BitParser BitParser BitStream & BitParser BitStream File
Parse Encode Find Skip Dump MPEG Headers MpegSeqHdr MpegGopHdr MpegPicHdr Picture Data
Parse Encode Find Skip Dump Find MpegSeqHdr MpegGopHdr MpegPicHdr Picture Data
Parse Encode Find Skip Dump Skip MpegSeqHdr MpegGopHdr MpegPicHdr Picture Data
Parse Encode Find Skip Dump Dump MpegSeqHdr MpegGopHdr MpegPicHdr Picture Data MpegGopHdr
Parse Encode Find Skip Dump Parse MpegSeqHdr MpegGopHdr MpegPicHdr Picture Data width: 320height: 240pic rate: 30 fps etc
Parse Encode Find Skip Dump Encode MpegSeqHdr width: 320height: 240pic rate: 30 fps etc
ScImage ScBlock :- { short dc; char index[63]; int ac[63];} represents 8x8 pixels
ByteImage unsigned char 0..255 represents a pixel
Example MpegSeqHdr *seqHdr = MpegSeqHdrNew (); MpegPicHdr *picHdr = MpegPicHdrNew (); BitStream *bs = BitStreamNew (65536); BitStream
Example BitParser *bp = BitParserNew (); BitParserAttach (bp, bs); BitStream BitParser
MpegSeqHdr MpegGopHdr MpegPicHdr Example BitStreamReadFromFile (bs, f, 0); BitStream File BitParser
Example MpegSeqHdrFind (bp); MpegSeqHdr MpegGopHdr MpegPicHdr BitParser
Example MpegSeqHdrParse (bp, seqHdr); w = (seqHdr->width + 7)/8; h = (seqHdr->height + 7)/8; MpegSeqHdr MpegGopHdr MpegPicHdr BitParser
Example ScImage *y = ScNew (w, h); ScImage *u = ScNew (w/2, h/2); ScImage *v = ScNew (w/2, h/2); y u v
Example status = MpegPicHdrFind (bp); while (status != NOT_FOUND) { MpegPicHdrParse (bp, picHdr); status = MpegPicHdrFind (bp); }
Example status = MpegPicHdrFind (bp); while (status != NOT_FOUND) { MpegPicHdrParse (bp, picHdr); if (picHdr->type == I_FRAME) { } status = MpegPicHdrFind (bp); }
Example status = MpegPicHdrFind (bp); while (status != NOT_FOUND) { MpegPicHdrParse (bp, picHdr); if (picHdr->type == I_FRAME) { MpegPicIParse ( bp,seqHdr,picHdr, scy,scu,scv); : } status = MpegPicHdrFind (bp); }
Example status = MpegPicHdrFind (bp); while (status != NOT_FOUND) { MpegPicHdrParse (bp, picHdr); if (picHdr->type == I_FRAME) { MpegPicIParse ( bp,seqHdr,picHdr, scy,scu,scv); : } BitStreamFill(bp, f); status = MpegPicHdrFind (bp); }
Refill the BitStream BitParser
Refill the BitStream BitParser
Refill the BitStream File BitParser
Memory Mapped BitStream bs = BitStreamMMapReadNew(“tennis.mpg”); File
* Physical ByteImage width: 8 height: 6x: 0y: 0 parentWidth: 8 isVirtual: 0firstByte
* Virtual ByteImage width: 5 height: 4x: 1y: 1 parentWidth: 8 isVirtual: 1firstByte
Example ScImage *virt = ScClip (y,6,2,20,20); 20 blocks 6
Example ScImage *virt = ScClip (y,6,2,20,20); ByteImage *byte = ByteNew (160, 160); ScToByte (virt, byte); 20 blocks 6