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-14 08:15:39 PST Path: supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-hog.berkeley.edu!ucberkeley!enews.sgi.com!newshub2.rdc1.sfba.home.com!news.home.com!news1.frmt1.sfba.home.com.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: bitstreams References: <93se2v$nen$1@eol.dd.chalmers.se> X-Newsreader: Tom's custom newsreader Message-ID: Date: Sun, 14 Jan 2001 16:15:35 GMT NNTP-Posting-Host: 24.20.190.201 X-Complaints-To: abuse@home.net X-Trace: news1.frmt1.sfba.home.com 979488935 24.20.190.201 (Sun, 14 Jan 2001 08:15:35 PST) NNTP-Posting-Date: Sun, 14 Jan 2001 08:15:35 PST Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: supernews.google.com comp.lang.ada:4000 Date: 2001-01-14T16:15:35+00:00 List-Id: >In my mp3 decoder I will have to search for bit-patterns in a buffer of >bytes, how is this best done, and How can I "shift" in a sequence of bits I'm guessing that perhaps mp3 uses a Huffman code like a fax. For a fax, the longest code is 13 bits so it's much faster to create an array of 2**13 entries such that the next 13 bits in the data can be used as an index, and the value at that position in the array is the desired code. For instance, if the third code is "01", then lookup(16#0100000000000# .. 16#0111111111111#) = 3.