Project

General

Profile

0001-Add-support-for-24-bit-3-bytes-format.patch

Andrea Iob, November 09, 2013 18:12

View differences:

src/audacious/output.c
76 76
    switch (get_int (NULL, "output_bit_depth"))
77 77
    {
78 78
        case 16: return FMT_S16_NE;
79
        case 24: return FMT_S24_NE;
79
        case 243: return FMT_S24_3NE;
80 80
        case 32: return FMT_S32_NE;
81 81
        default: return FMT_FLOAT;
82 82
    }
src/audacious/ui_preferences.c
108 108
static ComboBoxElements bitdepth_elements[] = {
109 109
    { GINT_TO_POINTER(16), "16" },
110 110
    { GINT_TO_POINTER(24), "24" },
111
    { GINT_TO_POINTER(243), "24 (3 bytes)" },
111 112
    { GINT_TO_POINTER(32), "32" },
112 113
    {GINT_TO_POINTER (0), N_("Floating point")},
113 114
};
src/libaudcore/audio.c
57 57
        INTERLACE_LOOP (int16_t);
58 58
        break;
59 59

  
60
    case FMT_S24_3LE:
61
    case FMT_S24_3BE:
62
    case FMT_U24_3LE:
63
    case FMT_U24_3BE:
60 64
    case FMT_S24_LE:
61 65
    case FMT_S24_BE:
62 66
    case FMT_U24_LE:
......
93 97
FROM_INT_LOOP (from_u8, int8_t, , 0x80, 0x7f)
94 98
FROM_INT_LOOP (from_s16, int16_t, , 0x0000, 0x7fff)
95 99
FROM_INT_LOOP (from_u16, int16_t, , 0x8000, 0x7fff)
100
FROM_INT_LOOP (from_s24_3, int32_t, , 0x000000, 0x7fffff)
101
FROM_INT_LOOP (from_u24_3, int32_t, , 0x800000, 0x7fffff)
96 102
FROM_INT_LOOP (from_s24, int32_t, , 0x000000, 0x7fffff)
97 103
FROM_INT_LOOP (from_u24, int32_t, , 0x800000, 0x7fffff)
98 104
FROM_INT_LOOP (from_s32, int32_t, , 0x00000000, 0x7fffffff)
......
102 108
TO_INT_LOOP (to_u8, int8_t, , 0x80, 0x7f)
103 109
TO_INT_LOOP (to_s16, int16_t, , 0x0000, 0x7fff)
104 110
TO_INT_LOOP (to_u16, int16_t, , 0x8000, 0x7fff)
111
TO_INT_LOOP (to_s24_3, int32_t, , 0x000000, 0x7fffff)
112
TO_INT_LOOP (to_u24_3, int32_t, , 0x800000, 0x7fffff)
105 113
TO_INT_LOOP (to_s24, int32_t, , 0x000000, 0x7fffff)
106 114
TO_INT_LOOP (to_u24, int32_t, , 0x800000, 0x7fffff)
107 115
TO_INT_LOOP (to_s32, int32_t, , 0x00000000, 0x7fffffff)
......
112 120

  
113 121
FROM_INT_LOOP (from_s16_swap, int16_t, SWAP16, 0x0000, 0x7fff)
114 122
FROM_INT_LOOP (from_u16_swap, int16_t, SWAP16, 0x8000, 0x7fff)
123
FROM_INT_LOOP (from_s24_3_swap, int32_t, SWAP32, 0x000000, 0x7fffff)
124
FROM_INT_LOOP (from_u24_3_swap, int32_t, SWAP32, 0x800000, 0x7fffff)
115 125
FROM_INT_LOOP (from_s24_swap, int32_t, SWAP32, 0x000000, 0x7fffff)
116 126
FROM_INT_LOOP (from_u24_swap, int32_t, SWAP32, 0x800000, 0x7fffff)
117 127
FROM_INT_LOOP (from_s32_swap, int32_t, SWAP32, 0x00000000, 0x7fffffff)
......
119 129

  
120 130
TO_INT_LOOP (to_s16_swap, int16_t, SWAP16, 0x0000, 0x7fff)
121 131
TO_INT_LOOP (to_u16_swap, int16_t, SWAP16, 0x8000, 0x7fff)
132
TO_INT_LOOP (to_s24_3_swap, int32_t, SWAP32, 0x000000, 0x7fffff)
133
TO_INT_LOOP (to_u24_3_swap, int32_t, SWAP32, 0x800000, 0x7fffff)
122 134
TO_INT_LOOP (to_s24_swap, int32_t, SWAP32, 0x000000, 0x7fffff)
123 135
TO_INT_LOOP (to_u24_swap, int32_t, SWAP32, 0x800000, 0x7fffff)
124 136
TO_INT_LOOP (to_s32_swap, int32_t, SWAP32, 0x00000000, 0x7fffffff)
......
141 153
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
142 154
    {FMT_S16_LE, (FromFunc) from_s16, (ToFunc) to_s16},
143 155
    {FMT_U16_LE, (FromFunc) from_u16, (ToFunc) to_u16},
156
    {FMT_S24_3_LE, (FromFunc) from_s24_3, (ToFunc) to_s24_3},
