From: Tom Yan <tom.ty89@gmail.com>
To: ffmpeg-devel@ffmpeg.org, jamrial@gmail.com,
andreas.rheinhardt@outlook.com
Cc: aman@tmm1.net, Tom Yan <tom.ty89@gmail.com>
Subject: [FFmpeg-devel] [PATCH v3] mpegvideo_parser: check picture_structure for field order
Date: Sun, 6 Feb 2022 18:04:08 +0800
Message-ID: <20220206100408.40824-1-tom.ty89@gmail.com> (raw)
the top_field_first bit is only used to indicate the field order
when the picture is a frame picture (which consists of two fields)
but not when it is a field picture (which consists of one single
top or bottom field).
Signed-off-by: Tom Yan <tom.ty89@gmail.com>
---
libavcodec/mpegvideo_parser.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
index c5dc867d24..26f3aac9da 100644
--- a/libavcodec/mpegvideo_parser.c
+++ b/libavcodec/mpegvideo_parser.c
@@ -181,6 +181,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s,
break;
case 0x8: /* picture coding extension */
if (bytes_left >= 5) {
+ s->picture_structure = buf[2] & 0x3;
top_field_first = buf[3] & (1 << 7);
repeat_first_field = buf[3] & (1 << 1);
progressive_frame = buf[4] & (1 << 7);
@@ -198,13 +199,15 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s,
}
}
- if (!pc->progressive_sequence && !progressive_frame) {
- if (top_field_first)
- s->field_order = AV_FIELD_TT;
- else
- s->field_order = AV_FIELD_BB;
- } else
+ /* picture_structure > progressive bits > top_field_first */
+ if (s->picture_structure == AV_PICTURE_STRUCTURE_TOP_FIELD)
+ s->field_order = AV_FIELD_TT;
+ else if (s->picture_structure == AV_PICTURE_STRUCTURE_BOTTOM_FIELD)
+ s->field_order = AV_FIELD_BB;
+ else if (pc->progressive_sequence || progressive_frame)
s->field_order = AV_FIELD_PROGRESSIVE;
+ else
+ s->field_order = top_field_first ? AV_FIELD_TT : AV_FIELD_BB;
}
break;
}
--
2.35.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:[~2022-02-06 10:04 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=20220206100408.40824-1-tom.ty89@gmail.com \
--to=tom.ty89@gmail.com \
--cc=aman@tmm1.net \
--cc=andreas.rheinhardt@outlook.com \
--cc=ffmpeg-devel@ffmpeg.org \
--cc=jamrial@gmail.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