diff options
Diffstat (limited to 'apps/codecs/libmad/layer3.c')
-rw-r--r-- | apps/codecs/libmad/layer3.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/apps/codecs/libmad/layer3.c b/apps/codecs/libmad/layer3.c index 38e488ddbb..a95927e10f 100644 --- a/apps/codecs/libmad/layer3.c +++ b/apps/codecs/libmad/layer3.c | |||
@@ -922,8 +922,19 @@ mad_fixed_t III_requantize(unsigned int value, signed int exp) | |||
922 | } | 922 | } |
923 | 923 | ||
924 | /* we must take care that sz >= bits and sz < sizeof(long) lest bits == 0 */ | 924 | /* we must take care that sz >= bits and sz < sizeof(long) lest bits == 0 */ |
925 | # if defined(CPU_ARM) | ||
926 | # define MASK(cache, sz, bits) \ | ||
927 | ({ unsigned long res; \ | ||
928 | asm ("mov %0, #1\n\t" \ | ||
929 | "rsb %0, %0, %0, lsl %3\n\t" \ | ||
930 | "and %0, %0, %1, lsr %2" \ | ||
931 | : "=&r" (res) : "r" (cache), "r" ((sz) - (bits)), "r" (bits)); \ | ||
932 | res; \ | ||
933 | }) | ||
934 | #else | ||
925 | # define MASK(cache, sz, bits) \ | 935 | # define MASK(cache, sz, bits) \ |
926 | (((cache) >> ((sz) - (bits))) & ((1 << (bits)) - 1)) | 936 | (((cache) >> ((sz) - (bits))) & ((1 << (bits)) - 1)) |
937 | #endif | ||
927 | # define MASK1BIT(cache, sz) \ | 938 | # define MASK1BIT(cache, sz) \ |
928 | ((cache) & (1 << ((sz) - 1))) | 939 | ((cache) & (1 << ((sz) - 1))) |
929 | 940 | ||
@@ -1546,6 +1557,9 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], | |||
1546 | return MAD_ERROR_NONE; | 1557 | return MAD_ERROR_NONE; |
1547 | } | 1558 | } |
1548 | 1559 | ||
1560 | #if defined(CPU_ARM) | ||
1561 | void III_aliasreduce(mad_fixed_t xr[576], int lines); | ||
1562 | #else | ||
1549 | /* | 1563 | /* |
1550 | * NAME: III_aliasreduce() | 1564 | * NAME: III_aliasreduce() |
1551 | * DESCRIPTION: perform frequency line alias reduction | 1565 | * DESCRIPTION: perform frequency line alias reduction |
@@ -1600,6 +1614,7 @@ void III_aliasreduce(mad_fixed_t xr[576], int lines) | |||
1600 | } | 1614 | } |
1601 | } | 1615 | } |
1602 | } | 1616 | } |
1617 | #endif | ||
1603 | 1618 | ||
1604 | # if defined(ASO_IMDCT) | 1619 | # if defined(ASO_IMDCT) |
1605 | void III_imdct_l(mad_fixed_t const [18], mad_fixed_t [36], unsigned int); | 1620 | void III_imdct_l(mad_fixed_t const [18], mad_fixed_t [36], unsigned int); |
@@ -2894,6 +2909,11 @@ void III_imdct_s(mad_fixed_t const X[18], mad_fixed_t z[36]) | |||
2894 | 2909 | ||
2895 | #endif | 2910 | #endif |
2896 | 2911 | ||
2912 | #ifdef CPU_ARM | ||
2913 | void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], | ||
2914 | mad_fixed_t sample[18][32], unsigned int sb); | ||
2915 | #else | ||
2916 | |||
2897 | /* | 2917 | /* |
2898 | * NAME: III_overlap() | 2918 | * NAME: III_overlap() |
2899 | * DESCRIPTION: perform overlap-add of windowed IMDCT outputs | 2919 | * DESCRIPTION: perform overlap-add of windowed IMDCT outputs |
@@ -2941,6 +2961,7 @@ void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], | |||
2941 | } | 2961 | } |
2942 | # endif | 2962 | # endif |
2943 | } | 2963 | } |
2964 | #endif | ||
2944 | 2965 | ||
2945 | /* | 2966 | /* |
2946 | * NAME: III_overlap_z() | 2967 | * NAME: III_overlap_z() |
@@ -3142,10 +3163,21 @@ enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, | |||
3142 | 3163 | ||
3143 | /* (nonzero) subbands 2-31 */ | 3164 | /* (nonzero) subbands 2-31 */ |
3144 | 3165 | ||
3166 | /* | ||
3145 | i = 576; | 3167 | i = 576; |
3146 | while (i > 36 && xr[ch][i - 1] == 0) | 3168 | while (i > 36 && xr[ch][i - 1] == 0) |
3147 | --i; | 3169 | --i; |
3170 | */ | ||
3148 | 3171 | ||
3172 | { | ||
3173 | /* saves ~600k cycles */ | ||
3174 | mad_fixed_t *p = &xr[ch][576]; | ||
3175 | mad_fixed_t tmp = xr[ch][35]; | ||
3176 | xr[ch][35] = 1; | ||
3177 | while (!*--p); | ||
3178 | xr[ch][35] = tmp; | ||
3179 | i = p - &xr[ch][0] + 1; | ||
3180 | } | ||
3149 | sblimit = 32 - (576 - i) / 18; | 3181 | sblimit = 32 - (576 - i) / 18; |
3150 | 3182 | ||
3151 | if (channel->block_type != 2) { | 3183 | if (channel->block_type != 2) { |