Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksoid <aleksoid@users.sourceforge.net>2012-04-08 15:01:12 +0400
committerAleksoid <aleksoid@users.sourceforge.net>2012-04-08 15:01:12 +0400
commit2927b55dbeb30820e318098673085b48cf8d82ed (patch)
tree9e228ca6fe3af26415e8e4aec49e41d6ce5f9fa2
parent30067f9222c5313683bcae7ccbe3b28ede70141c (diff)
Fix : H.264 DXVA Decoder - fix slice parser on Annex B style's frames;
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@4291 10f7b99b-c216-0410-bff0-8a66a9350fd8
-rw-r--r--src/filters/transform/MPCVideoDec/DXVADecoderH264.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/filters/transform/MPCVideoDec/DXVADecoderH264.cpp b/src/filters/transform/MPCVideoDec/DXVADecoderH264.cpp
index 9da5c4bc8..48eab64d4 100644
--- a/src/filters/transform/MPCVideoDec/DXVADecoderH264.cpp
+++ b/src/filters/transform/MPCVideoDec/DXVADecoderH264.cpp
@@ -99,12 +99,15 @@ void CDXVADecoderH264::CopyBitstream(BYTE* pDXVABuffer, BYTE* pBuffer, UINT& nSi
{
CH264Nalu Nalu;
int nDummy;
- int nSlices = 0;
+ int nSlices = 0;
+ UINT m_nSize = nSize;
+ int slice_step = 1;
int nDxvaNalLength;
Nalu.SetBuffer (pBuffer, nSize, m_nNALLength);
+
+slice_again:
nSize = 0;
-
while (Nalu.ReadNext()) {
switch (Nalu.GetType()) {
case NALU_TYPE_SLICE:
@@ -136,6 +139,12 @@ void CDXVADecoderH264::CopyBitstream(BYTE* pDXVABuffer, BYTE* pBuffer, UINT& nSi
}
}
+ if (!nSlices && slice_step == 1) {
+ slice_step++;
+ Nalu.SetBuffer (pBuffer, m_nSize, 0);
+ goto slice_again;
+ }
+
// Complete with zero padding (buffer size should be a multiple of 128)
nDummy = 128 - (nSize %128);
@@ -167,6 +176,7 @@ HRESULT CDXVADecoderH264::DecodeFrame (BYTE* pDataIn, UINT nSize, REFERENCE_TIME
UINT nNalOffset = 0;
CComPtr<IMediaSample> pSampleToDeliver;
CComQIPtr<IMPCDXVA2Sample> pDXVA2Sample;
+ int slice_step = 1;
if (FFH264DecodeBuffer (m_pFilter->GetAVCtx(), pDataIn, nSize, &nFramePOC, &nOutPOC, &rtOutStart) == -1) {
return S_FALSE;
@@ -175,6 +185,8 @@ HRESULT CDXVADecoderH264::DecodeFrame (BYTE* pDataIn, UINT nSize, REFERENCE_TIME
TRACE_H264 ("CDXVADecoderH264::DecodeFrame() : nFramePOC = %d, nOutPOC = %d[%d], rtOutStart = %I64d\n", nFramePOC, nOutPOC, m_nOutPOC, rtOutStart);
Nalu.SetBuffer (pDataIn, nSize, m_nNALLength);
+
+slice_again:
while (Nalu.ReadNext()) {
switch (Nalu.GetType()) {
case NALU_TYPE_SLICE:
@@ -197,7 +209,14 @@ HRESULT CDXVADecoderH264::DecodeFrame (BYTE* pDataIn, UINT nSize, REFERENCE_TIME
break;
}
}
- if (nSlices == 0) {
+
+ if (!nSlices) {
+ if(slice_step == 1) {
+ slice_step++;
+ Nalu.SetBuffer (pDataIn, nSize, 0);
+ goto slice_again;
+ }
+
return S_FALSE;
}