diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-04-29 17:44:22 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-05-15 11:56:35 +0200 |
commit | f249c32eff1514b86e2863f6f651daf7c761fdcb (patch) | |
tree | ada0410b0d02d6a7f222a1b49ada4df84adeadd7 /Changelog | |
parent | 634a187b9bd7d3f01deab6e79e63371933ab702e (diff) | |
download | ffmpeg-f249c32eff1514b86e2863f6f651daf7c761fdcb.tar.gz |
avcodec/jpeglsenc: Avoid intermediate buffer, allow user-supplied buffers
Up until now, the JPEG-LS encoder allocated a worst-case-sized packet
at the beginning of each encode2 call; then it wrote the packet header
into its destination buffer and encoded the actual packet data;
said data is written into another worst-case-sized buffer, because it
needs to be escaped before being written into the packet buffer.
Finally, because the packet buffer is worst-case-sized, the generic
code copies the actually used part into a fresh buffer.
This commit changes this: Allocating the packet and writing the header
into it is deferred until the actual data has been encoded and its size
is known. This gives a good upper bound for the needed size of the packet
buffer (the upper bound might be 1/15 too large) and so one can avoid the
implicit intermediate buffer and support user-supplied buffers by using
ff_get_encode_buffer().
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'Changelog')
0 files changed, 0 insertions, 0 deletions