comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Locating sequence of bytes within binary file
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Locating sequence of bytes within binary file [message #71451 is a reply to message #71379] Fri, 18 June 2010 09:47 Go to previous messageGo to previous message
Axel Martínez is currently offline  Axel Martínez
Messages: 22
Registered: June 2010
Junior Member
Wow, I had read in Coyote's website that JD Smith always finds amazing
solutions ;), but this is over any expectation!! I am simply amazed.
Not only I see all possible solutions for my problem and their
drawbacks, but I also learn a lot!

I spent some time to understand the methods, managed now...

> As usual, we can (over-)use IDL's array strengths to brute-force this
> using REBIN and dimensional TOTAL:

The problem of this solution might be the size of the variable quill
for a large "needle" (not my case). And also the speed, as you
acknowledge...

> That motivates another deeply unsatisfying, but resoundingly faster
> (20-50x) option: simply replace all 0b's with 1b's in both input byte
> array and search array, and just double-check for spurious matches as
> you go:

This is good, but it just uses double the amount of memory to preserve
the original and the modified array. Works for me, but could be bad
for others. And, honestly, it is really not so elegant.

> We might also lobby ITT to let STRPOS and its sort accept byte arrays
> (since frankly there is very little difference between them
> internally).

This would be by far the best solution. I believe a VIP like you have
more options to lobby ITT than I do :) Maybe creating a "BYTPOS" or
actually "ANYDATAFORMAT_POS" function would be good. A similar problem
might arise looking for a sequence of integers instead of bytes...

My problem is small, and solved by any of the solutions which were
proposed. But it would be good to have a fast and memory-efficient
option available for future IDL-users :) Next time then I do not need
to be ashamed of saying that IDL does virtually everything with
arrays.

Thanks so much!!!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: pixel information using envi+idl
Next Topic: WINDOW: Routine is not defined for current graphics device.

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:32:20 PDT 2025

Total time taken to generate the page: 0.00420 seconds