Esempio n. 1
0
void ConfigDialog::_init()
{
	// Video settings
	QStringList windowedModesList;
	int windowedModesCurrent = -1;
	for (unsigned int i = 0; i < numWindowedModes; ++i) {
		windowedModesList.append(WindowedModes[i].description);
		if (WindowedModes[i].width == config.video.windowedWidth &&
			WindowedModes[i].height == config.video.windowedHeight)
			windowedModesCurrent = i;
	}
	ui->windowedResolutionComboBox->insertItems(0, windowedModesList);
	if (windowedModesCurrent > -1)
		ui->windowedResolutionComboBox->setCurrentIndex(windowedModesCurrent);
	else
		ui->windowedResolutionComboBox->setCurrentText(
			QString::number(config.video.windowedWidth) + " x " +
			QString::number(config.video.windowedHeight)
		);

	// matches w x h where w is 300-7999 and h is 200-3999, spaces around x optional
	QRegExp windowedRegExp("([3-9][0-9]{2}|[1-7][0-9]{3}) ?x ?([2-9][0-9]{2}|[1-3][0-9]{3})");
	QValidator *windowedValidator = new QRegExpValidator(windowedRegExp, this);
	ui->windowedResolutionComboBox->setValidator(windowedValidator);

	ui->cropImageComboBox->setCurrentIndex(config.video.cropMode);
	ui->cropImageWidthSpinBox->setValue(config.video.cropWidth);
	ui->cropImageHeightSpinBox->setValue(config.video.cropHeight);
	ui->cropImageCustomFrame->setVisible(config.video.cropMode == Config::cmCustom);

	QStringList fullscreenModesList, fullscreenRatesList;
	int fullscreenMode, fullscreenRate;
	fillFullscreenResolutionsList(fullscreenModesList, fullscreenMode, fullscreenRatesList, fullscreenRate);
	ui->fullScreenResolutionComboBox->insertItems(0, fullscreenModesList);
	ui->fullScreenResolutionComboBox->setCurrentIndex(fullscreenMode);
	ui->fullScreenRefreshRateComboBox->setCurrentIndex(fullscreenRate);

	ui->aliasingSlider->setValue(powof(config.video.multisampling));
	ui->aliasingLabelVal->setText(QString::number(config.video.multisampling));
	ui->anisotropicSlider->setValue(config.texture.maxAnisotropy);
	ui->vSyncCheckBox->setChecked(config.video.verticalSync != 0);

	switch (config.texture.bilinearMode) {
	case BILINEAR_3POINT:
		ui->blnr3PointRadioButton->setChecked(true);
		break;
	case BILINEAR_STANDARD:
		ui->blnrStandardRadioButton->setChecked(true);
		break;
	}

	switch (config.texture.screenShotFormat) {
	case 0:
		ui->pngRadioButton->setChecked(true);
		break;
	case 1:
		ui->jpegRadioButton->setChecked(true);
		break;
	}

	// Emulation settings
	ui->emulateLodCheckBox->setChecked(config.generalEmulation.enableLOD != 0);
	ui->emulateNoiseCheckBox->setChecked(config.generalEmulation.enableNoise != 0);
	ui->enableHWLightingCheckBox->setChecked(config.generalEmulation.enableHWLighting != 0);
	ui->enableShadersStorageCheckBox->setChecked(config.generalEmulation.enableShadersStorage != 0);
	ui->customSettingsCheckBox->setChecked(config.generalEmulation.enableCustomSettings != 0);
	switch (config.generalEmulation.correctTexrectCoords) {
	case Config::tcDisable:
		ui->fixTexrectDisableRadioButton->setChecked(true);
		break;
	case Config::tcSmart:
		ui->fixTexrectSmartRadioButton->setChecked(true);
		break;
	case Config::tcForce:
		ui->fixTexrectForceRadioButton->setChecked(true);
		break;
	}
	ui->nativeRes2D_checkBox->toggle();
	ui->nativeRes2D_checkBox->setChecked(config.generalEmulation.enableNativeResTexrects != 0);

	ui->gammaCorrectionCheckBox->toggle();
	ui->gammaCorrectionCheckBox->setChecked(config.gammaCorrection.force != 0);
	ui->gammaLevelSpinBox->setValue(config.gammaCorrection.level);

	ui->frameBufferSwapComboBox->setCurrentIndex(config.frameBufferEmulation.bufferSwapMode);

	ui->fbInfoEnableCheckBox->toggle();
	ui->fbInfoEnableCheckBox->setChecked(config.frameBufferEmulation.fbInfoDisabled == 0);

	ui->frameBufferCheckBox->toggle();
	const bool fbEmulationEnabled = config.frameBufferEmulation.enable != 0;
	ui->frameBufferCheckBox->setChecked(fbEmulationEnabled);
	ui->frameBufferInfoFrame->setVisible(!fbEmulationEnabled);
	ui->frameBufferInfoFrame2->setVisible(!fbEmulationEnabled);

	ui->copyColorBufferComboBox->setCurrentIndex(config.frameBufferEmulation.copyToRDRAM);
	ui->copyDepthBufferComboBox->setCurrentIndex(config.frameBufferEmulation.copyDepthToRDRAM);
	ui->RenderFBCheckBox->setChecked(config.frameBufferEmulation.copyFromRDRAM != 0);
	ui->n64DepthCompareCheckBox->toggle();
	ui->n64DepthCompareCheckBox->setChecked(config.frameBufferEmulation.N64DepthCompare != 0);

	switch (config.frameBufferEmulation.aspect) {
	case Config::aStretch:
		ui->aspectStretchRadioButton->setChecked(true);
		break;
	case Config::a43:
		ui->aspect43RadioButton->setChecked(true);
		break;
	case Config::a169:
		ui->aspect169RadioButton->setChecked(true);
		break;
	case Config::aAdjust:
		ui->aspectAdjustRadioButton->setChecked(true);
		break;
	}

	ui->resolutionFactorSlider->valueChanged(2);
	ui->factor0xRadioButton->toggle();
	ui->factor1xRadioButton->toggle();
	ui->factorXxRadioButton->toggle();
	switch (config.frameBufferEmulation.nativeResFactor) {
	case 0:
		ui->factor0xRadioButton->setChecked(true);
		break;
	case 1:
		ui->factor1xRadioButton->setChecked(true);
		break;
	default:
		ui->factorXxRadioButton->setChecked(true);
		ui->resolutionFactorSlider->setValue(config.frameBufferEmulation.nativeResFactor);
		break;
	}

	ui->copyAuxBuffersCheckBox->setChecked(config.frameBufferEmulation.copyAuxToRDRAM != 0);

	ui->readColorChunkCheckBox->setChecked(config.frameBufferEmulation.fbInfoReadColorChunk != 0);
	ui->readColorChunkCheckBox->setEnabled(fbEmulationEnabled && config.frameBufferEmulation.fbInfoDisabled == 0);
	ui->readDepthChunkCheckBox->setChecked(config.frameBufferEmulation.fbInfoReadDepthChunk != 0);
	ui->readDepthChunkCheckBox->setEnabled(fbEmulationEnabled && config.frameBufferEmulation.fbInfoDisabled == 0);

	// Texture filter settings
	ui->filterComboBox->setCurrentIndex(config.textureFilter.txFilterMode);
	ui->enhancementComboBox->setCurrentIndex(config.textureFilter.txEnhancementMode);

	ui->textureFilterCacheSpinBox->setValue(config.textureFilter.txCacheSize / gc_uMegabyte);
	ui->deposterizeCheckBox->setChecked(config.textureFilter.txDeposterize != 0);
	ui->ignoreBackgroundsCheckBox->setChecked(config.textureFilter.txFilterIgnoreBG != 0);

	ui->texturePackOnCheckBox->toggle();
	ui->texturePackOnCheckBox->setChecked(config.textureFilter.txHiresEnable != 0);
	ui->alphaChannelCheckBox->setChecked(config.textureFilter.txHiresFullAlphaChannel != 0);
	ui->alternativeCRCCheckBox->setChecked(config.textureFilter.txHresAltCRC != 0);
	ui->textureDumpCheckBox->setChecked(config.textureFilter.txDump != 0);
	ui->force16bppCheckBox->setChecked(config.textureFilter.txForce16bpp != 0);
	ui->compressCacheCheckBox->setChecked(config.textureFilter.txCacheCompression != 0);
	ui->saveTextureCacheCheckBox->setChecked(config.textureFilter.txSaveCache != 0);

	ui->txPathLabel->setText(QString::fromWCharArray(config.textureFilter.txPath));
	ui->txCachePathLabel->setText(QString::fromWCharArray(config.textureFilter.txCachePath));
	ui->txDumpPathLabel->setText(QString::fromWCharArray(config.textureFilter.txDumpPath));

	// OSD settings
	QString fontName(config.font.name.c_str());
	ui->fontLineEdit->setText(fontName);
	m_font = QFont(fontName.left(fontName.indexOf(".ttf")));
	m_font.setPixelSize(config.font.size);

	ui->fontLineEdit->setHidden(true);

	ui->fontSizeSpinBox->setValue(config.font.size);

	m_color = QColor(config.font.color[0], config.font.color[1], config.font.color[2]);
	QPalette palette;
	palette.setColor(QPalette::WindowText, m_color);
	palette.setColor(QPalette::Window, Qt::black);
	ui->fontPreviewLabel->setAutoFillBackground(true);
	ui->fontPreviewLabel->setPalette(palette);
	ui->PickFontColorButton->setStyleSheet(QString("color:") + m_color.name());

	switch (config.onScreenDisplay.pos) {
	case Config::posTopLeft:
		ui->topLeftPushButton->setChecked(true);
		break;
	case Config::posTopCenter:
		ui->topPushButton->setChecked(true);
		break;
	case Config::posTopRight:
		ui->topRightPushButton->setChecked(true);
		break;
	case Config::posBottomLeft:
		ui->bottomLeftPushButton->setChecked(true);
		break;
	case Config::posBottomCenter:
		ui->bottomPushButton->setChecked(true);
		break;
	case Config::posBottomRight:
		ui->bottomRightPushButton->setChecked(true);
		break;
	}

	ui->fpsCheckBox->setChecked(config.onScreenDisplay.fps != 0);
	ui->visCheckBox->setChecked(config.onScreenDisplay.vis != 0);
	ui->percentCheckBox->setChecked(config.onScreenDisplay.percent != 0);
	ui->internalResolutionCheckBox->setChecked(config.onScreenDisplay.internalResolution != 0);
	ui->renderingResolutionCheckBox->setChecked(config.onScreenDisplay.renderingResolution != 0);

	// Buttons
	ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("OK"));
	ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel"));
	ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)->setText(tr("Restore Defaults"));

	ui->dumpLowCheckBox->setChecked((config.debug.dumpMode & DEBUG_LOW) != 0);
	ui->dumpNormalCheckBox->setChecked((config.debug.dumpMode & DEBUG_NORMAL) != 0);
	ui->dumpDetailCheckBox->setChecked((config.debug.dumpMode & DEBUG_DETAIL) != 0);

