summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2012-04-29 04:41:02 -0400
committerMichael Sevakis <jethead71@rockbox.org>2012-04-29 04:41:02 -0400
commitd8f3e3d0d1cb32cca15aaf6e027fd409320d671a (patch)
tree2552abcd2d409640238f9ddf8426024c032a7efb
parent7cc8bbdaaf37b0f1ad0a2182aace38d37a5a87f2 (diff)
downloadrockbox-d8f3e3d0d1cb32cca15aaf6e027fd409320d671a.tar.gz
rockbox-d8f3e3d0d1cb32cca15aaf6e027fd409320d671a.zip
Get warble building again.
Change-Id: Ibdb2d9064d0e948cfb745c10a7b23de1a750d55b
-rw-r--r--lib/rbcodec/test/warble.c48
1 files changed, 34 insertions, 14 deletions
diff --git a/lib/rbcodec/test/warble.c b/lib/rbcodec/test/warble.c
index 8dc27da9eb..8b555024ff 100644
--- a/lib/rbcodec/test/warble.c
+++ b/lib/rbcodec/test/warble.c
@@ -75,6 +75,13 @@ void debugf(const char *fmt, ...)
75 va_end(ap); 75 va_end(ap);
76} 76}
77 77
78int find_first_set_bit(uint32_t value)
79{
80 if (value == 0)
81 return 32;
82 return __builtin_ctz(value);
83}
84
78/***************** INTERNAL *****************/ 85/***************** INTERNAL *****************/
79 86
80static enum { MODE_PLAY, MODE_WRITE } mode; 87static enum { MODE_PLAY, MODE_WRITE } mode;
@@ -391,17 +398,30 @@ static void ci_pcmbuf_insert(const void *ch1, const void *ch2, int count)
391 num_output_samples += count; 398 num_output_samples += count;
392 399
393 if (use_dsp) { 400 if (use_dsp) {
394 const char *src[2] = {ch1, ch2}; 401 struct dsp_buffer src;
395 while (count > 0) { 402 src.remcount = count;
396 int out_count = dsp_output_count(ci.dsp, count); 403 src.pin[0] = ch1;
397 int in_count = MIN(dsp_input_count(ci.dsp, out_count), count); 404 src.pin[1] = ch2;
405 src.proc_mask = 0;
406 while (1) {
407 int out_count = MAX(count, 512);
398 int16_t buf[2 * out_count]; 408 int16_t buf[2 * out_count];
399 out_count = dsp_process(ci.dsp, (char *)buf, src, in_count); 409 struct dsp_buffer dst;
400 if (mode == MODE_WRITE) 410
401 write_pcm(buf, out_count); 411 dst.remcount = 0;
402 else if (mode == MODE_PLAY) 412 dst.p16out = buf;
403 playback_pcm(buf, out_count); 413 dst.bufcount = out_count;
404 count -= in_count; 414
415 dsp_process(ci.dsp, &src, &dst);
416
417 if (dst.remcount > 0) {
418 if (mode == MODE_WRITE)
419 write_pcm(buf, dst.remcount);
420 else if (mode == MODE_PLAY)
421 playback_pcm(buf, dst.remcount);
422 } else if (src.remcount <= 0) {
423 break;
424 }
405 } 425 }
406 } else { 426 } else {
407 /* Convert to 32-bit interleaved. */ 427 /* Convert to 32-bit interleaved. */
@@ -601,8 +621,9 @@ static struct codec_api ci = {
601 ci_semaphore_release, 621 ci_semaphore_release,
602#endif 622#endif
603 623
604 ci_cpucache_flush, 624 commit_dcache,
605 ci_cpucache_invalidate, 625 commit_discard_dcache,
626 commit_discard_idcache,
606 627
607 /* strings and memory */ 628 /* strings and memory */
608 strcpy, 629 strcpy,
@@ -685,7 +706,6 @@ static void decode_file(const char *input_fn)
685 memset(&global_settings, 0, sizeof(global_settings)); 706 memset(&global_settings, 0, sizeof(global_settings));
686 global_settings.timestretch_enabled = true; 707 global_settings.timestretch_enabled = true;
687 dsp_timestretch_enable(true); 708 dsp_timestretch_enable(true);
688 tdspeed_init();
689 709
690 /* Open file */ 710 /* Open file */
691 if (!strcmp(input_fn, "-")) { 711 if (!strcmp(input_fn, "-")) {
@@ -708,7 +728,7 @@ static void decode_file(const char *input_fn)
708 ci.filesize = filesize(input_fd); 728 ci.filesize = filesize(input_fd);
709 ci.id3 = &id3; 729 ci.id3 = &id3;
710 if (use_dsp) { 730 if (use_dsp) {
711 ci.dsp = (struct dsp_config *)dsp_configure(NULL, DSP_MYDSP, CODEC_IDX_AUDIO); 731 ci.dsp = dsp_get_config(CODEC_IDX_AUDIO);
712 dsp_configure(ci.dsp, DSP_RESET, 0); 732 dsp_configure(ci.dsp, DSP_RESET, 0);
713 dsp_dither_enable(false); 733 dsp_dither_enable(false);
714 } 734 }