From: "Ronald S. Bultje" <[email protected]>
---
libavcodec/snow.c | 4 ++++
libavcodec/snow.h | 3 ++-
libavcodec/snowenc.c | 2 +-
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index edd7d07..870bbef 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -386,6 +386,7 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){
SnowContext *s = avctx->priv_data;
int width, height;
int i, j;
+ int emu_buf_size;
s->avctx= avctx;
s->max_ref_frames=1; //just make sure its not an invalid value in case of
no initial keyframe
@@ -449,6 +450,8 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){
s->avctx->get_buffer(s->avctx, &s->mconly_picture);
s->scratchbuf = av_malloc(s->mconly_picture.linesize[0]*7*MB_SIZE);
+ emu_buf_size = s->mconly_picture.linesize[0] * (2 * MB_SIZE + HTAPS_MAX -
1);
+ s->emu_edge_buffer = av_malloc(emu_buf_size);
return 0;
}
@@ -632,6 +635,7 @@ av_cold void ff_snow_common_end(SnowContext *s)
av_freep(&s->block);
av_freep(&s->scratchbuf);
+ av_freep(&s->emu_edge_buffer);
for(i=0; i<MAX_REF_FRAMES; i++){
av_freep(&s->ref_mvs[i]);
diff --git a/libavcodec/snow.h b/libavcodec/snow.h
index 3ceb6af..05f1eba 100644
--- a/libavcodec/snow.h
+++ b/libavcodec/snow.h
@@ -164,6 +164,7 @@ typedef struct SnowContext{
MpegEncContext m; // needed for motion estimation, should not be used for
anything else, the idea is to eventually make the motion estimation independent
of MpegEncContext, so this will be removed then (FIXME/XXX)
uint8_t *scratchbuf;
+ uint8_t *emu_edge_buffer;
}SnowContext;
/* Tables */
@@ -284,7 +285,7 @@ static av_always_inline void add_yblock(SnowContext *s, int
sliced, slice_buffer
BlockNode *rb= lb+1;
uint8_t *block[4];
int tmp_step= src_stride >= 7*MB_SIZE ? MB_SIZE : MB_SIZE*src_stride;
- uint8_t *tmp = s->scratchbuf;
+ uint8_t *tmp = s->emu_edge_buffer;
uint8_t *ptmp;
int x,y;
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index 7e3b68f..f4c312e 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -672,7 +672,7 @@ static int get_block_rd(SnowContext *s, int mb_x, int mb_y,
int plane_index, con
uint8_t *src= s-> input_picture.data[plane_index];
IDWTELEM *pred= (IDWTELEM*)s->m.obmc_scratchpad +
plane_index*block_size*block_size*4;
uint8_t *cur = s->scratchbuf;
- uint8_t tmp[ref_stride*(2*MB_SIZE+HTAPS_MAX-1)];
+ uint8_t *tmp = s->emu_edge_buffer;
const int b_stride = s->b_width << s->block_max_depth;
const int b_height = s->b_height<< s->block_max_depth;
const int w= p->width;
--
1.7.9.5
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel