예제 #1
0
int float_UNRM_block (float * input, float * output, int inlen, int outsize, int rvidx)
{
	int subblocklen, intblocklen;

	float block0 [MAXCODEDSIZE/3];
	float block1 [MAXCODEDSIZE/3];
	float block2 [MAXCODEDSIZE/3];

	float intblock0 [MAXCODEDSIZE/3];
	float intblock1 [MAXCODEDSIZE/3];
	float intblock2 [MAXCODEDSIZE/3];

	subblocklen = intceil(outsize, 3);

	char dummymatrix [MAXCODEDSIZE];
	int interleaversize = getDummyMatrix(dummymatrix, subblocklen)/3;

	float_unratematching(input, intblock0, intblock1, intblock2, interleaversize, inlen, rvidx, dummymatrix);

	intblocklen = float_deinterleave(intblock0, block0, interleaversize);
	intblocklen = float_deinterleave(intblock1, block1, interleaversize);
	intblocklen = float_deinterleave(intblock2, block2, interleaversize);

	float_wrap(block0, block1, block2, output, intblocklen);

	return 0;
}
예제 #2
0
int float_unratematching (float * input, float * subblock0, float * subblock1, float * subblock2, int interleaversize, int inlen, int rvidx, char * dummyMatrix)
{
	int i, k0, k;
	float circularBuffer [MAXCODEDSIZE];
	int buffersize = interleaversize*3;

	memset(circularBuffer, 0, sizeof(float)*MAXCODEDSIZE);

	k0 = R*(2*intceil(buffersize, (8*R))*rvidx+2);
	k=0;
	i=0;
	while(k<inlen)
	{
		if (dummyMatrix[(k0+i)%buffersize]!=DUMMYBIT)
			circularBuffer[(k0+i)%buffersize] = input[k++];
		else
			circularBuffer[(k0+i)%buffersize] = 8.8;
		i++;
	}

	for (i=0; i<interleaversize; i++)
	{
		subblock0[i]=circularBuffer[i];
		subblock1[i]=circularBuffer[2*i+interleaversize+0];
		subblock2[i]=circularBuffer[2*i+interleaversize+1];
	}

	return interleaversize;
}
예제 #3
0
int char_ratematching (char * subblock0, char * subblock1, char * subblock2, char * output, int interleaversize, int outlen, int rvidx)
{
	int i, k0, k,km;
	char bit;
	char circularBuffer [MAXCODEDSIZE];
	int buffersize = 3*interleaversize;

	for (i=0; i<interleaversize; i++)
	{
		circularBuffer[i]=subblock0[i];
		circularBuffer[interleaversize+2*i+0]=subblock1[i];
		circularBuffer[interleaversize+2*i+1]=subblock2[i];
	}

 	k0 = R*(2*intceil(buffersize, (8*R))*rvidx+2);
	k=0;
	i=0;
	while(k<outlen)
	{
		km=k0+i;
		while(km>=buffersize) {
			km-=buffersize;
		}
		bit = circularBuffer[km];
		if (bit!=DUMMYBIT){
			output[k]=bit;
			k++;
		}
		i++;
	}

	return outlen;
}
예제 #4
0
int filter2d_init_default(filter2d_t* q, int ntime, int nfreq, int sztime,
    int szfreq) {

  int i, j;
  int ret = -1;
  float **taps;

  if (matrix_init((void***) &taps, ntime, nfreq, sizeof(float))) {
    goto free_and_exit;
  }

  /* Compute the default 2-D interpolation mesh */
  for (i = 0; i < ntime; i++) {
    for (j = 0; j < nfreq; j++) {
      if (j < nfreq / 2)
        taps[i][j] = (j + 1.0) / (2.0 * intceil(nfreq, 2));

      else if (j == nfreq / 2)
        taps[i][j] = 0.5;

      else if (j > nfreq / 2)
        taps[i][j] = (nfreq - j) / (2.0 * intceil(nfreq, 2));
    }
  }

  INFO("Using default interpolation matrix of size %dx%d\n", ntime, nfreq);
  if (verbose >= VERBOSE_DEBUG) {
    matrix_fprintf_f(stdout, taps, ntime, nfreq);
  }

  if (filter2d_init(q, taps, ntime, nfreq, sztime, szfreq)) {
    goto free_and_exit;
  }

  ret = 0;
free_and_exit:
  matrix_free((void**) taps, ntime);
  return ret;
}
예제 #5
0
void builder ( SOF_section_t SOF_section, uint32_t YV, uint32_t YH,
    uint32_t flit_size, uint8_t * MCU_YCbCr, uint8_t * picture,
    uint32_t * LB_X, uint32_t * LB_Y)
{
	uint8_t * CELLS = NULL, * Y_SRC = NULL, * Y_DST = NULL;
	uint8_t * U_SRC = NULL, * U_DST = NULL;
	uint8_t * V_SRC = NULL, * V_DST = NULL;
	uint8_t * uv_line_src = NULL, * uv_line_dst = NULL;

	uint16_t NB_MCU_X = 0, NB_MCU_Y = 0;
	uint16_t NB_CELLS = 0;

	uint32_t flit_bytes = 0;
	uint32_t * y_line_dst = NULL, * y_line_src = NULL;

#ifdef PROGRESS
	char progress_tab[4] = {'/', '-', '\\', '|'};
	uint32_t imageCount = 1;
	uint32_t block_index = 0;
#endif

	flit_bytes = flit_size * MCU_sx * MCU_sy * sizeof (uint8_t);
	NB_MCU_X = intceil(SOF_section.width, MCU_sx);
	NB_MCU_Y = intceil(SOF_section.height, MCU_sy);
	NB_CELLS = YV * YH + 2;

#ifdef PROGRESS
	printf ("Image %lu : |", imageCount++);
	fflush (stdout);
#endif

  for (int flit_index = 0; flit_index < flit_size; flit_index += NB_CELLS)
  {
    CELLS = MCU_INDEX(MCU_YCbCr, flit_index);

    for (int cell_y_index = 0; cell_y_index < YV; cell_y_index += 1)
    {
      for (int cell_x_index = 0; cell_x_index < YH; cell_x_index += 1)
      {
        Y_SRC = MCU_INDEX(CELLS, (YH * cell_y_index + cell_x_index));
        Y_DST = FB_Y_INDEX(picture, *LB_X + cell_x_index, *LB_Y + cell_y_index);

        for (int line_index = 0; line_index < MCU_sy; line_index += 1)
        {
          y_line_src = (uint32_t *) MCU_LINE(Y_SRC, line_index);
          y_line_dst = (uint32_t *) FB_Y_LINE(Y_DST, line_index);
          *y_line_dst++ = *y_line_src++; *y_line_dst++ = *y_line_src++;
        }
      }

      U_SRC = MCU_INDEX(CELLS, (YH * YV));
      U_DST = FB_U_INDEX(picture, *LB_X, *LB_Y + cell_y_index);

      for (int line_index = 0; line_index < MCU_sy; line_index += 1)
      {
        uv_line_src = MCU_LINE(U_SRC, line_index);
        uv_line_dst = FB_UV_LINE(U_DST, line_index);

        for (int i = 0; i < (MCU_sx / (3 - YH)); i += 1)
        {
          uv_line_dst[i] = uv_line_src[i * (3 - YH)];
        }
      }

      V_SRC = MCU_INDEX(CELLS, (YH * YV + 1));
      V_DST = FB_V_INDEX(picture, *LB_X, *LB_Y + cell_y_index);

      for (int line_index = 0; line_index < MCU_sy; line_index += 1)
      {
        uv_line_src = MCU_LINE(V_SRC, line_index);
        uv_line_dst = FB_UV_LINE(V_DST, line_index);

        for (int i = 0; i < (MCU_sx / (3 - YH)); i += 1)
        {
          uv_line_dst[i] = uv_line_src[i * (3 - YH)];
        }
      }
    }

    *LB_X = (*LB_X + YH) % NB_MCU_X;

#ifdef PROGRESS
    fputs ("\033[1D", stdout);
    putchar (progress_tab[block_index++ % 4]);
    fflush (stdout);
#endif

    if (*LB_X == 0)
    {
      *LB_Y = (*LB_Y + YV) % NB_MCU_Y;

      if (*LB_Y == 0) 
      {
        /*
         * TODO: Send the picture to someone !
         */

#ifdef PROGRESS
        puts ("\033[1Ddone");
#endif

#ifdef PROGRESS
        printf ("Image %lu : |", imageCount++);
        fflush (stdout);
#endif
      }
    }
  }
}