[vlc-commits] codec: videotoolbox: select best chroma for SW deinterlacer
Thomas Guillem
git at videolan.org
Tue Jan 16 12:13:07 CET 2018
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jan 16 09:50:40 2018 +0100| [19db35a904556dea51a41a160e094e75f6eb47f6] | committer: Thomas Guillem
codec: videotoolbox: select best chroma for SW deinterlacer
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=19db35a904556dea51a41a160e094e75f6eb47f6
---
modules/codec/videotoolbox.m | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index f0775e0849..d6e0dae06c 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -1773,14 +1773,35 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
vlc_mutex_lock(&p_sys->lock);
-#if TARGET_OS_IPHONE
if (p_block->i_flags & BLOCK_FLAG_INTERLACED_MASK)
{
+#if TARGET_OS_IPHONE
msg_Warn(p_dec, "VT decoder doesn't handle deinterlacing on iOS, "
"aborting...");
p_sys->vtsession_status = VTSESSION_STATUS_ABORT;
- }
+#else
+ if (p_sys->i_forced_cvpx_format == 0)
+ {
+ /* In case of interlaced content, force VT to output I420 since our
+ * SW deinterlacer handle this chroma natively. This avoids having
+ * 2 extra conversions (CVPX->I420 then I420->CVPX). */
+
+ p_sys->i_forced_cvpx_format = kCVPixelFormatType_420YpCbCr8Planar;
+ msg_Warn(p_dec, "Interlaced content: forcing VT to output I420");
+ if (p_sys->session != nil && p_sys->vtsession_status == VTSESSION_STATUS_OK)
+ {
+ msg_Warn(p_dec, "restarting vt session (color changed)");
+ vlc_mutex_unlock(&p_sys->lock);
+
+ /* Drain before stopping */
+ Drain(p_dec, false);
+ StopVideoToolbox(p_dec);
+
+ vlc_mutex_lock(&p_sys->lock);
+ }
+ }
#endif
+ }
if (p_sys->vtsession_status == VTSESSION_STATUS_RESTART)
{
More information about the vlc-commits
mailing list