Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v2 2/2] avcodec: add a ffv1 parser
Date: Thu, 6 Feb 2025 16:52:18 +0100
Message-ID: <20250206155218.GS4991@pb2> (raw)
In-Reply-To: <20250203021603.6413-2-jamrial@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 4406 bytes --]

On Sun, Feb 02, 2025 at 11:16:03PM -0300, James Almer wrote:
> Only setting frame and stream properties. No packetization is performed.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  configure                |  1 +
>  libavcodec/Makefile      |  1 +
>  libavcodec/ffv1_parser.c | 86 ++++++++++++++++++++++++++++++++++++++++
>  libavcodec/parsers.c     |  1 +
>  4 files changed, 89 insertions(+)
>  create mode 100644 libavcodec/ffv1_parser.c
> 
> diff --git a/configure b/configure
> index 06f641ead0..f09faaf505 100755
> --- a/configure
> +++ b/configure
> @@ -3469,6 +3469,7 @@ vvc_qsv_decoder_select="vvc_mp4toannexb_bsf qsvdec"
>  aac_parser_select="adts_header mpeg4audio"
>  av1_parser_select="cbs_av1"
>  evc_parser_select="evcparse"
> +ffv1_parser_select="rangecoder"
>  ftr_parser_select="adts_header mpeg4audio"
>  h264_parser_select="golomb h264dsp h264parse h264_sei"
>  hevc_parser_select="hevcparse hevc_sei"
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 44bb34182a..973e2c45d6 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -1207,6 +1207,7 @@ OBJS-$(CONFIG_DVBSUB_PARSER)           += dvbsub_parser.o
>  OBJS-$(CONFIG_DVD_NAV_PARSER)          += dvd_nav_parser.o
>  OBJS-$(CONFIG_DVDSUB_PARSER)           += dvdsub_parser.o
>  OBJS-$(CONFIG_EVC_PARSER)              += evc_parser.o
> +OBJS-$(CONFIG_FFV1_PARSER)             += ffv1_parser.o ffv1_parse.o ffv1.o
>  OBJS-$(CONFIG_FLAC_PARSER)             += flac_parser.o flacdata.o flac.o
>  OBJS-$(CONFIG_FTR_PARSER)              += ftr_parser.o
>  OBJS-$(CONFIG_G723_1_PARSER)           += g723_1_parser.o
> diff --git a/libavcodec/ffv1_parser.c b/libavcodec/ffv1_parser.c
> new file mode 100644
> index 0000000000..d0b396b693
> --- /dev/null
> +++ b/libavcodec/ffv1_parser.c
> @@ -0,0 +1,86 @@
> +/*
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#include "avcodec.h"
> +#include "ffv1.h"
> +#include "rangecoder.h"
> +
> +typedef struct FFV1ParseContext {
> +    FFV1Context f;
> +    int got_first;
> +} FFV1ParseContext;
> +
> +static int parse(AVCodecParserContext *s,
> +                 AVCodecContext *avctx,
> +                 const uint8_t **poutbuf, int *poutbuf_size,
> +                 const uint8_t *buf, int buf_size)
> +{
> +    FFV1ParseContext *p = s->priv_data;
> +    FFV1Context *f = &p->f;
> +    RangeCoder c;
> +    uint8_t keystate = 128;
> +
> +    *poutbuf      = buf;
> +    *poutbuf_size = buf_size;
> +
> +    if (!p->got_first) {
> +        int ret = ff_ffv1_common_init(avctx, f);
> +        p->got_first = 1;
> +        if (ret < 0)
> +            return buf_size;
> +
> +        if (avctx->extradata_size > 0 && (ret = ff_ffv1_read_extra_header(f)) < 0)
> +            return buf_size;
> +    }
> +
> +    ff_init_range_decoder(&c, buf, buf_size);
> +    ff_build_rac_states(&c, 0.05 * (1LL << 32), 256 - 8);
> +
> +    f->avctx = avctx;
> +    s->key_frame = get_rac(&c, &keystate);
> +    s->pict_type = AV_PICTURE_TYPE_I; //FIXME I vs. P, see ffv1dec.c

id remove the comment, also in ffv1dec.c

patch should be ok

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

  parent reply	other threads:[~2025-02-06 15:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-03  2:16 [FFmpeg-devel] [PATCH 1/2] avcodec/ffv1: split off and share frame header parsing code James Almer
2025-02-03  2:16 ` [FFmpeg-devel] [PATCH v2 2/2] avcodec: add a ffv1 parser James Almer
2025-02-03  5:42   ` Lynne
2025-02-03 13:00     ` James Almer
2025-02-06 15:52   ` Michael Niedermayer [this message]
2025-02-06 17:10     ` James Almer
2025-02-06 19:25     ` Jerome Martinez
2025-02-06 19:28       ` James Almer
2025-02-06 15:49 ` [FFmpeg-devel] [PATCH 1/2] avcodec/ffv1: split off and share frame header parsing code Michael Niedermayer

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=20250206155218.GS4991@pb2 \
    --to=michael@niedermayer.cc \
    --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