Mercurial > mplayer.hg
comparison libaf/af_hrtf.c @ 24888:b2402b4f0afa
libaf: change filter input/output ratio calculations
Change the audio filters to use a double instead of rationals for the
ratio of output to input size. The rationals could overflow when
calculating the overall ratio of a filter chain and gave no real
advantage compared to doubles.
author | uau |
---|---|
date | Thu, 01 Nov 2007 06:52:01 +0000 |
parents | 904e3f3f8bee |
children | e29d1b1afdc7 |
comparison
equal
deleted
inserted
replaced
24887:484b8eaaf28f | 24888:b2402b4f0afa |
---|---|
291 else if (af->data->nch < 5) | 291 else if (af->data->nch < 5) |
292 af->data->nch = 5; | 292 af->data->nch = 5; |
293 af->data->format = AF_FORMAT_S16_NE; | 293 af->data->format = AF_FORMAT_S16_NE; |
294 af->data->bps = 2; | 294 af->data->bps = 2; |
295 test_output_res = af_test_output(af, (af_data_t*)arg); | 295 test_output_res = af_test_output(af, (af_data_t*)arg); |
296 af->mul.n = 2; | 296 af->mul = 2.0 / af->data->nch; |
297 af->mul.d = af->data->nch; | |
298 // after testing input set the real output format | 297 // after testing input set the real output format |
299 af->data->nch = 2; | 298 af->data->nch = 2; |
300 s->print_flag = 1; | 299 s->print_flag = 1; |
301 return test_output_res; | 300 return test_output_res; |
302 case AF_CONTROL_COMMAND_LINE: | 301 case AF_CONTROL_COMMAND_LINE: |
558 s->cyc_pos += dblen; | 557 s->cyc_pos += dblen; |
559 } | 558 } |
560 | 559 |
561 /* Set output data */ | 560 /* Set output data */ |
562 data->audio = af->data->audio; | 561 data->audio = af->data->audio; |
563 data->len = (data->len * af->mul.n) / af->mul.d; | 562 data->len = data->len / data->nch * 2; |
564 data->nch = 2; | 563 data->nch = 2; |
565 | 564 |
566 return data; | 565 return data; |
567 } | 566 } |
568 | 567 |
595 float fc; | 594 float fc; |
596 | 595 |
597 af->control = control; | 596 af->control = control; |
598 af->uninit = uninit; | 597 af->uninit = uninit; |
599 af->play = play; | 598 af->play = play; |
600 af->mul.n = 1; | 599 af->mul = 1; |
601 af->mul.d = 1; | |
602 af->data = calloc(1, sizeof(af_data_t)); | 600 af->data = calloc(1, sizeof(af_data_t)); |
603 af->setup = calloc(1, sizeof(af_hrtf_t)); | 601 af->setup = calloc(1, sizeof(af_hrtf_t)); |
604 if((af->data == NULL) || (af->setup == NULL)) | 602 if((af->data == NULL) || (af->setup == NULL)) |
605 return AF_ERROR; | 603 return AF_ERROR; |
606 | 604 |