Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avcodec/hevc: compatible with mixed use of annexb and hvcc on bitstream like h264dec
@ 2024-07-12  2:49 Li Kai
  0 siblings, 0 replies; only message in thread
From: Li Kai @ 2024-07-12  2:49 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-07-12  2:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-12  2:49 [FFmpeg-devel] [PATCH] avcodec/hevc: compatible with mixed use of annexb and hvcc on bitstream like h264dec Li Kai

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