| OLD | NEW |
| 1 /* Copyright (C) 2003-2008 Jean-Marc Valin | 1 /* Copyright (C) 2003-2008 Jean-Marc Valin |
| 2 Copyright (C) 2007-2012 Xiph.Org Foundation */ | 2 Copyright (C) 2007-2012 Xiph.Org Foundation */ |
| 3 /** | 3 /** |
| 4 @file fixed_debug.h | 4 @file fixed_debug.h |
| 5 @brief Fixed-point operations with debugging | 5 @brief Fixed-point operations with debugging |
| 6 */ | 6 */ |
| 7 /* | 7 /* |
| 8 Redistribution and use in source and binary forms, with or without | 8 Redistribution and use in source and binary forms, with or without |
| 9 modification, are permitted provided that the following conditions | 9 modification, are permitted provided that the following conditions |
| 10 are met: | 10 are met: |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 } | 489 } |
| 490 if (Q==15) | 490 if (Q==15) |
| 491 celt_mips+=4; | 491 celt_mips+=4; |
| 492 else | 492 else |
| 493 celt_mips+=5; | 493 celt_mips+=5; |
| 494 return res; | 494 return res; |
| 495 } | 495 } |
| 496 | 496 |
| 497 #define MULT16_32_Q15(a,b) MULT16_32_QX(a,b,15) | 497 #define MULT16_32_Q15(a,b) MULT16_32_QX(a,b,15) |
| 498 #define MAC16_32_Q15(c,a,b) (celt_mips-=2,ADD32((c),MULT16_32_Q15((a),(b)))) | 498 #define MAC16_32_Q15(c,a,b) (celt_mips-=2,ADD32((c),MULT16_32_Q15((a),(b)))) |
| 499 #define MAC16_32_Q16(c,a,b) (celt_mips-=2,ADD32((c),MULT16_32_Q16((a),(b)))) |
| 499 | 500 |
| 500 static OPUS_INLINE int SATURATE(int a, int b) | 501 static OPUS_INLINE int SATURATE(int a, int b) |
| 501 { | 502 { |
| 502 if (a>b) | 503 if (a>b) |
| 503 a=b; | 504 a=b; |
| 504 if (a<-b) | 505 if (a<-b) |
| 505 a = -b; | 506 a = -b; |
| 506 celt_mips+=3; | 507 celt_mips+=3; |
| 507 return a; | 508 return a; |
| 508 } | 509 } |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 { | 761 { |
| 761 fprintf (stderr, "DIV32: output is not int: %d in %s: line %d\n", (int)res
, file, line); | 762 fprintf (stderr, "DIV32: output is not int: %d in %s: line %d\n", (int)res
, file, line); |
| 762 #ifdef FIXED_DEBUG_ASSERT | 763 #ifdef FIXED_DEBUG_ASSERT |
| 763 celt_assert(0); | 764 celt_assert(0); |
| 764 #endif | 765 #endif |
| 765 } | 766 } |
| 766 celt_mips+=70; | 767 celt_mips+=70; |
| 767 return res; | 768 return res; |
| 768 } | 769 } |
| 769 | 770 |
| 771 static OPUS_INLINE opus_val16 SIG2WORD16_generic(celt_sig x) |
| 772 { |
| 773 x = PSHR32(x, SIG_SHIFT); |
| 774 x = MAX32(x, -32768); |
| 775 x = MIN32(x, 32767); |
| 776 return EXTRACT16(x); |
| 777 } |
| 778 #define SIG2WORD16(x) (SIG2WORD16_generic(x)) |
| 779 |
| 780 |
| 770 #undef PRINT_MIPS | 781 #undef PRINT_MIPS |
| 771 #define PRINT_MIPS(file) do {fprintf (file, "total complexity = %llu MIPS\n", ce
lt_mips);} while (0); | 782 #define PRINT_MIPS(file) do {fprintf (file, "total complexity = %llu MIPS\n", ce
lt_mips);} while (0); |
| 772 | 783 |
| 773 #endif | 784 #endif |
| OLD | NEW |