Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v2 03/10] avcodec: add bitstream parser for H266/VVC
Date: Mon, 24 Oct 2022 11:38:16 -0300
Message-ID: <621697ae-1c24-811d-c2e9-6c044699f37f@gmail.com> (raw)
In-Reply-To: <20221024140645.4945-4-thomas.ff@spin-digital.com>

On 10/24/2022 11:06 AM, Thomas Siedel wrote:
> +static int combine_au(AVCodecParserContext *ctx, AVCodecContext *avctx,
> +                      const uint8_t **buf, int *buf_size)
> +{

This is being called only when you first assembled AUs from what's 
assumed to be raw input. When PARSER_FLAG_COMPLETE_FRAMES is set, it 
should also parse the AU for bitstream information.

> +    VVCParserContext *s = ctx->priv_data;
> +    CodedBitstreamFragment *pu = &s->picture_unit;
> +    int ret;
> +
> +    s->cbc->log_ctx = avctx;
> +
> +    if (avctx->extradata_size && !s->parsed_extradata) {
> +        s->parsed_extradata = 1;
> +
> +        if ((ret = ff_cbs_read(s->cbc, pu, avctx->extradata, avctx->extradata_size)) < 0)

ff_cbs_read_extradata_from_codec()

> +            av_log(avctx, AV_LOG_WARNING, "Failed to parse extradata.\n");
> +
> +        ff_cbs_fragment_reset(pu);
> +    }
> +    av_packet_unref(&s->last_au);
> +    ret = parse_nal_units(ctx, *buf, *buf_size, avctx);
> +    if (ret == 0) {
> +        if (s->last_au.size) {
> +            *buf = s->last_au.data;
> +            *buf_size = s->last_au.size;
> +        } else {
> +            //no output
> +            ret = 1;
> +        }
> +    }
> +    s->cbc->log_ctx = NULL;
> +    return ret;
> +}
> +
> +static int vvc_parser_parse(AVCodecParserContext *ctx, AVCodecContext *avctx,
> +                      const uint8_t **poutbuf, int *poutbuf_size,
> +                      const uint8_t *buf, int buf_size)
> +{
> +    int next;
> +    VVCParserContext *s = ctx->priv_data;
> +    ParseContext *pc = &s->pc;
> +
> +    if (avctx->extradata && !s->parsed_extradata) {
> +        av_log(avctx, AV_LOG_INFO, "extra data is not supported yet.\n");
> +        return AVERROR_PATCHWELCOME;
> +    }
> +
> +    if (ctx->flags & PARSER_FLAG_COMPLETE_FRAMES) {
> +        next = buf_size;
> +    } else {
> +        int ret, flush = !buf_size;
> +        next = find_frame_end(ctx, buf, buf_size);
> +        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0)
> +            goto no_out;
> +        ret = combine_au(ctx, avctx, &buf, &buf_size);
> +        if (ret > 0 && flush) {
> +            buf_size = 0;
> +            ret = combine_au(ctx, avctx, &buf, &buf_size);
> +        }
> +        if (ret != 0) {
> +            buf_size = next;
> +            goto no_out;
> +        }
> +    }
> +    *poutbuf      = buf;
> +    *poutbuf_size = buf_size;
> +    return next;
> +no_out:
> +    *poutbuf      = NULL;
> +    *poutbuf_size = 0;
> +    return buf_size;
> +}
_______________________________________________
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:[~2022-10-24 14:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24 14:06 [FFmpeg-devel] [PATCH v2 00/10] Add support " Thomas Siedel
2022-10-24 14:06 ` [FFmpeg-devel] [PATCH v2 01/10] avcodec: add enum types " Thomas Siedel
2022-10-24 14:06 ` [FFmpeg-devel] [PATCH v2 02/10] avcodec: add cbs " Thomas Siedel
2022-10-24 14:06 ` [FFmpeg-devel] [PATCH v2 03/10] avcodec: add bitstream parser " Thomas Siedel
2022-10-24 14:38   ` James Almer [this message]
2022-10-31 10:16     ` Thomas Siedel
2022-10-31 20:02       ` James Almer
2022-11-03 12:37         ` Thomas Siedel
2022-10-24 14:06 ` [FFmpeg-devel] [PATCH v2 04/10] avcodec: add MP4 to annexb support " Thomas Siedel
2022-10-24 14:06 ` [FFmpeg-devel] [PATCH v2 05/10] avformat: add demuxer and probe " Thomas Siedel
2022-10-24 14:06 ` [FFmpeg-devel] [PATCH v2 06/10] avformat: add muxer " Thomas Siedel
2022-10-24 14:06 ` [FFmpeg-devel] [PATCH v2 07/10] avcodec: add external decoder libvvdec " Thomas Siedel
2022-10-24 14:06 ` [FFmpeg-devel] [PATCH v2 08/10] avcodec: add external encoder libvvenc " Thomas Siedel
2022-10-24 14:37   ` quietvoid
2022-11-03 12:51     ` Thomas Siedel
2022-10-24 14:06 ` [FFmpeg-devel] [PATCH v2 09/10] avformat: add ts stream types " Thomas Siedel
2022-10-24 14:06 ` [FFmpeg-devel] [PATCH v2 10/10] avcodec: increase minor version " Thomas Siedel

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=621697ae-1c24-811d-c2e9-6c044699f37f@gmail.com \
    --to=jamrial@gmail.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