A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: How to decode RECT

  1. #1
    Junior Member
    Join Date
    Aug 2000
    Posts
    1
    Hi..

    I'm having problems decoding RECT.

    How does hex : 78 00 07 D0 00 00 17 70 00 decode into 800 by 600 movie width and height ????

    I understand hex : 78 deodes to supply 15 bits of data each for x min to y max, but I must be mad to not work out how the numbers are reached.

    Am I having problems with signed and unsigned bits and bytes ????

    Any help gladly received.

    Jon...



  2. #2
    Senior Member
    Join Date
    Jul 2000
    Posts
    503

    Info

    Check openswf.org for the source of SWFDump. It decodes everything.
    --Jesse

  3. #3
    Junior Member
    Join Date
    Jul 2000
    Posts
    11
    First convert each hex value into 8 bit binary code.
    and then take first five bits in the first byte of seies.
    suppose take 78
    0111 1000
    take first 5 bits 0 1 1 1 1
    (2^4 * 0) + (2 ^3 * 1) + (2^2 * 1) + (2^1 + 1) + (2^0 + 1)

    0 + 8 + 4 + 2 + 1 = 15

    You have already converted those hex series into binary bits na. Now from the sixth bit of first byte onwards divide the bit stream into 4 groups each of 15 bit size.

    In that ignore the first higher order bit and calculate the value for the remaining 14 bits.
    if that first higher order bit is zero the value you calculated is positive. if it is one then value is negative.



    Originally posted by jon.burden
    Hi..

    I'm having problems decoding RECT.

    How does hex : 78 00 07 D0 00 00 17 70 00 decode into 800 by 600 movie width and height ????

    I understand hex : 78 deodes to supply 15 bits of data each for x min to y max, but I must be mad to not work out how the numbers are reached.

    Am I having problems with signed and unsigned bits and bytes ????

    Any help gladly received.

    Jon...



  4. #4
    Why not - there's not really much in the way of tutorials here anyway...

    78: 0111 1000
    00: 0000 0000
    07: 0000 0111
    D0: 1101 0000
    00: 0000 0000
    00: 0000 0000
    17: 0001 0111
    70: 0111 0000
    00: 0000 0000

    1st 5 bits: 0111 (=15 bits per entry)
    next 15 bits: 0000 0000 0000 000 (0)
    next 15 bits: 0111 1101 0000 000 (16,000)
    next 15 bits: 0000 0000 0000 000 (0)
    next 15 bits: 0101 1101 1100 000 (12,000)
    (pad to byte boundary with another 7 zero bits)

    I think the problem is that you're not thinking in TWIPS - the values stored are 20x the actual pixel size, so 800x600 is stored as 16,000 x 12,000.

    Hope this helps!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center