Skip to content

Commit

Permalink
Rockchip: update kodi deinterlace patches
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Reichl <hias@horus.com>
  • Loading branch information
HiassofT committed Jul 15, 2022
1 parent aa377c6 commit 8631e51
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 41 deletions.
@@ -1,15 +1,15 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From b106cf859379c6edb00f1cbb1cd9ca4607201e1e Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Sun, 20 Oct 2019 17:10:07 +0000
Subject: [PATCH] WIP: DVDVideoCodecDRMPRIME: add support for filters
Subject: [PATCH 1/2] WIP: DVDVideoCodecDRMPRIME: add support for filters

---
.../DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp | 68 ++++++++++++++++---
.../DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp | 62 +++++++++++++++++--
.../DVDCodecs/Video/DVDVideoCodecDRMPRIME.h | 10 +++
2 files changed, 69 insertions(+), 9 deletions(-)
2 files changed, 66 insertions(+), 6 deletions(-)

diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index 8024c20816..7507c12e9a 100644
index a7407e76af..01ee7e7fe6 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -27,6 +27,8 @@
Expand All @@ -21,7 +21,7 @@ index 8024c20816..7507c12e9a 100644
#include <libavutil/error.h>
#include <libavutil/imgutils.h>
#include <libavutil/opt.h>
@@ -525,18 +527,30 @@ void CDVDVideoCodecDRMPRIME::SetPictureParams(VideoPicture* pVideoPicture)
@@ -531,12 +533,30 @@ void CDVDVideoCodecDRMPRIME::SetPictureParams(VideoPicture* pVideoPicture)
pVideoPicture->dts = DVD_NOPTS_VALUE;
}

Expand All @@ -32,19 +32,16 @@ index 8024c20816..7507c12e9a 100644
- Drain();
+ if (!m_pFilterIn)
+ return VC_PICTURE;

- if (pVideoPicture->videoBuffer)
+
+ int ret = av_buffersrc_add_frame(m_pFilterIn, m_pFrame);
+ if (ret < 0)
{
- pVideoPicture->videoBuffer->Release();
- pVideoPicture->videoBuffer = nullptr;
+ {
+ char err[AV_ERROR_MAX_STRING_SIZE] = {};
+ av_strerror(ret, err, AV_ERROR_MAX_STRING_SIZE);
+ CLog::Log(LOGERROR, "CDVDVideoCodecDRMPRIME::{} - buffersrc add frame failed: {} ({})",
+ __FUNCTION__, err, ret);
+ return VC_ERROR;
}
+ }

