[vlc-commits] videotoolbox: fix temporal deinterlacing handling

Thomas Guillem git at videolan.org
Fri Jun 2 18:43:43 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Apr  4 09:15:25 2017 +0200| [f54a9f250ca16861fef682f7667bf960f32301c6] | committer: Thomas Guillem

videotoolbox: fix temporal deinterlacing handling

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f54a9f250ca16861fef682f7667bf960f32301c6
---

 modules/codec/videotoolbox.m | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 0dccf8c956..09fae32bf2 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -662,16 +662,12 @@ static int StartVideoToolbox(decoder_t *p_dec)
                              kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder,
                              kCFBooleanTrue);
 
-    if (p_sys->b_enable_temporal_processing)
-    {
-        msg_Dbg(p_dec, "Interlaced content detected, inserting temporal deinterlacer");
-        CFDictionarySetValue(p_sys->decoderConfiguration,
-                             kVTDecompressionPropertyKey_FieldMode,
-                             kVTDecompressionProperty_FieldMode_DeinterlaceFields);
-        CFDictionarySetValue(p_sys->decoderConfiguration,
-                             kVTDecompressionPropertyKey_DeinterlaceMode,
-                             kVTDecompressionProperty_DeinterlaceMode_Temporal);
-    }
+    CFDictionarySetValue(p_sys->decoderConfiguration,
+                         kVTDecompressionPropertyKey_FieldMode,
+                         kVTDecompressionProperty_FieldMode_DeinterlaceFields);
+    CFDictionarySetValue(p_sys->decoderConfiguration,
+                         kVTDecompressionPropertyKey_DeinterlaceMode,
+                         kVTDecompressionProperty_DeinterlaceMode_Temporal);
 
     /* create video format description */
     status = CMVideoFormatDescriptionCreate(kCFAllocatorDefault,
@@ -865,7 +861,8 @@ static int OpenDecoder(vlc_object_t *p_this)
     p_sys->b_poc_based_reorder = false;
     p_sys->b_format_propagated = false;
     p_sys->b_abort = false;
-    p_sys->b_enable_temporal_processing = false;
+    p_sys->b_enable_temporal_processing =
+        var_InheritBool(p_dec, "videotoolbox-temporal-deinterlacing");
     h264_poc_context_init( &p_sys->pocctx );
     vlc_mutex_init(&p_sys->lock);
 
@@ -1316,10 +1313,6 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
         int i_ret = avcCFromAnnexBCreate(p_dec);
         if (i_ret == VLC_SUCCESS)
         {
-            if ((p_block->i_flags & BLOCK_FLAG_INTERLACED_MASK)
-             && var_InheritBool(p_dec, "videotoolbox-temporal-deinterlacing"))
-                p_sys->b_enable_temporal_processing = true;
-
             msg_Dbg(p_dec, "Got SPS/PPS: late opening of H264 decoder");
             StartVideoToolbox(p_dec);
         }
@@ -1341,7 +1334,8 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
 
     VTDecodeInfoFlags flagOut;
     VTDecodeFrameFlags decoderFlags = kVTDecodeFrame_EnableAsynchronousDecompression;
-    if (unlikely(p_sys->b_enable_temporal_processing))
+    if (p_sys->b_enable_temporal_processing
+     && (p_block->i_flags & BLOCK_FLAG_INTERLACED_MASK))
         decoderFlags |= kVTDecodeFrame_EnableTemporalProcessing;
 
     OSStatus status =



More information about the vlc-commits mailing list