summaryrefslogtreecommitdiff
path: root/libavcodec/ac3.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2007-03-11 02:13:05 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2007-03-11 02:13:05 +0000
commit050aa8b9bca6a2c29e1c4c914e05aca49007f1d7 (patch)
treed58da1f718db33a9d243668d4940a60a5d455388 /libavcodec/ac3.c
parent755c18ae5d19f940dfd05d8278637635fd8eece5 (diff)
downloadffmpeg-050aa8b9bca6a2c29e1c4c914e05aca49007f1d7.tar.gz
remove redundancy in AC-3 parser by using common tables from ac3tab.h
Originally committed as revision 8318 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3.c')
-rw-r--r--libavcodec/ac3.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c
index 019c7769d6..a1c46c6d2e 100644
--- a/libavcodec/ac3.c
+++ b/libavcodec/ac3.c
@@ -181,6 +181,11 @@ void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap,
} while (end > bndtab[j++]);
}
+/**
+ * Initializes some tables.
+ * note: This function must remain thread safe because it is called by the
+ * AVParser init code.
+ */
void ac3_common_init(void)
{
int i, j, k, l, v;
@@ -194,4 +199,12 @@ void ac3_common_init(void)
l += v;
}
bndtab[50] = l;
+
+ /* generate ff_ac3_frame_sizes table */
+ for(i=0; i<38; i++) {
+ int br = ff_ac3_bitratetab[i >> 1];
+ ff_ac3_frame_sizes[i][0] = ( 2*br );
+ ff_ac3_frame_sizes[i][1] = (320*br / 147) + (i & 1);
+ ff_ac3_frame_sizes[i][2] = ( 3*br );
+ }
}