Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Zhao Zhili <quinkblack@foxmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Zhao Zhili <quinkblack@foxmail.com>, Zhao Zhili <zhilizhao@tencent.com>
Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/avs2_parser: split data into frames
Date: Fri, 10 Jun 2022 21:50:20 +0800
Message-ID: <tencent_29E0145AB235AF80D034673E4557119C8009@qq.com> (raw)
In-Reply-To: <20220610135021.89892-1-quinkblack@foxmail.com>

From: Zhao Zhili <zhilizhao@tencent.com>

Before the patch, the parser split data into units, not frames.

Signed-off-by: Zhao Zhili <quinkblack@foxmail.com>
---
 libavcodec/avs2.h        | 2 +-
 libavcodec/avs2_parser.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/avs2.h b/libavcodec/avs2.h
index 7b66f51998..f342ba52a0 100644
--- a/libavcodec/avs2.h
+++ b/libavcodec/avs2.h
@@ -36,6 +36,6 @@ enum {
 };
 
 #define AVS2_ISPIC(x)  ((x) == AVS2_INTRA_PIC_START_CODE || (x) == AVS2_INTER_PIC_START_CODE)
-#define AVS2_ISUNIT(x) ((x) == AVS2_SEQ_START_CODE || (x) == AVS2_SEQ_END_CODE || (x) == AVS2_USER_DATA_START_CODE || AVS2_ISPIC(x))
+#define AVS2_ISUNIT(x) ((x) == AVS2_SEQ_START_CODE || AVS2_ISPIC(x))
 
 #endif
diff --git a/libavcodec/avs2_parser.c b/libavcodec/avs2_parser.c
index 3755dbd78c..71cf442903 100644
--- a/libavcodec/avs2_parser.c
+++ b/libavcodec/avs2_parser.c
@@ -31,7 +31,7 @@ static int avs2_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_siz
     if (!pic_found) {
         for (; cur < buf_size; ++cur) {
             state = (state << 8) | buf[cur];
-            if (AVS2_ISUNIT(buf[cur])){
+            if ((state & 0xFFFFFF00) == 0x100 && AVS2_ISPIC(buf[cur])) {
                 cur++;
                 pic_found = 1;
                 break;
@@ -44,7 +44,7 @@ static int avs2_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_siz
             return END_NOT_FOUND;
         for (; cur < buf_size; cur++) {
             state = (state << 8) | buf[cur];
-            if ((state & 0xFFFFFF00) == 0x100 && state > AVS2_SLICE_MAX_START_CODE) {
+            if ((state & 0xFFFFFF00) == 0x100 && AVS2_ISUNIT(buf[cur])) {
                 pc->frame_start_found = 0;
                 pc->state = -1;
                 return cur - 3;
-- 
2.35.3

_______________________________________________
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-06-10 13:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220610135021.89892-1-quinkblack@foxmail.com>
2022-06-10 13:50 ` Zhao Zhili [this message]
2022-06-10 13:50 ` [FFmpeg-devel] [PATCH 3/3] avcodec/avs2_parser: parse more info Zhao Zhili
2022-06-12 16:42   ` [FFmpeg-devel] [PATCH v2 " Zhao Zhili
2022-06-12 17:07     ` Andreas Rheinhardt
2022-06-13  3:42       ` "zhilizhao(赵志立)"

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=tencent_29E0145AB235AF80D034673E4557119C8009@qq.com \
    --to=quinkblack@foxmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=zhilizhao@tencent.com \
    /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