[FFmpeg-devel] [PATCH] QOA decoding support

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Sep 27 15:52:15 EEST 2023


Paul B Mahol:
> On Sun, Sep 24, 2023 at 2:04 AM Andreas Rheinhardt <
> andreas.rheinhardt at outlook.com> wrote:
> 
>> Paul B Mahol:
>>>
>>> +        if (!qoa->frame_size) {
>>> +            for (; i < buf_size; i++) {
>>> +                state = (state << 8) | buf[i];
>>> +                if (((state & 0xFFFF) > 0 && (state >> 56))) {
>>> +                    qoa->frame_size = state & 0xFFFF;
>>> +                    qoa->duration = (state >> 16) & 0xFFFF;
>>> +                    break;
>>> +                }
>>> +            }
>>> +        }
>>
>> So this codec uses a length field. In this case it is quite simple to
>> avoid the parser (and its implicit memcpy) altogether and just make the
>> demuxer directly output packets of the correct size. This is quite
>> natural given that this format does not seem to provide any features
>> like resyncing support (or at least the parser does not implement them).
>>
> 
> But channels/sample rate may differ between packets.

And?

> Also it may be in other formats, like wav. So I picked parser as more
> valuable implementation.
> 

Then you could simply reuse the code inside libavformat.

- Andreas



More information about the ffmpeg-devel mailing list