From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,435e65f4acf8bd X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-01-15 12:11:05 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!news.iac.net!news-out.cwix.com!newsfeed.cwix.com!cpk-news-hub1.bbnplanet.com!news.gtei.net!nntp2.deja.com!nnrp1.deja.com!not-for-mail From: mark_lundquist@my-deja.com Newsgroups: comp.lang.ada Subject: Re: bitstreams Date: Mon, 15 Jan 2001 19:56:23 GMT Organization: Deja.com Message-ID: <93vkl3$1j$1@nnrp1.deja.com> References: <93se2v$nen$1@eol.dd.chalmers.se> <3A622CE5.89C9378E@worldnet.att.net> NNTP-Posting-Host: 130.213.200.127 X-Article-Creation-Date: Mon Jan 15 19:56:23 2001 GMT X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt) X-Http-Proxy: 1.1 x62.deja.com:80 (Squid/1.1.22) for client 130.213.200.127 X-MyDeja-Info: XMYDJUIDmark_lundquist Xref: supernews.google.com comp.lang.ada:4022 Date: 2001-01-15T19:56:23+00:00 List-Id: In article <3A622CE5.89C9378E@worldnet.att.net>, srini wrote: > > I do not know much about mp3 etc but I have developed a bit stream > package which allows you to perform reads in terms of bits. I use these > in my own compression/decompression test software. The spec is attached. > ---------------------------------------------------------------------- > package Bits_Io is > > type File_Type is limited private; > type File_Mode is (In_File, Out_File, Append_File); > > type Vector_type is array (natural range <>) of boolean ; > pragma pack( Vector_Type ) ; . . . Beware, though... this is implementation-dependent. If the compiler doesn't represent a packed array of boolean as a bit vector, it doesn't work. The package is called Bits_Io, why not define a proper type Bit and then define Bit_Vector in terms of that? Is Boolean used so that you can be able to have the logical operations on arrays of Boolean? Note that the rationale for including that feature in Ada was in order to implement sets efficiently (I think that goes back to Steelman). So the idea of "and" on Boolean arrays in Ada is not the idea of a bitmask, it's the idea of a set intersection. To me, it's confusing whenever Boolean is used for something other than truth value. A couple of thoughts for the original poster... Bitstream is probably the wrong abstraction for all but a small handful of applications... specifically, compression and encryption, where you are going to do math on the bits but you have no awareness of the bits _representing_ something. MP3 is an application where you most certainly *do* care what the bits represent! So while it may lay on the disk as a sequence of bits (as does everything else), that seems irrelevant because you must immediately cease dealing with it as snippets of bits as soon as you get your hands on the snippets. You want the interpretation to be immediate, you don't want to have to be involved in dealing with the bits. You can desperately say, "if only I can just get my hands on the bits, then I can shift/mask/unchecked-convert my way to the answer", but you probably won't end up with a very good program. What you probably want to do is declare types for all the fields in the MP3 format, then define the Stream attributes for those types. Mark Lundquist Sent via Deja.com http://www.deja.com/