[vlc-devel] [PATCH 3/9] packetizer: hevc: set the proper amount of fields in HEVC output

Steve Lhomme robux4 at ycbcr.xyz
Mon Nov 16 13:44:14 CET 2020


In HEVC interlaced pictures only contain one field outside of decoders. We only
get the interlaced information when the first picture gets out of the decoder.
By that time the window has been created (to get a decoder device) and it's
assuming a wrong aspect ratio (before deinterlacing).
---
 modules/packetizer/hevc.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index 73f9a243e88..90f059ae3ea 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -669,7 +669,7 @@ static void GetXPSSet(uint8_t i_pps_id, void *priv,
             *pp_vps = p_sys->rg_vps[hevc_get_sps_vps_id(*pp_sps)].p_decoded;
 }
 
-static void ParseStoredSEI( decoder_t *p_dec )
+static void ParseStoredSEI( decoder_t *p_dec, hevc_sequence_parameter_set_t *p_sps )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
 
@@ -685,6 +685,12 @@ static void ParseStoredSEI( decoder_t *p_dec )
                                   2 /* nal header */, ParseSEICallback, p_dec );
         }
     }
+
+    if ( p_sps && p_sys->p_timing )
+    {
+        if ( !hevc_frame_is_progressive( p_sps, p_sys->p_timing ) )
+            p_dec->fmt_out.video.i_num_fields = 1;
+    }
 }
 
 static block_t *ParseVCL(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_frag)
@@ -714,16 +720,16 @@ static block_t *ParseVCL(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_frag)
 
         hevc_slice_segment_header_t *p_sli = hevc_decode_slice_header(p_buffer, i_buffer, true,
                                                                       GetXPSSet, p_sys);
+        hevc_sequence_parameter_set_t *p_sps = NULL;
         if(p_sli && i_layer == 0)
         {
-            hevc_sequence_parameter_set_t *p_sps;
             hevc_picture_parameter_set_t *p_pps;
             hevc_video_parameter_set_t *p_vps;
             GetXPSSet(hevc_get_slice_pps_id(p_sli), p_sys, &p_pps, &p_sps, &p_vps);
             ActivateSets(p_dec, p_pps, p_sps, p_vps);
         }
 
-        ParseStoredSEI( p_dec );
+        ParseStoredSEI( p_dec, p_sps );
 
         switch(i_nal_type)
         {
-- 
2.26.2



More information about the vlc-devel mailing list