From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 979B34B686 for ; Fri, 12 Jul 2024 02:49:28 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9775B68DB43; Fri, 12 Jul 2024 05:49:26 +0300 (EEST) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 79F1668D960 for ; Fri, 12 Jul 2024 05:49:19 +0300 (EEST) Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2ee90dc1dc1so15606541fa.3 for ; Thu, 11 Jul 2024 19:49:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720752558; x=1721357358; darn=ffmpeg.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=O9dpPWtMoECeGXGokECysC3Y9+tGnnqWNBekwzmlBIU=; b=QMOLI/e/uHFUSMRtFqpcgHs7RjeJOk9E9HvV/VUHbyNSOhnlnjWMnFof1YWe8hftPX i6b6GqvVu2vMc+tFbDM5+Pt7bBPIJWuDcWTRPzOmCP9D0f+pt/5+PNN8ANfROUVnrdy7 K1e3sS59iSS4w0Fhqn1zh3BOLS3v5Vog21lvzwWyTjd1u0CcCFH4lAlosfW2NK8O2NG1 Pt8XnWWiNpi+eAE0fSBDm7xp5n2c8RW08b0hORMW9v4zD/3g6Z6WKs2k2N6JN7lqIhWb 26vkxmr7+WCdpR1Lkl7BDiIoTzsujQfxpkDhv0g7Op61yEsWwiIGWrAc9fcAUy6LyH4k YoLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720752558; x=1721357358; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=O9dpPWtMoECeGXGokECysC3Y9+tGnnqWNBekwzmlBIU=; b=FKNbJ6RdBrsph48z09hLZU+R05PCpZcdZ5Hs/nqMRk3/FHwj7htC+1L1dBtSB8IhdI +ieo8/hSkDzZ6hoFc16VJXlSbvaCYLIRH8jnNXZjFSXS7jYzVQDQCbbxhd2VASDI0RWF 9TaVPQqe2GvqrEXOEZZPCB04PDJY3QyqCoCIsJmGFGuZpUuucRf4ccqJyaUftj0wesOr AcXMB18xStme/LNQwPOIbEjsJI+t0PBlpWnuK70lGLDwZSk83T+v5zEtbRQ5Zd9gkA1L Ret/JEu4JgMPdZjUWSsthLZ75+9YBGa0duUva77hwxGazUB/FT8oVHW9xYY0BXiBE3Cr 3mwg== X-Gm-Message-State: AOJu0YxP87xEL/JK7BmM7S6vbWVzxHHLCSphR5rjA8mNKMveFlg4P5Rh SIO724NP+sFsb7vntGTEgtWFLxLHnBWfhZ4g0/LXcgi825/hhdzG/FHdbsSDMeGLJHQWNFcgODE VItjIukIfIYaSNcNZz+erxlt7BAWVaFnv+q8= X-Google-Smtp-Source: AGHT+IF6FGk7XljIBI99PrF0snS8UowN0sAvBC0zNBrI0hcpmN7wcRHvl0G/W+EmLPZ87n8SljeNx7mGEijZ6fB9gL4= X-Received: by 2002:a2e:9bca:0:b0:2ec:5945:6301 with SMTP id 38308e7fff4ca-2eeb30e5de1mr68382401fa.18.1720752558051; Thu, 11 Jul 2024 19:49:18 -0700 (PDT) MIME-Version: 1.0 From: Li Kai Date: Fri, 12 Jul 2024 10:49:06 +0800 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [FFmpeg-devel] [PATCH] avcodec/hevc: compatible with mixed use of annexb and hvcc on bitstream like h264dec X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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 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 --- 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".