Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Li Kai <wolfleekay@gmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avcodec/hevc: compatible with mixed use of annexb and hvcc on bitstream like h264dec
Date: Fri, 12 Jul 2024 10:49:06 +0800
Message-ID: <CACGufqTitfAsF7Kat-geC-x5R-_gXXVoCc0iQtGy=kqHd-aogg@mail.gmail.com> (raw)

Hi:

    I found it's different actions with h264 and hevc when decoded. I try
to make it same as blow.

But I have no idea about the code:


*libavcode/h264dec.c:609 *

*AV_RB32(buf+5) > (unsigned)buf_size*

I tried to find the answer in specs, but I failed. So I am not sure that it
is valid in hevc.


From: Li Kai <wolfleekay@gmail.com>
Date: Fri, 12 Jul 2024 10:21:17 +0800
Subject: [PATCH] avcodec/hevc: compatible with mixed use of annexb and hvcc
on
 bitstream like h264dec

Signed-off-by: Li Kai <wolfleekay@gmail.com>
---
 libavcodec/hevc/hevcdec.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index fd143cddab..59e99493d5 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -3290,6 +3290,13 @@ static int decode_nal_units(HEVCContext *s, const
uint8_t *buf, int length)
     s->eos = 0;
     s->slice_initialized = 0;

+    if (s->nal_length_size == 4) {
+        if (length > 8 && AV_RB32(buf) == 1 && AV_RB32(buf+5) >
(unsigned)length) {
+            s->is_nalff = 0;
+        } else if (length > 3 && AV_RB32(buf) > 1 && AV_RB32(buf) <=
(unsigned)length)
+            s->is_nalff = 1;
+    }
+
     /* split the input packet into NAL units, so we know the upper bound
on the
      * number of slices in the frame */
     ret = ff_h2645_packet_split(&s->pkt, buf, length, s->avctx,
s->is_nalff,
-- 
2.45.1
_______________________________________________
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:[~2024-07-12  2:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='CACGufqTitfAsF7Kat-geC-x5R-_gXXVoCc0iQtGy=kqHd-aogg@mail.gmail.com' \
    --to=wolfleekay@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