From: "Ronald S. Bultje" <[email protected]>
---
libavcodec/snow.c | 4 +++-
libavcodec/snow.h | 1 +
libavcodec/snowenc.c | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index fc1703f..af5ad6d 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -452,6 +452,7 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){
s->spatial_dwt_buffer= av_mallocz(width*height*sizeof(DWTELEM)); //FIXME
this does not belong here
s->temp_dwt_buffer = av_mallocz(width * sizeof(DWTELEM));
s->temp_idwt_buffer = av_mallocz(width * sizeof(IDWTELEM));
+ s->run_buffer = av_mallocz(((width + 1) >> 1) * ((height + 1) >> 1) *
sizeof(*s->run_buffer));
for(i=0; i<MAX_REF_FRAMES; i++)
for(j=0; j<MAX_REF_FRAMES; j++)
@@ -466,7 +467,7 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){
s->emu_edge_buffer = av_malloc(emu_buf_size);
if (!s->spatial_idwt_buffer || !s->spatial_dwt_buffer ||
!s->temp_dwt_buffer || !s->temp_idwt_buffer || !s->scratchbuf ||
- !s->emu_edge_buffer)
+ !s->emu_edge_buffer || !s->run_buffer)
return AVERROR(ENOMEM);
return 0;
@@ -642,6 +643,7 @@ av_cold void ff_snow_common_end(SnowContext *s)
av_freep(&s->temp_dwt_buffer);
av_freep(&s->spatial_idwt_buffer);
av_freep(&s->temp_idwt_buffer);
+ av_freep(&s->run_buffer);
s->m.me.temp= NULL;
av_freep(&s->m.me.scratchpad);
diff --git a/libavcodec/snow.h b/libavcodec/snow.h
index ec98404..abf3309 100644
--- a/libavcodec/snow.h
+++ b/libavcodec/snow.h
@@ -135,6 +135,7 @@ typedef struct SnowContext{
DWTELEM *temp_dwt_buffer;
IDWTELEM *spatial_idwt_buffer;
IDWTELEM *temp_idwt_buffer;
+ int *run_buffer;
int colorspace_type;
int chroma_h_shift;
int chroma_v_shift;
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index 7aa7a95..96cbd44 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -836,7 +836,7 @@ static int encode_subband_c0run(SnowContext *s, SubBand *b,
IDWTELEM *src, IDWTE
if(1){
int run=0;
- int runs[w*h];
+ int *runs = s->run_buffer;
int run_index=0;
int max_index;
--
1.7.9.4
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel