*.scf trace file data

  • Nobody/Anonymous

    hello, everybody!

    not sure if this is the right forum for my question but i'm desperate! ;-)

    i am currently writing some php code trying to import and display *.scf files. however, i can't figure out how to handle the 'samples' data. the man pages say that the single values are stored as uint_2 data type which is an _unsigned_ short. but how is it possible to store those values as 'delta_delta's without having negative values?? as a consequence, calculating the 'real' trace values will result in larger and larger values?! what am i getting wrong?

    thanks for your help,

    j. thomas

    • James Bonfield

      James Bonfield - 2005-05-25

      Actually some SCF files are signed and some are unsigned. It's all a woolly thing which was not clearly defined originally and so has on occasion been interpreted differently.

      Do not be confused though between the final signed or unsignedness of the trace data and the actual delta values that are stored on disc. The latter can be treated as signed easily enough.

      It appears that with 0 200 0 200 0 200 we'd need to store (for 1 level of delta on 8-bit data, to simplify the example) +200 -200 +200 -200 +200. Effectively we need a range from -255 to +255 which means we need 1 more bit than our input data type.

      However the delights of 2s complement mean this isn't needed and it all magically overflows or underflows in predicatable fashions, and more importantly in reversable fashions.

      Ie. 00 c8 00 c8 00 c8
      delta => 00 c8 ffffff38 c8 ffffff38 c8

      But in 8-bits:

      00 c8 38 c8 38 c8 also works as c8 + 38 = 200 + 56 = 256 = 0 again :)


    • Nobody/Anonymous

      now i see... thanks a lot for the help - I finally made it!! :-)

      j. thomas


Log in to post a comment.