aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm_pack.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-03-21 19:25:52 +0100
committerMax Kellermann <max@duempel.org>2012-03-21 19:31:04 +0100
commit8c5ebdff360021a25b43418d3cd60ea975f5e245 (patch)
tree5780d19719f2493741fd11777bc39baf5361935b /src/pcm_pack.c
parent1c84f324a13bcc3d7fbd84f8d59398b1c801247a (diff)
downloadmpd-8c5ebdff360021a25b43418d3cd60ea975f5e245.tar.gz
mpd-8c5ebdff360021a25b43418d3cd60ea975f5e245.tar.xz
mpd-8c5ebdff360021a25b43418d3cd60ea975f5e245.zip
audio_format: remove the reverse_endian attribute
Eliminate support for reverse endian samples from the MPD core. This moves a lot of complexity to the plugins that really need it (only ALSA and CDIO currently).
Diffstat (limited to '')
-rw-r--r--src/pcm_pack.c42
1 files changed, 13 insertions, 29 deletions
diff --git a/src/pcm_pack.c b/src/pcm_pack.c
index 94fda5910..aa241f437 100644
--- a/src/pcm_pack.c
+++ b/src/pcm_pack.c
@@ -22,11 +22,11 @@
#include <glib.h>
static void
-pack_sample(uint8_t *dest, const int32_t *src0, bool reverse_endian)
+pack_sample(uint8_t *dest, const int32_t *src0)
{
const uint8_t *src = (const uint8_t *)src0;
- if ((G_BYTE_ORDER == G_BIG_ENDIAN) != reverse_endian)
+ if (G_BYTE_ORDER == G_BIG_ENDIAN)
++src;
*dest++ = *src++;
@@ -35,31 +35,23 @@ pack_sample(uint8_t *dest, const int32_t *src0, bool reverse_endian)
}
void
-pcm_pack_24(uint8_t *dest, const int32_t *src, const int32_t *src_end,
- bool reverse_endian)
+pcm_pack_24(uint8_t *dest, const int32_t *src, const int32_t *src_end)
{
/* duplicate loop to help the compiler's optimizer (constant
parameter to the pack_sample() inline function) */
- if (G_LIKELY(!reverse_endian)) {
- while (src < src_end) {
- pack_sample(dest, src++, false);
- dest += 3;
- }
- } else {
- while (src < src_end) {
- pack_sample(dest, src++, true);
- dest += 3;
- }
+ while (src < src_end) {
+ pack_sample(dest, src++);
+ dest += 3;
}
}
static void
-unpack_sample(int32_t *dest0, const uint8_t *src, bool reverse_endian)
+unpack_sample(int32_t *dest0, const uint8_t *src)
{
uint8_t *dest = (uint8_t *)dest0;
- if ((G_BYTE_ORDER == G_BIG_ENDIAN) != reverse_endian)
+ if (G_BYTE_ORDER == G_BIG_ENDIAN)
/* extend the sign bit to the most fourth byte */
*dest++ = *src & 0x80 ? 0xff : 0x00;
@@ -67,27 +59,19 @@ unpack_sample(int32_t *dest0, const uint8_t *src, bool reverse_endian)
*dest++ = *src++;
*dest++ = *src;
- if ((G_BYTE_ORDER == G_LITTLE_ENDIAN) != reverse_endian)
+ if (G_BYTE_ORDER != G_LITTLE_ENDIAN)
/* extend the sign bit to the most fourth byte */
*dest++ = *src & 0x80 ? 0xff : 0x00;
}
void
-pcm_unpack_24(int32_t *dest, const uint8_t *src, const uint8_t *src_end,
- bool reverse_endian)
+pcm_unpack_24(int32_t *dest, const uint8_t *src, const uint8_t *src_end)
{
/* duplicate loop to help the compiler's optimizer (constant
parameter to the unpack_sample() inline function) */
- if (G_LIKELY(!reverse_endian)) {
- while (src < src_end) {
- unpack_sample(dest++, src, false);
- src += 3;
- }
- } else {
- while (src < src_end) {
- unpack_sample(dest++, src, true);
- src += 3;
- }
+ while (src < src_end) {
+ unpack_sample(dest++, src);
+ src += 3;
}
}