determining the first scale factor band with short windows
Rafael Ávila de Espíndola <[email protected]>
| Newsgroups | gmane.comp.audio.mad.devel |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Rob, I noticed that libmad count up to 36 in III_reorder to determine the first scale factor band that should be reordered in a mixed block. The attached patch precomputes this. I don't expect it to improve performance in any measurable way but (IMHO) it makes the code a bit easier to read. Thanks for libmad, Rafael Ávila de Espíndola -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFA8zvTLlrfGJ8JUHwRAlmMAJwKzXgUoXPUM+U8u2l4cByyHPjRYgCfWuEZ Jw7Qs4lVqbC9wNHixrDaqFs= =Pu6p -----END PGP SIGNATURE-----
first-short-sfb.patch
(text/x-diff, 1.2 KB)
diff -u -r libmad-0.15.1b/layer3.c libmad-0.15.1b-new/layer3.c
--- libmad-0.15.1b/layer3.c 2004-01-23 07:41:32.000000000 -0200
+++ libmad-0.15.1b-new/layer3.c 2004-07-12 11:35:20.961368743 -0300
@@ -1277,9 +1277,13 @@
* NAME: III_reorder()
* DESCRIPTION: reorder frequency lines of a short block into subband order
*/
+static unsigned char const first_short_sfb[9]={ //the first scale factor band that has short windows. Indexed by frequencies
+ 8, 8, 8, 6, 6, 6, 6, 6, 3
+};
+
static
void III_reorder(mad_fixed_t xr[576], struct channel const *channel,
- unsigned char const sfbwidth[39])
+ unsigned char const sfbwidth[39], unsigned int sfreqi)
{
mad_fixed_t tmp[32][3][6];
unsigned int sb, l, f, w, sbw[3], sw[3];
@@ -1288,11 +1292,9 @@
sb = 0;
if (channel->flags & mixed_block_flag) {
- sb = 2;
-
- l = 0;
- while (l < 36)
- l += *sfbwidth++;
+ sb = 2;
+ l = 36;
+ sfbwidth += first_short_sfb[sfreqi];
}
for (w = 0; w < 3; ++w) {
@@ -2422,7 +2424,7 @@
mad_fixed_t output[36];
if (channel->block_type == 2) {
- III_reorder(xr[ch], channel, sfbwidth[ch]);
+ III_reorder(xr[ch], channel, sfbwidth[ch], sfreqi);
# if !defined(OPT_STRICT)
/*