JP2 (JPEG 2000 Part 1) validator and properties extractor. Jpylyzer was specifically created to check that a JP2 file really conforms to the format's specifications. Additionally jpylyzer is able to extract technical characteristics.
Following @stweil's comment here I noticed some weirdness with the validate function: depending on a number of conditions, the output tuple varies in length (2 or 3 elements) and contents. This makes things unnecessarily complex and hard to understand. We now have (numbers added here for reference):
if self.isValid is not None:
return (self.isValid, self.tests, self.characteristics) #[1]
elif self.returnOffset is None:
return (self.tests, self.characteristics) #[2]
else:
return (self.tests, self.characteristics, self.returnOffset) #[3]
Here a comment in the corresponding function says that "that unlike other marker validation functions this one returns a third result, which is the total tile-part length (psot)!"
All remaining calls are variation 1.
So this is a bit of a mess. A better approach might be to rewrite the main function as:
Following @stweil's comment here I noticed some weirdness with the validate function: depending on a number of conditions, the output tuple varies in length (2 or 3 elements) and contents. This makes things unnecessarily complex and hard to understand. We now have (numbers added here for reference):
Variation 1 is only used once in jpylyzer.py:
Variation 3 is used only once:
Then there's this weird one which looks like 3 but it isn't:
Here a comment in the corresponding function says that "that unlike other marker validation functions this one returns a third result, which is the total tile-part length (psot)!"
All remaining calls are variation 1.
So this is a bit of a mess. A better approach might be to rewrite the main function as:
And then use
self.tests
,self.characteristics
,self.isValid
,self.offsetNext
andself.tilePartLength
as needed.