Esempio n. 1
0
bool
GMPChild::PreLoadPluginVoucher()
{
  nsCOMPtr<nsIFile> voucherFile;
  GetPluginVoucherFile(mPluginPath, voucherFile);
  if (!FileExists(voucherFile)) {
    // Assume missing file is not fatal; that would break OpenH264.
    return true;
  }
  return ReadIntoArray(voucherFile, mPluginVoucher, MAX_VOUCHER_LENGTH);
}
Esempio n. 2
0
bool
ReadIntoString(nsIFile* aFile,
               nsCString& aOutDst,
               size_t aMaxLength)
{
  nsTArray<uint8_t> buf;
  bool rv = ReadIntoArray(aFile, buf, aMaxLength);
  if (rv) {
    buf.AppendElement(0); // Append null terminator, required by nsC*String.
    aOutDst = nsDependentCString((const char*)buf.Elements(), buf.Length() - 1);
  }
  return rv;
}
int main()
{
	int i, j;
	int ysize = 256;
	int xsize = 256;
	unsigned char **data = Init2DChar(data, xsize, ysize);
	float **spectrum = Init2DFloat(spectrum, xsize*2, ysize*2);

	ReadIntoArray("mri", 256, 256, data);

	for (i = 0; i < ysize; i++)
	{
		for (j = 0; j < xsize; j++)
		{
			spectrum[i][j] = (float)data[i][j];
		}
	}
	
	float **real = Init2DFloat(real, xsize, ysize);
	float **imag = Init2DFloat(imag, xsize, ysize);

	four2(spectrum, 256, 256, 1, real, imag);

	float** filter = Init2DFloat(filter, xsize * 2, ysize * 2);

	for (i = 0; i < ysize; i++)
	{
		for (j = 0; j < xsize; j++)
		{
			filter[i][j] = (float)spectrum[i][j];
		}
	}


	Butterworth(filter, real, imag, xsize, ysize, 1);
	NormalizeArray(spectrum, 256, 256);

	WriteIntoArray("mri", "_spectrum", 256, 256, spectrum);

	four2(filter, 256, 256, -1, real, imag);
	WriteIntoArray("mri", "_butterworth", 256, 256, filter);


	free(data);
	free(spectrum);
	free(real);


	return 0;
}
Esempio n. 4
0
void
GMPChild::PreLoadSandboxVoucher()
{
  nsCOMPtr<nsIFile> f;
  nsresult rv = NS_NewLocalFile(mSandboxVoucherPath, true, getter_AddRefs(f));
  if (NS_FAILED(rv)) {
    NS_WARNING("Can't create nsIFile for sandbox voucher");
    return;
  }
  if (!FileExists(f)) {
    // Assume missing file is not fatal; that would break OpenH264.
    return;
  }

  if (!ReadIntoArray(f, mSandboxVoucher, MAX_VOUCHER_LENGTH)) {
    NS_WARNING("Failed to read sandbox voucher");
  }
}