All pastes #552816 Raw Edit

Unnamed

public c v1 · immutable
·published 2007-06-09 13:32 UTC
rendered paste body
#define get_unaligned_u24(_x) ( (((guint8*)_x)[0]) | ((((guint8*)_x)[1]) << 8) | ((((guint8*)_x)[2]) << 16) )static voidvolume_process_int24 (GstVolume * this, gpointer bytes, guint n_bytes){   gint8 *data = (gint8 *) bytes; /* treat the data as a byte stream */  guint i, num_samples;  guint32 samp;  gint64 val;   num_samples = n_bytes / (sizeof (gint8) * 3);  for (i = 0; i < num_samples; i++) {    samp = get_unaligned_u24 (data);    if (samp & 0x800000) samp |= 0xFF000000; /* make signed */        val = (gint32) samp;    val = (((gint64) this->real_vol_i24 * val) >> VOLUME_UNITY_INT24_BIT_SHIFT);    samp = (guint32) val;    /* write the value back into the stream */    *data++ = samp & 0xFF; *data++ = (samp >> 8) & 0xFF; *data++ = (samp >> 16) & 0xFF;  }}