Beispiel #1
0
void VideoDecoder::StopThread()
{
#ifndef LIBRETRO
	_stopFlag = true;
	if(_decodeThread) {
		_waitForFrame.Signal();
		_decodeThread->join();

		_decodeThread.reset();

		_hud.reset();
		_hdScreenInfo = nullptr;
		EmulationSettings::SetPpuModel(PpuModel::Ppu2C02);
		UpdateVideoFilter();
		if(_ppuOutputBuffer != nullptr) {
			//Clear whole screen
			for(uint32_t i = 0; i < PPU::PixelCount; i++) {
				_ppuOutputBuffer[i] = 14; //Black
			}
			DecodeFrame();
		}
		_ppuOutputBuffer = nullptr;
	}
#endif
}
Beispiel #2
0
void CWinRenderer::Render(DWORD flags, CD3DTexture* target)
{
  if (!m_renderBuffers[m_iYV12RenderBuffer].loaded)
  {
    if (!m_renderBuffers[m_iYV12RenderBuffer].UploadBuffer())
      return;
  }

  UpdateVideoFilter();

  switch (m_renderMethod)
  {
  case RENDER_DXVA:
    RenderHW(flags, target);
    break;
  case RENDER_PS:
    RenderPS(target);
    break;
  case RENDER_SW:
    RenderSW(target);
    break;
  default:
    return;
  }

  if (m_bUseHQScaler)
    RenderHQ(target);

  DX::Windowing().ApplyStateBlock();
}
Beispiel #3
0
void CWinRenderer::Render(DWORD flags, CD3DTexture* target)
{
  CRenderBuffer& buf = m_renderBuffers[m_iYV12RenderBuffer];
  if (!buf.loaded)
  {
    if (!buf.UploadBuffer())
      return;
  }

  AVColorPrimaries srcPrim = GetSrcPrimaries(buf.primaries, buf.GetWidth(), buf.GetHeight());
  if (srcPrim != m_srcPrimaries)
  {
    m_srcPrimaries = srcPrim;
    m_bFilterInitialized = false;
  }

  bool toneMap = false;
  if (m_videoSettings.m_ToneMapMethod != VS_TONEMAPMETHOD_OFF)
  {
    if (buf.hasLightMetadata || (buf.hasDisplayMetadata && buf.displayMetadata.has_luminance))
      toneMap = true;
  }
  if (toneMap != m_toneMapping)
  {
    m_outputShader.reset();
    m_bFilterInitialized = false;
  }
  m_toneMapping = toneMap;

  UpdateVideoFilter();

  switch (m_renderMethod)
  {
  case RENDER_DXVA:
    RenderHW(flags, target);
    break;
  case RENDER_PS:
    RenderPS(target);
    break;
  case RENDER_SW:
    RenderSW(target);
    break;
  default:
    return;
  }

  if (m_bUseHQScaler)
    RenderHQ(target);

  DX::Windowing()->ApplyStateBlock();
}
Beispiel #4
0
void VideoDecoder::DecodeFrame(bool synchronous)
{
	UpdateVideoFilter();

	if(_hdFilterEnabled) {
		((HdVideoFilter*)_videoFilter.get())->SetHdScreenTiles(_hdScreenInfo);
	}
	_videoFilter->SendFrame(_ppuOutputBuffer, _isOddFrame);

	uint32_t* outputBuffer = (uint32_t*)_videoFilter->GetOutputBuffer();
	FrameInfo frameInfo = _videoFilter->GetFrameInfo();

	if(_rotateFilter) {
		outputBuffer = _rotateFilter->ApplyFilter(outputBuffer, frameInfo.Width, frameInfo.Height);
		frameInfo = _rotateFilter->GetFrameInfo(frameInfo);
	}

	if(_scaleFilter) {
		outputBuffer = _scaleFilter->ApplyFilter(outputBuffer, frameInfo.Width, frameInfo.Height);
		frameInfo = _scaleFilter->GetFrameInfo(frameInfo);
	}

	if(_hud) {
		_hud->DrawHud((uint8_t*)outputBuffer, frameInfo, _videoFilter->GetOverscan());
	}

	ScreenSize screenSize;
	GetScreenSize(screenSize, true);
	if(_previousScale != EmulationSettings::GetVideoScale() || screenSize.Height != _previousScreenSize.Height || screenSize.Width != _previousScreenSize.Width) {
		MessageManager::SendNotification(ConsoleNotificationType::ResolutionChanged);
	}
	_previousScale = EmulationSettings::GetVideoScale();
	_previousScreenSize = screenSize;
	
	_lastFrameInfo = frameInfo;

	_frameChanged = false;
	
	//Rewind manager will take care of sending the correct frame to the video renderer
	RewindManager::SendFrame(outputBuffer, frameInfo.Width, frameInfo.Height, synchronous);
}
Beispiel #5
0
bool CRendererVDPAU::RenderHook(int idx)
{
  UpdateVideoFilter();

  if (m_format == RENDER_FMT_VDPAU_420)
  {
    switch(m_renderQuality)
    {
    case RQ_LOW:
    case RQ_SINGLEPASS:
      if (m_currentField == FIELD_FULL)
        RenderProgressiveWeave(idx, m_currentField);
      else
        RenderSinglePass(idx, m_currentField);
      VerifyGLState();
      break;

    case RQ_MULTIPASS:
      if (m_currentField == FIELD_FULL)
        RenderProgressiveWeave(idx, m_currentField);
      else
      {
        RenderToFBO(idx, m_currentField);
        RenderFromFBO();
      }
      VerifyGLState();
      break;
    }
  }
  else
  {
    RenderRGB(idx, m_currentField);
  }

  YUVBUFFER &buf = m_buffers[idx];
  if (buf.hwDec)
  {
    ((VDPAU::CVdpauRenderPicture*)buf.hwDec)->Sync();
  }
  return true;
}
Beispiel #6
0
VideoDecoder::VideoDecoder()
{
	_frameChanged = false;
	_stopFlag = false;
	UpdateVideoFilter();
}