/** Data specific to the compress filter. */
struct private_compress_data {
/** The current multiplier. */
unsigned current_gain;
/** Points to the configuration data for this instance of the compress filter. */
struct compress_filter_args_info *conf;
/** Data specific to the compress filter. */
struct private_compress_data {
/** The current multiplier. */
unsigned current_gain;
/** Points to the configuration data for this instance of the compress filter. */
struct compress_filter_args_info *conf;
return 0;
for (i = 0; i < length / 2; i++) {
/* be careful in that heat, my dear */
return 0;
for (i = 0; i < length / 2; i++) {
/* be careful in that heat, my dear */
- int sample = *ip++, adjusted_sample;
-
- adjusted_sample = (PARA_ABS(sample) * pcd->current_gain)
- >> gain_shift;
+ int sample = *ip++, adjusted_sample = (PARA_ABS(sample) *
+ pcd->current_gain) >> gain_shift;
if (unlikely(adjusted_sample > 32767)) { /* clip */
PARA_NOTICE_LOG("clip: sample: %d, adjusted sample: %d\n",
sample, adjusted_sample);
if (unlikely(adjusted_sample > 32767)) { /* clip */
PARA_NOTICE_LOG("clip: sample: %d, adjusted sample: %d\n",
sample, adjusted_sample);
- } else {
- if (pcd->current_gain > pcd->min_gain + 1)
- pcd->current_gain -= 2;
- }
- PARA_DEBUG_LOG("gain: %lu, peak: %d\n", pcd->current_gain,
- pcd->peak);
+ } else
+ pcd->current_gain = PARA_MAX(pcd->current_gain - 2,
+ 1 << pcd->conf->inertia_arg);
fn->bufsize = COMPRESS_CHUNK_SIZE;
fn->buf = para_malloc(fn->bufsize);
pcd->current_gain = 1 << pcd->conf->inertia_arg;
fn->bufsize = COMPRESS_CHUNK_SIZE;
fn->buf = para_malloc(fn->bufsize);
pcd->current_gain = 1 << pcd->conf->inertia_arg;