summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2010-12-15 17:28:52 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2010-12-15 17:28:52 +0000
commit1c3e117e0bd73ffc5a3abeb35b521fd048988f06 (patch)
treed5932169bc2de692965ddf999ae05c0799f9daa0 /libavcodec
parent7eeca961e3e496ab93366e5a3f5b695d2d3b99ee (diff)
Remove last_samples[] and copy directly from planar_samples[].
Avoids memcpy that was used to store last samples for next frame. Approx. 3% faster in function deinterleave_input_samples() and reduces memory usage by 3kB. Originally committed as revision 26021 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/ac3enc.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index 647d815899..4292f0a4df 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -119,7 +119,6 @@ typedef struct AC3EncodeContext {
int mant1_cnt, mant2_cnt, mant4_cnt; ///< mantissa counts for bap=1,2,4
uint16_t *qmant1_ptr, *qmant2_ptr, *qmant4_ptr; ///< mantissa pointers for bap=1,2,4
- int16_t last_samples[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE]; ///< last 256 samples from previous frame
int16_t planar_samples[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE+AC3_FRAME_SIZE];
int16_t windowed_samples[AC3_WINDOW_SIZE];
uint8_t bap[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][AC3_MAX_COEFS];
@@ -166,7 +165,7 @@ static void deinterleave_input_samples(AC3EncodeContext *s,
int sinc;
/* copy last 256 samples of previous frame to the start of the current frame */
- memcpy(&s->planar_samples[ch][0], s->last_samples[ch],
+ memcpy(&s->planar_samples[ch][0], &s->planar_samples[ch][AC3_FRAME_SIZE],
AC3_BLOCK_SIZE * sizeof(s->planar_samples[0][0]));
/* deinterleave */
@@ -176,10 +175,6 @@ static void deinterleave_input_samples(AC3EncodeContext *s,
s->planar_samples[ch][i] = *sptr;
sptr += sinc;
}
-
- /* save last 256 samples for next frame */
- memcpy(s->last_samples[ch], &s->planar_samples[ch][6* AC3_BLOCK_SIZE],
- AC3_BLOCK_SIZE * sizeof(s->planar_samples[0][0]));
}
}