You're right on the "@Q" part. Dumb mistake. With that corrected, the mapping makes a lot more sense.

As for the right interpretation of the spec, I guess you'll have to ask the OP. I believe, (with the "deliberate" error:) and constant 9th bit excepted), I coded a direct implementation of the spec. If the spec is wrong, or my interpretation of it is wrong, then the OP will have to correct it.

The main point was to answer the OPs question of the best way to perform the mapping efficiently, and that is tr/// with the appropriate translation strings. On a gig of data, doing 10 x 100MB tr///s, (or even 1 x 1GB if he has the memory), is going to beat performing half a dozens boolean operations on every byte, hands down.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"

In reply to Re^9: encoding hdmi video byte by BrowserUk
in thread encoding hdmi video byte by hdmiguru

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.