aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-09-07 21:28:29 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-09-07 21:46:34 +0200
commitdbb9117d1817610ff1e7987a7c5a73b012d96b68 (patch)
treea8de1c3fd2c673a38de0ee8809131d794f15697d
parent9b6467fd4674e92334e1a34b3bfc24d1b800ae55 (diff)
downloadffmpeg-dbb9117d1817610ff1e7987a7c5a73b012d96b68.tar.gz
flashsv2enc: move blockbuffer realloc to reconfigure_at_keyframe()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/flashsv2enc.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/libavcodec/flashsv2enc.c b/libavcodec/flashsv2enc.c
index bc833f4d6a..64e05fb768 100644
--- a/libavcodec/flashsv2enc.c
+++ b/libavcodec/flashsv2enc.c
@@ -554,16 +554,9 @@ static int encode_block(FlashSV2Context *s, Palette * palette, Block * b,
int dist, int keyframe)
{
unsigned buf_size = b->width * b->height * 6;
- uint8_t *buf;
+ uint8_t *buf = s->blockbuffer;
int res;
- av_fast_malloc(&s->blockbuffer, &s->blockbuffer_size, buf_size);
- if (!s->blockbuffer) {
- av_log(s->avctx, AV_LOG_ERROR, "Could not allocate block buffer.\n");
- return AVERROR(ENOMEM);
- }
- buf = s->blockbuffer;
-
if (b->flags & COLORSPACE_15_7) {
encode_15_7(palette, b, src, stride, dist);
} else {
@@ -826,6 +819,11 @@ static int reconfigure_at_keyframe(FlashSV2Context * s, const uint8_t * image,
init_blocks(s, s->frame_blocks, s->encbuffer, s->databuffer);
init_blocks(s, s->key_blocks, s->keybuffer, 0);
+ av_fast_malloc(&s->blockbuffer, &s->blockbuffer_size, block_width * block_height * 6);
+ if (!s->blockbuffer) {
+ av_log(s->avctx, AV_LOG_ERROR, "Could not allocate block buffer.\n");
+ return AVERROR(ENOMEM);
+ }
}
s->use15_7 = optimum_use15_7(s);