in reply to Re^4: encoding hdmi video byte
in thread encoding hdmi video byte

Read this and come back if you have specific questions.


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"

Replies are listed 'Best First'.
Re^6: encoding hdmi video byte
by hdmiguru (Initiate) on Feb 24, 2010 at 21:23 UTC
    Hi BrowserUK, ONce again thanks for the reply. I read the tr\\\ translate info...pointed by you. I understand the simple example in there but still i cannot understand the solution provide by you. I understand that first part tr[\x00-\xff] that we want to translate the hex byte but i am unable to understand the rest of the logic. pls just explain one line if possible. Any help to explain is really appreciated. Thanks,
    tr[\x00-\xff][ \x00UT\x01P\x05\x04 Q(\x15\x14)\x10ED\x11 \x00UT\x01P\x05\x04Q(\x15\x14)\x10ED\x11 \x00UT\x01P\x05\x04Q(\x15\x14)\x10ED\x11 \x00UT\x01P\x05\x04Q(\x15\x14)\x10ED\x11 \x00UT\x01P\x05\x04Q(\x15\x14)\x10ED\x11 \x00UT\x01P\x05\x04Q(\x15\x14)\x10ED\x11 \x00UT\x01P\x05\x04Q(\x15\x14)\x10ED\x11 \x00UT\x01P\x05\x04Q(\x15\x14)\x10ED\x11 \x00UT\x01P\x05\x04Q(\x15\x14)\x10ED\x11 \x00UT\x01P\x05\x04Q(\x15\x14)\x10ED\x11 \x00UT\x01P\x05\x04Q(\x15\x14)\x10ED\x11 \x00UT\x01P\x05\x04Q(\x15\x14)\x10ED\x11 \x00UT\x01P\x05\x04Q(\x15\x14)\x10ED\x11 \x00UT\x01P\x05\x04Q(\x15\x14)\x10ED\x11 \x00UT\x01P\x05\x04Q(\x15\x14)\x10ED\x11 \x00UT\x01P\x05\x04Q(\x15\x14)\x10ED\x11 ];

      Okay. I took your spec and coded this slow and labourious implementation and applied it to the bytes 0 .. 255:

      #! perl -slw use strict; use Data::Dump qw[ pp ]; my %map; for my $i ( 0 .. 255 ) { my @Q; my @D = split '', unpack 'b8', chr $i; $Q[ 0 ] = $D[ 0 ]; $Q[ 1 ] = $D[ 1 ] ^ $Q[ 0 ]; $Q[ 2 ] = $D[ 2 ] ^ $Q[ 1 ]; $Q[ 3 ] = $D[ 3 ] ^ $Q[ 2 ]; $Q[ 4 ] = $D[ 4 ] ^ $Q[ 3 ]; $Q[ 5 ] = $D[ 5 ] ^ $Q[ 4 ]; $Q[ 6 ] = $D[ 6 ] ^ $Q[ 5 ]; $Q[ 7 ] = $D[ 7 ] ^ $Q[ 6 ]; my $outb = ord pack 'b8', "@Q"; $map{ $i } = $outb; } pp \%map;

      And it produced this output:

      That's a byte to byte mapping table. I then used that to build the translation table I posted.


      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.

        A couple of points I don't understand about Re^7: encoding hdmi video byte.

        First, in the statement
            my $outb = ord pack 'b8',"@Q";
        will not  "@Q" interpolate the array with spaces between the elements of  @Q and so give an oddball result (i.e., only 16 unique values) since a space (ASCII space == 0x20) is packed by b as a 0 bit and half the elements of  @Q will be ignored?
        I.e., shouldn't it be
            my $outb = ord pack 'b8',join '', @Q;
        instead?

        The other point I don't understand is that I took the OP statement

        Data byte D(0:7) encode this to make 9bit data q_m(0:8) q_m[0] = D(0); q_m(1) = q_m(0) XOR D(1); q_m(2) = q_m(1) XOR D(2); q_m(3) = q_m(2) XOR D(3); q_m(4) = q_m(3) XOR D(4); q_m(5) = q_m(4) XOR D(5); q_m(6) = q_m(5) XOR D(6); q_m(7) = q_m(6) XOR D(7); q_m(8) = 1;

        to be pseudo-code, and to be the equivalent (on a byte-for-byte basis) of

        $q_m_byte = (0x100 | ($D_byte ^ (0xff & ($q_m_byte << 1))));

        with a  $q_m_byte 'byte' of 9 bits always ending up with its bit-8 set, and bit-7 of the original value of  $q_m_byte always being lost.

        But

        $Q[ 0 ] = $D[ 0 ]; $Q[ 1 ] = $D[ 1 ] ^ $Q[ 0 ]; $Q[ 2 ] = $D[ 2 ] ^ $Q[ 1 ]; $Q[ 3 ] = $D[ 3 ] ^ $Q[ 2 ]; ...

        seems to be the equivalent of

        $Q[ 0 ] = $D[ 0 ]; $Q[ 1 ] = $D[ 1 ] ^ $D[ 0 ]; $Q[ 2 ] = $D[ 2 ] ^ $D[ 1 ] ^ $D[ 0 ]; $Q[ 3 ] = $D[ 3 ] ^ $D[ 2 ] ^ $D[ 1 ] ^ $D[ 0 ]; ...

        which is very different.

        Thanks a lot! Mr. BrowserUK.... that is really a ery big help !!!!