[FFmpeg-devel] [PATCH] avformat/westwood_vqa: Store VQFL codebook chunks

Pekka Väänänen pekka.vaananen at iki.fi
Wed Sep 22 15:42:22 EEST 2021


Thank you for your patience with this patch.

> This code also reads the VQFR chunk before seeking back, so this needs
> to be changed or accounted for.
> 
> > +            ffio_ensure_seekback(pb, wsvqa->vqfl_chunk_size + 512 * 1024);
> > +            avio_skip(pb, chunk_size + skip_byte);

That's right. I measured that VQFR's size seems to be less than 140 KiB
in my test files so a 256 KiB extra padding should be safe.

> > +                    av_packet_unref(pkt);
> 
> This fixes the memleak, yet the main data is still read twice.
> 
> > +                    if (av_get_packet(pb, pkt, wsvqa->vqfl_chunk_size) < 0)
> > +                        return AVERROR(EIO);

Alright I didn't think reading the data twice was a problem.
Anyway, I realized that the decoder doesn't care about the chunk order. The
VQFL chunk is now appended to the VQFR chunk which simplifies the logic. I hope
this isn't too clever a solution.





More information about the ffmpeg-devel mailing list