You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the best way to determine the size of the output buffer passed to HapDecode? Looking at HapDecode itself, it seems like there is no real way to know the correct size ahead of time, so one simply has to make a good guess. After a little experimentation, I settled on simply multiplying the size of the compressed buffer by a factor of 2, but that may fail with a different encoder (this source is FFMPEG), or a different Hap codec (this is Snappy + DXT5 YCoCg). Setting it too high obviously impacts performance, as the runtime needs to find too much contiguous memory.
Usually (ie always for mov or avi) dimensions are stored independently in the container, so armed with those and the texture format (from HapGetFrameTextureFormat()) you can calculate it exactly (round dimensions up to a multiple of four, apply known DXT block size).
What is the best way to determine the size of the output buffer passed to HapDecode? Looking at HapDecode itself, it seems like there is no real way to know the correct size ahead of time, so one simply has to make a good guess. After a little experimentation, I settled on simply multiplying the size of the compressed buffer by a factor of 2, but that may fail with a different encoder (this source is FFMPEG), or a different Hap codec (this is Snappy + DXT5 YCoCg). Setting it too high obviously impacts performance, as the runtime needs to find too much contiguous memory.
https://github.com/heisters/libglvideo/blob/master/src/decoders/hap.cpp#L24
The text was updated successfully, but these errors were encountered: