XilinxProcessorIPLib/drivers/vprocss/src/xvprocss.c
static int ValidateSubsystemConfig(XVprocSs *InstancePtr)
{
  XVidC_VideoStream *StrmIn  = &InstancePtr->VidIn;
  XVidC_VideoStream *StrmOut = &InstancePtr->VidOut;

  /* Runtime Color Depth conversion not supported
   * Always overwrite input/output stream color depth with subsystem setting
   */
  StrmIn->ColorDepth  = (XVidC_ColorDepth)InstancePtr->Config.ColorDepth;
  StrmOut->ColorDepth = (XVidC_ColorDepth)InstancePtr->Config.ColorDepth;

  /* Runtime Pixel/Clock conversion not supported
   * Always overwrite input/output stream pixel/clk with subsystem setting
   */
  StrmIn->PixPerClk  = (XVidC_PixelsPerClock)InstancePtr->Config.PixPerClock;
  StrmOut->PixPerClk = (XVidC_PixelsPerClock)InstancePtr->Config.PixPerClock;

  /* Frame rate conversion is possible only in FULL topology */
  if((XVprocSs_GetSubsystemTopology(InstancePtr)
      != XVPROCSS_TOPOLOGY_FULL_FLEDGED) &&
     (StrmIn->FrameRate != StrmOut->FrameRate)) {
    XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_FRDIFF);
    return(XST_FAILURE);
  }

  /* Check input resolution is supported by HW */
  if((StrmIn->Timing.HActive > InstancePtr->Config.MaxWidth) ||
	 (StrmIn->Timing.HActive == 0) ||
	 (StrmIn->Timing.VActive > InstancePtr->Config.MaxHeight) ||
	 (StrmIn->Timing.VActive == 0)) {
    XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_IVRANGE);
	return(XST_FAILURE);
  }

  /* Check output resolution is supported by HW */
  if((StrmOut->Timing.HActive > InstancePtr->Config.MaxWidth) ||
	 (StrmOut->Timing.HActive == 0) ||
	 (StrmOut->Timing.VActive > InstancePtr->Config.MaxHeight) ||
	 (StrmOut->Timing.VActive == 0)) {
    XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_OVRANGE);
	return(XST_FAILURE);
  }

  /* Check Stream Width is aligned at Samples/Clock boundary */
  if(((StrmIn->Timing.HActive  % InstancePtr->Config.PixPerClock) != 0) ||
     ((StrmOut->Timing.HActive % InstancePtr->Config.PixPerClock) != 0))
  {
    XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_WIDBAD);
	return(XST_FAILURE);
  }


  /* Check for HCResamp required, but not present */
  if(XVprocSs_IsConfigModeMax(InstancePtr) &&
     ((StrmIn->ColorFormatId == XVIDC_CSF_YCRCB_420) || (StrmIn->ColorFormatId == XVIDC_CSF_YCRCB_422)) &&
     ((StrmOut->ColorFormatId == XVIDC_CSF_YCRCB_444) || (StrmOut->ColorFormatId == XVIDC_CSF_RGB)) &&
     (InstancePtr->HcrsmplrPtr==NULL)) {
     XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_NOHCR);
	return(XST_FAILURE);
  }

  /* Check for YUV422 In/Out stream width is even */
  if(((StrmIn->ColorFormatId  == XVIDC_CSF_YCRCB_422) &&
	  ((StrmIn->Timing.HActive % 2) != 0)) ||
	  ((StrmOut->ColorFormatId == XVIDC_CSF_YCRCB_422) &&
      ((StrmOut->Timing.HActive % 2) != 0))) {
    XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_WIDODD);
	return(XST_FAILURE);
  }

  /* Check for YUV420 In stream width and height is even */
  if((StrmIn->ColorFormatId == XVIDC_CSF_YCRCB_420) &&
      (((StrmIn->Timing.HActive % 2) != 0) &&
      ((StrmIn->Timing.VActive % 2) != 0))) {
    XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_SIZODD);
    return(XST_FAILURE);
  }

  /* Check for VCResamp required, but not present */
  /* In the Full-fledged case, the Output V C Resampler is "VcrsmplrOut" */
  /* In the VCResample-only case, the Output V C Resampler is "VcrsmplrIn" */
  if(((StrmOut->ColorFormatId == XVIDC_CSF_YCRCB_420) &&
      XVprocSs_IsConfigModeMax(InstancePtr) &&
      !InstancePtr->VcrsmplrOutPtr)) {
    XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_NOVCRO);
	return(XST_FAILURE);
  }
  if(((StrmIn->ColorFormatId == XVIDC_CSF_YCRCB_420) &&
      XVprocSs_IsConfigModeMax(InstancePtr) &&
      !InstancePtr->VcrsmplrInPtr)) {
    XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_NOVCRI);
	return(XST_FAILURE);
  }

  /* Check for Interlaced input limitation */
  if(StrmIn->IsInterlaced) {
	if(StrmIn->ColorFormatId == XVIDC_CSF_YCRCB_420) {
      XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_NO420);
	  return(XST_FAILURE);
	}
	if(!InstancePtr->DeintPtr) {
      XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_NODEIN);
	  return(XST_FAILURE);
	}
  }
  XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VALID);
  return(XST_SUCCESS);
}
/*****************************************************************************/
/**
* This function validates the input and output stream configuration against the
* Subsystem hardware capabilities
*
* @param  InstancePtr is a pointer to the Subsystem instance to be worked on.
*
* @return XST_SUCCESS if successful else XST_FAILURE
*
******************************************************************************/
This function validates the input and output stream configuration against the
Subsystem hardware capabilities
This function validates the input and output stream configuration against the Subsystem hardware capabilities
static int ValidateSubsystemConfig(XVprocSs *InstancePtr)
{
  XVidC_VideoStream *StrmIn  = &InstancePtr->VidIn;
  XVidC_VideoStream *StrmOut = &InstancePtr->VidOut;
  StrmIn->ColorDepth  = (XVidC_ColorDepth)InstancePtr->Config.ColorDepth;
  StrmOut->ColorDepth = (XVidC_ColorDepth)InstancePtr->Config.ColorDepth;
  StrmIn->PixPerClk  = (XVidC_PixelsPerClock)InstancePtr->Config.PixPerClock;
  StrmOut->PixPerClk = (XVidC_PixelsPerClock)InstancePtr->Config.PixPerClock;
  if((XVprocSs_GetSubsystemTopology(InstancePtr)
      != XVPROCSS_TOPOLOGY_FULL_FLEDGED) &&
     (StrmIn->FrameRate != StrmOut->FrameRate)) {
    XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_FRDIFF);
    return(XST_FAILURE);
  }
  if((StrmIn->Timing.HActive > InstancePtr->Config.MaxWidth) ||
	 (StrmIn->Timing.HActive == 0) ||
	 (StrmIn->Timing.VActive > InstancePtr->Config.MaxHeight) ||
	 (StrmIn->Timing.VActive == 0)) {
    XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_IVRANGE);
	return(XST_FAILURE);
  }
  if((StrmOut->Timing.HActive > InstancePtr->Config.MaxWidth) ||
	 (StrmOut->Timing.HActive == 0) ||
	 (StrmOut->Timing.VActive > InstancePtr->Config.MaxHeight) ||
	 (StrmOut->Timing.VActive == 0)) {
    XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_OVRANGE);
	return(XST_FAILURE);
  }
  if(((StrmIn->Timing.HActive  % InstancePtr->Config.PixPerClock) != 0) ||
     ((StrmOut->Timing.HActive % InstancePtr->Config.PixPerClock) != 0))
  {
    XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_WIDBAD);
	return(XST_FAILURE);
  }
  if(XVprocSs_IsConfigModeMax(InstancePtr) &&
     ((StrmIn->ColorFormatId == XVIDC_CSF_YCRCB_420) || (StrmIn->ColorFormatId == XVIDC_CSF_YCRCB_422)) &&
     ((StrmOut->ColorFormatId == XVIDC_CSF_YCRCB_444) || (StrmOut->ColorFormatId == XVIDC_CSF_RGB)) &&
     (InstancePtr->HcrsmplrPtr==NULL)) {
     XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_NOHCR);
	return(XST_FAILURE);
  }
  if(((StrmIn->ColorFormatId  == XVIDC_CSF_YCRCB_422) &&
	  ((StrmIn->Timing.HActive % 2) != 0)) ||
	  ((StrmOut->ColorFormatId == XVIDC_CSF_YCRCB_422) &&
      ((StrmOut->Timing.HActive % 2) != 0))) {
    XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_WIDODD);
	return(XST_FAILURE);
  }
  if((StrmIn->ColorFormatId == XVIDC_CSF_YCRCB_420) &&
      (((StrmIn->Timing.HActive % 2) != 0) &&
      ((StrmIn->Timing.VActive % 2) != 0))) {
    XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_SIZODD);
    return(XST_FAILURE);
  }
  if(((StrmOut->ColorFormatId == XVIDC_CSF_YCRCB_420) &&
      XVprocSs_IsConfigModeMax(InstancePtr) &&
      !InstancePtr->VcrsmplrOutPtr)) {
    XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_NOVCRO);
	return(XST_FAILURE);
  }
  if(((StrmIn->ColorFormatId == XVIDC_CSF_YCRCB_420) &&
      XVprocSs_IsConfigModeMax(InstancePtr) &&
      !InstancePtr->VcrsmplrInPtr)) {
    XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_NOVCRI);
	return(XST_FAILURE);
  }
  if(StrmIn->IsInterlaced) {
	if(StrmIn->ColorFormatId == XVIDC_CSF_YCRCB_420) {
      XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_NO420);
	  return(XST_FAILURE);
	}
	if(!InstancePtr->DeintPtr) {
      XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VPSS_NODEIN);
	  return(XST_FAILURE);
	}
  }
  XVprocSs_LogWrite(InstancePtr, XVPROCSS_EVT_CFG_VPSS, XVPROCSS_EDAT_VALID);
  return(XST_SUCCESS);
}
static int ValidateSubsystemConfig ( XVprocSs * InstancePtr ) { XVidC_VideoStream * StrmIn = & InstancePtr -> VidIn ; XVidC_VideoStream * StrmOut = & InstancePtr -> VidOut ; StrmIn -> ColorDepth = ( XVidC_ColorDepth ) InstancePtr -> Config . ColorDepth ; StrmOut -> ColorDepth = ( XVidC_ColorDepth ) InstancePtr -> Config . ColorDepth ; StrmIn -> PixPerClk = ( XVidC_PixelsPerClock ) InstancePtr -> Config . PixPerClock ; StrmOut -> PixPerClk = ( XVidC_PixelsPerClock ) InstancePtr -> Config . PixPerClock ; if ( ( XVprocSs_GetSubsystemTopology ( InstancePtr ) != XVPROCSS_TOPOLOGY_FULL_FLEDGED ) && ( StrmIn -> FrameRate != StrmOut -> FrameRate ) ) { XVprocSs_LogWrite ( InstancePtr , XVPROCSS_EVT_CFG_VPSS , XVPROCSS_EDAT_VPSS_FRDIFF ) ; return ( XST_FAILURE ) ; } if ( ( StrmIn -> Timing . HActive > InstancePtr -> Config . MaxWidth ) || ( StrmIn -> Timing . HActive == 0 ) || ( StrmIn -> Timing . VActive > InstancePtr -> Config . MaxHeight ) || ( StrmIn -> Timing . VActive == 0 ) ) { XVprocSs_LogWrite ( InstancePtr , XVPROCSS_EVT_CFG_VPSS , XVPROCSS_EDAT_VPSS_IVRANGE ) ; return ( XST_FAILURE ) ; } if ( ( StrmOut -> Timing . HActive > InstancePtr -> Config . MaxWidth ) || ( StrmOut -> Timing . HActive == 0 ) || ( StrmOut -> Timing . VActive > InstancePtr -> Config . MaxHeight ) || ( StrmOut -> Timing . VActive == 0 ) ) { XVprocSs_LogWrite ( InstancePtr , XVPROCSS_EVT_CFG_VPSS , XVPROCSS_EDAT_VPSS_OVRANGE ) ; return ( XST_FAILURE ) ; } if ( ( ( StrmIn -> Timing . HActive % InstancePtr -> Config . PixPerClock ) != 0 ) || ( ( StrmOut -> Timing . HActive % InstancePtr -> Config . PixPerClock ) != 0 ) ) { XVprocSs_LogWrite ( InstancePtr , XVPROCSS_EVT_CFG_VPSS , XVPROCSS_EDAT_VPSS_WIDBAD ) ; return ( XST_FAILURE ) ; } if ( XVprocSs_IsConfigModeMax ( InstancePtr ) && ( ( StrmIn -> ColorFormatId == XVIDC_CSF_YCRCB_420 ) || ( StrmIn -> ColorFormatId == XVIDC_CSF_YCRCB_422 ) ) && ( ( StrmOut -> ColorFormatId == XVIDC_CSF_YCRCB_444 ) || ( StrmOut -> ColorFormatId == XVIDC_CSF_RGB ) ) && ( InstancePtr -> HcrsmplrPtr == NULL ) ) { XVprocSs_LogWrite ( InstancePtr , XVPROCSS_EVT_CFG_VPSS , XVPROCSS_EDAT_VPSS_NOHCR ) ; return ( XST_FAILURE ) ; } if ( ( ( StrmIn -> ColorFormatId == XVIDC_CSF_YCRCB_422 ) && ( ( StrmIn -> Timing . HActive % 2 ) != 0 ) ) || ( ( StrmOut -> ColorFormatId == XVIDC_CSF_YCRCB_422 ) && ( ( StrmOut -> Timing . HActive % 2 ) != 0 ) ) ) { XVprocSs_LogWrite ( InstancePtr , XVPROCSS_EVT_CFG_VPSS , XVPROCSS_EDAT_VPSS_WIDODD ) ; return ( XST_FAILURE ) ; } if ( ( StrmIn -> ColorFormatId == XVIDC_CSF_YCRCB_420 ) && ( ( ( StrmIn -> Timing . HActive % 2 ) != 0 ) && ( ( StrmIn -> Timing . VActive % 2 ) != 0 ) ) ) { XVprocSs_LogWrite ( InstancePtr , XVPROCSS_EVT_CFG_VPSS , XVPROCSS_EDAT_VPSS_SIZODD ) ; return ( XST_FAILURE ) ; } if ( ( ( StrmOut -> ColorFormatId == XVIDC_CSF_YCRCB_420 ) && XVprocSs_IsConfigModeMax ( InstancePtr ) && ! InstancePtr -> VcrsmplrOutPtr ) ) { XVprocSs_LogWrite ( InstancePtr , XVPROCSS_EVT_CFG_VPSS , XVPROCSS_EDAT_VPSS_NOVCRO ) ; return ( XST_FAILURE ) ; } if ( ( ( StrmIn -> ColorFormatId == XVIDC_CSF_YCRCB_420 ) && XVprocSs_IsConfigModeMax ( InstancePtr ) && ! InstancePtr -> VcrsmplrInPtr ) ) { XVprocSs_LogWrite ( InstancePtr , XVPROCSS_EVT_CFG_VPSS , XVPROCSS_EDAT_VPSS_NOVCRI ) ; return ( XST_FAILURE ) ; } if ( StrmIn -> IsInterlaced ) { if ( StrmIn -> ColorFormatId == XVIDC_CSF_YCRCB_420 ) { XVprocSs_LogWrite ( InstancePtr , XVPROCSS_EVT_CFG_VPSS , XVPROCSS_EDAT_NO420 ) ; return ( XST_FAILURE ) ; } if ( ! InstancePtr -> DeintPtr ) { XVprocSs_LogWrite ( InstancePtr , XVPROCSS_EVT_CFG_VPSS , XVPROCSS_EDAT_VPSS_NODEIN ) ; return ( XST_FAILURE ) ; } } XVprocSs_LogWrite ( InstancePtr , XVPROCSS_EVT_CFG_VPSS , XVPROCSS_EDAT_VALID ) ; return ( XST_SUCCESS ) ; }
This function validates the input and output stream configuration against the
Subsystem hardware capabilities
This function validates the input and output stream configuration against the Subsystem hardware capabilities
/* Runtime Color Depth conversion not supported
   * Always overwrite input/output stream color depth with subsystem setting
   */ /* Runtime Pixel/Clock conversion not supported
   * Always overwrite input/output stream pixel/clk with subsystem setting
   */ /* Frame rate conversion is possible only in FULL topology */ /* Check input resolution is supported by HW */ /* Check output resolution is supported by HW */ /* Check Stream Width is aligned at Samples/Clock boundary */ /* Check for HCResamp required, but not present */ /* Check for YUV422 In/Out stream width is even */ /* Check for YUV420 In stream width and height is even */ /* Check for VCResamp required, but not present */ /* In the Full-fledged case, the Output V C Resampler is "VcrsmplrOut" */ /* In the VCResample-only case, the Output V C Resampler is "VcrsmplrIn" */ /* Check for Interlaced input limitation */