vortex86sx: we use sisfb which gives 2D acceleration
[vuplus_openembedded] / packages / gstreamer / gst-plugins-ugly / gstmad_16bit.patch
1 --- gst-plugins-ugly-0.10.6/ext/mad/gstmad.c.orig       2007-06-13 11:21:25.000000000 +0200
2 +++ gst-plugins-ugly-0.10.6/ext/mad/gstmad.c    2007-09-16 22:45:04.000000000 +0200
3 @@ -119,8 +119,8 @@
4      GST_STATIC_CAPS ("audio/x-raw-int, "
5          "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
6          "signed = (boolean) true, "
7 -        "width = (int) 32, "
8 -        "depth = (int) 32, "
9 +        "width = (int) 16, "
10 +        "depth = (int) 16, "
11          "rate = (int) { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, "
12          "channels = (int) [ 1, 2 ]")
13      );
14 @@ -458,7 +458,7 @@
15  
16    mad = GST_MAD (GST_PAD_PARENT (pad));
17  
18 -  bytes_per_sample = MAD_NCHANNELS (&mad->frame.header) * 4;
19 +  bytes_per_sample = MAD_NCHANNELS (&mad->frame.header) << 1;
20  
21    switch (src_format) {
22      case GST_FORMAT_BYTES:
23 @@ -870,13 +870,11 @@
24    return res;
25  }
26  
27 -static inline gint32
28 +static inline gint16
29  scale (mad_fixed_t sample)
30  {
31 -#if MAD_F_FRACBITS < 28
32    /* round */
33 -  sample += (1L << (28 - MAD_F_FRACBITS - 1));
34 -#endif
35 +  sample += (1L << (MAD_F_FRACBITS - 16));
36  
37    /* clip */
38    if (sample >= MAD_F_ONE)
39 @@ -884,13 +882,8 @@
40    else if (sample < -MAD_F_ONE)
41      sample = -MAD_F_ONE;
42  
43 -#if MAD_F_FRACBITS < 28
44    /* quantize */
45 -  sample >>= (28 - MAD_F_FRACBITS);
46 -#endif
47 -
48 -  /* convert from 29 bits to 32 bits */
49 -  return (gint32) (sample << 3);
50 +  return sample >> (MAD_F_FRACBITS + 1 - 16);
51  }
52  
53  /* do we need this function? */
54 @@ -1277,8 +1270,8 @@
55      caps = gst_caps_new_simple ("audio/x-raw-int",
56          "endianness", G_TYPE_INT, G_BYTE_ORDER,
57          "signed", G_TYPE_BOOLEAN, TRUE,
58 -        "width", G_TYPE_INT, 32,
59 -        "depth", G_TYPE_INT, 32,
60 +        "width", G_TYPE_INT, 16,
61 +        "depth", G_TYPE_INT, 16,
62          "rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, nchannels, NULL);
63  
64      gst_pad_set_caps (mad->srcpad, caps);
65 @@ -1576,7 +1569,7 @@
66             to skip and send the remaining pcm samples */
67  
68          GstBuffer *outbuffer = NULL;
69 -        gint32 *outdata;
70 +        gint16 *outdata;
71          mad_fixed_t const *left_ch, *right_ch;
72  
73          if (mad->need_newsegment) {
74 @@ -1594,7 +1587,7 @@
75          /* will attach the caps to the buffer */
76          result =
77              gst_pad_alloc_buffer_and_set_caps (mad->srcpad, 0,
78 -            nsamples * mad->channels * 4, GST_PAD_CAPS (mad->srcpad),
79 +            nsamples * mad->channels * 2, GST_PAD_CAPS (mad->srcpad),
80              &outbuffer);
81          if (result != GST_FLOW_OK) {
82            /* Head for the exit, dropping samples as we go */
83 @@ -1607,7 +1600,7 @@
84          left_ch = mad->synth.pcm.samples[0];
85          right_ch = mad->synth.pcm.samples[1];
86  
87 -        outdata = (gint32 *) GST_BUFFER_DATA (outbuffer);
88 +        outdata = (gint16 *) GST_BUFFER_DATA (outbuffer);
89  
90          GST_DEBUG ("mad out timestamp %" GST_TIME_FORMAT,
91              GST_TIME_ARGS (time_offset));
92 @@ -1621,14 +1614,14 @@
93            gint count = nsamples;
94  
95            while (count--) {
96 -            *outdata++ = scale (*left_ch++) & 0xffffffff;
97 +            *outdata++ = scale (*left_ch++) & 0xffff;
98            }
99          } else {
100            gint count = nsamples;
101  
102            while (count--) {
103 -            *outdata++ = scale (*left_ch++) & 0xffffffff;
104 -            *outdata++ = scale (*right_ch++) & 0xffffffff;
105 +            *outdata++ = scale (*left_ch++) & 0xffff;
106 +            *outdata++ = scale (*right_ch++) & 0xffff;
107            }
108          }
109