Beispiel #1
0
/* convert dual to left */
void sbtB_dual_left(MPEG *m, float *sample, unsigned char *pcm, int n)
{
   int i;

   for (i = 0; i < n; i++)
   {
      fdct32_dual(m,sample, m->csbt.vbuf + m->csbt.vb_ptr);
      windowB(m,m->csbt.vbuf, m->csbt.vb_ptr, pcm);
      sample += 64;
      m->csbt.vb_ptr = (m->csbt.vb_ptr - 32) & 511;
      pcm += 32;
   }
}
Beispiel #2
0
/* convert dual to left */
void sbtB_dual_left(float *sample, unsigned char *pcm, int n)
{
   int i;

   for (i = 0; i < n; i++)
   {
      fdct32_dual(sample, pMP3Stream->vbuf + pMP3Stream->vb_ptr);
      windowB(pMP3Stream->vbuf, pMP3Stream->vb_ptr, pcm);
      sample += 64;
      pMP3Stream->vb_ptr = (pMP3Stream->vb_ptr - 32) & 511;
      pcm += 32;
   }
}
Beispiel #3
0
/*------------------------------------------------------------*/
void sbtB_mono_L3(float *sample, unsigned char *pcm, int ch)
{
	int i;

	ch = 0;
	for (i = 0; i < 18; i++)
	{
		fdct32(sample, pMP3Stream->vbuf + pMP3Stream->vb_ptr);
		windowB(pMP3Stream->vbuf, pMP3Stream->vb_ptr, pcm);
		sample += 32;
		pMP3Stream->vb_ptr = (pMP3Stream->vb_ptr - 32) & 511;
		pcm += 32;
	}
}
Beispiel #4
0
/* convert dual to left */
void sbtB_dual_left(float *sample, unsigned char *pcm, 
                    int n, float vbuf[][512], int vb_ptr_arg[])
{
int i;
vb_ptr = vb_ptr_arg[0];
for(i=0;i<n;i++) {
  fdct32_dual(sample, vbuf[0]+vb_ptr);
  windowB(vbuf[0], vb_ptr, pcm);
  sample += 64;
  vb_ptr = (vb_ptr-32) & 511;
  pcm += 32;
}
vb_ptr_arg[0] = vb_ptr;
}
Beispiel #5
0
void sbtB_dual_right(float *sample, unsigned char *pcm, int n)
{
   int i;

   sample++;			/* point to right chan */
   for (i = 0; i < n; i++)
   {
      fdct32_dual(sample, vbuf + vb_ptr);
      windowB(vbuf, vb_ptr, pcm);
      sample += 64;
      vb_ptr = (vb_ptr - 32) & 511;
      pcm += 32;
   }
}
Beispiel #6
0
void sbtB_dual_mono(float *sample, unsigned char *pcm, int n)
{
   int i;

   for (i = 0; i < n; i++)
   {
      fdct32_dual_mono(sample, vbuf + vb_ptr);
      windowB(vbuf, vb_ptr, pcm);
      sample += 64;
      vb_ptr = (vb_ptr - 32) & 511;
      pcm += 32;
   }

}
PNM* MorphologicalOperator::transform()
{  
	int size  = getParameter("size").toInt();
	SE  shape = (MorphologicalOperator::SE) getParameter("shape").toInt();

	PNM* newImage = new PNM(image->width(), image->height(), QImage::Format_RGB32);
	
	math::matrix<bool> se(size,size);
	
	se = getSE(size,shape);
	
	int radius = size/2;

	if (image->format() == QImage::Format_Mono) {
	}
	else if (image->format() == QImage::Format_Indexed8) {
		// Iterate over image space
		for (int x=0; x<image->width(); x++) {
			for (int y=0; y<image->height(); y++) {
				math::matrix<double> window(size,size);
				int a=0;
				for (int i=(x-radius);i<(x+radius+1);i++) {
					int b=0;
					for (int j=(y-radius);j<(y+radius+1);j++) {
						QRgb pixel = getPixel (i,j, RepeatEdge);
						window(a,b) = qGray(pixel);
						b++;
					}
					a++;
				}
				int v = morph(window, se);
				
				newImage->setPixel(x,y, v);
			}
		}
	}
	else { //if (image->format() == QImage::Format_RGB32)
		// Iterate over image space
		for (int x=0; x<image->width(); x++) {
			for (int y=0; y<image->height(); y++){
				math::matrix<double> windowR(size,size);
				math::matrix<double> windowG(size,size);
				math::matrix<double> windowB(size,size);
				int a=0;
				for (int i=(x-radius);i<(x+radius+1);i++) {
					int b=0;
					for (int j=(y-radius);j<(y+radius+1);j++) {
						QRgb pixel = getPixel (i,j, RepeatEdge);
						windowR(a,b) = qRed(pixel);
						windowG(a,b) = qGreen(pixel);
						windowB(a,b) = qBlue(pixel);
						b++;
					}
					a++;
				}
				int r = morph(windowR, se);
				int g = morph(windowG, se);
				int b = morph(windowB, se);
				
				QColor newPixel = QColor(r,g,b);
				newImage->setPixel(x,y, newPixel.rgb());
			}
		}
	}

    return newImage;
}