TJ: Calc. xformed buf sizes based on dst. subsamp
With respect to tj3Transform(), this addresses an oversight from
bb1d540a80.
Note to self: A convenience function/method for computing the worst-case
transformed JPEG size for a particular transform would be nice.
This commit is contained in:
@@ -2065,13 +2065,15 @@ DLLEXPORT int tj3DecodeYUV8(tjhandle handle, const unsigned char *srcBuf,
|
||||
* you, or
|
||||
* -# pre-allocate the buffer to a "worst case" size determined by calling
|
||||
* #tj3JPEGBufSize() with the transformed or cropped width and height and the
|
||||
* level of subsampling used in the destination image. Under normal
|
||||
* circumstances, this should ensure that the buffer never has to be
|
||||
* level of subsampling used in the destination image (taking into account
|
||||
* grayscale conversion and transposition of the width and height.) Under
|
||||
* normal circumstances, this should ensure that the buffer never has to be
|
||||
* re-allocated. (Setting #TJPARAM_NOREALLOC guarantees that it won't be.)
|
||||
* Note, however, that there are some rare cases (such as transforming images
|
||||
* with a large amount of embedded Exif or ICC profile data) in which the
|
||||
* transformed JPEG image will be larger than the worst-case size, and
|
||||
* #TJPARAM_NOREALLOC cannot be used in those cases.
|
||||
* #TJPARAM_NOREALLOC cannot be used in those cases unless the embedded data is
|
||||
* discarded using #TJXOPT_COPYNONE.
|
||||
* .
|
||||
* If you choose option 1, then `dstSizes[i]` should be set to the size of your
|
||||
* pre-allocated buffer. In any case, unless you have set #TJPARAM_NOREALLOC,
|
||||
|
||||
Reference in New Issue
Block a user