comparison mpegaudiodec.c @ 3614:d0310d1cce13 libavcodec

optimize reorder_block() though this function seems to be executed too rarely for this to make much difference
author michael
date Thu, 24 Aug 2006 08:40:09 +0000
parents 5cb45b2211a0
children 270790578711
comparison
equal deleted inserted replaced
3613:5cb45b2211a0 3614:d0310d1cce13
1774 /* Reorder short blocks from bitstream order to interleaved order. It 1774 /* Reorder short blocks from bitstream order to interleaved order. It
1775 would be faster to do it in parsing, but the code would be far more 1775 would be faster to do it in parsing, but the code would be far more
1776 complicated */ 1776 complicated */
1777 static void reorder_block(MPADecodeContext *s, GranuleDef *g) 1777 static void reorder_block(MPADecodeContext *s, GranuleDef *g)
1778 { 1778 {
1779 int i, j, k, len; 1779 int i, j, len;
1780 int32_t *ptr, *dst, *ptr1; 1780 int32_t *ptr, *dst, *ptr1;
1781 int32_t tmp[576]; 1781 int32_t tmp[576];
1782 1782
1783 if (g->block_type != 2) 1783 if (g->block_type != 2)
1784 return; 1784 return;
1794 } 1794 }
1795 1795
1796 for(i=g->short_start;i<13;i++) { 1796 for(i=g->short_start;i<13;i++) {
1797 len = band_size_short[s->sample_rate_index][i]; 1797 len = band_size_short[s->sample_rate_index][i];
1798 ptr1 = ptr; 1798 ptr1 = ptr;
1799 for(k=0;k<3;k++) { 1799 dst = tmp;
1800 dst = tmp + k; 1800 for(j=len;j>0;j--) {
1801 for(j=len;j>0;j--) { 1801 *dst++ = ptr[0*len];
1802 *dst = *ptr++; 1802 *dst++ = ptr[1*len];
1803 dst += 3; 1803 *dst++ = ptr[2*len];
1804 } 1804 ptr++;
1805 } 1805 }
1806 memcpy(ptr1, tmp, len * 3 * sizeof(int32_t)); 1806 ptr+=2*len;
1807 memcpy(ptr1, tmp, len * 3 * sizeof(*ptr1));
1807 } 1808 }
1808 } 1809 }
1809 1810
1810 #define ISQRT2 FIXR(0.70710678118654752440) 1811 #define ISQRT2 FIXR(0.70710678118654752440)
1811 1812