Exemple #1
0
int
decode_layer1_frame(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point)
{
    real    fraction[2][SBLIMIT]; /* FIXME: change real -> double ? */
    sideinfo_layer_I si;
    struct frame *fr = &(mp->fr);
    int     single = fr->single;
    int     i, clip = 0;

    I_step_one(mp, &si);

    if (fr->stereo == 1 || single == 3)
        single = 0;

    if (single >= 0) {
        /* decoding one of possibly two channels */
        for (i = 0; i < SCALE_BLOCK; i++) {
            I_step_two(mp, &si, fraction);
            clip += synth_1to1_mono(mp, (real *) fraction[single], pcm_sample, pcm_point);
        }
    }
    else {
        for (i = 0; i < SCALE_BLOCK; i++) {
            int     p1 = *pcm_point;
            I_step_two(mp, &si, fraction);
            clip += synth_1to1(mp, (real *) fraction[0], 0, pcm_sample, &p1);
            clip += synth_1to1(mp, (real *) fraction[1], 1, pcm_sample, pcm_point);
        }
    }

    return clip;
}
Exemple #2
0
/*int do_layer1(struct frame *fr,int outmode,struct audio_info_struct *ai) */
int do_layer1(PMPSTR mp, unsigned char *pcm_sample,int *pcm_point)
{
  int clip=0;
  unsigned int balloc[2*SBLIMIT];
  unsigned int scale_index[2][SBLIMIT];
  real fraction[2][SBLIMIT];
  struct frame *fr=&(mp->fr);
  int i,stereo = fr->stereo;
  int single = fr->single;

  fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext<<2)+4 : 32;

  if(stereo == 1 || single == 3)
    single = 0;

  I_step_one(balloc,scale_index,fr);

  for (i=0;i<SCALE_BLOCK;i++)
  {
    I_step_two(fraction,balloc,scale_index,fr);

    if(single >= 0)
    {
      clip += synth_1to1_mono( mp, (real *) fraction[single],pcm_sample,pcm_point);
    }
    else {
        int p1 = *pcm_point;
        clip += synth_1to1( mp, (real *) fraction[0],0,pcm_sample,&p1);
        clip += synth_1to1( mp, (real *) fraction[1],1,pcm_sample,pcm_point);
    }
  }

  return clip;
}
Exemple #3
0
int do_layer1(mpg123_handle *fr)
{
	int clip=0;
	int i,stereo = fr->stereo;
	unsigned int balloc[2*SBLIMIT];
	unsigned int scale_index[2][SBLIMIT];
	real (*fraction)[SBLIMIT] = fr->layer1.fraction; /* fraction[2][SBLIMIT] */
	int single = fr->single;

	fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext<<2)+4 : 32;

	if(stereo == 1 || single == SINGLE_MIX) /* I don't see mixing handled here */
	single = SINGLE_LEFT;

	I_step_one(balloc,scale_index,fr);

	for(i=0;i<SCALE_BLOCK;i++)
	{
		I_step_two(fraction,balloc,scale_index,fr);

		if(single != SINGLE_STEREO)
		clip += (fr->synth_mono)(fraction[single], fr);
		else
		clip += (fr->synth_stereo)(fraction[0], fraction[1], fr);
	}

	return clip;
}
Exemple #4
0
int do_layer1(mpg123_handle *fr)
{
  int clip=0;
  int i,stereo = fr->stereo;
  unsigned int balloc[2*SBLIMIT];
  unsigned int scale_index[2][SBLIMIT];
  ALIGNED(16) real fraction[2][SBLIMIT];
  int single = fr->single;

  fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext<<2)+4 : 32;

  if(stereo == 1 || single == SINGLE_MIX) /* I don't see mixing handled here */
    single = SINGLE_LEFT;

  I_step_one(balloc,scale_index,fr);

  for (i=0;i<SCALE_BLOCK;i++)
  {
    I_step_two(fraction,balloc,scale_index,fr);

    if(single != SINGLE_STEREO)
    {
      clip += (fr->synth_mono)( (real *) fraction[single], fr);
    }
    else
    {
      clip += (fr->synth)( (real *) fraction[0], 0, fr, 0);
      clip += (fr->synth)( (real *) fraction[1], 1, fr, 1);
    }
  }

  return clip;
}
Exemple #5
0
static int do_layer1(mp3lib_ctx *ctx,int single)
{
  struct frame *fr=&ctx->fr;
  int clip=0;
  int i,stereo = fr->stereo;
  unsigned int balloc[2*SBLIMIT];
  unsigned int scale_index[2][SBLIMIT];
  real fraction[2][SBLIMIT];
//  int single = fr->single;

//  printf("do_layer1(0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X )\n",
//    wordpointer[0],wordpointer[1],wordpointer[2],wordpointer[3],wordpointer[4],wordpointer[5],wordpointer[6],wordpointer[7]);

  fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? 
                         (fr->mode_ext<<2)+4 : 32;

  if(stereo == 1 || single == 3)
    single = 0;

  I_step_one(ctx,balloc,scale_index,fr);

  for (i=0;i<SCALE_BLOCK;i++)
  {
    I_step_two(ctx,fraction,balloc,scale_index,fr);

    if(single >= 0)
    {
      clip += (fr->synth_mono)( ctx,(real *) fraction[single],ctx->pcm_sample,&ctx->pcm_point);
    }
    else {
        int p1 = ctx->pcm_point;
        clip += (fr->synth)( ctx,(real *) fraction[0],0,ctx->pcm_sample,&p1);
        clip += (fr->synth)( ctx,(real *) fraction[1],1,ctx->pcm_sample,&ctx->pcm_point);
    }

  }

  return clip;
}