📄 mpeg_lib.ps
字号:
269 134 moveto 1 -1 scale(4) gsave 0.000 rotate show grestore 1 -1 scale/Courier findfont 12.000 scalefont setfont289 134 moveto 1 -1 scale(5) gsave 0.000 rotate show grestore 1 -1 scale/Courier findfont 12.000 scalefont setfont309 134 moveto 1 -1 scale(6) gsave 0.000 rotate show grestore 1 -1 scale/Courier findfont 12.000 scalefont setfont329 134 moveto 1 -1 scale(7) gsave 0.000 rotate show grestore 1 -1 scale/Courier findfont 12.000 scalefont setfont349 134 moveto 1 -1 scale(8) gsave 0.000 rotate show grestore 1 -1 scale/Courier findfont 12.000 scalefont setfont189 134 moveto 1 -1 scale(0) gsave 0.000 rotate show grestore 1 -1 scale/Courier findfont 12.000 scalefont setfont249 134 moveto 1 -1 scale(3) gsave 0.000 rotate show grestore 1 -1 scale/Courier findfont 12.000 scalefont setfont209 134 moveto 1 -1 scale(1) gsave 0.000 rotate show grestore 1 -1 scale/Courier findfont 12.000 scalefont setfont229 134 moveto 1 -1 scale(2) gsave 0.000 rotate show grestore 1 -1 scale/Courier findfont 12.000 scalefont setfont369 134 moveto 1 -1 scale(9) gsave 0.000 rotate show grestore 1 -1 scale/Courier findfont 12.000 scalefont setfont184 154 moveto 1 -1 scale(10) gsave 0.000 rotate show grestore 1 -1 scale/Courier findfont 12.000 scalefont setfont184 174 moveto 1 -1 scale(20) gsave 0.000 rotate show grestore 1 -1 scale/Courier findfont 12.000 scalefont setfont184 194 moveto 1 -1 scale(30) gsave 0.000 rotate show grestore 1 -1 scale/Courier findfont 12.000 scalefont setfont184 214 moveto 1 -1 scale(40) gsave 0.000 rotate show grestore 1 -1 scale/Courier findfont 12.000 scalefont setfont184 234 moveto 1 -1 scale(50) gsave 0.000 rotate show grestore 1 -1 scale/Courier findfont 12.000 scalefont setfont184 254 moveto 1 -1 scale(60) gsave 0.000 rotate show grestore 1 -1 scale/Courier findfont 12.000 scalefont setfont184 274 moveto 1 -1 scale(70) gsave 0.000 rotate show grestore 1 -1 scale$F2psEnd%%EndDocument endTexFig 0 3428 a Fm(Figur)n(e)g(1:)30 b(Illustration)23 b(of)g(image)h(data)f(layout)g(for)g(a)h(sample)f Fc(8)e Fh(\002)f Fc(10)kFm(image.)30 b(The)23 b(number)g(at)g(each)h(pixel)f(is)03541 y(just)f(the)g(of)n(fset)g(into)g(the)g(image)h(data)g(array)-10b(.)0 3934 y Fo(4)119 b(Programming)31 b(Reference)04148 y Ff(4.1)99 b(The)25 b Fb(ImageDesc)e Ff(structure)04325 y Fm(Relevant)f(declarations:)0 4504 y Fl(typedef)51b(struct)0 4617 y({)164 4730 y(unsigned)g(char)h(red,)h(green,)f(blue;)0 4843 y(})i(ColormapEntry;)0 5068 y(typedef)d(struct)05181 y({)164 5294 y(int)107 b(Height;)706 b(/*)54 b(in)g(pixels)d(*/)164 5407 y(int)107 b(Width;)1927 5656 y Fm(6)p eop%%Page: 7 77 6 bop 164 399 a Fl(int)107 b(Depth;)761 b(/*)54 b(image)e(depth)g(\(bits\))g(*/)164 511 y(int)107 b(PixelSize;)541 b(/*)54b(bits)f(actually)e(stored)g(per)j(pixel)e(*/)164 624y(int)107 b(Size;)816 b(/*)54 b(bytes)e(for)h(whole)g(image)f(*/)164737 y(int)107 b(BitmapPad;)541 b(/*)54 b("quantum")c(of)k(a)g(scanline)d(--)j(*/)1527 850 y(/*)g(each)f(scanline)e(starts)g(on)j(an)g(even)e(*/)1527 963 y(/*)i(interval)d(of)i(this)g(many)g(bits)g(*/)1641076 y(int)107 b(ColormapSize;)164 1189 y(ColormapEntry)48b(*Colormap;)i(/*)k(an)g(array)e(of)h(ColormapSize)d(entries)h(*/)01302 y(})j(ImageDesc;)141 1461 y Fm(This)32 b(str)o(uctur)n(e)f(pr)n(ovides)g(\(hopefully\))h(all)i(the)d(information)i(needed)d(to)h(display)h(an)h(MPEG)f(str)n(eam,)0 1574 y(although)18b(it)h(doesn't)f(necessarily)g(pr)n(ovide)g(all)j(the)d(information)h(you)f(could)h(possibly)f(want)h(to)f(know)g(about)01687 y(such)j(a)i(str)n(eam.)k(However)-7 b(,)21 b(that's)g(not)g(the)g(intent)g(of)h(the)f(MPEG)g(Library;)h(if)h(you)e(r)n(eally)h(need)f(to)g(know)-8 b(,)20 b(for)0 1800 y(instance,)25 b(just)f(how)h(many)g(intra-frames)h(ar)n(e)f(in)g(a)h(particular)g(MPEG,)e(you)g(might)h(want)g(to)f(take)g(a)i(look)e(at)0 1912 y(the)e Fl(mpegstat)dFm(pr)n(ogram,)j(which)h(was)g(also)g(based)f(on)g(the)g(Berkeley)e(X1)-5 b(1)23 b(player)-7 b(.)2985 1879 y Fi(2)141 2025 yFm(Her)n(e)22 b(is)h(the)e(list)i(of)g(\002elds)f(in)h(the)f(str)o(uctur)n(e:)150 2184 y Fl(Height:)320 b Fm(the)22 b(height,)f(in)j(pixels,)e(of)g(the)g(movie.)150 2361 y Fl(Width:)375b Fm(the)27 b(width,)i(in)g(pixels,)g(of)f(the)f(movie.)45b(Note)26 b(that)i(due)f(to)g(the)h(block)g(natur)n(e)g(of)8552473 y(MPEG)23 b(encoding,)e(the)h(height)g(and)g(width)g(will)i(always)f(be)g(multiples)f(of)h(16.)150 2650 y Fl(Depth:)375b Fm(the)23 b(number)g(of)h(bits)g(per)e(pixel)i(that)f(ar)n(e)h(actually)h(r)n(elevant)f(to)f(the)g(display)-10 b(.)30b(For)855 2763 y(most)18 b(dithering)g(methods,)g(this)g(will)j(be)d(8)i(\(i.e.,)f(we)g(usually)g(use)f(an)h(8-bit)h(colour)8552875 y(map\);)j(for)g(full-colour)h(dithering,)d(it)i(will)h(be)e(24.)150 3052 y Fl(PixelSize:)155 b Fm(the)22 b(number)g(of)h(bits)g(\(not)f(bytes!\))27 b(of)c(storage)e(allocated)i(per)f(pixel.)1503228 y Fl(Size:)430 b Fm(the)29 b(size,)i(in)f(bytes,)f(of)h(one)e(entir)n(e)h(unencoded)f(frame.)49 b(This)29 b(is)g(simply)h(equal)8553341 y(to)d Fl(Height*Width*P)o(ix)o(el)o(Si)o(ze/)o(8)pFm(.)35 b(\(Note:)g(curr)n(ently)-10 b(,)28 b Fl(BitmapPad)23b Fm(is)k(ig-)855 3454 y(nor)n(ed)22 b(in)h(the)f(calculation)i(of)fFl(Size)p Fm(.\))150 3630 y Fl(BitmapPad:)155 b Fm(the)18b(\223quantum\224)i(of)e(a)i(scan)f(line;)h(i.e.,)f(each)g(scan)g(line)g(starts)f(on)g(an)h(even)f(interval)855 3743 y(of)23b(this)f(many)h(bits.)150 3919 y Fl(ColormapSize:)-10b Fm(the)34 b(number)h(of)g(entries)f(in)h(the)g(colour)g(map.)65b(This)35 b(is)g(usually)g(128,)k(but)c(for)855 4032y(most)26 b(dithering)h(methods)e(it)i(can)h(be)f(indir)n(ectly)g(modi\002ed)g(by)g(the)f(user)g(of)h(the)855 4145 y(Library)-10b(.)28 b(It)22 b(is)h(zer)n(o)f(in)i(non-colourmapped)d(modes.)1504321 y Fl(Colormap:)210 b Fm(the)25 b(table)g(used)f(to)h(map)g(pixel)g(values)h(to)f(r)n(ed/gr)n(een/blue)e(values)j(\(which)g(ar)n(e)8554434 y(themselves)d(stor)n(ed)g(as)i(bytes)e(in)i(the)fFl(ColormapEntry)19 b Fm(str)o(uctur)n(e.)33 b(It)24b(is)h Fl(NULL)855 4547 y Fm(in)e(non-colourmapped)f(modes.)04796 y Ff(4.2)99 b Fb(SetMPEGOption\(\))0 4972 y Fn(Function)21b(prototype:)141 5105 y Fl(void)53 b(SetMPEGOption)48b(\(MPEGOptionEnum)g(Option,)k(int)h(Value\))0 5256 y(Option)20b Fm(should)i(be)g(one)g(of:)p 0 5320 1560 4 v 105 5375a Fe(2)134 5407 y Fd(mpegstat)c Fj(should)g(also)g(be)h(available)g(at)h Fd(ftp://ftp.bic.mni.mcgill.ca/pub/mpeg)p Fj(.)19275656 y Fm(7)p eop%%Page: 8 88 7 bop 150 399 a Fl(MPEG)p 375 399 28 4 v 31 w(DITHER:)378b Fm(Sets)28 b(the)h(dithering)f(mode,)i(which)g(contr)n(ols)f(how)g(YCrCb)h(values)g(ar)n(e)1164 511 y(converted)19 b(to)h(RGB)h(space.)27b Fl(Value)18 b Fm(should)i(be)g(a)h Fl(DitherEnum)cFm(value,)1164 624 y(cast)23 b(to)f Fl(int)p Fm(.)k(Dithering)c(modes)f(ar)n(e)i(explained)f(above,)h(in)g(section)f(3.1.)150812 y Fl(MPEG)p 375 812 V 31 w(LUM)p 571 812 V 31 w(RANGE:)1501000 y(MPEG)p 375 1000 V 31 w(CR)p 516 1000 V 32 w(RANGE:)1501187 y(MPEG)p 375 1187 V 31 w(CB)p 516 1187 V 32 w(RANGE:)291b Fm(These)25 b(set)g(the)g(ranges)g(of)h(luminance)i(and)e(chr)n(omaticity)h(values.)39 b(The)1164 1300 y(defaults)21b(ar)n(e)g(8,)h(4,)g(and)f(4.)28 b(\(I)21 b(do)g(not)f(understand)f(the)i(ef)n(fects)f(of)i(chang-)1164 1413 y(ing)37 b(these;)43b(my)37 b(experiments)e(indicate)j(that)f(doing)g(so)f(garbles)h(per)n(-)1164 1526 y(fectly)23 b(good)e(colour)h(maps.\))01714 y Fn(Notes:)141 1851 y Fl(SetMPEGOption\(\))13 bFm(allows)19 b(you)f(to)h(set)f(a)h(variety)g(of)h(options)d(r)n(elated)i(to)f(MPEG)h(decoding.)26 b(The)18 b(pos-)01964 y(sible)26 b(values)f(for)g Fl(Option)e Fm(ar)n(e)i(described)f(above;)j(the)e(possible)f(values)h(for)h Fl(Value)dFm(value)j(ar)n(e)f(dependent)0 2077 y(on)d(what)h Fl(Option)dFm(you)i(ar)n(e)h(setting.)j(Whatever)c Fl(Value)e Fm(is,)j(it)f(should)g(of)h(course)e(be)i(cast)g(to)f(an)h Fl(int)pFm(.)0 2382 y Ff(4.3)99 b Fb(OpenMPEG\(\))0 2559 y Fn(Function)21b(prototype:)141 2697 y Fl(Boolean)52 b(OpenMPEG)e(\(FILE)j(*MPEGfile,)d(ImageDesc)g(*Image\))0 2859 y Fn(Arguments:)150 3047y Fl(MPEGfile:)10 b Fm(A)17 b(\002le)h(that)f(is)h(alr)n(eady)g(open)e(for)i(r)n(eading,)g(positioned)e(at)h(the)g(beginning)h(of)f(an)h(MPEG)655 3160 y(str)n(eam.)150 3347 y Fl(Image:)175b Fm(Pointer)28 b(to)g(a)i(user)n(-declar)n(ed)e Fl(ImageDesc)dFm(str)o(uctur)n(e.)46 b(Y)-8 b(ou)28 b(shouldn't)f(change)i(any)6553460 y(of)g(the)f(\002elds)g(in)h Fl(*Image)d Fm(yourself,)j(either)f(befor)n(e)h(or)f(after)h(calling)i Fl(OpenMPEG\(\))pFm(;)655 3573 y(use)21 b Fl(SetMPEGOption\(\))16 b Fm(instead.)03811 y Fn(Notes:)141 3948 y Fl(OpenMPEG\(\))h Fm(pr)n(epar)n(es)j(an)i(MPEG)f(str)n(eam)g(for)g(decoding.)26 b(It)21 b(initializes)i(internal)f(data)f(str)o(uctur)n(es)f(for)0 4061 y(decoding)g(and)g(dithering)g(and\227if)i(applicable\227cr)n(eates)g(a)f(colour)g(map.)28 b(After)20 b(calling)i Fl(OpenMPEG\(\))p Fm(,)17 b(the)04174 y(following)24 b(\002elds)f(in)h Fl(*Image)d Fm(will)k(be)f(set:)29 b Fl(Height)p Fm(,)21 b Fl(Width)p Fm(,)g Fl(Depth)pFm(,)h Fl(PixelSize)p Fm(,)d Fl(Size)p Fm(,)j Fl(BitmapPad)pFm(,)0 4287 y Fl(ColormapSize)p Fm(,)17 b(and)23 b Fl(Colormap)pFm(.)0 4592 y Ff(4.4)99 b Fb(GetMPEGFrame\(\))0 4769y Fn(Function)21 b(prototype:)141 4906 y Fl(Boolean)52b(GetMPEGFrame)d(\(char)j(*Frame\))0 5069 y Fn(Arguments:)1505257 y Fl(Frame:)75 b Fm(Pointer)28 b(to)h(a)g(user)n(-allocated)g(chunk)g(of)g(memory)-10 b(.)45 b(Must)29 b(have)g(enough)e(r)n(oom)i(for)g(the)555 5370 y(decoded)21 b(image,)h(which)i(can)f(be)g(determined)d(fr)n(om)j(the)f Fl(Size)f Fm(\002eld)h(of)hFl(ImageDesc)p Fm(.)1927 5656 y(8)p eop%%Page: 9 99 8 bop 0 399 a Fn(Notes:)141 536 y Fm(Decodes)26 b(the)g(next)g(frame)i(fr)n(om)g(the)e(movie.)42 b(Returns)25 b Fl(TRUE)gFm(if)j(ther)n(e)e(ar)n(e)i(any)f(frames)g(left)g(to)g(decode)0649 y(in)h(the)f(movie,)i(or)e Fl(FALSE)e Fm(if)j(the)f(decoded)e(frame)k(is)e(the)g(last)h(frame)g(in)g(the)e(movie.)43b(That)28 b(is,)g(for)g(a)g(movie)0 762 y(with)e Fa(N)36b Fm(frames)26 b Fl(GetMPEGFrame\(\))20 b Fm(will)27b(r)n(eturn)f Fl(TRUE)e Fa(N)33 b Fh(\000)22 b Fc(1)27b Fm(times,)f(and)g(then)f(the)g(call)j(to)e(decode)e(the)0875 y(last)e(frame)h(will)g(r)n(eturn)f Fl(FALSE)p Fm(.)d(After)i(that,)h(the)f(behaviour)i(of)f Fl(GetMPEGFrame\(\))16b Fm(is)22 b(unde\002ned)e(\(unless)0 988 y(you)i(call)iFl(RewindMPEG\(\))p Fm(.\))0 1293 y Ff(4.5)99 b Fb(RewindMPEG\(\))01469 y Fn(Function)21 b(prototype:)141 1607 y Fl(void)53b(RewindMPEG)d(\(FILE)i(*MPEGfile,)e(ImageDesc)h(*Image\))01770 y Fn(Arguments:)150 1958 y Fl(MPEGfile:)10 b Fm(The)22b(open,)f(r)n(eadable)i(str)n(eam)g(pointer)e(that)h(was)h(also)g(passed)e(to)h Fl(OpenMPEG\(\))p Fm(.)150 2145 y Fl(Image:)175b Fm(The)22 b(image)h(descriptor)e(that)h(was)h(passed)e(to)h(and)g(\002lled)h(in)g(by)g Fl(OpenMPEG\(\))p Fm(.)0 2383 yFn(Notes:)141 2520 y Fm(Repositions)h Fl(MPEGfile)p Fm('s)f(\002le-of)n(fset)j(pointer)g(to)g(point)g(to)f(the)h(beginning)g(of)h(the)f(str)n(eam,)h(and)f(r)n(eini-)0 2633 y(tializes)33 b(internal)g(MPEG)f(Library)g(str)o(uctur)n(es)f(to)g(pr)n(epar)n(e)h(r)n(eading)g(the)f(MPEG)i(again.)57 b(The)31 b(\002rst)h(call)i(to)0 2746y Fl(GetMPEGFrame\(\))13 b Fm(after)18 b(calling)j Fl(RewindMPEG\(\))13b Fm(will)21 b(r)n(eturn)d(the)g(\002rst)g(frame)h(of)g(the)f(movie,)i(as)f(though)0 2859 y Fl(OpenMPEG\(\))f Fm(had)23 b(just)f(been)g(called.)0 3208 y Fo(Acknowledgements)0 3419 y Fm(Most)29b(of)g(the)g(cr)n(edit)h(for)g(this)f(package)g(should)g(go)g(to)g(the)g(authors)g(of)h Fl(mpeg)p 2817 3419 28 4 v 31 w(play)pFm(;)h(all)g(I)f(can)g(r)n(eally)h(take)0 3532 y(cr)n(edit)f(for)g(is)h(shuf)n(\003ing)f(code)f(ar)n(ound)h(and)h(coming)f(up)g(with)g(a)h(r)n(easonably)f(intelligent)g(interface)g(to)g(the)0 3644y(decoding)21 b(engine)h(that)g(does)f(the)h(r)n(eal)i(work.)1413757 y(Thanks)i(to)h(Magnus)f(Heldestat)f(for)i(contributing)g(a)g(sped-up)e(version)i(of)g(24bit.c,)i(r)n(esulting)d(in)i(faster)03870 y(decoding/dithering)20 b(of)j(full-colour)h(images.)04169 y Fo(References)0 4380 y Fm([1])46 b(Didier)29 b(LeGall,)i(\223MPEG\226A)e(V)-5 b(ideo)28 b(Compr)n(ession)g(Standar)n(d)g(for)g(Multimedia)i(Applications,\224)g Fg(Com-)151 4493 y(munications)23b(of)h(the)g(ACM)p Fm(,)d(April)i(1991,)h(V)-10 b(ol)23b(34)g(Num)g(4,)g(pp.)e(46\22658.)0 4680 y([2])46 b(Ketan)25b(Patel,)f(Brian)h(C.)g(Smith,)g(and)f(Lawr)n(ence)g(A.)g(Rowe,)g(\223Performace)g(of)h(a)g(Softwar)n(e)f(MPEG)g(V)-5b(ideo)151 4793 y(Decoder)7 b(\224,)22 b Fg(ACM)g(Multimedia)i('93)g(Confer)n(ence)p Fm(.)1927 5656 y(9)p eop%%Trailerenduserdict /end-hook known{end-hook}if%%EOF
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -