OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
345 } | 345 } |
346 #else | 346 #else |
347 // FIXME: add ARM NEON optimizations for the following. The scalar | 347 // FIXME: add ARM NEON optimizations for the following. The scalar |
348 // code-path can probably also be optimized better. | 348 // code-path can probably also be optimized better. |
349 | 349 |
350 // Optimize size 32 and size 64 kernels by unrolling the while loop. | 350 // Optimize size 32 and size 64 kernels by unrolling the while loop. |
351 // A 20 - 30% speed improvement was measured in some cases by using this | 351 // A 20 - 30% speed improvement was measured in some cases by using this |
352 // approach. | 352 // approach. |
353 | 353 |
354 if (n == 32) { | 354 if (n == 32) { |
355 CONVOLVE_ONE_SAMPLE // 1 | 355 CONVOLVE_ONE_SAMPLE // 1 |
Dan Beam
2017/06/15 22:54:42
this is more "wat", imo. i think these all just n
Nico
2017/06/15 23:00:13
Yeah...can you add ;s here please?
Raymond Toy
2017/06/15 23:03:37
DBC: I'd be perfectly happy to rewrite these macro
| |
356 CONVOLVE_ONE_SAMPLE // 2 | 356 CONVOLVE_ONE_SAMPLE // 2 |
357 CONVOLVE_ONE_SAMPLE // 3 | 357 CONVOLVE_ONE_SAMPLE // 3 |
358 CONVOLVE_ONE_SAMPLE // 4 | 358 CONVOLVE_ONE_SAMPLE // 4 |
359 CONVOLVE_ONE_SAMPLE // 5 | 359 CONVOLVE_ONE_SAMPLE // 5 |
360 CONVOLVE_ONE_SAMPLE // 6 | 360 CONVOLVE_ONE_SAMPLE // 6 |
361 CONVOLVE_ONE_SAMPLE // 7 | 361 CONVOLVE_ONE_SAMPLE // 7 |
362 CONVOLVE_ONE_SAMPLE // 8 | 362 CONVOLVE_ONE_SAMPLE // 8 |
363 CONVOLVE_ONE_SAMPLE // 9 | 363 CONVOLVE_ONE_SAMPLE // 9 |
364 CONVOLVE_ONE_SAMPLE // 10 | 364 CONVOLVE_ONE_SAMPLE // 10 |
365 CONVOLVE_ONE_SAMPLE // 11 | 365 CONVOLVE_ONE_SAMPLE // 11 |
366 CONVOLVE_ONE_SAMPLE // 12 | 366 CONVOLVE_ONE_SAMPLE // 12 |
367 CONVOLVE_ONE_SAMPLE // 13 | 367 CONVOLVE_ONE_SAMPLE / / 13 |
368 CONVOLVE_ONE_SAMPLE // 14 | 368 CONVOLVE_ONE_SAMPL E // 14 |
369 CONVOLVE_ONE_SAMPLE // 15 | 369 CONVOLVE_ONE_S AMPLE // 15 |
370 CONVOLVE_ONE_SAMPLE // 16 | 370 CONVOLVE_O NE_SAMPLE // 16 |
371 CONVOLVE_ONE_SAMPLE // 17 | 371 CONVOL VE_ONE_SAMPLE // 17 |
372 CONVOLVE_ONE_SAMPLE // 18 | 372 CO NVOLVE_ONE_SAMPLE // 18 |
373 CONVOLVE_ONE_SAMPLE // 19 | 373 CONVOLVE_ONE_SAMPLE // 19 |
374 CONVOLVE_ONE_SAMPLE // 20 | 374 CONVOLVE_ONE_SAMPLE // 20 |
375 CONVOLVE_ONE_SAMPLE // 21 | 375 CONVOLVE_ONE_SAMPLE // 21 |
376 CONVOLVE_ONE_SAMPLE // 22 | 376 CONVOLVE_ONE_SAMPLE // 22 |
377 CONVOLVE_ONE_SAMPLE // 23 | 377 CONVOLVE_ONE_SAMPLE // 23 |
378 CONVOLVE_ONE_SAMPLE // 24 | 378 CONVOLVE_ONE_SAMPLE // 24 |
379 CONVOLVE_ONE_SAMPLE // 25 | 379 CONVOLVE_ONE_SAMPLE // 25 |
380 CONVOLVE_ONE_SAMPLE // 26 | 380 CONVOLVE_ONE_SAMPLE // 26 |
381 CONVOLVE_ONE_SAMPLE // 27 | 381 CONVOLVE_ONE_SAMPLE // 27 |
382 CONVOLVE_ONE_SAMPLE // 28 | 382 CONVOLVE_ONE_SAMPLE // 28 |
383 CONVOLVE_ONE_SAMPLE // 29 | 383 CONVOLVE_ONE_SAMPLE // 29 |
384 CONVOLVE_ONE_SAMPLE // 30 | 384 CONVOLVE_ONE_SAMPLE // 30 |
385 CONVOLVE_ONE_SAMPLE // 31 | 385 CONVOLVE_ONE_SAMPLE // 31 |
386 CONVOLVE_ONE_SAMPLE // 32 | 386 CONVOLVE_ONE_SAMPLE // 32 |
387 } else if (n == 64) { | 387 } else if (n == 64) { |
388 CONVOLVE_ONE_SAMPLE // 1 | 388 CONVOLVE_ONE_SAMPLE // 1 |
389 CONVOLVE_ONE_SAMPLE // 2 | 389 CONVOLVE_ONE_SAMPLE // 2 |
390 CONVOLVE_ONE_SAMPLE // 3 | 390 CONVOLVE_ONE_SAMPLE // 3 |
391 CONVOLVE_ONE_SAMPLE // 4 | 391 CONVOLVE_ONE_SAMPLE // 4 |
392 CONVOLVE_ONE_SAMPLE // 5 | 392 CONVOLVE_ONE_SAMPLE // 5 |
393 CONVOLVE_ONE_SAMPLE // 6 | 393 CONVOLVE_ONE_SAMPLE // 6 |
394 CONVOLVE_ONE_SAMPLE // 7 | 394 CONVOLVE_ONE_SAMPLE // 7 |
395 CONVOLVE_ONE_SAMPLE // 8 | 395 CONVOLVE_ONE_SAMPLE // 8 |
396 CONVOLVE_ONE_SAMPLE // 9 | 396 CONVOLVE_ONE_SAMPLE // 9 |
397 CONVOLVE_ONE_SAMPLE // 10 | 397 CONVOLVE_ONE_SAMPLE // 10 |
398 CONVOLVE_ONE_SAMPLE // 11 | 398 CONVOLVE_ONE_SAMPLE // 11 |
399 CONVOLVE_ONE_SAMPLE // 12 | 399 CONVOLVE_ONE_SAMPLE // 12 |
400 CONVOLVE_ONE_SAMPLE // 13 | 400 CONVOLVE_ONE_SAMPLE / / 13 |
401 CONVOLVE_ONE_SAMPLE // 14 | 401 CONVOLVE_ONE_SAMPL E // 14 |
402 CONVOLVE_ONE_SAMPLE // 15 | 402 CONVOLVE_ONE_S AMPLE // 15 |
403 CONVOLVE_ONE_SAMPLE // 16 | 403 CONVOLVE_O NE_SAMPLE // 16 |
404 CONVOLVE_ONE_SAMPLE // 17 | 404 CONVOL VE_ONE_SAMPLE // 17 |
405 CONVOLVE_ONE_SAMPLE // 18 | 405 CO NVOLVE_ONE_SAMPLE // 18 |
406 CONVOLVE_ONE_SAMPLE // 19 | 406 CONVOLVE_ONE_SAMPLE // 19 |
407 CONVOLVE_ONE_SAMPLE // 20 | 407 CONVOLVE_ONE_SAMPLE // 20 |
408 CONVOLVE_ONE_SAMPLE // 21 | 408 CONVOLVE_ONE_SAMPLE // 21 |
409 CONVOLVE_ONE_SAMPLE // 22 | 409 CONVOLVE_ONE_SAMPLE // 22 |
410 CONVOLVE_ONE_SAMPLE // 23 | 410 CONVOLVE_ONE_SAMPLE // 23 |
411 CONVOLVE_ONE_SAMPLE // 24 | 411 CONVOLVE_ONE_SAMPLE // 24 |
412 CONVOLVE_ONE_SAMPLE // 25 | 412 CONVOLVE_ONE_SAMPLE // 25 |
413 CONVOLVE_ONE_SAMPLE // 26 | 413 CONVOLVE_ONE_SAMPLE // 26 |
414 CONVOLVE_ONE_SAMPLE // 27 | 414 CONVOLVE_ONE_SAMPLE // 27 |
415 CONVOLVE_ONE_SAMPLE // 28 | 415 CONVOLVE_ONE_SAMPLE // 28 |
416 CONVOLVE_ONE_SAMPLE // 29 | 416 CONVOLVE_ONE_SAMPLE // 29 |
417 CONVOLVE_ONE_SAMPLE // 30 | 417 CONVOLVE_ONE_SAMPLE // 30 |
418 CONVOLVE_ONE_SAMPLE // 31 | 418 CONVOLVE_ONE_SAMPLE // 31 |
419 CONVOLVE_ONE_SAMPLE // 32 | 419 CONVOLVE_ONE_SAMPLE // 32 |
420 CONVOLVE_ONE_SAMPLE // 33 | 420 CONVOLVE_ONE_SAMPLE / / 33 |
421 CONVOLVE_ONE_SAMPLE // 34 | 421 CONVOLVE_ONE_SAMPL E // 34 |
422 CONVOLVE_ONE_SAMPLE // 35 | 422 CONVOLVE_ONE_S AMPLE // 35 |
423 CONVOLVE_ONE_SAMPLE // 36 | 423 CONVOLVE_O NE_SAMPLE // 36 |
424 CONVOLVE_ONE_SAMPLE // 37 | 424 CONVOL VE_ONE_SAMPLE // 37 |
425 CONVOLVE_ONE_SAMPLE // 38 | 425 CO NVOLVE_ONE_SAMPLE // 38 |
426 CONVOLVE_ONE_SAMPLE // 39 | 426 CONVOLVE_ONE_SAMPLE // 39 |
427 CONVOLVE_ONE_SAMPLE // 40 | 427 CONVOLVE_ONE_SAMPLE // 40 |
428 CONVOLVE_ONE_SAMPLE // 41 | 428 CONVOLVE_ONE_SAMPLE // 41 |
429 CONVOLVE_ONE_SAMPLE // 42 | 429 CONVOLVE_ONE_SAMPLE // 42 |
430 CONVOLVE_ONE_SAMPLE // 43 | 430 CONVOLVE_ONE_SAMPLE // 43 |
431 CONVOLVE_ONE_SAMPLE // 44 | 431 CONVOLVE_ONE_SAMPLE // 44 |
432 CONVOLVE_ONE_SAMPLE // 45 | 432 CONVOLVE_ONE_SAMPLE // 45 |
433 CONVOLVE_ONE_SAMPLE // 46 | 433 CONVOLVE_ONE_SAMPLE // 46 |
434 CONVOLVE_ONE_SAMPLE // 47 | 434 CONVOLVE_ONE_SAMPLE // 47 |
435 CONVOLVE_ONE_SAMPLE // 48 | 435 CONVOLVE_ONE_SAMPLE // 48 |
436 CONVOLVE_ONE_SAMPLE // 49 | 436 CONVOLVE_ONE_SAMPLE // 49 |
437 CONVOLVE_ONE_SAMPLE // 50 | 437 CONVOLVE_ONE_SAMPLE // 50 |
438 CONVOLVE_ONE_SAMPLE // 51 | 438 CONVOLVE_ONE_SAMPLE // 51 |
439 CONVOLVE_ONE_SAMPLE // 52 | 439 CONVOLVE_ONE_SAMPLE // 52 |
440 CONVOLVE_ONE_SAMPLE // 53 | 440 CONVOLVE_ONE_SAMPLE / / 53 |
441 CONVOLVE_ONE_SAMPLE // 54 | 441 CONVOLVE_ONE_SAMPL E // 54 |
442 CONVOLVE_ONE_SAMPLE // 55 | 442 CONVOLVE_ONE_S AMPLE // 55 |
443 CONVOLVE_ONE_SAMPLE // 56 | 443 CONVOLVE_O NE_SAMPLE // 56 |
444 CONVOLVE_ONE_SAMPLE // 57 | 444 CONVOL VE_ONE_SAMPLE // 57 |
445 CONVOLVE_ONE_SAMPLE // 58 | 445 CO NVOLVE_ONE_SAMPLE // 58 |
446 CONVOLVE_ONE_SAMPLE // 59 | 446 CONVOLVE_ONE_SAMPLE // 59 |
447 CONVOLVE_ONE_SAMPLE // 60 | 447 CONVOLVE_ONE_SAMPLE // 60 |
448 CONVOLVE_ONE_SAMPLE // 61 | 448 CONVOLVE_ONE_SAMPLE // 61 |
449 CONVOLVE_ONE_SAMPLE // 62 | 449 CONVOLVE_ONE_SAMPLE // 62 |
450 CONVOLVE_ONE_SAMPLE // 63 | 450 CONVOLVE_ONE_SAMPLE // 63 |
451 CONVOLVE_ONE_SAMPLE // 64 | 451 CONVOLVE_ONE_SAMPLE // 64 |
452 } else { | 452 } else { |
453 while (n--) { | 453 while (n--) { |
454 // Non-optimized using actual while loop. | 454 // Non-optimized using actual while loop. |
455 CONVOLVE_ONE_SAMPLE | 455 CONVOLVE_ONE_SAMPLE |
456 } | 456 } |
457 } | 457 } |
458 #endif | 458 #endif |
459 } | 459 } |
460 | 460 |
461 // Linearly interpolate the two "convolutions". | 461 // Linearly interpolate the two "convolutions". |
(...skipping 18 matching lines...) Expand all Loading... | |
480 memcpy(r1, r3, sizeof(float) * (kernel_size_ / 2)); | 480 memcpy(r1, r3, sizeof(float) * (kernel_size_ / 2)); |
481 memcpy(r2, r4, sizeof(float) * (kernel_size_ / 2)); | 481 memcpy(r2, r4, sizeof(float) * (kernel_size_ / 2)); |
482 | 482 |
483 // Step (4) | 483 // Step (4) |
484 // Refresh the buffer with more input. | 484 // Refresh the buffer with more input. |
485 ConsumeSource(r5, block_size_); | 485 ConsumeSource(r5, block_size_); |
486 } | 486 } |
487 } | 487 } |
488 | 488 |
489 } // namespace blink | 489 } // namespace blink |
OLD | NEW |