#ifndef DEBUG_DUMP
	for (int i = 0; i < ui->tabWidget->count(); ++i) {
		if (tr("Debug") == ui->tabWidget->tabText(i)) {
			ui->tabWidget->removeTab(i);
			break;
		}
	}
#endif
}
Esempio n. 2
0
void
kernel (int type, double *parameters, int nb_param, type_AF ker)
{
  int            line, col;
  double         doppler, delay;
  double         inter;


  /* some tests */

  if ((ker.N_doppler <1) || (ker.N_delay < 1))
    {
      printf("kernel.c : invalid number of lines / columns in the kernel matrix \n");
      exit(0);
    }

  switch (type)
    {
      /***************************************************************
       *              Multiform Tiltable Exponentiel Kernel          *
       ***************************************************************
       * The parameters vector is made of                            *
       * alpha, beta, gamma, r, tau0, nu0, lambda]                   *
       *   see the reference :                                       * 
       *	H. Costa and G.F. Boudreaux-Bartels,                 *
       *	Design of Time-Frequency Representations Using a     *
       *		  Multiform, Tiltable Exponential Kernel     *
       *	IEEE Trans. on Signal Processing                     *
       *	October 1995, vol. 43, no 10, pp 2283-2301           *
       ***************************************************************/
      /* LOCAL VARIABLES                                             *
       * Name           |                   role                     *
       * A              | intermediary in the computation of the     *
       *                | MTEK kernel                                *
       ***************************************************************/
   case MTEK:
      {
	/* local variables for the MTEK */

	double         A;

	/* Kernel Construction */
	for (line = 0; line < ker.N_doppler; line++)
	  {
	    doppler = (line - ker.N_doppler / 2.0 + 1.0) / ker.N_doppler;
	    for (col = 0; col < ker.N_delay; col++)
	      {
		delay = col - ker.N_delay / 2.0 + 1.0;
		A = (doppler * delay) / (TAU_0 * NU_0);

		/* case of the symmetrical kernel */
		if ((BETA == 2) && (GAMMA == 0.5))
		  {
		    A = ABS (A);
		  }

		/* case where the marginals do not have to be verified */
		if (ALPHA == 0)
		  {
		    inter = sqr (delay / TAU_0) + sqr (doppler / NU_0)
		      + 2.0
		      * R * A;
		  }
		/* case where the marginals have to be verified */
		else
		  {
		    inter = sqr (delay / TAU_0) * powof (sqr (doppler /
							      NU_0), ALPHA)
		      + sqr (doppler / NU_0) * powof (sqr (delay /
							   TAU_0), ALPHA)
		      + 2.0 * R * A;
		  }
		/* test to avoid the computation of log(0) */
		if (inter == 0)
		  {
		    ker.real_part[idx (line, col, ker.N_doppler)] = 1.0;
		  }
		else
		  {
		    ker.real_part[idx (line, col, ker.N_doppler)] =
		      exp (-pi * powof (sqr (inter), LAMBDA));
		  }
		inter = 0;
		A = 0;
	      }
	  }
      }
      break;
      /***************************************************************
       *                 Radially Gaussian kernel                    *
       ***************************************************************
       * The parameters vector is made according to the rule :       *
       * if the order of the kernel is p, the vector is              *
       * [ c ,a1 , ... , ap, b1,... ,bp] where c is the constant     *
       * ai are the cosine coefficients and bi the sine              *
       * coefficients in the Fourier series decomposition of the     *
       * contour. See the reference :                                *
       *     M. Davy and C. Doncarli,                                *
       *    Optimal Kernels of Time-Frequency Representations for    *
       *    Signal Classification,                                   *
       *	  TFTS 1998, pp 581-584.                             *
       ***************************************************************/
      /* LOCAL VARIABLES                                             *
       * Name           |                   role                     *
       * order          | Fixes the maximum p in the vector of params*
       * p              | Current parameter p in the vector of params*
       * a,b            | Vectors containing the parameters ap, bp   *
       *                | from the vector of params                  *
       * c              | The minimum value of the contour function  *
       * inter, mini    | Intermediary values in the computations    *
       * phi            | angle parameter in the polar coordinates   *
       * rho2           | square radius parameter in polar coord.    *         
       ***************************************************************/


    case RGK:
      {
	/* local variables for the RGK */
	int            order, p;
	double         *a, *b;
	double         c, inter, mini;
	double         phi, rho2;


	/* some error cases to avoid ... */
	if (ISODD(nb_param) == 0)
	  {
	    printf("kernel.c : the number of RGK parameters must be ODD\n");
	    exit(0);
	  } 


	order = (nb_param - 1) / 2;


	/* memory allocation for a and b */
	a = (double *) ALLOC ( order , sizeof(double) );
	b = (double *) ALLOC ( order , sizeof(double) );

	/* variables recovery */
	c = parameters[0];
	for (p = 0; p < order; p++)
	  {
	    a[p] = parameters[p + 1];
	    b[p] = parameters[order + p + 1];
	  }
	/*-----------------------------------------------*/
	/*             Kernel Construction               */
	/*-----------------------------------------------*/

	/* minimum value of the contour function */
	mini = 0;	


	/* construction of the matrix of the contour function */
	for (line = 0; line < ker.N_doppler; line++)
	  {
	    /* current doppler value */
	    doppler = (line - ker.N_doppler / 2.0 + 1.0) / ker.N_doppler;
	    /* normalization of the doppler to have angles in radians */
	    doppler = doppler * sqrt (ker.N_delay);

	    for (col = 0; col < ker.N_delay; col++)
	      {
		/* currrent delay value */
		delay = col - ker.N_delay / 2.0 + 1.0;
		/* normalization of the delay to have angles in radians */
		delay = delay / sqrt (ker.N_delay);

		/* computation of the angles in the ambiguity plane */
		if (((delay > 0) && (doppler > 0))
		    || ((delay < 0) && (doppler < 0)))
		  {
		    phi = atan (doppler / delay);
		  }
		else
		  {
		    phi = atan (doppler / delay) + pi;
		  }

		inter = 0;
		for (p = 0; p < order; p++)
		  {
		    inter = inter + a[p] * cos (2.0 * (p + 1) * phi) +
		      b[p]
		      * sin (2.0 * (p + 1) * phi);
		  }
		/* look for the minimum */
		if (inter < mini)
		  {
		    mini = inter;
		  }
		/* matrix of the contour function : each element in this */
		/* matrix contains the value of the contour function for */
		/* the corresponding delay and doppler values */
		ker.real_part[idx (line, col, ker.N_doppler)] = inter;

	      }
	  }

	/* construction of the RGK matrix */
	for (line = 0; line < ker.N_doppler; line++)
	  {
	    /* current normalized doppler */
	    doppler = (line - ker.N_doppler / 2.0 + 1.0) / ker.N_doppler;
	    doppler = doppler * sqrt (ker.N_delay);

	    for (col = 0; col < ker.N_delay; col++)
	      {
		/* current normalized delay */
		delay = col - ker.N_delay / 2.0 + 1.0;
		delay = delay / sqrt (ker.N_delay);
		/* Square Polar radius */
		rho2 = sqr (doppler) + sqr (delay);
		ker.real_part[idx (line, col, ker.N_doppler)] =
		  exp (-(rho2 / 2.0) / 
		       sqr (ker.real_part[idx (line, col, ker.N_doppler)]
			    - mini + c));

		/* case of the center of the ambiguity plane */
		if ((delay == 0) && (doppler == 0))
		  ker.real_part[idx (line, col, ker.N_doppler)] = 1.0;
	      }
	  }
	/* free the memory used here */
	FREE (a);
	FREE (b);
      }
      break;

      /***************************************************************
       *          Generalized Marginals Choi-Williams                *
       ***************************************************************
       * The parameters vector is made of the width of the           *
       * branches "sigma" and the angle of each branch theta_i       *
       * (0 to Pi). The number of branches is given by the number    *
       * of coefficients                                             *
       * [ sigma theta_1 theta_2  ... theta_p]                       *
       *                                                             *
       * see the reference :                                         *
       * X.-G. Xia and Y. Owechko and B. H. Soffer and R. M. Matic,  *
       * Generalized-Marginal Time-Frequency Distributions,          *
       * TFTS 1996, pp. 509-51                                       *
       ***************************************************************/
      /* LOCAL VARIABLES                                             *
       * Name           |                   role                     *
       * N_Branch       | Number of kernel branches                  *
       * branch         | Current branch number                      *
       * angle          | vector of branches angles                  *
       * sigma          | value of the parameter sigma (kernel width)*
       * inter          | intermediary variable                      *
       ***************************************************************/


    case GMCWK:
      {
	/* local variables for the RGK */
	int            N_branch, branch;
	double         *angle, sigma, inter;



	/* some error cases to avoid ... */
	if (nb_param < 2)
	  {
	    printf("kernel.c : at least 2 GMCWK parameters required\n");
	    exit(0);
	  } 


	/* variables recovery */
	sigma = parameters[0];
	N_branch = nb_param - 1;



	/* recovery of the angles */
	angle = &(parameters[1]);

	/* Kernel Construction  */
	for (line = 0; line < ker.N_doppler; line++)
	  {
	    doppler = (line - ker.N_doppler / 2.0 + 1.0) 
	      / ker.N_doppler;
	    doppler = doppler * sqrt (ker.N_delay);

	    for (col = 0; col < ker.N_delay; col++)
	      {
		delay = col - ker.N_delay / 2.0 + 1.0;
		delay = delay / sqrt (ker.N_delay);
		inter = 1;
		for (branch = 0; branch < N_branch; branch++)
		  {
		    inter = inter 
		      * sqr (doppler * cos (angle[branch])
			     + delay * sin (angle[branch]));
		  }
		ker.real_part[idx (line, col, ker.N_doppler)] = 
		  exp (-inter / sigma);
	      }
	  }
      }
      break;
      /***************************************************************
       *                Wigner-Ville kernel                          *
       ***************************************************************
       * No parameter is required. The matrix is equal to            *
       * one in each point                                           *
       ***************************************************************/


    case WIGNER:
      {



	/* Kernel Construction  */
	for (line = 0; line < ker.N_doppler; line++)
	  {
	    for (col = 0; col < ker.N_delay; col++)
	      {
		ker.real_part[idx (line, col, ker.N_doppler)] = 1.0;
	      }
	  }
      }
      break;
      /***************************************************************
       *                   Spectrogram  kernel                       *
       ***************************************************************
       *  The paremters are the window points in the time            *
       * domain. The kernel is the ambiguity function of the window  *
       ***************************************************************/
      /* LOCAL VARIABLES                                             *
       * Name           |                   role                     *
       * window         | structure containing the window of the     *
       *                | spectrogram                                *
       * AF_h           | Ambiguity function of th window            *
       * min_delay |    | in order to pad with zeros, defines the    *
       * max_delay |    | indices where the zero padding begins/ends *
       * index          | indice to access the elements in matrices  *
       *                | (stored as vectors)                        *
       ***************************************************************/



    case SPECTRO:
      {
	/* local variable */
	type_signal    window;
	type_AF        AF_h;
	int            min_delay, max_delay, index;

	/* some error cases to avoid ... */
	if (ISODD(nb_param) == 1)
	  {
	    printf("kernel.c : the window length must be EVEN for SPECTRO\n");
	    exit(0);
	  } 



	/* initialization of the local variables : window */
	window.length = ker.N_delay;
	window.is_complex = TRUE;
	/* creation of memory */
	window.real_part = (double *) ALLOC (window.length, sizeof (double));
	window.imag_part = (double *) ALLOC (window.length, sizeof (double));


	min_delay = (int) (window.length / 2 - nb_param / 2);
	max_delay = (int) (window.length / 2 + nb_param / 2 - 1);

	/* initialization of the imaginary part for the window 
	   and zero padding out of [min_delay;max_delay] */
	for (col = 0; col < window.length; col++)
	  {
	    if ((col >= min_delay) && (col <= max_delay))
	      {
		window.real_part[col] = parameters[col - min_delay];
	      }
	    else
	      {
		window.real_part[col] = 0;
	      }
	    window.imag_part[col] = 0;
	  }


	/* initialization of the local variables : AF_h */
	AF_h.N_doppler = ker.N_doppler;
	AF_h.N_delay = ker.N_delay;
	AF_h.is_complex = TRUE;

	mem_alloc_AF (&AF_h, NULL, NULL, NULL, NULL);
 	for (index = 0; index < AF_h.N_delay; index++)
	  {
	    AF_h.delay_bins[index] = -AF_h.N_delay / 2.0 + 1.0 + index;
	  }




	/* computation of the AF of the window */
	af (window, AF_h);

	/* Warning : if ker.N_delay != ker.N_doppler,
	   one must add or suppress lines in this AF */
	for (line = 0; line < ker.N_doppler; line++)
	  {
	    for (col = 0; col < ker.N_delay; col++)
	      {
		index = idx (line, col, ker.N_delay);
		ker.real_part[idx (line, col, ker.N_doppler)] =
		  sqrt (sqr (AF_h.real_part[index])
			+ sqr (AF_h.imag_part[index]));
	      }
	  }
	/* free memory !! */

	mem_free_AF (&AF_h);
	FREE (window.real_part);
	FREE (window.imag_part);

      }
      break;
    }
}