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

Hi BrowserUK, Thanks for the reply. I am new to Perl and could not understand the code you posted. can you pls help in clarifying the code. Thanks for the other tips about reducing the file size. Thanks

Replies are listed 'Best First'.
Re^5: encoding hdmi video byte
by BrowserUk (Patriarch) on Feb 24, 2010 at 20:22 UTC

    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.
      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.