- int ret = avcodec_receive_frame(m_pCodecContext, m_pFrame);
+ return ProcessFilterOut();
Expand All @@ -59,7 +56,7 @@ index 8024c20816..7507c12e9a 100644
if (ret == AVERROR(EAGAIN))
return VC_BUFFER;
else if (ret == AVERROR_EOF)
@@ -553,11 +567,47 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideo
@@ -553,11 +573,41 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideo
{
char err[AV_ERROR_MAX_STRING_SIZE] = {};
av_strerror(ret, err, AV_ERROR_MAX_STRING_SIZE);
Expand All @@ -78,12 +75,6 @@ index 8024c20816..7507c12e9a 100644
+ if (m_codecControlFlags & DVD_CODEC_CTRL_DRAIN)
+ Drain();
+
+ if (pVideoPicture->videoBuffer)
+ {
+ pVideoPicture->videoBuffer->Release();
+ pVideoPicture->videoBuffer = nullptr;
+ }
+
+ auto result = ProcessFilterOut();
+ if (result != VC_PICTURE)
+ {
Expand All @@ -108,9 +99,9 @@ index 8024c20816..7507c12e9a 100644
+
SetPictureParams(pVideoPicture);

if (IsSupportedHwFormat(static_cast<AVPixelFormat>(m_pFrame->format)))
if (pVideoPicture->videoBuffer)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
index 77d066c3d9..7112d1b48a 100644
index 9d70893b70..48bbae40fc 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
@@ -14,6 +14,11 @@
Expand Down Expand Up @@ -143,3 +134,6 @@ index 77d066c3d9..7112d1b48a 100644
+ AVFilterContext* m_pFilterOut = nullptr;
std::shared_ptr<IVideoBufferPool> m_videoBufferPool;
};
--
2.34.1

@@ -1,15 +1,15 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From 2e2964365ed7b38080ee0f590512868257891397 Mon Sep 17 00:00:00 2001
From: Jernej Skrabec <jernej.skrabec@siol.net>
Date: Thu, 26 Dec 2019 11:01:51 +0100
Subject: [PATCH] WIP: DRMPRIME deinterlace filter
Subject: [PATCH 2/2] WIP: DRMPRIME deinterlace filter

---
.../DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp | 368 +++++++++++++++---
.../DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp | 378 +++++++++++++++---
.../DVDCodecs/Video/DVDVideoCodecDRMPRIME.h | 9 +-
2 files changed, 322 insertions(+), 55 deletions(-)
2 files changed, 327 insertions(+), 60 deletions(-)

diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index 7507c12e9a..4759dde3f9 100644
index 01ee7e7fe6..1b662d11c7 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -79,12 +79,15 @@ CDVDVideoCodecDRMPRIME::CDVDVideoCodecDRMPRIME(CProcessInfo& processInfo)
Expand Down Expand Up @@ -67,11 +67,17 @@ index 7507c12e9a..4759dde3f9 100644
{
pVideoPicture->iWidth = m_pFrame->width;
pVideoPicture->iHeight = m_pFrame->height;
@@ -525,13 +541,232 @@ void CDVDVideoCodecDRMPRIME::SetPictureParams(VideoPicture* pVideoPicture)
@@ -531,13 +547,238 @@ void CDVDVideoCodecDRMPRIME::SetPictureParams(VideoPicture* pVideoPicture)
? DVD_NOPTS_VALUE
: static_cast<double>(pts) * DVD_TIME_BASE / AV_TIME_BASE;
pVideoPicture->dts = DVD_NOPTS_VALUE;
+
+ if (pVideoPicture->videoBuffer)
+ {
+ pVideoPicture->videoBuffer->Release();
+ pVideoPicture->videoBuffer = nullptr;
+ }
+
+ if (IsSupportedHwFormat(static_cast<AVPixelFormat>(m_pFrame->format)))
+ {
+ CVideoBufferDRMPRIMEFFmpeg* buffer =
Expand Down Expand Up @@ -303,7 +309,7 @@ index 7507c12e9a..4759dde3f9 100644
int ret = av_buffersrc_add_frame(m_pFilterIn, m_pFrame);
if (ret < 0)
{
@@ -547,21 +782,14 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::ProcessFilterIn()
@@ -553,21 +794,14 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::ProcessFilterIn()

CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::ProcessFilterOut()
{
Expand All @@ -329,7 +335,7 @@ index 7507c12e9a..4759dde3f9 100644
}
else if (ret)
{
@@ -572,9 +800,27 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::ProcessFilterOut()
@@ -578,71 +812,97 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::ProcessFilterOut()
return VC_ERROR;
}

Expand Down Expand Up @@ -357,9 +363,7 @@ index 7507c12e9a..4759dde3f9 100644
CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideoPicture)
{
if (m_codecControlFlags & DVD_CODEC_CTRL_DRAIN)
@@ -586,57 +832,71 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideo
pVideoPicture->videoBuffer = nullptr;
}
Drain();

- auto result = ProcessFilterOut();
- if (result != VC_PICTURE)
Expand All @@ -382,35 +386,40 @@ index 7507c12e9a..4759dde3f9 100644
+ if (!SetPictureParams(pVideoPicture))
+ return VC_ERROR;
+ return VC_PICTURE;
}
+ }
+ else if (ret != VC_BUFFER)
+ {
+ return ret;
+ }
+ }

}
-
- result = ProcessFilterIn();
- if (result != VC_PICTURE)
- return result;
}

- SetPictureParams(pVideoPicture);
-
- if (pVideoPicture->videoBuffer)
+ int ret = avcodec_receive_frame(m_pCodecContext, m_pFrame);
+ if (ret == AVERROR(EAGAIN))
+ return VC_BUFFER;
+ else if (ret == AVERROR_EOF)
+ return VC_EOF;
+ else if (ret)
+ {
{
- pVideoPicture->videoBuffer->Release();
- pVideoPicture->videoBuffer = nullptr;
+ char err[AV_ERROR_MAX_STRING_SIZE] = {};
+ av_strerror(ret, err, AV_ERROR_MAX_STRING_SIZE);
+ CLog::Log(LOGERROR, "CDVDVideoCodecDRMPRIME::{} - receive frame failed: {} ({})",
+ __FUNCTION__, err, ret);
+ return VC_ERROR;
}

- SetPictureParams(pVideoPicture);
- if (IsSupportedHwFormat(static_cast<AVPixelFormat>(m_pFrame->format)))
+ if (!m_processInfo.GetVideoInterlaced() && m_pFrame->interlaced_frame)
+ m_processInfo.SetVideoInterlaced(true);

- if (IsSupportedHwFormat(static_cast<AVPixelFormat>(m_pFrame->format)))
+
+ std::string filterChain = GetFilterChain(m_pFrame->interlaced_frame);
+ if (!filterChain.empty())
{
Expand Down Expand Up @@ -468,7 +477,7 @@ index 7507c12e9a..4759dde3f9 100644
return VC_PICTURE;
}
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
index 7112d1b48a..13bec95135 100644
index 48bbae40fc..c0478f0072 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
@@ -38,18 +38,25 @@ public:
Expand Down Expand Up @@ -498,3 +507,6 @@ index 7112d1b48a..13bec95135 100644
AVFilterGraph* m_pFilterGraph = nullptr;
AVFilterContext* m_pFilterIn = nullptr;
AVFilterContext* m_pFilterOut = nullptr;
--
2.34.1

0 comments on commit 8631e51

Please sign in to comment.