⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmif-film.ms

📁 reduced python source for embedded apps
💻 MS
字号:
.de PP.LP...de pT.IP \fB\\$1\fP...TLCMIF video file format.AUJack Jansen(Version of 27-Feb-92).SHIntroduction.PPThe CMIF video format was invented to allow various applicationsto exchange video data. The format consists ofa header containing global information (like data format)followed by a sequence of frames, each consisting of a headerfollowed by the actual frame data.All information except pixel data isencoded in ASCII. Pixel data is \fIalways\fP encoded in Silicon Graphicsorder, which means that the first pixel in the frame is the lower leftpixel on the screen..PPAll ASCII data except the first line of the fileis in python format. This means thatouter parentheses can be ommitted, and parentheses around a tuple withone element can also be omitted. So, the lines.IP.ft C.nf('grey',(4))('grey',4)'grey',4.LPhave the same meaning. To ease parsing in C programs, however, it is advised that there areno parenteses around single items, and that there are parentheses aroundlists. So, the second format above is preferred..PPThe current version is version 3, but this document will also explainshortly what the previous formats looked like..SHHeader..PPThe header consists of three lines. The first line identifies the fileas a CMIF video file, and gives the version number.It looks as follows:.IP.ft CCMIF video 3.0.LPAll programs expect the layout to be exactly like this, so noextra spaces, etc. should be added..PPThe second line specifies the data format. Its format is a pythontuple with two members. The first member is a string giving the formattype and the second is a tuple containing type-specific information.The following formats are currently understood:.pT rgbThe video data is 24 bit RGB packed into 32 bit words. R is the least significant byte, then G and then B. The top byte isunused..IPThere is no type-specific information, so the complete data formatline is.IP.ft C('rgb',()).pT greyThe video data is greyscale, at most 8 bits. Data is packed into8 bit bytes (in the low-order bits). The extra information is thenumber of significant bits, so an example data format line is.IP.ft C('grey',(6)).pT yiqThe video data is in YIQ format. This is a format that has one luminancecomponent, Y, and two chrominance components, I and Q. The luminance andchrominance components are encoded in \fItwo\fP pixel arrays: first anarray of 8-bit luminance values followed by a array of 16 bit chrominancevalues. See the section on chrominance coding for details..IPThe type specific part contains the number of bits for Y, I and Q,the chrominance packfactor and the colormap offset. So, a sample formatinformation line of.IP.ft C('yiq',(5,3,3,2,1024)).IPmeans that the pictures have 5 bit Y values (in the luminance array),3 bits of I and Q each (in the chrominance array), chrominance datais packed for 2x2 pixels, and the first colormap index used is 1024..pT hlsThe video data is in HLS format. L is the luminance component, H and Sare the chrominance components. The data format and type specific informationare the same as for the yiq format..pT hsvThe video data is in HSV format. V is the luminance component, H and Sare the chrominance components. Again, data format and type specificinformation are the same as for the yiq format..pT rgb8The video data is in 8 bit dithered rgb format. This is the formatused internally by the Indigo. bit 0-2 are green, bit 3-4 are blue andbit 5-7 are red. Because rgb8 is treated more-or-less like yiq formatinternally the type-specific information is the same, with zeroes forthe (unused) chrominance sizes:.IP.ft C('rgb8',(8,0,0,0,0)).PPThe third header line contains width and height of the video image,in pixels, and the pack factor of the picture. For compatability, RGBimages must have a pack factor of 0 (zero), and non-RGB images musthave a pack factor of at least 1.The packfactor is the amount of compression done on the original videosignal to obtain pictures. In other words, if only one out of three pixelsand lines is stored (so every 9 original pixels have one pixel in thedata) the packfactor is three. Width and height are the size of the\fIoriginal\fP picture.Viewers are expected to enlarge the picture so it is shown in theoriginal size. RGB videos cannot be packed.So, a size line like.IP.ft C200,200,2.LPmeans that this was a 200x200 picture that is stored as 100x100 pixels..SHFrame header.PPEach frame is preceded by a single header line. This line contains timing informationand optional size information. The time information is mandatory, andcontains the time this frame should be displayed, in milliseconds sincethe start of the film. Frames should be stored in chronological order..PPAn optional second number is interpreted as the size of the luminancedata in bytes. Currently this number, if present, should always be thesame as \fCwidth*height/(packfactor*packfactor)\fP (times 4 for RGBdata), but this might change if we come up with variable-length encodingfor frame data..PPAn optional third number is the size of the chrominance datain bytes. If present, the number should be equal to.ft Cluminance_size2*/(chrompack*chrompack)..SHFrame data.PPFor RGB films, the frame data is an array of 32 bit pixels containingRGB data in the lower 24 bits. For greyscale films, the frame datais an array of 8 bit pixels. For split luminance/chrominance films thedata consists of two parts: first an array of 8 bit luminance valuesfollowed by an  array of 16 bit chrominance values..PPFor all data formats, the data is stored left-to-right, bottom-to-top..SHChrominance coding.PPSince the human eye is apparently more sensitive to luminance changesthan to chrominance changes we support a coding where we split the luminanceand chrominance components of the video image. The main point of thisis that it allows us to transmit chrominance data in a coarser granularitythan luminance data, for instance one chrominance pixel for every2x2 luminance pixels. According to the theory this should result in anacceptable picture while reducing the data by a fair amount..PPThe coding of split chrominance/luminance data is a bit tricky, tomake maximum use of the graphics hardware on the Personal Iris. Therefore,there are the following constraints on the number of bits used:.IP -No more than 8 luminance bits,.IP -No more than 11 bits total,.IP -The luminance bits are in the low-end of the data word, and are storedas 8 bit bytes,.IP -The two sets of chrominance bits are stored in 16 bit words, correctlyaligned,.IP -The color map offset is added to the chrominance data. The offset shouldbe at most 4096-256-2**(total number of bits). To reduce interference withother applications the offset should be at least 1024..LPSo, as an example, an HLS video with 5 bits L, 4 bits H, 2 bits S and anoffset of 1024 will look as follows in-core and in-file:.IP.nf.ft C	  31         15    11 10 9 8  5 4   0         +-----------------------------------+incore   +               0+ 1+  S +  H +   L +         +-----------------------------------+                                  +----------+L-array                           +  0 +   L +                                  +----------+                     +-----------------------+C-array              +   0+ 1+  S +  H +   0 +                     +-----------------------+

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -