Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] QOA decoding support
Date: Sun, 24 Sep 2023 02:05:49 +0200
Message-ID: <AS8P250MB0744CEB558949B7A42AEE76A8FFDA@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <CAPYw7P7HjG6Ow+Uv4JJgyhyKiqSsTqBLOePwU9hOw5pF61peiw@mail.gmail.com>

Paul B Mahol:
> +    .flags          = AVFMT_GENERIC_INDEX,
> +    .extensions     = "qoa",
> +    .raw_codec_id   = AV_CODEC_ID_QOA,

This will not compile: The codec_id is only added in the second patch.

> +    .priv_data_size = sizeof(FFRawDemuxerContext),
> +    .priv_class     = &ff_raw_demuxer_class,


> 
> +        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).

> 
> +#include "avcodec.h"
> +#include "codec_internal.h"
> +#include "decode.h"
> +#include "get_bits.h"

You don't use the GetBit API at all.

> +#include "bytestream.h"

> 
> +    for (int sample_index = 0; sample_index < frame->nb_samples * nb_channels;
> +         sample_index += QOA_SLICE_LEN) {
> +        for (int ch = 0; ch < nb_channels; ch++) {

So the number of times the second loop is executed is quadratic in
nb_channels. Is this really intended? The frame_size check is not
quadratic in nb_channels. In fact, it does not seem to account for this
double-loop here at all.

- Andreas

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2023-09-24  0:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-23 21:39 Paul B Mahol
2023-09-24  0:05 ` Andreas Rheinhardt [this message]
2023-09-24  0:48   ` Paul B Mahol
2023-09-27 12:52     ` Andreas Rheinhardt
2023-09-27 12:52       ` Paul B Mahol
2023-09-27 12:57         ` Nicolas George
2023-09-27 13:00           ` Paul B Mahol
2023-09-27 18:37             ` Michael Niedermayer
2023-09-27 19:59               ` Paul B Mahol
2023-10-06 11:54                 ` Paul B Mahol
2023-09-27 13:02           ` Paul B Mahol
2023-09-27 12:58       ` Nicolas George
2023-09-27 13:05         ` Andreas Rheinhardt
2023-09-27 13:09           ` Paul B Mahol
2023-09-24  0:50 ` Paul B Mahol
2023-09-27 12:44   ` Paul B Mahol
2023-09-27 12:54   ` Tomas Härdin
2023-09-27 12:56     ` Paul B Mahol
2023-09-27 12:57       ` Tomas Härdin
2023-09-27 12:59         ` Paul B Mahol
2023-09-27 13:05           ` Tomas Härdin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8P250MB0744CEB558949B7A42AEE76A8FFDA@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git