1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00

avcodec/j2kenc: init bitstream after writing SOP

Otherwise, *sop remains uninitialized if the sop is written.

Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
This commit is contained in:
Niklas Haas
2026-08-29 13:48:22 +02:00
committed by Niklas Haas
parent 86416861a7
commit f88b741dbf

View File

@@ -721,15 +721,16 @@ static int encode_packet(Jpeg2000EncoderContext *s, Jpeg2000ResLevel *rlevel, in
{
int bandno, empty = 1;
int i;
// init bitstream
*s->buf = 0;
s->bit_index = 0;
if (s->sop) {
bytestream_put_be16(&s->buf, JPEG2000_SOP);
bytestream_put_be16(&s->buf, 4);
bytestream_put_be16(&s->buf, packetno);
}
// init bitstream
*s->buf = 0;
s->bit_index = 0;
// header
if (!layno) {