[vlc-devel] [PATCH 4/9] avcodec: video: set the number of fields to 1 in HEVC interlaced
Steve Lhomme
robux4 at ycbcr.xyz
Mon Nov 16 13:44:15 CET 2020
lavc doesn't give this information but given the specs this is how it's
supposed to be. The decoder (software and hardware don't merge fields into
a frame)
---
modules/codec/avcodec/video.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 13b00e3f26d..23d1d469394 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -1144,6 +1144,11 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
}
}
+ p_dec->fmt_out.video.i_num_fields = 2;
+ if (frame->interlaced_frame && p_context->codec_id == AV_CODEC_ID_HEVC)
+ // interlaced HEVC decoding sends 1 field at a time and isn't signaled by lavc
+ p_dec->fmt_out.video.i_num_fields = 1;
+
picture_t *p_pic = frame->opaque;
if( p_pic == NULL )
{ /* When direct rendering is not used, get_format() and get_buffer()
@@ -1205,7 +1210,11 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_pic->date = i_pts;
/* Hack to force display of still pictures */
p_pic->b_force = p_sys->b_first_frame;
- p_pic->i_nb_fields = 2 + frame->repeat_pict;
+ if (frame->interlaced_frame && p_context->codec_id == AV_CODEC_ID_HEVC)
+ // interlaced HEVC decoding sends 1 field at a time and isn't signaled by lavc
+ p_pic->i_nb_fields = 1;
+ else
+ p_pic->i_nb_fields = 2 + frame->repeat_pict;
p_pic->b_progressive = !frame->interlaced_frame;
p_pic->b_top_field_first = frame->top_field_first;
--
2.26.2
More information about the vlc-devel
mailing list