157
    {FMT_U24_3_LE, (FromFunc) from_u24_3, (ToFunc) to_u24_3},
144 158
    {FMT_S24_LE, (FromFunc) from_s24, (ToFunc) to_s24},
145 159
    {FMT_U24_LE, (FromFunc) from_u24, (ToFunc) to_u24},
146 160
    {FMT_S32_LE, (FromFunc) from_s32, (ToFunc) to_s32},
......
148 162

  
149 163
    {FMT_S16_BE, (FromFunc) from_s16_swap, (ToFunc) to_s16_swap},
150 164
    {FMT_U16_BE, (FromFunc) from_u16_swap, (ToFunc) to_u16_swap},
165
    {FMT_S24_3_BE, (FromFunc) from_s24_3_swap, (ToFunc) to_s24_3_swap},
166
    {FMT_U24_3_BE, (FromFunc) from_u24_3_swap, (ToFunc) to_u24_3_swap},
151 167
    {FMT_S24_BE, (FromFunc) from_s24_swap, (ToFunc) to_s24_swap},
152 168
    {FMT_U24_BE, (FromFunc) from_u24_swap, (ToFunc) to_u24_swap},
153 169
    {FMT_S32_BE, (FromFunc) from_s32_swap, (ToFunc) to_s32_swap},
......
155 171
#else
156 172
    {FMT_S16_BE, (FromFunc) from_s16, (ToFunc) to_s16},
157 173
    {FMT_U16_BE, (FromFunc) from_u16, (ToFunc) to_u16},
174
    {FMT_S24_3_BE, (FromFunc) from_s24_3, (ToFunc) to_s24_3},
175
    {FMT_U24_3_BE, (FromFunc) from_u24_3, (ToFunc) to_u24_3},
158 176
    {FMT_S24_BE, (FromFunc) from_s24, (ToFunc) to_s24},
159 177
    {FMT_U24_BE, (FromFunc) from_u24, (ToFunc) to_u24},
160 178
    {FMT_S32_BE, (FromFunc) from_s32, (ToFunc) to_s32},
......
162 180

  
163 181
    {FMT_S16_LE, (FromFunc) from_s16_swap, (ToFunc) to_s16_swap},
164 182
    {FMT_U16_LE, (FromFunc) from_u16_swap, (ToFunc) to_u16_swap},
183
    {FMT_S24_3_LE, (FromFunc) from_s24_3_swap, (ToFunc) to_s24_3_swap},
184
    {FMT_U24_3_LE, (FromFunc) from_u24_3_swap, (ToFunc) to_u24_3_swap},
165 185
    {FMT_S24_LE, (FromFunc) from_s24_swap, (ToFunc) to_s24_swap},
166 186
    {FMT_U24_LE, (FromFunc) from_u24_swap, (ToFunc) to_u24_swap},
167 187
    {FMT_S32_LE, (FromFunc) from_s32_swap, (ToFunc) to_s32_swap},
src/libaudcore/audio.h.in
25 25
 FMT_FLOAT,
26 26
 FMT_S8, FMT_U8,
27 27
 FMT_S16_LE, FMT_S16_BE, FMT_U16_LE, FMT_U16_BE,
28
 FMT_S24_3_LE, FMT_S24_3_BE, FMT_U24_3_LE, FMT_U24_3_BE, 
28 29
 FMT_S24_LE, FMT_S24_BE, FMT_U24_LE, FMT_U24_BE,
29 30
 FMT_S32_LE, FMT_S32_BE, FMT_U32_LE, FMT_U32_BE};
30 31

  
31 32
#if @BIGENDIAN@
32 33
#define FMT_S16_NE FMT_S16_BE
33 34
#define FMT_U16_NE FMT_U16_BE
35
#define FMT_S24_3NE FMT_S24_3BE
36
#define FMT_U24_3NE FMT_U24_3BE
34 37
#define FMT_S24_NE FMT_S24_BE
35 38
#define FMT_U24_NE FMT_U24_BE
36 39
#define FMT_S32_NE FMT_S32_BE
......
38 41
#else
39 42
#define FMT_S16_NE FMT_S16_LE
40 43
#define FMT_U16_NE FMT_U16_LE
44
#define FMT_S24_3NE FMT_S24_3LE
45
#define FMT_U24_3NE FMT_U24_3LE
41 46
#define FMT_S24_NE FMT_S24_LE
42 47
#define FMT_U24_NE FMT_U24_LE
43 48
#define FMT_S32_NE FMT_S32_LE
44 49
#define FMT_U32_NE FMT_U32_LE
45 50
#endif
46 51

  
47
#define FMT_SIZEOF(f) ((f) == FMT_FLOAT ? sizeof (float) : (f) <= FMT_U8 ? 1 : (f) <= FMT_U16_BE ? 2 : 4)
52
#define FMT_SIZEOF(f) ((f) == FMT_FLOAT ? sizeof (float) : (f) <= FMT_U8 ? 1 : (f) <= FMT_U16_BE ? 2 : (f) <= FMT_U24_3_BE ? 3 : 4)
48 53

  
49 54
void audio_interlace (const void * const * in, int format, int channels, void * out, int frames);
50 55
void audio_from_int (const void * in, int format, float * out, int samples);
51
-