OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [torture/] [pr36066.c] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-funsafe-loop-optimizations -ftree-vrp" } */
3
 
4
typedef int FLAC__int32;
5
typedef int FLAC__bool;
6
typedef struct { } FLAC__Subframe;
7
typedef enum { FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT = 0,  FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE = 1,  FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE = 2,  FLAC__CHANNEL_ASSIGNMENT_MID_SIDE = 3 } FLAC__ChannelAssignment;
8
typedef struct {
9
  struct FLAC__StreamEncoderProtected *protected_;
10
  struct FLAC__StreamEncoderPrivate *private_;
11
} FLAC__StreamEncoder;
12
typedef struct FLAC__StreamEncoderProtected {
13
  FLAC__bool loose_mid_side_stereo;
14
  unsigned channels;
15
  unsigned blocksize;
16
} FLAC__StreamEncoderProtected;
17
typedef struct FLAC__StreamEncoderPrivate {
18
  FLAC__int32 *integer_signal[(8u)];
19
  FLAC__Subframe subframe_workspace_mid_side[2][2];
20
  unsigned best_subframe_mid_side[2];
21
  unsigned loose_mid_side_stereo_frame_count;
22
} FLAC__StreamEncoderPrivate;
23
static void get_wasted_bits_(FLAC__int32 signal[], unsigned samples)
24
{
25
  unsigned i;
26
  FLAC__int32 x = 0;
27
  for(i = 0; i < samples && !(x&1); i++)
28
    x |= signal[i];
29
}
30
FLAC__Subframe * process_subframes_(FLAC__StreamEncoder *encoder, unsigned *bits)
31
{
32
  unsigned channel;
33
  FLAC__Subframe *left_subframe = 0;
34
  FLAC__ChannelAssignment channel_assignment;
35
  for(channel = 0; channel < encoder->protected_->channels; channel++)
36
      get_wasted_bits_(encoder->private_->integer_signal[channel], encoder->protected_->blocksize);
37
  if(encoder->protected_->loose_mid_side_stereo && encoder->private_->loose_mid_side_stereo_frame_count > 0)
38
      channel_assignment = FLAC__CHANNEL_ASSIGNMENT_MID_SIDE;
39
  else {
40
      FLAC__ChannelAssignment ca = (FLAC__ChannelAssignment)1;
41
      unsigned min_bits = bits[0];
42
      for(channel_assignment = (FLAC__ChannelAssignment)0; (int)ca <= 3; ca = (FLAC__ChannelAssignment)((int)ca + 1))
43
          if(bits[ca] < min_bits)
44
              channel_assignment = ca;
45
  }
46
  switch(channel_assignment) {
47
      case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT:
48
      case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE:
49
      case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE:
50
      case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE:
51
          left_subframe = &encoder->private_->subframe_workspace_mid_side[0][encoder->private_->best_subframe_mid_side[0]];
52
  }
53
  return left_subframe;
54
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.