diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2017-05-08 23:49:11 +0300 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2017-05-08 23:49:11 +0300 |
commit | 2675937efa5fd57146c473d4af29e509e28e7ed2 (patch) | |
tree | fdeddacb7d83030164c5589974ef370747703b49 /decoder | |
parent | 887cc51afa5a41278b119c46413c64866a6978d9 (diff) |
cuvid: pass bitdepth to the decoder
Diffstat (limited to 'decoder')
-rw-r--r-- | decoder/LAVVideo/decoders/cuvid.cpp | 9 | ||||
-rw-r--r-- | decoder/LAVVideo/decoders/cuvid.h | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/decoder/LAVVideo/decoders/cuvid.cpp b/decoder/LAVVideo/decoders/cuvid.cpp index 51edb52a..687b9501 100644 --- a/decoder/LAVVideo/decoders/cuvid.cpp +++ b/decoder/LAVVideo/decoders/cuvid.cpp @@ -671,6 +671,7 @@ STDMETHODIMP CDecCuvid::InitDecoder(AVCodecID codec, const CMediaType *pmt) } } + int bitdepth = 8; m_bNeedSequenceCheck = FALSE; if (m_VideoParserExInfo.format.seqhdr_data_length) { if (cudaCodec == cudaVideoCodec_H264) { @@ -726,7 +727,7 @@ STDMETHODIMP CDecCuvid::InitDecoder(AVCodecID codec, const CMediaType *pmt) videoFormatTypeHandler(pmt->Format(), pmt->FormatType(), &bmi); { - hr = CreateCUVIDDecoder(cudaCodec, bmi->biWidth, bmi->biHeight, !m_bInterlaced); + hr = CreateCUVIDDecoder(cudaCodec, bmi->biWidth, bmi->biHeight, bitdepth, !m_bInterlaced); if (FAILED(hr)) { DbgLog((LOG_ERROR, 10, L"-> Creating CUVID decoder failed")); return hr; @@ -740,7 +741,7 @@ STDMETHODIMP CDecCuvid::InitDecoder(AVCodecID codec, const CMediaType *pmt) return S_OK; } -STDMETHODIMP CDecCuvid::CreateCUVIDDecoder(cudaVideoCodec codec, DWORD dwWidth, DWORD dwHeight, bool bProgressiveSequence) +STDMETHODIMP CDecCuvid::CreateCUVIDDecoder(cudaVideoCodec codec, DWORD dwWidth, DWORD dwHeight, int nBitdepth, bool bProgressiveSequence) { DbgLog((LOG_TRACE, 10, L"CDecCuvid::CreateCUVIDDecoder(): Creating CUVID decoder instance")); HRESULT hr = S_OK; @@ -759,6 +760,7 @@ retry: dci->ulHeight = dwHeight; dci->ulNumDecodeSurfaces = MAX_DECODE_FRAMES; dci->CodecType = codec; + dci->bitDepthMinus8 = nBitdepth - 8; dci->ChromaFormat = cudaVideoChromaFormat_420; dci->OutputFormat = cudaVideoSurfaceFormat_NV12; dci->DeinterlaceMode = (bProgressiveSequence || (m_pSettings->GetDeinterlacingMode() == DeintMode_Disable)) ? cudaVideoDeinterlaceMode_Weave : (cudaVideoDeinterlaceMode)m_pSettings->GetHWAccelDeintMode(); @@ -830,11 +832,12 @@ int CUDAAPI CDecCuvid::HandleVideoSequence(void *obj, CUVIDEOFORMAT *cuvidfmt) || (cuvidfmt->coded_width != dci->ulWidth) || (cuvidfmt->coded_height != dci->ulHeight) || (cuvidfmt->chroma_format != dci->ChromaFormat) + || (cuvidfmt->bit_depth_luma_minus8 != dci->bitDepthMinus8) || (bShouldDeinterlace != (dci->DeinterlaceMode != cudaVideoDeinterlaceMode_Weave)) || filter->m_bForceSequenceUpdate) { filter->m_bForceSequenceUpdate = FALSE; - HRESULT hr = filter->CreateCUVIDDecoder(cuvidfmt->codec, cuvidfmt->coded_width, cuvidfmt->coded_height, cuvidfmt->progressive_sequence); + HRESULT hr = filter->CreateCUVIDDecoder(cuvidfmt->codec, cuvidfmt->coded_width, cuvidfmt->coded_height, cuvidfmt->bit_depth_luma_minus8 + 8, cuvidfmt->progressive_sequence); if (FAILED(hr)) filter->m_bFormatIncompatible = TRUE; } diff --git a/decoder/LAVVideo/decoders/cuvid.h b/decoder/LAVVideo/decoders/cuvid.h index 8daab069..5382d46d 100644 --- a/decoder/LAVVideo/decoders/cuvid.h +++ b/decoder/LAVVideo/decoders/cuvid.h @@ -63,7 +63,7 @@ private: STDMETHODIMP InitD3D9(int best_device, DWORD requested_device); - STDMETHODIMP CreateCUVIDDecoder(cudaVideoCodec codec, DWORD dwWidth, DWORD dwHeight, bool bProgressiveSequence); + STDMETHODIMP CreateCUVIDDecoder(cudaVideoCodec codec, DWORD dwWidth, DWORD dwHeight, int nBitdepth, bool bProgressiveSequence); STDMETHODIMP DecodeSequenceData(); // CUDA Callbacks |