This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 6092f060f4 avcodec/h264_parser: align field_order default with the 
decoder
6092f060f4 is described below

commit 6092f060f431f587b3d619a36d9b9d5f963d8b57
Author:     Nicolas Gaullier <[email protected]>
AuthorDate: Thu Aug 13 17:00:42 2026 +0200
Commit:     James Almer <[email protected]>
CommitDate: Fri Aug 14 13:39:48 2026 +0000

    avcodec/h264_parser: align field_order default with the decoder
    
    Use case: interlaced AVC Intra is typically missing the required information
    for proper tff detection.
    Currently, the decoder defaults to tff, but the parser defaults to 
progressive.
    
    ./ffmpeg -f lavfi -i testsrc=1920x1080 -codec libx264 -pix_fmt yuv422p10le \
        -x264-params avcintra-class=100:tff=1 -frames 1 tff.h264
    ./ffprobe tff.h264 -of flat -show_entries 
stream=field_order:frame=interlaced_frame,top_field_first
    
    Before:
    frames.frame.0.interlaced_frame=1
    frames.frame.0.top_field_first=1
    streams.stream.0.field_order="progressive"
    
    After:
    frames.frame.0.interlaced_frame=1
    frames.frame.0.top_field_first=1
    streams.stream.0.field_order="tt"
    
    Issue since field_order setting in 3f1a7ceb2c604deff.
    
    Signed-off-by: Nicolas Gaullier <[email protected]>
---
 libavcodec/h264_parser.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 9d64fc603f..af43cad609 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -423,6 +423,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
 
             if (sps->frame_mbs_only_flag) {
                 p->picture_structure = PICT_FRAME;
+                s->field_order = AV_FIELD_PROGRESSIVE;
             } else {
                 if (get_bits1(&nal.gb)) { // field_pic_flag
                     p->picture_structure = PICT_TOP_FIELD + 
get_bits1(&nal.gb); // bottom_field_flag
@@ -541,8 +542,11 @@ static inline int parse_nal_units(AVCodecParserContext *s,
                         s->field_order = AV_FIELD_TT;
                     else if (field_poc[0] > field_poc[1])
                         s->field_order = AV_FIELD_BB;
-                    else
-                        s->field_order = AV_FIELD_PROGRESSIVE;
+                    else if (sps->mb_aff) {
+                        /* Default to top field first
+                         * This is the same as what the decoder does */
+                        s->field_order = AV_FIELD_TT;
+                    }
                 }
             } else {
                 if (p->picture_structure == PICT_TOP_FIELD)

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to