kicken Posted March 10 Share Posted March 10 (edited) 1 hour ago, jodunno said: I'm sorry but i do not see the difference between 0xFFx?? and checking it in the array. The list of marker codes you are checking for is only a limited subset of possible marker codes. That means you'll be missing a bunch of potential markers. For example, 0xFFFE - Comment 0xFFDD - Restart interval 0xFFE2 - 0xFFEF - App specific markers. and more You may not care what those markers do, but you need to correctly identify them to ensure the file as a whole is parsed correctly. 1 hour ago, jodunno said: Is the marker data different using my code than the output using your code? By marker data I am referring to the data attached to the marker, ie. the hexdump of stuff shown after a marker in my script's output. The next two byte after a marker define a length value, then after that is arbitrary data. You need to skip over all that as you're searching for markers or you might catch something that looks like a marker but actually is not. Skipping over that would save a bunch of time reading bytes as well. Your idea of just finding the markers then using ftell to record their offsets is fine. As you noted you can then go back and fseek to that position and read the marker data. You just want to ensure you're finding the markers correctly by skipping past that data and the image data during your initial scan. 1 hour ago, jodunno said: C0 is supposed to hold 17bytes of data. Just make sure you are using the encoded length value to and not try to hard-code data lengths. The length of the data attached to a marker isn't necessarily fixed. Edited March 10 by kicken Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.