Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - When can the Decode array be safely ignored
  FAQ FAQ  Forum Search   Register Register  Login Login

Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

When can the Decode array be safely ignored

 Post Reply Post Reply
Author
needpdfa View Drop Down
New Member
New Member


Joined: 13 Sep 2011
Points: 14
Post Options Post Options   Quote needpdfa Quote  Post ReplyReply Direct Link To This Post Topic: When can the Decode array be safely ignored
    Posted: 16 Sep 2011 at 11:36pm
When can the Decode array be safely ignored for extracting image data?  It seems when it's the default or none is used and you assume the default that it's safe to ignore it.  I have some code that implements it but it's somewhat slow and I've yet to see a case where the default Decode array makes a difference.

It's been alluded to that ignoring it is incorrect and that you can optimize your code by ignoring it in certain cases, can anybody be more specific about this?

Thanks so much.
Back to Top
aandi View Drop Down
Senior Member
Senior Member


Joined: 07 Jul 2011
Points: 18358
Post Options Post Options   Quote aandi Quote  Post ReplyReply Direct Link To This Post Posted: 22 Sep 2011 at 12:53pm
The decode can be ignored where it has no effect on the result.

Consider the process like this. You want to extract the colour information for each component of each pixel. This could be written as

InputValue = NextComponent { e.g. next byte if BitsPerComponent 8 }
ColourValue = ApplyDecode(InputValue)

In this process Decode is always important; the cases where it does nothing are not significant.

(As an aside, it is useful to think of colour values as numbers in the range 0 to 1 - or whatever it is for the colour space. Colours stored as 0 to 255 is a representation, but it is often mistaken for the natural colour ranges, which causes confusion and an expectation that whever you see a colour it won't need interpretation of the range).

Anyway, from your posts you are continuing to take the values and use them to extract image data. You haven't said what formats, but you are probably using formats where there is 8 bit data and the colour values are scaled into the range 0 to 255.

Well, applying Decode is a linear function, so you have a useful test. If ApplyDecode(0) = ColourMinimum and ApplyDecode(255)=ColourMaximum, then applying Decode will not change the result, and 8 byte values can be carried from input to output. Or so it seems to me, but you should check the formulae for decoding carefully in case I've missed something.
Back to Top
needpdfa View Drop Down
New Member
New Member


Joined: 13 Sep 2011
Points: 14
Post Options Post Options   Quote needpdfa Quote  Post ReplyReply Direct Link To This Post Posted: 22 Sep 2011 at 4:43pm
I'm extracting to the BMP format only.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.031 seconds.